/// <summary> /// Moves to the next entry in the source. /// After this call, IsValid() is true iff the iterator was not positioned at the last entry in the source. /// REQUIRES: IsValid() /// </summary> public void Next() { LevelDBInterop.leveldb_iter_next(this.Handle); this.Throw(); }
/// <summary> /// Moves to the previous entry in the source. /// After this call, IsValid() is true iff the iterator was not positioned at the first entry in source. /// REQUIRES: IsValid() /// </summary> public void Prev() { LevelDBInterop.leveldb_iter_prev(this.Handle); this.Throw(); }
/// <summary> /// Position at the last key in the source. /// The iterator is IsValid() after this call iff the source is not empty. /// </summary> public void SeekToLast() { LevelDBInterop.leveldb_iter_seek_to_last(this.Handle); this.Throw(); }
/// <summary> /// Position at the first key in the source that at or past target /// The iterator is IsValid() after this call iff the source contains /// an entry that comes at or past target. /// </summary> public void Seek(Byte[] key) { LevelDBInterop.leveldb_iter_seek(this.Handle, key, (IntPtr)key.Length); this.Throw(); }
/// <summary> /// If an error has occurred, throw it. /// </summary> private void Throw() { LevelDBInterop.leveldb_iter_get_error(this.Handle, out IntPtr error); LevelDBException.Check(error); GC.KeepAlive(this); }
/// <summary> /// /// </summary> protected override void FreeUnManagedObjects() { LevelDBInterop.leveldb_iter_destroy(this.Handle); }
/// <summary> /// Support for iterating over a batch. /// </summary> public void Iterate(IntPtr state, Action <IntPtr, IntPtr, IntPtr, IntPtr, IntPtr> put, Action <IntPtr, IntPtr, IntPtr> deleted) { LevelDBInterop.leveldb_writebatch_iterate(Handle, state, put, deleted); }
/// <summary> /// /// </summary> public WriteOptions() { this.Handle = LevelDBInterop.leveldb_writeoptions_create(); }
/// <summary> /// Store the mapping "key->value" in the database. /// </summary> public WriteBatch Put(byte[] key, byte[] value) { LevelDBInterop.leveldb_writebatch_put(Handle, key, (IntPtr)key.Length, value, (IntPtr)value.Length); return(this); }
/// <summary> /// If the database contains a mapping for "key", erase it. /// Else do nothing. /// </summary> public WriteBatch Delete(byte[] key) { LevelDBInterop.leveldb_writebatch_delete(Handle, key, (IntPtr)key.Length); return(this); }
/// <summary> /// Clear all updates buffered in this batch. /// </summary> public void Clear() { LevelDBInterop.leveldb_writebatch_clear(Handle); }
public WriteBatch() { Handle = LevelDBInterop.leveldb_writebatch_create(); }
/// <summary> /// /// </summary> public Options() { this.Handle = LevelDBInterop.leveldb_options_create(); }
/// <summary> /// Return an iterator over the contents of the database. /// The result of CreateIterator is initially invalid (caller must /// call one of the Seek methods on the iterator before using it). /// </summary> public Iterator CreateIterator(ReadOptions options) { return(new Iterator(LevelDBInterop.leveldb_create_iterator(this.Handle, options.Handle), _encoding)); }
protected override void FreeUnManagedObjects() { LevelDBInterop.leveldb_writebatch_destroy(Handle); }
/// <summary> /// Return a handle to the current DB state. /// Iterators and Gets created with this handle will all observe a stable snapshot of the current DB state. /// </summary> public SnapShot CreateSnapshot() { return(new SnapShot(LevelDBInterop.leveldb_create_snapshot(this.Handle), this)); }
/// <summary> /// Support for iterating over a batch. /// </summary> public void Iterate(object state, Action <object, byte[], int, byte[], int> put, Action <object, byte[], int> deleted) { LevelDBInterop.leveldb_writebatch_iterate(this.Handle, state, put, deleted); }