public override bool SingleWriter(ref MyKey key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     dst = src; return(true);
 }
Example #2
0
 public override void PostSingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     Assert.AreEqual((WriteReason)input, reason);
     actualReason = reason;
 }
Example #3
0
 public override bool ConcurrentWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo)
 {
     lastFunc = CancelLocation.ConcurrentWriter;
     if (cancelLocation == CancelLocation.ConcurrentWriter)
     {
         upsertInfo.Action = UpsertAction.CancelOperation;
         return(false);
     }
     dst = src;
     return(true);
 }
Example #4
0
 public override bool ConcurrentWriter(ref int key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo updateInfo)
 {
     dst.value = src.value;
     return(true);
 }
Example #5
0
 // Upsert functions
 public override bool SingleWriter(ref VLValue key, ref Input input, ref VLValue src, ref VLValue dst, ref int[] output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     src.CopyTo(ref dst);
     return(true);
 }
Example #6
0
 // Upsert functions
 public override bool SingleWriter(ref KeyStruct key, ref InputStruct input, ref ValueStruct src, ref ValueStruct dst, ref OutputStruct output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     Assert.IsFalse(upsertInfo.RecordInfo.IsNull());
     dst = src;
     return(true);
 }
Example #7
0
 // Record addresses
 public override bool SingleWriter(ref Key key, ref Value input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     dst                   = src;
     output.address        = upsertInfo.Address;
     this.lastWriteAddress = upsertInfo.Address;
     return(true);
 }
Example #8
0
 public override void PostSingleWriter(ref CacheKey key, ref CacheValue input, ref CacheValue src, ref CacheValue dst, ref CacheValue output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     dst = src;
     sizeTracker.AddTrackedSize(key.GetSize + src.GetSize);
 }
Example #9
0
 public bool ConcurrentWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo)
 {
     dst = src;
     return(true);
 }
Example #10
0
 // Return false to force a chain of values.
 public override bool ConcurrentWriter(ref Key key, ref Value input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo) => false;
Example #11
0
 public bool SingleWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     dst = src;
     return(true);
 }
Example #12
0
 public void DisposeSingleWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 => functions.DisposeSingleWriter(ref key, ref input, ref src, ref dst, ref output, ref upsertInfo, reason);
Example #13
0
 public bool ConcurrentWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo)
 => functions.ConcurrentWriter(ref key, ref input, ref src, ref dst, ref output, ref upsertInfo);
 /// <inheritdoc/>
 public override void PostSingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reasons)
 {
     Assert.AreEqual(lastWriteAddress, upsertInfo.Address);
     Assert.AreEqual(key * input, dst);
     Assert.AreEqual(dst, output);
 }
Example #15
0
 public override bool ConcurrentWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo) => Increment(ref dst);
Example #16
0
        public override bool ConcurrentWriter(ref CacheKey key, ref CacheValue input, ref CacheValue src, ref CacheValue dst, ref CacheValue output, ref UpsertInfo upsertInfo)
        {
            var old = Interlocked.Exchange(ref dst, src);

            sizeTracker.AddTrackedSize(dst.GetSize - old.GetSize);
            return(true);
        }
Example #17
0
 public override void PostSingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     this.pswAddress = upsertInfo.Address;
 }
Example #18
0
 // Upsert functions
 public override bool SingleWriter(ref KeyStruct key, ref InputStruct input, ref ValueStruct src, ref ValueStruct dst, ref OutputStruct output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     dst = src; return(true);
 }
Example #19
0
 /// <summary>
 /// For compaction, we never perform concurrent writes as rolled over data defers to
 /// newly inserted data for the same key.
 /// </summary>
 public bool ConcurrentWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo) => true;
Example #20
0
        public override bool ConcurrentWriter(ref VLValue key, ref Input input, ref VLValue src, ref VLValue dst, ref int[] output, ref UpsertInfo upsertInfo)
        {
            if (src.length != dst.length)
            {
                return(false);
            }

            src.CopyTo(ref dst);
            return(true);
        }
Example #21
0
 /// <summary>
 /// Write compacted live value to store
 /// </summary>
 public bool SingleWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 => _functions.SingleWriter(ref key, ref input, ref src, ref dst, ref output, ref upsertInfo, reason);
Example #22
0
 public override bool ConcurrentWriter(ref KeyStruct key, ref InputStruct input, ref ValueStruct src, ref ValueStruct dst, ref OutputStruct output, ref UpsertInfo upsertInfo)
 {
     Assert.IsFalse(upsertInfo.RecordInfo.IsNull());
     Interlocked.Increment(ref _concurrentWriterCallCount);
     return(false);
 }
Example #23
0
 public void DisposeSingleWriter(ref Key key, ref Input input, ref Value src, ref Value dst, ref Output output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
 }
Example #24
0
 // Upsert functions
 public override bool SingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     lastFunc = CancelLocation.SingleWriter;
     if (cancelLocation == CancelLocation.SingleWriter)
     {
         upsertInfo.Action = UpsertAction.CancelOperation;
         return(false);
     }
     dst = src;
     return(true);
 }
 /// <inheritdoc/>
 public override bool ConcurrentWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo)
 => SingleWriter(ref key, ref input, ref src, ref dst, ref output, ref upsertInfo, WriteReason.Upsert);
Example #26
0
 public override bool ConcurrentWriter(ref MyKey key, ref MyInput input, ref MyLargeValue src, ref MyLargeValue dst, ref MyLargeOutput output, ref UpsertInfo updateInfo)
 {
     dst = src;
     return(true);
 }
 /// <inheritdoc/>
 public override bool SingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     lastWriteAddress = upsertInfo.Address;
     dst = output = src * input;
     return(true);
 }
Example #28
0
        public override bool ConcurrentWriter(ref MyKey key, ref MyInput input, ref MyValue src, ref MyValue dst, ref MyOutput output, ref UpsertInfo upsertInfo)
        {
            if (src == null)
            {
                return(false);
            }

            if (dst.value.Length != src.value.Length)
            {
                return(false);
            }

            dst = src;
            return(true);
        }
Example #29
0
 public override bool SingleWriter(ref int key, ref int input, ref int src, ref int dst, ref int output, ref UpsertInfo upsertInfo, WriteReason reason)
 {
     Assert.AreEqual((WriteReason)input, reason);
     actualReason = reason;
     return(true);
 }