forked from jsgf/rocksdb-sys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
lib.rs
683 lines (349 loc) · 37 KB
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
//! Raw bindings for RocksDB.
//!
//! This is simply a raw interface to the RocksDB C API. It is intended to underpin a higher-level library rather than for direct use.
#![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#[cfg(test)]
mod test;
use libc::*;
extern "C" {
// Database operations
pub fn rocksdb_open(options: *const rocksdb_options_t, name: *const c_char, errptr: *mut *mut c_char) -> *mut rocksdb_t;
pub fn rocksdb_open_for_read_only(options: *const rocksdb_options_t, name: *const c_char, error_if_log_file_exist: c_uchar, errptr: *mut *mut c_char) -> *mut rocksdb_t;
pub fn rocksdb_backup_engine_open(options: *const rocksdb_options_t, path: *const c_char, errptr: *mut *mut c_char) -> *mut rocksdb_backup_engine_t;
pub fn rocksdb_backup_engine_create_new_backup(be: *mut rocksdb_backup_engine_t, db: *mut rocksdb_t, errptr: *mut *mut c_char);
pub fn rocksdb_backup_engine_purge_old_backups(be: *mut rocksdb_backup_engine_t, num_backups_to_keep: uint32_t, errptr: *mut *mut c_char);
pub fn rocksdb_restore_options_create() -> *mut rocksdb_restore_options_t;
pub fn rocksdb_restore_options_destroy(opt: *mut rocksdb_restore_options_t);
pub fn rocksdb_restore_options_set_keep_log_files(opt: *mut rocksdb_restore_options_t, v: c_int);
pub fn rocksdb_backup_engine_restore_db_from_latest_backup(be: *mut rocksdb_backup_engine_t, db_dir: *const c_char, wal_dir: *const c_char, restore_options: *const rocksdb_restore_options_t, errptr: *mut *mut c_char);
pub fn rocksdb_backup_engine_get_backup_info(be: *mut rocksdb_backup_engine_t) -> *const rocksdb_backup_engine_info_t;
pub fn rocksdb_backup_engine_info_count(info: *const rocksdb_backup_engine_info_t) -> c_int;
pub fn rocksdb_backup_engine_info_timestamp(info: *const rocksdb_backup_engine_info_t, index: c_int) -> int64_t;
pub fn rocksdb_backup_engine_info_backup_id(info: *const rocksdb_backup_engine_info_t, index: c_int) -> uint32_t;
pub fn rocksdb_backup_engine_info_size(info: *const rocksdb_backup_engine_info_t, index: c_int) -> uint64_t;
pub fn rocksdb_backup_engine_info_number_files(info: *const rocksdb_backup_engine_info_t, index: c_int) -> uint32_t;
pub fn rocksdb_backup_engine_info_destroy(info: *const rocksdb_backup_engine_info_t);
pub fn rocksdb_backup_engine_close(be: *mut rocksdb_backup_engine_t);
pub fn rocksdb_open_column_families(options: *const rocksdb_options_t, name: *const c_char, num_column_families: c_int, column_family_names: *const *const c_char, column_family_options: *const *const rocksdb_options_t, column_family_handles: *mut *mut rocksdb_column_family_handle_t, errptr: *mut *mut c_char) -> *mut rocksdb_t;
pub fn rocksdb_open_for_read_only_column_families(options: *const rocksdb_options_t, name: *const c_char, num_column_families: c_int, column_family_names: *const *const c_char, column_family_options: *const *const rocksdb_options_t, column_family_handles: *mut *mut rocksdb_column_family_handle_t, error_if_log_file_exist: c_uchar, errptr: *mut *mut c_char) -> *mut rocksdb_t;
pub fn rocksdb_list_column_families(options: *const rocksdb_options_t, name: *const c_char, lencf: *mut size_t, errptr: *mut *mut c_char) -> *mut *mut c_char;
pub fn rocksdb_list_column_families_destroy(list: *mut *mut c_char, len: size_t);
pub fn rocksdb_create_column_family(db: *mut rocksdb_t, column_family_options: *const rocksdb_options_t, column_family_name: *const c_char, errptr: *mut *mut c_char) -> *mut rocksdb_column_family_handle_t;
pub fn rocksdb_drop_column_family(db: *mut rocksdb_t, handle: *mut rocksdb_column_family_handle_t, errptr: *mut *mut c_char);
pub fn rocksdb_column_family_handle_destroy(handle: *mut rocksdb_column_family_handle_t);
pub fn rocksdb_close(db: *mut rocksdb_t);
pub fn rocksdb_put(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, key: *const c_char, keylen: size_t, val: *const c_char, vallen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_put_cf(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, keylen: size_t, val: *const c_char, vallen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_delete(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, key: *const c_char, keylen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_delete_cf(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, keylen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_merge(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, key: *const c_char, keylen: size_t, val: *const c_char, vallen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_merge_cf(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, keylen: size_t, val: *const c_char, vallen: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_write(db: *mut rocksdb_t, options: *const rocksdb_writeoptions_t, batch: *mut rocksdb_writebatch_t, errptr: *mut *mut c_char);
pub fn rocksdb_get(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t, key: *const c_char, keylen: size_t, vallen: *mut size_t, errptr: *mut *mut c_char) -> *mut c_char;
pub fn rocksdb_get_cf(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, keylen: size_t, vallen: *mut size_t, errptr: *mut *mut c_char) -> *mut c_char;
pub fn rocksdb_multi_get(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t, num_keys: size_t, keys_list: *const *const c_char, keys_list_sizes: *const size_t, values_list: *mut *mut c_char, values_list_sizes: *mut size_t, errs: *mut *mut c_char);
pub fn rocksdb_multi_get_cf(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t, column_families: *const *const rocksdb_column_family_handle_t, num_keys: size_t, keys_list: *const *const c_char, keys_list_sizes: *const size_t, values_list: *mut *mut c_char, values_list_sizes: *mut size_t, errs: *mut *mut c_char);
pub fn rocksdb_create_iterator(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t) -> *mut rocksdb_iterator_t;
pub fn rocksdb_create_iterator_cf(db: *mut rocksdb_t, options: *const rocksdb_readoptions_t, column_family: *mut rocksdb_column_family_handle_t) -> *mut rocksdb_iterator_t;
pub fn rocksdb_create_iterators(db: *mut rocksdb_t, opts: *mut rocksdb_readoptions_t, column_families: *mut *mut rocksdb_column_family_handle_t, iterators: *mut *mut rocksdb_iterator_t, size: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_create_snapshot(db: *mut rocksdb_t) -> *const rocksdb_snapshot_t;
pub fn rocksdb_release_snapshot(db: *mut rocksdb_t, snapshot: *const rocksdb_snapshot_t);
pub fn rocksdb_property_value(db: *mut rocksdb_t, propname: *const c_char) -> *mut c_char;
pub fn rocksdb_property_value_cf(db: *mut rocksdb_t, column_family: *mut rocksdb_column_family_handle_t, propname: *const c_char) -> *mut c_char;
pub fn rocksdb_approximate_sizes(db: *mut rocksdb_t, num_ranges: c_int, range_start_key: *const *const c_char, range_start_key_len: *const size_t, range_limit_key: *const *const c_char, range_limit_key_len: *const size_t, sizes: *mut uint64_t);
pub fn rocksdb_approximate_sizes_cf(db: *mut rocksdb_t, column_family: *mut rocksdb_column_family_handle_t, num_ranges: c_int, range_start_key: *const *const c_char, range_start_key_len: *const size_t, range_limit_key: *const *const c_char, range_limit_key_len: *const size_t, sizes: *mut uint64_t);
pub fn rocksdb_compact_range(db: *mut rocksdb_t, start_key: *const c_char, start_key_len: size_t, limit_key: *const c_char, limit_key_len: size_t);
pub fn rocksdb_compact_range_cf(db: *mut rocksdb_t, column_family: *mut rocksdb_column_family_handle_t, start_key: *const c_char, start_key_len: size_t, limit_key: *const c_char, limit_key_len: size_t);
pub fn rocksdb_delete_file(db: *mut rocksdb_t, name: *const c_char);
pub fn rocksdb_livefiles(db: *mut rocksdb_t) -> *const rocksdb_livefiles_t;
pub fn rocksdb_flush(db: *mut rocksdb_t, options: *const rocksdb_flushoptions_t, errptr: *mut *mut c_char);
pub fn rocksdb_disable_file_deletions(db: *mut rocksdb_t, errptr: *mut *mut c_char);
pub fn rocksdb_enable_file_deletions(db: *mut rocksdb_t, force: c_uchar, errptr: *mut *mut c_char);
// Management operations
pub fn rocksdb_destroy_db(options: *const rocksdb_options_t, name: *const c_char, errptr: *mut *mut c_char);
pub fn rocksdb_repair_db(options: *const rocksdb_options_t, name: *const c_char, errptr: *mut *mut c_char);
// Iterator
pub fn rocksdb_iter_destroy(iterator: *mut rocksdb_iterator_t);
pub fn rocksdb_iter_valid(iterator: *const rocksdb_iterator_t) -> c_uchar;
pub fn rocksdb_iter_seek_to_first(iterator: *mut rocksdb_iterator_t);
pub fn rocksdb_iter_seek_to_last(iterator: *mut rocksdb_iterator_t);
pub fn rocksdb_iter_seek(iterator: *mut rocksdb_iterator_t, k: *const c_char, klen: size_t);
pub fn rocksdb_iter_next(iterator: *mut rocksdb_iterator_t);
pub fn rocksdb_iter_prev(iterator: *mut rocksdb_iterator_t);
pub fn rocksdb_iter_key(iterator: *const rocksdb_iterator_t, klen: *mut size_t) -> *const c_char;
pub fn rocksdb_iter_value(iterator: *const rocksdb_iterator_t, vlen: *mut size_t) -> *const c_char;
pub fn rocksdb_iter_get_error(iterator: *const rocksdb_iterator_t, errptr: *mut *mut c_char);
// Write batch
pub fn rocksdb_writebatch_create() -> *mut rocksdb_writebatch_t;
pub fn rocksdb_writebatch_create_from(rep: *const c_char, size: size_t) -> *mut rocksdb_writebatch_t;
pub fn rocksdb_writebatch_destroy(batch: *mut rocksdb_writebatch_t);
pub fn rocksdb_writebatch_clear(batch: *mut rocksdb_writebatch_t);
pub fn rocksdb_writebatch_count(batch: *mut rocksdb_writebatch_t) -> c_int;
pub fn rocksdb_writebatch_put(batch: *mut rocksdb_writebatch_t, key: *const c_char, klen: size_t, val: *const c_char, vlen: size_t);
pub fn rocksdb_writebatch_put_cf(batch: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, klen: size_t, val: *const c_char, vlen: size_t);
pub fn rocksdb_writebatch_putv(b: *mut rocksdb_writebatch_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t, num_values: c_int, values_list: *const *const c_char, values_list_sizes: *const size_t);
pub fn rocksdb_writebatch_putv_cf(b: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t, num_values: c_int, values_list: *const *const c_char, values_list_sizes: *const size_t);
pub fn rocksdb_writebatch_merge(batch: *mut rocksdb_writebatch_t, key: *const c_char, klen: size_t, val: *const c_char, vlen: size_t);
pub fn rocksdb_writebatch_merge_cf(batch: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, klen: size_t, val: *const c_char, vlen: size_t);
pub fn rocksdb_writebatch_mergev(b: *mut rocksdb_writebatch_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t, num_values: c_int, values_list: *const *const c_char, values_list_sizes: *const size_t);
pub fn rocksdb_writebatch_mergev_cf(b: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t, num_values: c_int, values_list: *const *const c_char, values_list_sizes: *const size_t);
pub fn rocksdb_writebatch_delete(batch: *mut rocksdb_writebatch_t, key: *const c_char, klen: size_t);
pub fn rocksdb_writebatch_delete_cf(batch: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, key: *const c_char, klen: size_t);
pub fn rocksdb_writebatch_deletev(b: *mut rocksdb_writebatch_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t);
pub fn rocksdb_writebatch_deletev_cf(b: *mut rocksdb_writebatch_t, column_family: *mut rocksdb_column_family_handle_t, num_keys: c_int, keys_list: *const *const c_char, keys_list_sizes: *const size_t);
pub fn rocksdb_writebatch_put_log_data(batch: *mut rocksdb_writebatch_t, blob: *const c_char, len: size_t);
pub fn rocksdb_writebatch_iterate(batch: *mut rocksdb_writebatch_t, state: *mut c_void, put: Option<unsafe extern "C" fn(state: *mut c_void, k: *const c_char, klen: size_t, v: *const c_char, vlen: size_t)>, deleted: Option<unsafe extern "C" fn(state: *mut c_void, k: *const c_char, klen: size_t)>);
pub fn rocksdb_writebatch_data(batch: *mut rocksdb_writebatch_t, size: *mut size_t) -> *const c_char;
// Block-based table options
pub fn rocksdb_block_based_options_create() -> *mut rocksdb_block_based_table_options_t;
pub fn rocksdb_block_based_options_destroy(options: *mut rocksdb_block_based_table_options_t);
pub fn rocksdb_block_based_options_set_block_size(options: *mut rocksdb_block_based_table_options_t, v: size_t);
pub fn rocksdb_block_based_options_set_block_size_deviation(options: *mut rocksdb_block_based_table_options_t, v: c_int);
pub fn rocksdb_block_based_options_set_block_restart_interval(options: *mut rocksdb_block_based_table_options_t, v: c_int);
pub fn rocksdb_block_based_options_set_filter_policy(options: *mut rocksdb_block_based_table_options_t, v: *mut rocksdb_filterpolicy_t);
pub fn rocksdb_block_based_options_set_no_block_cache(options: *mut rocksdb_block_based_table_options_t, v: c_uchar);
pub fn rocksdb_block_based_options_set_block_cache(options: *mut rocksdb_block_based_table_options_t, v: *mut rocksdb_cache_t);
pub fn rocksdb_block_based_options_set_block_cache_compressed(options: *mut rocksdb_block_based_table_options_t, v: *mut rocksdb_cache_t);
pub fn rocksdb_block_based_options_set_whole_key_filtering(options: *mut rocksdb_block_based_table_options_t, v: c_uchar);
pub fn rocksdb_block_based_options_set_format_version(options: *mut rocksdb_block_based_table_options_t, v: c_int);
pub fn rocksdb_block_based_options_set_index_type(options: *mut rocksdb_block_based_table_options_t, v: c_int);
pub fn rocksdb_block_based_options_set_hash_index_allow_collision(options: *mut rocksdb_block_based_table_options_t, v: c_uchar);
pub fn rocksdb_block_based_options_set_cache_index_and_filter_blocks(options: *mut rocksdb_block_based_table_options_t, v: c_uchar);
pub fn rocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache(options: *mut rocksdb_block_based_table_options_t, v: c_uchar);
pub fn rocksdb_block_based_options_set_skip_table_builder_flush(options: *mut rocksdb_block_based_table_options_t, skip_table_builder_flush: c_uchar);
pub fn rocksdb_options_set_block_based_table_factory(opt: *mut rocksdb_options_t, table_options: *mut rocksdb_block_based_table_options_t);
// Cuckoo table options
pub fn rocksdb_cuckoo_options_create() -> *mut rocksdb_cuckoo_table_options_t;
pub fn rocksdb_cuckoo_options_destroy(options: *mut rocksdb_cuckoo_table_options_t);
pub fn rocksdb_cuckoo_options_set_hash_ratio(options: *mut rocksdb_cuckoo_table_options_t, v: f64);
pub fn rocksdb_cuckoo_options_set_max_search_depth(options: *mut rocksdb_cuckoo_table_options_t, v: uint32_t);
pub fn rocksdb_cuckoo_options_set_cuckoo_block_size(options: *mut rocksdb_cuckoo_table_options_t, v: uint32_t);
pub fn rocksdb_cuckoo_options_set_identity_as_first_hash(options: *mut rocksdb_cuckoo_table_options_t, v: c_uchar);
pub fn rocksdb_cuckoo_options_set_use_module_hash(options: *mut rocksdb_cuckoo_table_options_t, v: c_uchar);
pub fn rocksdb_options_set_cuckoo_table_factory(opt: *mut rocksdb_options_t, table_options: *mut rocksdb_cuckoo_table_options_t);
// Options
pub fn rocksdb_options_create() -> *mut rocksdb_options_t;
pub fn rocksdb_options_destroy(opt: *mut rocksdb_options_t);
pub fn rocksdb_options_increase_parallelism(opt: *mut rocksdb_options_t, total_threads: c_int);
pub fn rocksdb_options_optimize_for_point_lookup(opt: *mut rocksdb_options_t, block_cache_size_mb: uint64_t);
pub fn rocksdb_options_optimize_level_style_compaction(opt: *mut rocksdb_options_t, memtable_memory_budget: uint64_t);
pub fn rocksdb_options_optimize_universal_style_compaction(opt: *mut rocksdb_options_t, memtable_memory_budget: uint64_t);
pub fn rocksdb_options_set_compaction_filter(opt: *mut rocksdb_options_t, filter: *mut rocksdb_compactionfilter_t);
pub fn rocksdb_options_set_compaction_filter_factory(opt: *mut rocksdb_options_t, factory: *mut rocksdb_compactionfilterfactory_t);
pub fn rocksdb_options_compaction_readahead_size(opt: *mut rocksdb_options_t, s: size_t);
pub fn rocksdb_options_set_comparator(opt: *mut rocksdb_options_t, cmp: *mut rocksdb_comparator_t);
pub fn rocksdb_options_set_merge_operator(opt: *mut rocksdb_options_t, merge_operator: *mut rocksdb_mergeoperator_t);
pub fn rocksdb_options_set_uint64add_merge_operator(opt: *mut rocksdb_options_t);
pub fn rocksdb_options_set_compression_per_level(opt: *mut rocksdb_options_t, level_values: *mut c_int, num_levels: size_t);
pub fn rocksdb_options_set_create_if_missing(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_create_missing_column_families(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_error_if_exists(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_paranoid_checks(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_env(opt: *mut rocksdb_options_t, env: *mut rocksdb_env_t);
pub fn rocksdb_options_set_info_log(opt: *mut rocksdb_options_t, l: *mut rocksdb_logger_t);
pub fn rocksdb_options_set_info_log_level(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_write_buffer_size(opt: *mut rocksdb_options_t, s: size_t);
pub fn rocksdb_options_set_db_write_buffer_size(opt: *mut rocksdb_options_t, s: size_t);
pub fn rocksdb_options_set_max_open_files(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_total_wal_size(opt: *mut rocksdb_options_t, n: uint64_t);
pub fn rocksdb_options_set_compression_options(opt: *mut rocksdb_options_t, w_bits: c_int, level: c_int, strategy: c_int, max_dict_bytes: c_int);
pub fn rocksdb_options_set_prefix_extractor(opt: *mut rocksdb_options_t, prefix_extractor: *mut rocksdb_slicetransform_t);
pub fn rocksdb_options_set_num_levels(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_level0_file_num_compaction_trigger(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_level0_slowdown_writes_trigger(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_level0_stop_writes_trigger(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_mem_compaction_level(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_target_file_size_base(opt: *mut rocksdb_options_t, n: uint64_t);
pub fn rocksdb_options_set_target_file_size_multiplier(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_bytes_for_level_base(opt: *mut rocksdb_options_t, n: uint64_t);
pub fn rocksdb_options_set_max_bytes_for_level_multiplier(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_expanded_compaction_factor(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_max_grandparent_overlap_factor(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_max_bytes_for_level_multiplier_additional(opt: *mut rocksdb_options_t, level_values: *mut c_int, num_levels: size_t);
pub fn rocksdb_options_enable_statistics(opt: *mut rocksdb_options_t);
pub fn rocksdb_options_statistics_get_string(opt: *mut rocksdb_options_t) -> *mut c_char;
pub fn rocksdb_options_set_max_write_buffer_number(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_min_write_buffer_number_to_merge(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_write_buffer_number_to_maintain(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_background_compactions(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_background_flushes(opt: *mut rocksdb_options_t, n: c_int);
pub fn rocksdb_options_set_max_log_file_size(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_log_file_time_to_roll(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_keep_log_file_num(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_recycle_log_file_num(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_soft_rate_limit(opt: *mut rocksdb_options_t, v: f64);
pub fn rocksdb_options_set_hard_rate_limit(opt: *mut rocksdb_options_t, v: f64);
pub fn rocksdb_options_set_rate_limit_delay_max_milliseconds(opt: *mut rocksdb_options_t, v: c_uint);
pub fn rocksdb_options_set_max_manifest_file_size(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_table_cache_numshardbits(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_table_cache_remove_scan_count_limit(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_arena_block_size(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_use_fsync(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_db_log_dir(opt: *mut rocksdb_options_t, v: *const c_char);
pub fn rocksdb_options_set_wal_dir(opt: *mut rocksdb_options_t, v: *const c_char);
pub fn rocksdb_options_set_WAL_ttl_seconds(opt: *mut rocksdb_options_t, ttl: uint64_t);
pub fn rocksdb_options_set_WAL_size_limit_MB(opt: *mut rocksdb_options_t, limit: uint64_t);
pub fn rocksdb_options_set_manifest_preallocation_size(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_purge_redundant_kvs_while_flush(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_allow_os_buffer(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_allow_mmap_reads(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_allow_mmap_writes(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_is_fd_close_on_exec(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_skip_log_error_on_recovery(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_stats_dump_period_sec(opt: *mut rocksdb_options_t, v: c_uint);
pub fn rocksdb_options_set_advise_random_on_open(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_access_hint_on_compaction_start(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_use_adaptive_mutex(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_bytes_per_sync(opt: *mut rocksdb_options_t, v: uint64_t);
pub fn rocksdb_options_set_verify_checksums_in_compaction(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_filter_deletes(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_max_sequential_skip_in_iterations(opt: *mut rocksdb_options_t, v: uint64_t);
pub fn rocksdb_options_set_disable_data_sync(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_disable_auto_compactions(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_delete_obsolete_files_period_micros(opt: *mut rocksdb_options_t, v: uint64_t);
pub fn rocksdb_options_set_source_compaction_factor(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_prepare_for_bulk_load(opt: *mut rocksdb_options_t);
pub fn rocksdb_options_set_memtable_vector_rep(opt: *mut rocksdb_options_t);
pub fn rocksdb_options_set_hash_skip_list_rep(opt: *mut rocksdb_options_t, bucket_count: size_t, skiplist_height: int32_t, skiplist_branching_factor: int32_t);
pub fn rocksdb_options_set_hash_link_list_rep(opt: *mut rocksdb_options_t, bucket_count: size_t);
pub fn rocksdb_options_set_plain_table_factory(opt: *mut rocksdb_options_t, user_key_len: uint32_t, bloom_bits_per_key: c_int, hash_table_ratio: f64, index_sparseness: size_t);
pub fn rocksdb_options_set_min_level_to_compress(opt: *mut rocksdb_options_t, level: c_int);
pub fn rocksdb_options_set_memtable_prefix_bloom_bits(opt: *mut rocksdb_options_t, v: uint32_t);
pub fn rocksdb_options_set_memtable_prefix_bloom_probes(opt: *mut rocksdb_options_t, v: uint32_t);
pub fn rocksdb_options_set_memtable_huge_page_size(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_max_successive_merges(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_min_partial_merge_operands(opt: *mut rocksdb_options_t, v: uint32_t);
pub fn rocksdb_options_set_bloom_locality(opt: *mut rocksdb_options_t, v: uint32_t);
pub fn rocksdb_options_set_inplace_update_support(opt: *mut rocksdb_options_t, v: c_uchar);
pub fn rocksdb_options_set_inplace_update_num_locks(opt: *mut rocksdb_options_t, v: size_t);
pub fn rocksdb_options_set_report_bg_io_stats(opt: *mut rocksdb_options_t, v: c_int);
pub fn rocksdb_options_set_compression(opt: *mut rocksdb_options_t, t: c_int);
pub fn rocksdb_options_set_compaction_style(opt: *mut rocksdb_options_t, style: c_int);
pub fn rocksdb_options_set_universal_compaction_options(opt: *mut rocksdb_options_t, uco: *mut rocksdb_universal_compaction_options_t);
pub fn rocksdb_options_set_fifo_compaction_options(opt: *mut rocksdb_options_t, fifo: *mut rocksdb_fifo_compaction_options_t);
// Compaction filter
pub fn rocksdb_compactionfilter_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, filter: Option<unsafe extern "C" fn(state: *mut c_void, level: c_int, key: *const c_char, key_length: size_t, existing_value: *const c_char, value_length: size_t, new_value: *mut *mut c_char, new_value_length: *mut size_t, value_changed: *mut c_uchar) -> c_uchar>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_compactionfilter_t;
pub fn rocksdb_compactionfilter_set_ignore_snapshots(filter: *mut rocksdb_compactionfilter_t, v: c_uchar);
pub fn rocksdb_compactionfilter_destroy(filter: *mut rocksdb_compactionfilter_t);
// Compaction Filter context
pub fn rocksdb_compactionfiltercontext_is_full_compaction(context: *mut rocksdb_compactionfiltercontext_t) -> c_uchar;
pub fn rocksdb_compactionfiltercontext_is_manual_compaction(context: *mut rocksdb_compactionfiltercontext_t) -> c_uchar;
// Compaction Filter factory
pub fn rocksdb_compactionfilterfactory_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, create_compaction_filter: Option<unsafe extern "C" fn(state: *mut c_void, context: *mut rocksdb_compactionfiltercontext_t) -> *mut rocksdb_compactionfilter_t>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_compactionfilterfactory_t;
pub fn rocksdb_compactionfilterfactory_destroy(factory: *mut rocksdb_compactionfilterfactory_t);
// Comparator
pub fn rocksdb_comparator_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, compare: Option<unsafe extern "C" fn(state: *mut c_void, a: *const c_char, alen: size_t, b: *const c_char, blen: size_t) -> c_int>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_comparator_t;
pub fn rocksdb_comparator_destroy(cmp: *mut rocksdb_comparator_t);
// Filter policy
pub fn rocksdb_filterpolicy_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, create_filter: Option<unsafe extern "C" fn(state: *mut c_void, key_array: *const *const c_char, key_length_array: *const size_t, num_keys: c_int, filter_length: *mut size_t) -> *mut c_char>, key_may_match: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, length: size_t, filter: *const c_char, filter_length: size_t) -> c_uchar>, delete_filter: Option<unsafe extern "C" fn(state: *mut c_void, filter: *const c_char, filter_length: size_t)>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_filterpolicy_t;
pub fn rocksdb_filterpolicy_destroy(filter: *mut rocksdb_filterpolicy_t);
pub fn rocksdb_filterpolicy_create_bloom(bits_per_key: c_int) -> *mut rocksdb_filterpolicy_t;
pub fn rocksdb_filterpolicy_create_bloom_full(bits_per_key: c_int) -> *mut rocksdb_filterpolicy_t;
// Merge Operator
pub fn rocksdb_mergeoperator_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, full_merge: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, key_length: size_t, existing_value: *const c_char, existing_value_length: size_t, operands_list: *const *const c_char, operands_list_length: *const size_t, num_operands: c_int, success: *mut c_uchar, new_value_length: *mut size_t) -> *mut c_char>, partial_merge: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, key_length: size_t, operands_list: *const *const c_char, operands_list_length: *const size_t, num_operands: c_int, success: *mut c_uchar, new_value_length: *mut size_t) -> *mut c_char>, delete_value: Option<unsafe extern "C" fn(state: *mut c_void, value: *const c_char, value_length: size_t)>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_mergeoperator_t;
pub fn rocksdb_mergeoperator_destroy(merge_operator: *mut rocksdb_mergeoperator_t);
// Read options
pub fn rocksdb_readoptions_create() -> *mut rocksdb_readoptions_t;
pub fn rocksdb_readoptions_destroy(opt: *mut rocksdb_readoptions_t);
pub fn rocksdb_readoptions_set_verify_checksums(opt: *mut rocksdb_readoptions_t, v: c_uchar);
pub fn rocksdb_readoptions_set_fill_cache(opt: *mut rocksdb_readoptions_t, v: c_uchar);
pub fn rocksdb_readoptions_set_snapshot(opt: *mut rocksdb_readoptions_t, v: *const rocksdb_snapshot_t);
pub fn rocksdb_readoptions_set_iterate_upper_bound(opt: *mut rocksdb_readoptions_t, key: *const c_char, keylen: size_t);
pub fn rocksdb_readoptions_set_read_tier(opt: *mut rocksdb_readoptions_t, v: c_int);
pub fn rocksdb_readoptions_set_tailing(opt: *mut rocksdb_readoptions_t, v: c_uchar);
pub fn rocksdb_readoptions_set_readahead_size(opt: *mut rocksdb_readoptions_t, v: size_t);
// Write options
pub fn rocksdb_writeoptions_create() -> *mut rocksdb_writeoptions_t;
pub fn rocksdb_writeoptions_destroy(opt: *mut rocksdb_writeoptions_t);
pub fn rocksdb_writeoptions_set_sync(opt: *mut rocksdb_writeoptions_t, v: c_uchar);
pub fn rocksdb_writeoptions_disable_WAL(opt: *mut rocksdb_writeoptions_t, disable: c_int);
// Flush options
pub fn rocksdb_flushoptions_create() -> *mut rocksdb_flushoptions_t;
pub fn rocksdb_flushoptions_destroy(opt: *mut rocksdb_flushoptions_t);
pub fn rocksdb_flushoptions_set_wait(opt: *mut rocksdb_flushoptions_t, v: c_uchar);
// Cache
pub fn rocksdb_cache_create_lru(capacity: size_t) -> *mut rocksdb_cache_t;
pub fn rocksdb_cache_destroy(cache: *mut rocksdb_cache_t);
pub fn rocksdb_cache_set_capacity(cache: *mut rocksdb_cache_t, capacity: size_t);
// Environment
pub fn rocksdb_create_default_env() -> *mut rocksdb_env_t;
pub fn rocksdb_create_mem_env() -> *mut rocksdb_env_t;
pub fn rocksdb_env_set_background_threads(env: *mut rocksdb_env_t, n: c_int);
pub fn rocksdb_env_set_high_priority_background_threads(env: *mut rocksdb_env_t, n: c_int);
pub fn rocksdb_env_join_all_threads(env: *mut rocksdb_env_t);
pub fn rocksdb_env_destroy(env: *mut rocksdb_env_t);
// Slice Transform
pub fn rocksdb_slicetransform_create(state: *mut c_void, destructor: Option<unsafe extern "C" fn(state: *mut c_void)>, transform: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, length: size_t, dst_length: *mut size_t) -> *mut c_char>, in_domain: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, length: size_t) -> c_uchar>, in_range: Option<unsafe extern "C" fn(state: *mut c_void, key: *const c_char, length: size_t) -> c_uchar>, name: Option<unsafe extern "C" fn(state: *mut c_void) -> *const c_char>) -> *mut rocksdb_slicetransform_t;
pub fn rocksdb_slicetransform_create_fixed_prefix(len: size_t) -> *mut rocksdb_slicetransform_t;
pub fn rocksdb_slicetransform_create_noop() -> *mut rocksdb_slicetransform_t;
pub fn rocksdb_slicetransform_destroy(st: *mut rocksdb_slicetransform_t);
// Universal Compaction options
pub fn rocksdb_universal_compaction_options_create() -> *mut rocksdb_universal_compaction_options_t;
pub fn rocksdb_universal_compaction_options_set_size_ratio(uco: *mut rocksdb_universal_compaction_options_t, ratio: c_int);
pub fn rocksdb_universal_compaction_options_set_min_merge_width(uco: *mut rocksdb_universal_compaction_options_t, w: c_int);
pub fn rocksdb_universal_compaction_options_set_max_merge_width(uco: *mut rocksdb_universal_compaction_options_t, w: c_int);
pub fn rocksdb_universal_compaction_options_set_max_size_amplification_percent(uco: *mut rocksdb_universal_compaction_options_t, p: c_int);
pub fn rocksdb_universal_compaction_options_set_compression_size_percent(uco: *mut rocksdb_universal_compaction_options_t, p: c_int);
pub fn rocksdb_universal_compaction_options_set_stop_style(uco: *mut rocksdb_universal_compaction_options_t, style: c_int);
pub fn rocksdb_universal_compaction_options_destroy(uco: *mut rocksdb_universal_compaction_options_t);
pub fn rocksdb_fifo_compaction_options_create() -> *mut rocksdb_fifo_compaction_options_t;
pub fn rocksdb_fifo_compaction_options_set_max_table_files_size(fifo_opts: *mut rocksdb_fifo_compaction_options_t, size: uint64_t);
pub fn rocksdb_fifo_compaction_options_destroy(fifo_opts: *mut rocksdb_fifo_compaction_options_t);
pub fn rocksdb_livefiles_count(files: *const rocksdb_livefiles_t) -> c_int;
pub fn rocksdb_livefiles_name(files: *const rocksdb_livefiles_t, index: c_int) -> *const c_char;
pub fn rocksdb_livefiles_level(files: *const rocksdb_livefiles_t, index: c_int) -> c_int;
pub fn rocksdb_livefiles_size(files: *const rocksdb_livefiles_t, index: c_int) -> size_t;
pub fn rocksdb_livefiles_smallestkey(files: *const rocksdb_livefiles_t, index: c_int, size: *mut size_t) -> *const c_char;
pub fn rocksdb_livefiles_largestkey(files: *const rocksdb_livefiles_t, index: c_int, size: *mut size_t) -> *const c_char;
pub fn rocksdb_livefiles_destroy(files: *const rocksdb_livefiles_t);
// Utilities
pub fn rocksdb_get_options_from_string(base_options: *const rocksdb_options_t, opts_str: *const c_char, new_options: *mut rocksdb_options_t, errptr: *mut *mut c_char);
pub fn rocksdb_delete_file_in_range(db: *mut rocksdb_t, start_key: *const c_char, start_key_len: size_t, limit_key: *const c_char, limit_key_len: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_delete_file_in_range_cf(db: *mut rocksdb_t, column_family: *mut rocksdb_column_family_handle_t, start_key: *const c_char, start_key_len: size_t, limit_key: *const c_char, limit_key_len: size_t, errptr: *mut *mut c_char);
pub fn rocksdb_free(ptr: *mut c_void);
}
pub const rocksdb_block_based_table_index_type_binary_search: c_int = 0;
pub const rocksdb_block_based_table_index_type_hash_search: c_int = 1;
pub const rocksdb_no_compression: c_int = 0;
pub const rocksdb_snappy_compression: c_int = 1;
pub const rocksdb_zlib_compression: c_int = 2;
pub const rocksdb_bz2_compression: c_int = 3;
pub const rocksdb_lz4_compression: c_int = 4;
pub const rocksdb_lz4hc_compression: c_int = 5;
pub const rocksdb_level_compaction: c_int = 0;
pub const rocksdb_universal_compaction: c_int = 1;
pub const rocksdb_fifo_compaction: c_int = 2;
pub const rocksdb_similar_size_compaction_stop_style: c_int = 0;
pub const rocksdb_total_size_compaction_stop_style: c_int = 1;
pub enum rocksdb_t { }
pub enum rocksdb_backup_engine_t { }
pub enum rocksdb_backup_engine_info_t { }
pub enum rocksdb_restore_options_t { }
pub enum rocksdb_cache_t { }
pub enum rocksdb_compactionfilter_t { }
pub enum rocksdb_compactionfiltercontext_t { }
pub enum rocksdb_compactionfilterfactory_t { }
pub enum rocksdb_comparator_t { }
pub enum rocksdb_env_t { }
pub enum rocksdb_fifo_compaction_options_t { }
pub enum rocksdb_filelock_t { }
pub enum rocksdb_filterpolicy_t { }
pub enum rocksdb_flushoptions_t { }
pub enum rocksdb_iterator_t { }
pub enum rocksdb_logger_t { }
pub enum rocksdb_mergeoperator_t { }
pub enum rocksdb_options_t { }
pub enum rocksdb_block_based_table_options_t { }
pub enum rocksdb_cuckoo_table_options_t { }
pub enum rocksdb_randomfile_t { }
pub enum rocksdb_readoptions_t { }
pub enum rocksdb_seqfile_t { }
pub enum rocksdb_slicetransform_t { }
pub enum rocksdb_snapshot_t { }
pub enum rocksdb_writablefile_t { }
pub enum rocksdb_writebatch_t { }
pub enum rocksdb_writeoptions_t { }
pub enum rocksdb_universal_compaction_options_t { }
pub enum rocksdb_livefiles_t { }
pub enum rocksdb_column_family_handle_t { }