示例#1
0
 /// <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();
 }
示例#2
0
 /// <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();
 }
示例#3
0
 /// <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();
 }
示例#4
0
 /// <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();
 }
示例#5
0
 /// <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);
 }
示例#6
0
 /// <summary>
 ///
 /// </summary>
 protected override void FreeUnManagedObjects()
 {
     LevelDBInterop.leveldb_iter_destroy(this.Handle);
 }
示例#7
0
 /// <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);
 }
示例#8
0
 /// <summary>
 /// 
 /// </summary>
 public WriteOptions() {
     this.Handle = LevelDBInterop.leveldb_writeoptions_create();
 }
示例#9
0
 /// <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);
 }
示例#10
0
 /// <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);
 }
示例#11
0
 /// <summary>
 /// Clear all updates buffered in this batch.
 /// </summary>
 public void Clear()
 {
     LevelDBInterop.leveldb_writebatch_clear(Handle);
 }
示例#12
0
 public WriteBatch()
 {
     Handle = LevelDBInterop.leveldb_writebatch_create();
 }
示例#13
0
 /// <summary>
 ///
 /// </summary>
 public Options()
 {
     this.Handle = LevelDBInterop.leveldb_options_create();
 }
示例#14
0
 /// <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));
 }
示例#15
0
 protected override void FreeUnManagedObjects()
 {
     LevelDBInterop.leveldb_writebatch_destroy(Handle);
 }
示例#16
0
 /// <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));
 }
示例#17
0
 /// <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);
 }