@@ -40,10 +40,19 @@ namespace RocksDbSharp
4040{
4141 using size_t = System . UIntPtr ;
4242
43+ public delegate void PutDelegate ( IntPtr p0 , IntPtr k , size_t klen , IntPtr v , size_t vlen ) ;
44+ public delegate void DeletedDelegate ( IntPtr p0 , IntPtr k , size_t klen ) ;
45+ public delegate void DestructorDelegate ( IntPtr p0 ) ;
46+ public delegate IntPtr NameDelegate ( IntPtr p0 ) ;
47+ public delegate int CompareDelegate ( IntPtr p0 , IntPtr a , size_t alen , IntPtr b , size_t blen ) ;
48+
4349 //void (*put)(IntPtr s, /*(const char*)*/ IntPtr k, /*(size_t)*/ UIntPtr klen, /*(const char*)*/ IntPtr v, /*(size_t)*/ UIntPtr vlen),
50+ [ Obsolete ( "Use PutDelegate" ) ]
4451 public delegate void WriteBatchIteratePutCallback ( IntPtr s , /*(const char*)*/ IntPtr k , /*(size_t)*/ size_t klen , /*(const char*)*/ IntPtr v , /*(size_t)*/ size_t vlen ) ;
4552//void (*deleted)(void*, const char* k, /*(size_t)*/ UIntPtr klen)
53+ [ Obsolete ( "Use DeletedDelegate" ) ]
4654public delegate void WriteBatchIterateDeleteCallback ( IntPtr s , /*(const char*)*/ IntPtr k , /*(size_t)*/ size_t klen ) ;
55+
4756public abstract partial class Native
4857{
4958/* BEGIN c.h */
@@ -567,12 +576,19 @@ public unsafe abstract void rocksdb_writebatch_delete_rangev_cf(
567576 /*(const size_t)*/ IntPtr end_keys_list_sizes ) ;
568577public abstract void rocksdb_writebatch_put_log_data (
569578 /*(rocksdb_writebatch_t*)*/ IntPtr writeBatch , byte [ ] blob , UIntPtr len ) ;
579+ [ Obsolete ( "Use PutDelegate and DeletedDelegate overload" ) ]
570580public abstract void rocksdb_writebatch_iterate (
571581 /*(rocksdb_writebatch_t*)*/ IntPtr writeBatch , /*(void*)*/ IntPtr state ,
572582 //void (*put)(IntPtr s, /*(const char*)*/ IntPtr k, /*(size_t)*/ ulong klen, /*(const char*)*/ IntPtr v, /*(size_t)*/ ulong vlen),
573583 WriteBatchIteratePutCallback put ,
574584 //void (*deleted)(void*, const char* k, /*(size_t)*/ ulong klen)
575585 WriteBatchIterateDeleteCallback deleted ) ;
586+ public abstract void rocksdb_writebatch_iterate (
587+ /*(rocksdb_writebatch_t*)*/ IntPtr writeBatch , /*(void*)*/ IntPtr state ,
588+ //void (*put)(IntPtr s, /*(const char*)*/ IntPtr k, /*(size_t)*/ ulong klen, /*(const char*)*/ IntPtr v, /*(size_t)*/ ulong vlen),
589+ PutDelegate put ,
590+ //void (*deleted)(void*, const char* k, /*(size_t)*/ ulong klen)
591+ DeletedDelegate deleted ) ;
576592public abstract /* const char* */ IntPtr rocksdb_writebatch_data (
577593 /*(rocksdb_writebatch_t*)*/ IntPtr writeBatch , /*(size_t*)*/ out size_t size ) ;
578594public abstract void rocksdb_writebatch_set_save_point (
@@ -691,11 +707,17 @@ public abstract void rocksdb_writebatch_wi_put_log_data(
691707 /*(rocksdb_writebatch_wi_t*)*/ IntPtr b , /*(const char*)*/ byte [ ] blob , /*(size_t)*/ size_t len ) ;
692708public abstract void rocksdb_writebatch_wi_put_log_data (
693709 /*(rocksdb_writebatch_wi_t*)*/ IntPtr b , /*(const char*)*/ IntPtr blob , /*(size_t)*/ size_t len ) ;
710+ [ Obsolete ( "Use PutDelegate and DeletedDelegate overload" ) ]
694711public abstract void rocksdb_writebatch_wi_iterate (
695712 /*(rocksdb_writebatch_wi_t*)*/ IntPtr b ,
696713 /*(void*)*/ IntPtr state ,
697714 /*(void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen))*/ WriteBatchIteratePutCallback put ,
698715 /*(void (*deleted)(void*, const char* k, size_t klen))*/ WriteBatchIterateDeleteCallback deleted ) ;
716+ public abstract void rocksdb_writebatch_wi_iterate (
717+ /*(rocksdb_writebatch_wi_t*)*/ IntPtr b ,
718+ /*(void*)*/ IntPtr state ,
719+ /*(void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen))*/ PutDelegate put ,
720+ /*(void (*deleted)(void*, const char* k, size_t klen))*/ DeletedDelegate deleted ) ;
699721public abstract /*(const char*)*/ IntPtr rocksdb_writebatch_wi_data (
700722 /*(rocksdb_writebatch_wi_t*)*/ IntPtr b ,
701723 /*(size_t*)*/ out size_t size ) ;
@@ -809,9 +831,15 @@ public abstract void rocksdb_block_based_options_set_format_version(
809831 /*(rocksdb_block_based_table_options_t*)*/ IntPtr bbto , int format_version ) ;
810832}
811833public enum BlockBasedTableIndexType {
834+ [ Obsolete ( "Use Binary" ) ]
812835 BinarySearch = 0 ,
836+ Binary = 0 ,
837+ [ Obsolete ( "Use Hash" ) ]
813838 HashSearch = 1 ,
839+ Hash = 1 ,
840+ [ Obsolete ( "Use TwoLevelIndex" ) ]
814841 TwoLevelIndexSearch = 2 ,
842+ TwoLevelIndex = 2 ,
815843} ;
816844public abstract partial class Native {
817845public abstract void rocksdb_block_based_options_set_index_type (
@@ -936,8 +964,6 @@ public abstract void rocksdb_options_set_max_bytes_for_level_multiplier_addition
936964 /* rocksdb_options_t* */ IntPtr options , /*(int*)*/ int [ ] level_values , UIntPtr num_levels ) ;
937965public abstract void rocksdb_options_enable_statistics (
938966 /* rocksdb_options_t* */ IntPtr options ) ;
939- public abstract void rocksdb_options_set_skip_stats_update_on_db_open (
940- /* rocksdb_options_t* */ IntPtr opt , /* unsigned char */ bool val ) ;
941967
942968/* returns a pointer to a malloc()-ed, null terminated string */
943969public abstract /* char* */ IntPtr rocksdb_options_statistics_get_string (
@@ -1073,17 +1099,39 @@ public abstract void rocksdb_options_set_report_bg_io_stats(
10731099 /* rocksdb_options_t* */ IntPtr options , int value ) ;
10741100
10751101}
1102+ public enum Recovery
1103+ {
1104+ TolerateCorruptedTailRecords = 0 ,
1105+ AbsoluteConsistency = 1 ,
1106+ PointInTime = 2 ,
1107+ SkipAnyCorruptedRecords = 3 ,
1108+ }
1109+ [ Obsolete ( "Use Recovery" ) ]
10761110public enum WalRecoveryMode {
10771111 rocksdb_tolerate_corrupted_tail_records_recovery = 0 ,
10781112 rocksdb_absolute_consistency_recovery = 1 ,
10791113 rocksdb_point_in_time_recovery = 2 ,
10801114 rocksdb_skip_any_corrupted_records_recovery = 3
10811115}
10821116public abstract partial class Native {
1117+ [ Obsolete ( "Use Recovery enum" ) ]
10831118public abstract void rocksdb_options_set_wal_recovery_mode (
10841119 /* rocksdb_options_t* */ IntPtr options , WalRecoveryMode mode ) ;
1120+ public abstract void rocksdb_options_set_wal_recovery_mode (
1121+ /* rocksdb_options_t* */ IntPtr options , Recovery mode ) ;
10851122}
1086-
1123+ public enum Compression
1124+ {
1125+ No = 0 ,
1126+ Snappy = 1 ,
1127+ Zlib = 2 ,
1128+ Bz2 = 3 ,
1129+ Lz4 = 4 ,
1130+ Lz4hc = 5 ,
1131+ Xpress = 6 ,
1132+ Zstd = 7 ,
1133+ }
1134+ [ Obsolete ( "Use Compression" ) ]
10871135public enum CompressionTypeEnum {
10881136 rocksdb_no_compression = 0 ,
10891137 rocksdb_snappy_compression = 1 ,
@@ -1095,17 +1143,30 @@ public enum CompressionTypeEnum {
10951143 rocksdb_zstd_compression = 7
10961144}
10971145public abstract partial class Native {
1146+ [ Obsolete ( "Use Compression enum" ) ]
10981147public abstract void rocksdb_options_set_compression (
10991148 /* rocksdb_options_t* */ IntPtr options , CompressionTypeEnum value ) ;
1149+ public abstract void rocksdb_options_set_compression (
1150+ /* rocksdb_options_t* */ IntPtr options , Compression value ) ;
11001151}
1152+ public enum Compaction
1153+ {
1154+ Level = 0 ,
1155+ Universal = 1 ,
1156+ Fifo = 2 ,
1157+ }
1158+ [ Obsolete ( "Use Compaction" ) ]
11011159public enum CompactionStyleEnum {
11021160 rocksdb_level_compaction = 0 ,
11031161 rocksdb_universal_compaction = 1 ,
11041162 rocksdb_fifo_compaction = 2 ,
11051163}
11061164public abstract partial class Native {
1165+ [ Obsolete ( "Use Compaction enum" ) ]
11071166public abstract void rocksdb_options_set_compaction_style (
11081167 /* rocksdb_options_t* */ IntPtr options , CompactionStyleEnum value ) ;
1168+ public abstract void rocksdb_options_set_compaction_style (
1169+ /* rocksdb_options_t* */ IntPtr options , Compaction value ) ;
11091170public abstract void rocksdb_options_set_universal_compaction_options (
11101171 /* rocksdb_options_t* */ IntPtr options , /*(rocksdb_universal_compaction_options_t*)*/ IntPtr universal_compaction_options ) ;
11111172public abstract void rocksdb_options_set_fifo_compaction_options (
@@ -1275,6 +1336,11 @@ public abstract void rocksdb_compactionfilterfactory_destroy(
12751336 /*(int (*compare)(void*, const char* a, size_t alen, const char* b,
12761337 size_t blen))*/ IntPtr compare ,
12771338 /*(const char* (*name)(void*))*/ IntPtr getName ) ;
1339+ public abstract /* rocksdb_comparator_t* */ IntPtr rocksdb_comparator_create (
1340+ /*(void*)*/ IntPtr state , /*(void (*destructor)(void*))*/ DestructorDelegate destructor ,
1341+ /*(int (*compare)(void*, const char* a, size_t alen, const char* b,
1342+ size_t blen))*/ CompareDelegate compare ,
1343+ /*(const char* (*name)(void*))*/ NameDelegate name ) ;
12781344public abstract void rocksdb_comparator_destroy (
12791345 /*(rocksdb_comparator_t*)*/ IntPtr comparator ) ;
12801346
@@ -1416,19 +1482,17 @@ public abstract void rocksdb_flushoptions_set_wait(
14161482#endregion
14171483
14181484#region Cache
1419- #if ROCKSDB_CACHE
14201485
14211486public abstract /* rocksdb_cache_t* */ IntPtr rocksdb_cache_create_lru (
14221487 size_t capacity ) ;
1423- public abstract void rocksdb_cache_destroy ( rocksdb_cache_t * cache ) ;
1488+ public abstract void rocksdb_cache_destroy ( /* rocksdb_cache_t* */ IntPtr cache ) ;
14241489public abstract void rocksdb_cache_set_capacity (
1425- rocksdb_cache_t * cache , size_t capacity ) ;
1426- public abstract /*(size_t)*/ ulong
1490+ /* rocksdb_cache_t* */ IntPtr cache , size_t capacity ) ;
1491+ public abstract /*(size_t)*/ UIntPtr
14271492rocksdb_cache_get_usage ( /*(rocksdb_cache_t*)*/ IntPtr cache ) ;
1428- public abstract /*(size_t)*/ ulong
1493+ public abstract /*(size_t)*/ UIntPtr
14291494rocksdb_cache_get_pinned_usage ( /*(rocksdb_cache_t*)*/ IntPtr cache ) ;
14301495
1431- #endif
14321496#endregion
14331497
14341498#region DBPath
0 commit comments