Пример #1
0
        /// <inheritdoc />
        public override bool ConcurrentWriter(ref Key key, ref SpanByte src, ref SpanByte dst)
        {
            if (locking)
            {
                dst.SpinLock();
            }

            // We can write the source (src) data to the existing destination (dst) in-place,
            // only if there is sufficient space
            if (dst.Length < src.Length || dst.IsMarkedReadOnly())
            {
                dst.MarkReadOnly();
                if (locking)
                {
                    dst.Unlock();
                }
                return(false);
            }

            // Option 1: write the source data, leaving the destination size unchanged. You will need
            // to mange the actual space used by the value if you stop here.
            src.CopyTo(ref dst);

            // We can adjust the length header on the serialized log, if we wish.
            // This method will also zero out the extra space to retain log scan correctness.
            dst.ShrinkSerializedLength(src.Length);

            if (locking)
            {
                dst.Unlock();
            }
            return(true);
        }
Пример #2
0
        /// <inheritdoc />
        public override bool ConcurrentWriter(ref Key key, ref SpanByte input, ref SpanByte src, ref SpanByte dst, ref Output output, ref UpsertInfo upsertInfo)
        {
            if (dst.Length < src.Length)
            {
                return(false);
            }

            // We can adjust the length header on the serialized log, if we wish.
            // This method will also zero out the extra space to retain log scan correctness.
            dst.UnmarkExtraMetadata();
            dst.ShrinkSerializedLength(src.Length);

            // Write the source data, leaving the destination size unchanged. You will need
            // to mange the actual space used by the value if you stop here.
            src.CopyTo(ref dst);

            return(true);
        }
Пример #3
0
 /// <inheritdoc/>
 public override void CopyUpdater(ref Key key, ref SpanByte input, ref SpanByte oldValue, ref SpanByte newValue, ref Output output)
 {
     oldValue.CopyTo(ref newValue);
 }
Пример #4
0
 /// <inheritdoc/>
 public override void InitialUpdater(ref Key key, ref SpanByte input, ref SpanByte value, ref Output output)
 {
     input.CopyTo(ref value);
 }
Пример #5
0
 /// <inheritdoc />
 public override void SingleWriter(ref Key key, ref SpanByte src, ref SpanByte dst)
 {
     src.CopyTo(ref dst);
 }
Пример #6
0
 /// <inheritdoc/>
 public override bool CopyUpdater(ref Key key, ref SpanByte input, ref SpanByte oldValue, ref SpanByte newValue, ref Output output, ref RMWInfo rmwInfo)
 {
     oldValue.CopyTo(ref newValue);
     return(true);
 }
Пример #7
0
 /// <inheritdoc/>
 public override bool InitialUpdater(ref Key key, ref SpanByte input, ref SpanByte value, ref Output output, ref RMWInfo rmwInfo)
 {
     input.CopyTo(ref value);
     return(true);
 }
Пример #8
0
 /// <inheritdoc />
 public override bool SingleWriter(ref Key key, ref SpanByte input, ref SpanByte src, ref SpanByte dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     src.CopyTo(ref dst);
     return(true);
 }