@ -19,75 +19,75 @@ use std::ffi::CString;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBOptions( pub * const c_void ) ;
pub struct DBOptions ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBInstance( pub * const c_void ) ;
pub struct DBInstance ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBWriteOptions( pub * const c_void ) ;
pub struct DBWriteOptions ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBReadOptions( pub * const c_void ) ;
pub struct DBReadOptions ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBMergeOperator( pub * const c_void ) ;
pub struct DBMergeOperator ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBBlockBasedTableOptions( pub * const c_void ) ;
pub struct DBBlockBasedTableOptions ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBCache( pub * const c_void ) ;
pub struct DBCache ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBFilterPolicy( pub * const c_void ) ;
pub struct DBFilterPolicy ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBSnapshot( pub * const c_void ) ;
pub struct DBSnapshot ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBIterator( pub * const c_void ) ;
pub struct DBIterator ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBCFHandle( pub * const c_void ) ;
pub struct DBCFHandle ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBWriteBatch( pub * const c_void ) ;
pub struct DBWriteBatch ( pub * const c_void ) ;
#[ derive(Copy, Clone) ]
#[ derive(Copy, Clone) ]
#[ repr(C) ]
#[ repr(C) ]
pub struct Rocks DBComparator( pub * const c_void ) ;
pub struct DBComparator ( pub * const c_void ) ;
pub fn new_bloom_filter ( bits : c_int ) -> Rocks DBFilterPolicy {
pub fn new_bloom_filter ( bits : c_int ) -> DBFilterPolicy {
unsafe {
unsafe {
rocksdb_filterpolicy_create_bloom ( bits )
rocksdb_filterpolicy_create_bloom ( bits )
}
}
}
}
pub fn new_cache ( capacity : size_t ) -> Rocks DBCache {
pub fn new_cache ( capacity : size_t ) -> DBCache {
unsafe {
unsafe {
rocksdb_cache_create_lru ( capacity )
rocksdb_cache_create_lru ( capacity )
}
}
}
}
#[ repr(C) ]
#[ repr(C) ]
pub enum Rocks DBCompressionType {
pub enum DBCompressionType {
Rocks DBNoCompression = 0 ,
DBNoCompression = 0 ,
Rocks DBSnappyCompression = 1 ,
DBSnappyCompression = 1 ,
Rocks DBZlibCompression = 2 ,
DBZlibCompression = 2 ,
Rocks DBBz2Compression = 3 ,
DBBz2Compression = 3 ,
Rocks DBLz4Compression = 4 ,
DBLz4Compression = 4 ,
Rocks DBLz4hcCompression = 5 ,
DBLz4hcCompression = 5 ,
}
}
#[ repr(C) ]
#[ repr(C) ]
pub enum Rocks DBCompactionStyle {
pub enum DBCompactionStyle {
Rocks DBLevelCompaction = 0 ,
DBLevelCompaction = 0 ,
Rocks DBUniversalCompaction = 1 ,
DBUniversalCompaction = 1 ,
Rocks DBFifoCompaction = 2 ,
DBFifoCompaction = 2 ,
}
}
#[ repr(C) ]
#[ repr(C) ]
pub enum Rocks DBUniversalCompactionStyle {
pub enum DBUniversalCompactionStyle {
rocksdb_similar_size_compaction_stop_style = 0 ,
rocksdb_similar_size_compaction_stop_style = 0 ,
rocksdb_total_size_compaction_stop_style = 1 ,
rocksdb_total_size_compaction_stop_style = 1 ,
}
}
@ -95,160 +95,178 @@ pub enum RocksDBUniversalCompactionStyle {
//TODO audit the use of boolean arguments, b/c I think they need to be u8 instead...
//TODO audit the use of boolean arguments, b/c I think they need to be u8 instead...
#[ link(name = " rocksdb " ) ]
#[ link(name = " rocksdb " ) ]
extern {
extern {
pub fn rocksdb_options_create ( ) -> Rocks DBOptions;
pub fn rocksdb_options_create ( ) -> DBOptions ;
pub fn rocksdb_options_destroy ( opts : Rocks DBOptions) ;
pub fn rocksdb_options_destroy ( opts : DBOptions ) ;
pub fn rocksdb_cache_create_lru ( capacity : size_t ) -> Rocks DBCache;
pub fn rocksdb_cache_create_lru ( capacity : size_t ) -> DBCache ;
pub fn rocksdb_cache_destroy ( cache : Rocks DBCache) ;
pub fn rocksdb_cache_destroy ( cache : DBCache ) ;
pub fn rocksdb_block_based_options_create ( ) -> Rocks DBBlockBasedTableOptions;
pub fn rocksdb_block_based_options_create ( ) -> DBBlockBasedTableOptions ;
pub fn rocksdb_block_based_options_destroy ( opts : Rocks DBBlockBasedTableOptions) ;
pub fn rocksdb_block_based_options_destroy ( opts : DBBlockBasedTableOptions ) ;
pub fn rocksdb_block_based_options_set_block_size (
pub fn rocksdb_block_based_options_set_block_size (
block_options : Rocks DBBlockBasedTableOptions,
block_options : DBBlockBasedTableOptions ,
block_size : size_t ) ;
block_size : size_t ) ;
pub fn rocksdb_block_based_options_set_block_size_deviation (
pub fn rocksdb_block_based_options_set_block_size_deviation (
block_options : Rocks DBBlockBasedTableOptions,
block_options : DBBlockBasedTableOptions ,
block_size_deviation : c_int ) ;
block_size_deviation : c_int ) ;
pub fn rocksdb_block_based_options_set_block_restart_interval (
pub fn rocksdb_block_based_options_set_block_restart_interval (
block_options : Rocks DBBlockBasedTableOptions,
block_options : DBBlockBasedTableOptions ,
block_restart_interval : c_int ) ;
block_restart_interval : c_int ) ;
pub fn rocksdb_block_based_options_set_filter_policy (
pub fn rocksdb_block_based_options_set_filter_policy (
block_options : Rocks DBBlockBasedTableOptions,
block_options : DBBlockBasedTableOptions ,
filter_policy : Rocks DBFilterPolicy) ;
filter_policy : DBFilterPolicy ) ;
pub fn rocksdb_block_based_options_set_no_block_cache (
pub fn rocksdb_block_based_options_set_no_block_cache (
block_options : Rocks DBBlockBasedTableOptions, no_block_cache : bool ) ;
block_options : DBBlockBasedTableOptions , no_block_cache : bool ) ;
pub fn rocksdb_block_based_options_set_block_cache (
pub fn rocksdb_block_based_options_set_block_cache (
block_options : Rocks DBBlockBasedTableOptions, block_cache : Rocks DBCache) ;
block_options : DBBlockBasedTableOptions , block_cache : DBCache ) ;
pub fn rocksdb_block_based_options_set_block_cache_compressed (
pub fn rocksdb_block_based_options_set_block_cache_compressed (
block_options : Rocks DBBlockBasedTableOptions,
block_options : DBBlockBasedTableOptions ,
block_cache_compressed : Rocks DBCache) ;
block_cache_compressed : DBCache ) ;
pub fn rocksdb_block_based_options_set_whole_key_filtering (
pub fn rocksdb_block_based_options_set_whole_key_filtering (
ck_options : Rocks DBBlockBasedTableOptions, doit : bool ) ;
ck_options : DBBlockBasedTableOptions , doit : bool ) ;
pub fn rocksdb_options_set_block_based_table_factory (
pub fn rocksdb_options_set_block_based_table_factory (
options : Rocks DBOptions,
options : DBOptions ,
block_options : Rocks DBBlockBasedTableOptions) ;
block_options : DBBlockBasedTableOptions ) ;
pub fn rocksdb_options_increase_parallelism (
pub fn rocksdb_options_increase_parallelism (
options : Rocks DBOptions, threads : c_int ) ;
options : DBOptions , threads : c_int ) ;
pub fn rocksdb_options_optimize_level_style_compaction (
pub fn rocksdb_options_optimize_level_style_compaction (
options : Rocks DBOptions, memtable_memory_budget : c_int ) ;
options : DBOptions , memtable_memory_budget : c_int ) ;
pub fn rocksdb_options_set_create_if_missing (
pub fn rocksdb_options_set_create_if_missing (
options : Rocks DBOptions, v : bool ) ;
options : DBOptions , v : bool ) ;
pub fn rocksdb_options_set_max_open_files (
pub fn rocksdb_options_set_max_open_files (
options : Rocks DBOptions, files : c_int ) ;
options : DBOptions , files : c_int ) ;
pub fn rocksdb_options_set_use_fsync (
pub fn rocksdb_options_set_use_fsync (
options : Rocks DBOptions, v : c_int ) ;
options : DBOptions , v : c_int ) ;
pub fn rocksdb_options_set_bytes_per_sync (
pub fn rocksdb_options_set_bytes_per_sync (
options : Rocks DBOptions, bytes : u64 ) ;
options : DBOptions , bytes : u64 ) ;
pub fn rocksdb_options_set_disable_data_sync (
pub fn rocksdb_options_set_disable_data_sync (
options : Rocks DBOptions, v : c_int ) ;
options : DBOptions , v : c_int ) ;
pub fn rocksdb_options_optimize_for_point_lookup (
pub fn rocksdb_options_optimize_for_point_lookup (
options : Rocks DBOptions, block_cache_size_mb : u64 ) ;
options : DBOptions , block_cache_size_mb : u64 ) ;
pub fn rocksdb_options_set_table_cache_numshardbits (
pub fn rocksdb_options_set_table_cache_numshardbits (
options : Rocks DBOptions, bits : c_int ) ;
options : DBOptions , bits : c_int ) ;
pub fn rocksdb_options_set_max_write_buffer_number (
pub fn rocksdb_options_set_max_write_buffer_number (
options : Rocks DBOptions, bufno : c_int ) ;
options : DBOptions , bufno : c_int ) ;
pub fn rocksdb_options_set_min_write_buffer_number_to_merge (
pub fn rocksdb_options_set_min_write_buffer_number_to_merge (
options : Rocks DBOptions, bufno : c_int ) ;
options : DBOptions , bufno : c_int ) ;
pub fn rocksdb_options_set_level0_file_num_compaction_trigger (
pub fn rocksdb_options_set_level0_file_num_compaction_trigger (
options : Rocks DBOptions, no : c_int ) ;
options : DBOptions , no : c_int ) ;
pub fn rocksdb_options_set_level0_slowdown_writes_trigger (
pub fn rocksdb_options_set_level0_slowdown_writes_trigger (
options : Rocks DBOptions, no : c_int ) ;
options : DBOptions , no : c_int ) ;
pub fn rocksdb_options_set_level0_stop_writes_trigger (
pub fn rocksdb_options_set_level0_stop_writes_trigger (
options : Rocks DBOptions, no : c_int ) ;
options : DBOptions , no : c_int ) ;
pub fn rocksdb_options_set_write_buffer_size (
pub fn rocksdb_options_set_write_buffer_size (
options : Rocks DBOptions, bytes : u64 ) ;
options : DBOptions , bytes : u64 ) ;
pub fn rocksdb_options_set_target_file_size_base (
pub fn rocksdb_options_set_target_file_size_base (
options : Rocks DBOptions, bytes : u64 ) ;
options : DBOptions , bytes : u64 ) ;
pub fn rocksdb_options_set_target_file_size_multiplier (
pub fn rocksdb_options_set_target_file_size_multiplier (
options : Rocks DBOptions, mul : c_int ) ;
options : DBOptions , mul : c_int ) ;
pub fn rocksdb_options_set_max_log_file_size (
pub fn rocksdb_options_set_max_log_file_size (
options : Rocks DBOptions, bytes : u64 ) ;
options : DBOptions , bytes : u64 ) ;
pub fn rocksdb_options_set_max_manifest_file_size (
pub fn rocksdb_options_set_max_manifest_file_size (
options : Rocks DBOptions, bytes : u64 ) ;
options : DBOptions , bytes : u64 ) ;
pub fn rocksdb_options_set_hash_skip_list_rep (
pub fn rocksdb_options_set_hash_skip_list_rep (
options : Rocks DBOptions, bytes : u64 , a1 : i32 , a2 : i32 ) ;
options : DBOptions , bytes : u64 , a1 : i32 , a2 : i32 ) ;
pub fn rocksdb_options_set_compaction_style (
pub fn rocksdb_options_set_compaction_style (
options : Rocks DBOptions, cs : Rocks DBCompactionStyle) ;
options : DBOptions , cs : DBCompactionStyle ) ;
pub fn rocksdb_options_set_compression (
pub fn rocksdb_options_set_compression (
options : Rocks DBOptions, compression_style_no : c_int ) ;
options : DBOptions , compression_style_no : c_int ) ;
pub fn rocksdb_options_set_max_background_compactions (
pub fn rocksdb_options_set_max_background_compactions (
options : Rocks DBOptions, max_bg_compactions : c_int ) ;
options : DBOptions , max_bg_compactions : c_int ) ;
pub fn rocksdb_options_set_max_background_flushes (
pub fn rocksdb_options_set_max_background_flushes (
options : Rocks DBOptions, max_bg_flushes : c_int ) ;
options : DBOptions , max_bg_flushes : c_int ) ;
pub fn rocksdb_options_set_filter_deletes (
pub fn rocksdb_options_set_filter_deletes (
options : Rocks DBOptions, v : bool ) ;
options : DBOptions , v : bool ) ;
pub fn rocksdb_options_set_disable_auto_compactions (
pub fn rocksdb_options_set_disable_auto_compactions (
options : Rocks DBOptions, v : c_int ) ;
options : DBOptions , v : c_int ) ;
pub fn rocksdb_filterpolicy_create_bloom (
pub fn rocksdb_filterpolicy_create_bloom (
bits_per_key : c_int ) -> Rocks DBFilterPolicy;
bits_per_key : c_int ) -> DBFilterPolicy ;
pub fn rocksdb_open ( options : Rocks DBOptions,
pub fn rocksdb_open ( options : DBOptions ,
path : * const i8 ,
path : * const i8 ,
err : * mut * const i8
err : * mut * const i8
) -> Rocks DBInstance;
) -> DBInstance ;
pub fn rocksdb_writeoptions_create ( ) -> Rocks DBWriteOptions;
pub fn rocksdb_writeoptions_create ( ) -> DBWriteOptions ;
pub fn rocksdb_writeoptions_destroy ( writeopts : Rocks DBWriteOptions) ;
pub fn rocksdb_writeoptions_destroy ( writeopts : DBWriteOptions ) ;
pub fn rocksdb_put ( db : Rocks DBInstance,
pub fn rocksdb_put ( db : DBInstance ,
writeopts : Rocks DBWriteOptions,
writeopts : DBWriteOptions ,
k : * const u8 , kLen : size_t ,
k : * const u8 , kLen : size_t ,
v : * const u8 , vLen : size_t ,
v : * const u8 , vLen : size_t ,
err : * mut * const i8 ) ;
err : * mut * const i8 ) ;
pub fn rocksdb_readoptions_create ( ) -> RocksDBReadOptions ;
pub fn rocksdb_put_cf ( db : DBInstance ,
pub fn rocksdb_readoptions_destroy ( readopts : RocksDBReadOptions ) ;
writeopts : DBWriteOptions ,
cf : DBCFHandle ,
k : * const u8 , kLen : size_t ,
v : * const u8 , vLen : size_t ,
err : * mut * const i8 ) ;
pub fn rocksdb_readoptions_create ( ) -> DBReadOptions ;
pub fn rocksdb_readoptions_destroy ( readopts : DBReadOptions ) ;
pub fn rocksdb_readoptions_set_verify_checksums (
pub fn rocksdb_readoptions_set_verify_checksums (
readopts : RocksDBReadOptions ,
readopts : DBReadOptions ,
v : bool ) ;
v : bool ) ;
pub fn rocksdb_readoptions_set_fill_cache (
pub fn rocksdb_readoptions_set_fill_cache (
readopts : RocksDBReadOptions ,
readopts : DBReadOptions ,
v : bool ) ;
v : bool ) ;
pub fn rocksdb_readoptions_set_snapshot (
pub fn rocksdb_readoptions_set_snapshot (
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
snapshot : Rocks DBSnapshot) ; //TODO how do I make this a const ref?
snapshot : DBSnapshot ) ; //TODO how do I make this a const ref?
pub fn rocksdb_readoptions_set_iterate_upper_bound (
pub fn rocksdb_readoptions_set_iterate_upper_bound (
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
k : * const u8 ,
k : * const u8 ,
kLen : size_t ) ;
kLen : size_t ) ;
pub fn rocksdb_readoptions_set_read_tier (
pub fn rocksdb_readoptions_set_read_tier (
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
tier : c_int ) ;
tier : c_int ) ;
pub fn rocksdb_readoptions_set_tailing (
pub fn rocksdb_readoptions_set_tailing (
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
v : bool ) ;
v : bool ) ;
pub fn rocksdb_get ( db : Rocks DBInstance,
pub fn rocksdb_get ( db : DBInstance ,
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
k : * const u8 , kLen : size_t ,
k : * const u8 , kLen : size_t ,
valLen : * const size_t ,
valLen : * const size_t ,
err : * mut * const i8
err : * mut * const i8
) -> * mut c_void ;
) -> * mut c_void ;
pub fn rocksdb_get_cf ( db : Rocks DBInstance,
pub fn rocksdb_get_cf ( db : DBInstance ,
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
cf_handle : Rocks DBCFHandle,
cf_handle : DBCFHandle ,
k : * const u8 , kLen : size_t ,
k : * const u8 , kLen : size_t ,
valLen : * const size_t ,
valLen : * const size_t ,
err : * mut * const i8
err : * mut * const i8
) -> * mut c_void ;
) -> * mut c_void ;
pub fn rocksdb_create_iterator ( db : Rocks DBInstance,
pub fn rocksdb_create_iterator ( db : DBInstance ,
readopts : Rocks DBReadOptions
readopts : DBReadOptions
) -> Rocks DBIterator;
) -> DBIterator ;
pub fn rocksdb_create_iterator_cf ( db : Rocks DBInstance,
pub fn rocksdb_create_iterator_cf ( db : DBInstance ,
readopts : Rocks DBReadOptions,
readopts : DBReadOptions ,
cf_handle : Rocks DBCFHandle
cf_handle : DBCFHandle
) -> Rocks DBIterator;
) -> DBIterator ;
pub fn rocksdb_create_snapshot ( db : Rocks DBInstance) -> Rocks DBSnapshot;
pub fn rocksdb_create_snapshot ( db : DBInstance ) -> DBSnapshot ;
pub fn rocksdb_release_snapshot ( db : Rocks DBInstance,
pub fn rocksdb_release_snapshot ( db : DBInstance ,
snapshot : Rocks DBSnapshot) ;
snapshot : DBSnapshot ) ;
pub fn rocksdb_delete ( db : RocksDBInstance ,
pub fn rocksdb_delete ( db : DBInstance ,
writeopts : RocksDBWriteOptions ,
writeopts : DBWriteOptions ,
k : * const u8 , kLen : size_t ,
err : * mut * const i8
) -> * mut c_void ;
pub fn rocksdb_delete_cf ( db : DBInstance ,
writeopts : DBWriteOptions ,
cf : DBCFHandle ,
k : * const u8 , kLen : size_t ,
k : * const u8 , kLen : size_t ,
err : * mut * const i8
err : * mut * const i8
) -> * mut c_void ;
) -> * mut c_void ;
pub fn rocksdb_close ( db : RocksDBInstance ) ;
pub fn rocksdb_close ( db : DBInstance ) ;
pub fn rocksdb_destroy_db ( options : RocksDBOptions ,
pub fn rocksdb_destroy_db ( options : DBOptions ,
path : * const i8 , err : * mut * const i8 ) ;
path : * const i8 , err : * mut * const i8 ) ;
pub fn rocksdb_repair_db ( options : Rocks DBOptions,
pub fn rocksdb_repair_db ( options : DBOptions ,
path : * const i8 , err : * mut * const i8 ) ;
path : * const i8 , err : * mut * const i8 ) ;
// Merge
// Merge
pub fn rocksdb_merge ( db : RocksDBInstance ,
pub fn rocksdb_merge ( db : DBInstance ,
writeopts : RocksDBWriteOptions ,
writeopts : DBWriteOptions ,
k : * const u8 , kLen : size_t ,
v : * const u8 , vLen : size_t ,
err : * mut * const i8 ) ;
pub fn rocksdb_merge_cf ( db : DBInstance ,
writeopts : DBWriteOptions ,
cf : DBCFHandle ,
k : * const u8 , kLen : size_t ,
k : * const u8 , kLen : size_t ,
v : * const u8 , vLen : size_t ,
v : * const u8 , vLen : size_t ,
err : * mut * const i8 ) ;
err : * mut * const i8 ) ;
@ -276,73 +294,73 @@ extern {
value_len : * mut size_t
value_len : * mut size_t
) -> ( ) > ,
) -> ( ) > ,
name_fn : extern fn ( * mut c_void ) -> * const c_char ,
name_fn : extern fn ( * mut c_void ) -> * const c_char ,
) -> Rocks DBMergeOperator;
) -> DBMergeOperator ;
pub fn rocksdb_mergeoperator_destroy ( mo : Rocks DBMergeOperator) ;
pub fn rocksdb_mergeoperator_destroy ( mo : DBMergeOperator ) ;
pub fn rocksdb_options_set_merge_operator ( options : Rocks DBOptions,
pub fn rocksdb_options_set_merge_operator ( options : DBOptions ,
mo : Rocks DBMergeOperator) ;
mo : DBMergeOperator ) ;
// Iterator
// Iterator
pub fn rocksdb_iter_destroy ( iter : Rocks DBIterator) ;
pub fn rocksdb_iter_destroy ( iter : DBIterator ) ;
pub fn rocksdb_iter_valid ( iter : Rocks DBIterator) -> bool ;
pub fn rocksdb_iter_valid ( iter : DBIterator ) -> bool ;
pub fn rocksdb_iter_seek_to_first ( iter : Rocks DBIterator) ;
pub fn rocksdb_iter_seek_to_first ( iter : DBIterator ) ;
pub fn rocksdb_iter_seek_to_last ( iter : Rocks DBIterator) ;
pub fn rocksdb_iter_seek_to_last ( iter : DBIterator ) ;
pub fn rocksdb_iter_seek ( iter : Rocks DBIterator,
pub fn rocksdb_iter_seek ( iter : DBIterator ,
key : * const u8 , klen : size_t ) ;
key : * const u8 , klen : size_t ) ;
pub fn rocksdb_iter_next ( iter : Rocks DBIterator) ;
pub fn rocksdb_iter_next ( iter : DBIterator ) ;
pub fn rocksdb_iter_prev ( iter : Rocks DBIterator) ;
pub fn rocksdb_iter_prev ( iter : DBIterator ) ;
pub fn rocksdb_iter_key ( iter : Rocks DBIterator,
pub fn rocksdb_iter_key ( iter : DBIterator ,
klen : * mut size_t ) -> * mut u8 ;
klen : * mut size_t ) -> * mut u8 ;
pub fn rocksdb_iter_value ( iter : Rocks DBIterator,
pub fn rocksdb_iter_value ( iter : DBIterator ,
vlen : * mut size_t ) -> * mut u8 ;
vlen : * mut size_t ) -> * mut u8 ;
pub fn rocksdb_iter_get_error ( iter : Rocks DBIterator,
pub fn rocksdb_iter_get_error ( iter : DBIterator ,
err : * mut * const u8 ) ;
err : * mut * const u8 ) ;
// Write batch
// Write batch
pub fn rocksdb_write ( db : Rocks DBInstance,
pub fn rocksdb_write ( db : DBInstance ,
writeopts : Rocks DBWriteOptions,
writeopts : DBWriteOptions ,
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
err : * mut * const i8 ) ;
err : * mut * const i8 ) ;
pub fn rocksdb_writebatch_create ( ) -> Rocks DBWriteBatch;
pub fn rocksdb_writebatch_create ( ) -> DBWriteBatch ;
pub fn rocksdb_writebatch_create_from ( rep : * const u8 ,
pub fn rocksdb_writebatch_create_from ( rep : * const u8 ,
size : size_t ) -> Rocks DBWriteBatch;
size : size_t ) -> DBWriteBatch ;
pub fn rocksdb_writebatch_destroy ( batch : Rocks DBWriteBatch) ;
pub fn rocksdb_writebatch_destroy ( batch : DBWriteBatch ) ;
pub fn rocksdb_writebatch_clear ( batch : Rocks DBWriteBatch) ;
pub fn rocksdb_writebatch_clear ( batch : DBWriteBatch ) ;
pub fn rocksdb_writebatch_count ( batch : Rocks DBWriteBatch) -> c_int ;
pub fn rocksdb_writebatch_count ( batch : DBWriteBatch ) -> c_int ;
pub fn rocksdb_writebatch_put ( batch : Rocks DBWriteBatch,
pub fn rocksdb_writebatch_put ( batch : DBWriteBatch ,
key : * const u8 , klen : size_t ,
key : * const u8 , klen : size_t ,
val : * const u8 , vlen : size_t ) ;
val : * const u8 , vlen : size_t ) ;
pub fn rocksdb_writebatch_put_cf ( batch : Rocks DBWriteBatch,
pub fn rocksdb_writebatch_put_cf ( batch : DBWriteBatch ,
cf : Rocks DBCFHandle,
cf : DBCFHandle ,
key : * const u8 , klen : size_t ,
key : * const u8 , klen : size_t ,
val : * const u8 , vlen : size_t ) ;
val : * const u8 , vlen : size_t ) ;
pub fn rocksdb_writebatch_merge (
pub fn rocksdb_writebatch_merge (
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
key : * const u8 , klen : size_t ,
key : * const u8 , klen : size_t ,
val : * const u8 , vlen : size_t ) ;
val : * const u8 , vlen : size_t ) ;
pub fn rocksdb_writebatch_merge_cf (
pub fn rocksdb_writebatch_merge_cf (
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
cf : Rocks DBCFHandle,
cf : DBCFHandle ,
key : * const u8 , klen : size_t ,
key : * const u8 , klen : size_t ,
val : * const u8 , vlen : size_t ) ;
val : * const u8 , vlen : size_t ) ;
pub fn rocksdb_writebatch_delete (
pub fn rocksdb_writebatch_delete (
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
key : * const u8 , klen : size_t ) ;
key : * const u8 , klen : size_t ) ;
pub fn rocksdb_writebatch_delete_cf (
pub fn rocksdb_writebatch_delete_cf (
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
cf : Rocks DBCFHandle,
cf : DBCFHandle ,
key : * const u8 , klen : size_t ) ;
key : * const u8 , klen : size_t ) ;
pub fn rocksdb_writebatch_iterate (
pub fn rocksdb_writebatch_iterate (
batch : Rocks DBWriteBatch,
batch : DBWriteBatch ,
state : * mut c_void ,
state : * mut c_void ,
put_fn : extern fn ( state : * mut c_void ,
put_fn : extern fn ( state : * mut c_void ,
k : * const u8 , klen : size_t ,
k : * const u8 , klen : size_t ,
v : * const u8 , vlen : size_t ) ,
v : * const u8 , vlen : size_t ) ,
deleted_fn : extern fn ( state : * mut c_void ,
deleted_fn : extern fn ( state : * mut c_void ,
k : * const u8 , klen : size_t ) ) ;
k : * const u8 , klen : size_t ) ) ;
pub fn rocksdb_writebatch_data ( batch : Rocks DBWriteBatch,
pub fn rocksdb_writebatch_data ( batch : DBWriteBatch ,
size : * mut size_t ) -> * const u8 ;
size : * mut size_t ) -> * const u8 ;
// Comparator
// Comparator
pub fn rocksdb_options_set_comparator ( options : Rocks DBOptions,
pub fn rocksdb_options_set_comparator ( options : DBOptions ,
cb : Rocks DBComparator) ;
cb : DBComparator ) ;
pub fn rocksdb_comparator_create (
pub fn rocksdb_comparator_create (
state : * mut c_void ,
state : * mut c_void ,
destroy : extern fn ( * mut c_void ) -> ( ) ,
destroy : extern fn ( * mut c_void ) -> ( ) ,
@ -351,11 +369,30 @@ extern {
b : * const c_char , blen : size_t
b : * const c_char , blen : size_t
) -> c_int ,
) -> c_int ,
name_fn : extern fn ( * mut c_void ) -> * const c_char
name_fn : extern fn ( * mut c_void ) -> * const c_char
) -> RocksDBComparator ;
) -> DBComparator ;
pub fn rocksdb_comparator_destroy ( cmp : RocksDBComparator ) ;
pub fn rocksdb_comparator_destroy ( cmp : DBComparator ) ;
// Column Family
pub fn rocksdb_open_column_families ( options : DBOptions ,
path : * const i8 ,
num_column_families : c_int ,
column_family_names : * const * const i8 ,
column_family_options : * const DBOptions ,
column_family_handles : * const DBCFHandle ,
err : * mut * const i8
) -> DBInstance ;
pub fn rocksdb_create_column_family ( db : DBInstance ,
column_family_options : DBOptions ,
column_family_name : * const i8 ,
err : * mut * const i8
) -> DBCFHandle ;
pub fn rocksdb_drop_column_family ( db : DBInstance ,
column_family_handle : DBCFHandle ,
err : * mut * const i8 ) ;
pub fn rocksdb_column_family_handle_destroy ( column_family_handle : DBCFHandle ) ;
}
}
#[ allow(dead_code) ]
#[ test ]
#[ test ]
fn internal ( ) {
fn internal ( ) {
unsafe {
unsafe {