// DeleteRange deletes the given keys within the given time range, // returning the segment ID for the operation. public string DeleteRange(List <ulong> sids, long min, long max) { if (sids == null || sids.Count == 0) { return(null); } DeleteRangeWalEntry entry = new DeleteRangeWalEntry() { Sids = sids, Min = min, Max = max }; return(writeToLog(entry)); }
public bool Next() { int nReadOK = 0; // read the type and the length of the entry byte[] lv = new byte[5]; try { nReadOK += stream.Read(lv, 0, 5); if (nReadOK == 0) { return(false); } } catch (EndOfStreamException ex) { err = ex.Message; return(false); } catch (Exception ex) { err = ex.Message; // We return true here because we want the client code to call read which // will return the this error to be handled. return(true); } byte entryType = lv[0]; int length = BitConverter.ToInt32(lv, 1); byte[] b = ArrayPool <byte> .Shared.Rent(length);;//? b := *(getBuf(int(length))) try { nReadOK += stream.Read(b, 0, length); } catch (Exception ex) { err = ex.Message; return(true); } IWalEntry newentry = null; switch (entryType) { case Constants.WriteWALEntryType: newentry = new WriteWalEntry(); break; case Constants.DeleteWALEntryType: newentry = new DeleteWalEntry(); break; case Constants.DeleteRangeWALEntryType: newentry = new DeleteRangeWalEntry(); break; default: err = string.Format("unknown wal entry type: {0}", entryType); return(true); } byte[] data = SnappyPI.SnappyCodec.Uncompress(b, 0, length); ArrayPool <byte> .Shared.Return(b); err = newentry.UnmarshalBinary(data, 0, data.Length); if (err == null) { // Read and decode of this entry was successful. n += nReadOK; } entry = newentry; return(true); }