public unsafe bool GetNext(out RecordInfo recordInfo) { while (true) { if (enumerationPhase == 0) { if (iter1.GetNext(out recordInfo)) { ref var key = ref iter1.GetKey(); ref var value = ref iter1.GetValue(); var bucket = default(HashBucket *); var slot = default(int); var entry = default(HashBucketEntry); var hash = fht.Comparer.GetHashCode64(ref key); var tag = (ushort)((ulong)hash >> Constants.kHashTagShift); if (fht.FindTag(hash, tag, ref bucket, ref slot, ref entry) && entry.Address == iter1.CurrentAddress) { if (recordInfo.PreviousAddress >= fht.Log.BeginAddress) { if (tempKvSession.ContainsKeyInMemory(ref key, out _) == Status.OK) { tempKvSession.Delete(ref key); } } if (!recordInfo.Tombstone) { return(true); } continue; } else { if (recordInfo.Tombstone) { tempKvSession.Delete(ref key); } else { tempKvSession.Upsert(ref key, ref value); } continue; } }
/// <summary> /// Delete with Span input /// </summary> /// <typeparam name="Input"></typeparam> /// <typeparam name="Output"></typeparam> /// <typeparam name="Context"></typeparam> /// <typeparam name="Functions"></typeparam> /// <param name="clientSession"></param> /// <param name="key"></param> /// <param name="userContext"></param> /// <param name="serialNo"></param> /// <returns></returns> public static Status Delete <Input, Output, Context, Functions>(this ClientSession <SpanByte, SpanByte, Input, Output, Context, Functions> clientSession, ReadOnlySpan <byte> key, Context userContext = default, long serialNo = 0) where Functions : IFunctions <SpanByte, SpanByte, Input, Output, Context> { fixed(byte *k = key) { var _key = SpanByte.FromFixedSpan(key); return(clientSession.Delete(ref _key, userContext, serialNo)); } }