예제 #1
0
        public static void Put(this RocksDbSharp.WriteBatch batch, byte table, byte[] key, byte[] value)
        {
            Span <byte> dbkey = stackalloc byte[key.Length + 1];

            dbkey[0] = table;
            key.AsSpan().CopyTo(dbkey.Slice(1));

            batch.Put(dbkey.ToArray(), value);
        }
예제 #2
0
        public void RocksdbInsert()
        {
            using (var batch = new rdb.WriteBatch())
            {
                for (int i = 0; i < 10; i++)
                {
                    batch.Put(new byte[] { 1 }.Concat(BitConverter.GetBytes(ldbInsertCount++)).ToArray(), data);
                }

                rocksdb.Write(batch);
            }
        }
예제 #3
0
 public void Write(WriteBatch writeBatch, WriteOptions writeOptions = null)
 {
     Native.Instance.rocksdb_write(Handle, (writeOptions ?? defaultWriteOptions).Handle, writeBatch.Handle);
 }