Exemple #1
0
 public KeyValuePair <string, string>[] MultiGet(string[] keys, ColumnFamilyHandle[] cf = null, ReadOptions readOptions = null)
 {
     return(Native.Instance.rocksdb_multi_get(Handle, (readOptions ?? DefaultReadOptions).Handle, keys));
 }
Exemple #2
0
 /// <summary>
 /// Reads the contents of the database value associated with <paramref name="key"/>, if present, into the supplied
 /// <paramref name="buffer"/> at <paramref name="offset"/> up to <paramref name="length"/> bytes, returning the
 /// length of the value in the database, or -1 if the key is not present.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="buffer"></param>
 /// <param name="offset"></param>
 /// <param name="length"></param>
 /// <param name="cf"></param>
 /// <param name="readOptions"></param>
 /// <returns>The actual length of the database field if it exists, otherwise -1</returns>
 public long Get(byte[] key, byte[] buffer, long offset, long length, ColumnFamilyHandle cf = null, ReadOptions readOptions = null)
 {
     return(Get(key, key.GetLongLength(0), buffer, offset, length, cf, readOptions));
 }
Exemple #3
0
 /// <summary>
 /// Reads the contents of the database value associated with <paramref name="key"/>, if present, into the supplied
 /// <paramref name="buffer"/> at <paramref name="offset"/> up to <paramref name="length"/> bytes, returning the
 /// length of the value in the database, or -1 if the key is not present.
 /// </summary>
 /// <param name="key"></param>
 /// <param name="buffer"></param>
 /// <param name="offset"></param>
 /// <param name="length"></param>
 /// <param name="cf"></param>
 /// <param name="readOptions"></param>
 /// <returns>The actual length of the database field if it exists, otherwise -1</returns>
 public long Get(byte[] key, long keyLength, byte[] buffer, long offset, long length, ColumnFamilyHandle cf = null, ReadOptions readOptions = null)
 {
     unsafe
     {
         var ptr = Native.Instance.rocksdb_get(Handle, (readOptions ?? DefaultReadOptions).Handle, key, keyLength, out long valLength, cf);
         if (ptr == IntPtr.Zero)
         {
             return(-1);
         }
         var copyLength = Math.Min(length, valLength);
         Marshal.Copy(ptr, buffer, (int)offset, (int)copyLength);
         Native.Instance.rocksdb_free(ptr);
         return(valLength);
     }
 }
Exemple #4
0
 public byte[] Get(byte[] key, ColumnFamilyHandle cf = null, ReadOptions readOptions = null)
 {
     return(Get(key, key.GetLongLength(0), cf, readOptions));
 }
Exemple #5
0
 public byte[] Get(byte[] key, long keyLength, ColumnFamilyHandle cf = null, ReadOptions readOptions = null)
 {
     return(Native.Instance.rocksdb_get(Handle, (readOptions ?? DefaultReadOptions).Handle, key, keyLength, cf));
 }
Exemple #6
0
 public KeyValuePair <byte[], byte[]>[] MultiGet(byte[][] keys, ColumnFamilyHandle[] cf = null, ReadOptions readOptions = null)
 {
     return(Native.Instance.rocksdb_multi_get(Handle, (readOptions ?? defaultReadOptions).Handle, keys));
 }
Exemple #7
0
 public string Get(string key, ColumnFamilyHandle cf = null, ReadOptions readOptions = null, Encoding encoding = null)
 {
     return(Native.Instance.rocksdb_get(Handle, (readOptions ?? DefaultReadOptions).Handle, key, cf, encoding ?? DefaultEncoding));
 }
 public byte[] Get(RocksDb db, byte[] key, ColumnFamilyHandle cf = null, ReadOptions options = null)
 {
     return(Get(db, key, (ulong)key.GetLongLength(0), cf, options));
 }
 public string Get(RocksDb db, string key, ColumnFamilyHandle cf = null, ReadOptions options = null, Encoding encoding = null)
 {
     return(Native.Instance.rocksdb_writebatch_wi_get_from_batch_and_db(Handle, db.Handle, (options ?? RocksDb.DefaultReadOptions).Handle, key, cf, encoding ?? defaultEncoding));
 }
 public ulong Get(RocksDb db, byte[] key, ulong keyLength, byte[] buffer, ulong offset, ulong length, ColumnFamilyHandle cf = null, ReadOptions options = null)
 {
     unsafe
     {
         var ptr = Native.Instance.rocksdb_writebatch_wi_get_from_batch_and_db(Handle, db.Handle, (options ?? RocksDb.DefaultReadOptions).Handle, key, keyLength, out ulong valLength, cf);
         valLength = Math.Min(length, valLength);
         Marshal.Copy(ptr, buffer, (int)offset, (int)valLength);
         Native.Instance.rocksdb_free(ptr);
         return(valLength);
     }
 }
 public ulong Get(RocksDb db, byte[] key, byte[] buffer, ulong offset, ulong length, ColumnFamilyHandle cf = null, ReadOptions options = null)
 {
     return(Get(db, key, (ulong)key.GetLongLength(0), buffer, offset, length, cf, options));
 }
 public byte[] Get(RocksDb db, byte[] key, ulong keyLength, ColumnFamilyHandle cf = null, ReadOptions options = null)
 {
     return(Native.Instance.rocksdb_writebatch_wi_get_from_batch_and_db(Handle, db.Handle, (options ?? RocksDb.DefaultReadOptions).Handle, key, keyLength, cf));
 }