public static void DeleteRange(Tx tx, byte[] key, string traceName) { tx.TraceStart(traceName); ushort x = 0; var slice = Slice.Create(key); var range = FdbKeyRange.StartsWith(slice); using (var c = tx.CreateCursor()) { if (!c.MoveToFirstAfter(key)) { tx.TraceStop(traceName, x); return; } var pair = c.Current; for (var i = 0; i < int.MaxValue; i++) { var current = Slice.Create(pair.Key); if (!range.Contains(current)) { tx.TraceStop(traceName, x); break; } x += 1; tx.Delete(pair.Key); if (!c.MoveNext()) { tx.TraceStop(traceName, x); break; } pair = c.Current; } } tx.TraceStop(traceName); }
public static void Delete(Tx tx, byte[] key) { tx.TraceStart("Delete"); tx.Delete(key); tx.TraceStop("Delete"); }