Skip to content

Commit eb8d481

Browse files
fredbjerConnor1996
authored andcommitted
change c.h and c.cc for bindgen ffi (#401)
* change c.h and c.cc for bindgen ffi Signed-off-by: fredchenbj <[email protected]>
1 parent a3503b2 commit eb8d481

File tree

2 files changed

+50
-49
lines changed
  • librocksdb_sys/crocksdb

2 files changed

+50
-49
lines changed

librocksdb_sys/crocksdb/c.cc

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ crocksdb_t* crocksdb_open_column_families_with_ttl(
746746
const char** column_family_names,
747747
const crocksdb_options_t** column_family_options,
748748
const int32_t* ttl_array,
749-
bool read_only,
749+
unsigned char read_only,
750750
crocksdb_column_family_handle_t** column_family_handles,
751751
char** errptr) {
752752
std::vector<ColumnFamilyDescriptor> column_families;
@@ -1139,7 +1139,7 @@ void crocksdb_destroy_map_property(crocksdb_map_property_t* info) {
11391139
delete info;
11401140
}
11411141

1142-
bool crocksdb_get_map_property_cf(
1142+
unsigned char crocksdb_get_map_property_cf(
11431143
crocksdb_t* db,
11441144
crocksdb_column_family_handle_t* column_family,
11451145
const char* property,
@@ -1916,11 +1916,11 @@ const crocksdb_table_properties_t* crocksdb_flushjobinfo_table_properties(
19161916
&info->rep.table_properties);
19171917
}
19181918

1919-
bool crocksdb_flushjobinfo_triggered_writes_slowdown(const crocksdb_flushjobinfo_t* info) {
1919+
unsigned char crocksdb_flushjobinfo_triggered_writes_slowdown(const crocksdb_flushjobinfo_t* info) {
19201920
return info->rep.triggered_writes_slowdown;
19211921
}
19221922

1923-
bool crocksdb_flushjobinfo_triggered_writes_stop(const crocksdb_flushjobinfo_t* info) {
1923+
unsigned char crocksdb_flushjobinfo_triggered_writes_stop(const crocksdb_flushjobinfo_t* info) {
19241924
return info->rep.triggered_writes_stop;
19251925
}
19261926

@@ -2895,11 +2895,11 @@ void crocksdb_options_set_vector_memtable_factory(crocksdb_options_t* opt, uint6
28952895
opt->rep.memtable_factory.reset(new VectorRepFactory(reserved_bytes));
28962896
}
28972897

2898-
bool crocksdb_load_latest_options(const char* dbpath, crocksdb_env_t* env,
2898+
unsigned char crocksdb_load_latest_options(const char* dbpath, crocksdb_env_t* env,
28992899
crocksdb_options_t* db_options,
29002900
crocksdb_column_family_descriptor*** cf_descs,
29012901
size_t* cf_descs_len,
2902-
bool ignore_unknown_options, char** errptr) {
2902+
unsigned char ignore_unknown_options, char** errptr) {
29032903
std::vector<ColumnFamilyDescriptor> tmp_cf_descs;
29042904
Status s = rocksdb::LoadLatestOptions(dbpath, env->rep, &db_options->rep,
29052905
&tmp_cf_descs, ignore_unknown_options);
@@ -2934,7 +2934,7 @@ crocksdb_ratelimiter_t* crocksdb_ratelimiter_create_with_auto_tuned(
29342934
int64_t refill_period_us,
29352935
int32_t fairness,
29362936
crocksdb_ratelimiter_mode_t mode,
2937-
bool auto_tuned) {
2937+
unsigned char auto_tuned) {
29382938
crocksdb_ratelimiter_t* rate_limiter = new crocksdb_ratelimiter_t;
29392939
RateLimiter::Mode m = RateLimiter::Mode::kWritesOnly;
29402940
switch (mode) {
@@ -3437,7 +3437,7 @@ void crocksdb_lru_cache_options_set_num_shard_bits(
34373437
}
34383438

34393439
void crocksdb_lru_cache_options_set_strict_capacity_limit(
3440-
crocksdb_lru_cache_options_t* opt, bool strict_capacity_limit) {
3440+
crocksdb_lru_cache_options_t* opt, unsigned char strict_capacity_limit) {
34413441
opt->rep.strict_capacity_limit = strict_capacity_limit;
34423442
}
34433443

@@ -3785,7 +3785,7 @@ void crocksdb_ingest_external_file_cf(
37853785
SaveError(errptr, db->rep->IngestExternalFile(handle->rep, files, opt->rep));
37863786
}
37873787

3788-
bool crocksdb_ingest_external_file_optimized(
3788+
unsigned char crocksdb_ingest_external_file_optimized(
37893789
crocksdb_t* db, crocksdb_column_family_handle_t* handle,
37903790
const char* const* file_list, const size_t list_len,
37913791
const crocksdb_ingestexternalfileoptions_t* opt, char** errptr) {
@@ -3947,7 +3947,7 @@ void crocksdb_fifo_compaction_options_set_max_table_files_size(
39473947
}
39483948

39493949
void crocksdb_fifo_compaction_options_set_allow_compaction(
3950-
crocksdb_fifo_compaction_options_t* fifo_opts, bool allow_compaction) {
3950+
crocksdb_fifo_compaction_options_t* fifo_opts, unsigned char allow_compaction) {
39513951
fifo_opts->rep.allow_compaction = allow_compaction;
39523952
}
39533953

@@ -4026,7 +4026,7 @@ void crocksdb_delete_files_in_range(
40264026
crocksdb_t* db,
40274027
const char* start_key, size_t start_key_len,
40284028
const char* limit_key, size_t limit_key_len,
4029-
bool include_end, char** errptr) {
4029+
unsigned char include_end, char** errptr) {
40304030
Slice a, b;
40314031
SaveError(
40324032
errptr,
@@ -4041,7 +4041,7 @@ void crocksdb_delete_files_in_range_cf(
40414041
crocksdb_t* db, crocksdb_column_family_handle_t* column_family,
40424042
const char* start_key, size_t start_key_len,
40434043
const char* limit_key, size_t limit_key_len,
4044-
bool include_end, char** errptr) {
4044+
unsigned char include_end, char** errptr) {
40454045
Slice a, b;
40464046
SaveError(
40474047
errptr,
@@ -4056,7 +4056,7 @@ void crocksdb_delete_files_in_ranges_cf(
40564056
crocksdb_t* db, crocksdb_column_family_handle_t* cf,
40574057
const char* const* start_keys, const size_t* start_keys_lens,
40584058
const char* const* limit_keys, const size_t* limit_keys_lens,
4059-
size_t num_ranges, bool include_end, char** errptr) {
4059+
size_t num_ranges, unsigned char include_end, char** errptr) {
40604060
std::vector<Slice> starts(num_ranges);
40614061
std::vector<Slice> limits(num_ranges);
40624062
std::vector<RangePtr> ranges(num_ranges);
@@ -5246,12 +5246,12 @@ void ctitandb_decode_blob_index(const char* value, size_t value_size,
52465246
index->blob_size = bi.blob_handle.size;
52475247
}
52485248

5249-
void ctitandb_encode_blob_index(const ctitandb_blob_index_t& index,
5249+
void ctitandb_encode_blob_index(const ctitandb_blob_index_t* index,
52505250
char** value, size_t* value_size) {
52515251
BlobIndex bi;
5252-
bi.file_number = index.file_number;
5253-
bi.blob_handle.offset = index.blob_offset;
5254-
bi.blob_handle.size = index.blob_size;
5252+
bi.file_number = index->file_number;
5253+
bi.blob_handle.offset = index->blob_offset;
5254+
bi.blob_handle.size = index->blob_size;
52555255
std::string result;
52565256
bi.EncodeTo(&result);
52575257
*value = CopyString(result);
@@ -5372,12 +5372,12 @@ void ctitandb_readoptions_destroy(ctitandb_readoptions_t* opts) {
53725372
delete opts;
53735373
}
53745374

5375-
bool ctitandb_readoptions_key_only(ctitandb_readoptions_t* opts) {
5375+
unsigned char ctitandb_readoptions_key_only(ctitandb_readoptions_t* opts) {
53765376
return opts->rep.key_only;
53775377
}
53785378

53795379
void ctitandb_readoptions_set_key_only(ctitandb_readoptions_t* opts,
5380-
bool v) {
5380+
unsigned char v) {
53815381
opts->rep.key_only = v;
53825382
}
53835383

@@ -5449,7 +5449,7 @@ void ctitandb_delete_files_in_range(
54495449
crocksdb_t* db,
54505450
const char* start_key, size_t start_key_len,
54515451
const char* limit_key, size_t limit_key_len,
5452-
bool include_end, char** errptr) {
5452+
unsigned char include_end, char** errptr) {
54535453
Slice a, b;
54545454
RangePtr range(
54555455
start_key ? (a = Slice(start_key, start_key_len), &a) : nullptr,
@@ -5467,7 +5467,7 @@ void ctitandb_delete_files_in_range_cf(
54675467
crocksdb_t* db, crocksdb_column_family_handle_t* column_family,
54685468
const char* start_key, size_t start_key_len,
54695469
const char* limit_key, size_t limit_key_len,
5470-
bool include_end, char** errptr) {
5470+
unsigned char include_end, char** errptr) {
54715471
Slice a, b;
54725472
RangePtr range(
54735473
start_key ? (a = Slice(start_key, start_key_len), &a) : nullptr,
@@ -5485,7 +5485,7 @@ void ctitandb_delete_files_in_ranges_cf(
54855485
crocksdb_t* db, crocksdb_column_family_handle_t* cf,
54865486
const char* const* start_keys, const size_t* start_keys_lens,
54875487
const char* const* limit_keys, const size_t* limit_keys_lens,
5488-
size_t num_ranges, bool include_end, char** errptr) {
5488+
size_t num_ranges, unsigned char include_end, char** errptr) {
54895489
std::vector<Slice> starts(num_ranges);
54905490
std::vector<Slice> limits(num_ranges);
54915491
std::vector<RangePtr> ranges(num_ranges);

librocksdb_sys/crocksdb/crocksdb/c.h

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ extern C_ROCKSDB_LIBRARY_API crocksdb_t* crocksdb_open_column_families_with_ttl(
254254
const crocksdb_options_t* options, const char* name, int num_column_families,
255255
const char** column_family_names,
256256
const crocksdb_options_t** column_family_options,
257-
const int32_t* ttl_array, bool read_only,
257+
const int32_t* ttl_array, unsigned char read_only,
258258
crocksdb_column_family_handle_t** column_family_handles,
259259
char** errptr);
260260

@@ -402,7 +402,7 @@ extern C_ROCKSDB_LIBRARY_API crocksdb_map_property_t* crocksdb_create_map_proper
402402

403403
extern C_ROCKSDB_LIBRARY_API void crocksdb_destroy_map_property(crocksdb_map_property_t* info);
404404

405-
extern C_ROCKSDB_LIBRARY_API bool crocksdb_get_map_property_cf(
405+
extern C_ROCKSDB_LIBRARY_API unsigned char crocksdb_get_map_property_cf(
406406
crocksdb_t* db, crocksdb_column_family_handle_t* column_family,
407407
const char* property, crocksdb_map_property_t* data);
408408

@@ -711,13 +711,14 @@ extern C_ROCKSDB_LIBRARY_API const char* crocksdb_flushjobinfo_file_path(
711711
const crocksdb_flushjobinfo_t*, size_t*);
712712
extern C_ROCKSDB_LIBRARY_API const crocksdb_table_properties_t*
713713
crocksdb_flushjobinfo_table_properties(const crocksdb_flushjobinfo_t*);
714-
extern C_ROCKSDB_LIBRARY_API bool
714+
extern C_ROCKSDB_LIBRARY_API unsigned char
715715
crocksdb_flushjobinfo_triggered_writes_slowdown(const crocksdb_flushjobinfo_t*);
716-
extern C_ROCKSDB_LIBRARY_API bool
716+
extern C_ROCKSDB_LIBRARY_API unsigned char
717717
crocksdb_flushjobinfo_triggered_writes_stop(const crocksdb_flushjobinfo_t*);
718718

719719
/* Compaction job info */
720-
720+
extern C_ROCKSDB_LIBRARY_API void crocksdb_compactionjobinfo_status(const crocksdb_compactionjobinfo_t* info, char**
721+
errptr);
721722
extern C_ROCKSDB_LIBRARY_API const char* crocksdb_compactionjobinfo_cf_name(
722723
const crocksdb_compactionjobinfo_t*, size_t*);
723724
extern C_ROCKSDB_LIBRARY_API size_t
@@ -757,7 +758,6 @@ crocksdb_compactionjobinfo_total_output_bytes(
757758
const crocksdb_compactionjobinfo_t* info);
758759

759760
/* External file ingestion info */
760-
761761
extern C_ROCKSDB_LIBRARY_API const char*
762762
crocksdb_externalfileingestioninfo_cf_name(
763763
const crocksdb_externalfileingestioninfo_t*, size_t*);
@@ -940,10 +940,10 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_options_enable_statistics(
940940
crocksdb_options_t*, unsigned char);
941941
extern C_ROCKSDB_LIBRARY_API void crocksdb_options_reset_statistics(
942942
crocksdb_options_t*);
943-
extern C_ROCKSDB_LIBRARY_API bool crocksdb_load_latest_options(
943+
extern C_ROCKSDB_LIBRARY_API unsigned char crocksdb_load_latest_options(
944944
const char* dbpath, crocksdb_env_t* env, crocksdb_options_t* db_options,
945945
crocksdb_column_family_descriptor*** cf_descs, size_t* cf_descs_len,
946-
bool ignore_unknown_options, char** errptr);
946+
unsigned char ignore_unknown_options, char** errptr);
947947

948948
/* returns a pointer to a malloc()-ed, null terminated string */
949949
extern C_ROCKSDB_LIBRARY_API char* crocksdb_options_statistics_get_string(
@@ -1161,7 +1161,7 @@ extern C_ROCKSDB_LIBRARY_API crocksdb_ratelimiter_t* crocksdb_ratelimiter_create
11611161
int64_t rate_bytes_per_sec, int64_t refill_period_us, int32_t fairness);
11621162
extern C_ROCKSDB_LIBRARY_API crocksdb_ratelimiter_t* crocksdb_ratelimiter_create_with_auto_tuned(
11631163
int64_t rate_bytes_per_sec, int64_t refill_period_us, int32_t fairness,
1164-
crocksdb_ratelimiter_mode_t mode, bool auto_tuned);
1164+
crocksdb_ratelimiter_mode_t mode, unsigned char auto_tuned);
11651165
extern C_ROCKSDB_LIBRARY_API void crocksdb_ratelimiter_destroy(crocksdb_ratelimiter_t*);
11661166
extern C_ROCKSDB_LIBRARY_API void crocksdb_ratelimiter_set_bytes_per_second(
11671167
crocksdb_ratelimiter_t *limiter, int64_t rate_bytes_per_sec);
@@ -1376,7 +1376,7 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_lru_cache_options_set_capacity(
13761376
extern C_ROCKSDB_LIBRARY_API void crocksdb_lru_cache_options_set_num_shard_bits(
13771377
crocksdb_lru_cache_options_t*, int);
13781378
extern C_ROCKSDB_LIBRARY_API void crocksdb_lru_cache_options_set_strict_capacity_limit(
1379-
crocksdb_lru_cache_options_t*, bool);
1379+
crocksdb_lru_cache_options_t*, unsigned char);
13801380
extern C_ROCKSDB_LIBRARY_API void crocksdb_lru_cache_options_set_high_pri_pool_ratio(
13811381
crocksdb_lru_cache_options_t*, double);
13821382
extern C_ROCKSDB_LIBRARY_API void crocksdb_lru_cache_options_set_memory_allocator(
@@ -1522,7 +1522,7 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_ingest_external_file_cf(
15221522
crocksdb_t* db, crocksdb_column_family_handle_t* handle,
15231523
const char* const* file_list, const size_t list_len,
15241524
const crocksdb_ingestexternalfileoptions_t* opt, char** errptr);
1525-
extern C_ROCKSDB_LIBRARY_API bool crocksdb_ingest_external_file_optimized(
1525+
extern C_ROCKSDB_LIBRARY_API unsigned char crocksdb_ingest_external_file_optimized(
15261526
crocksdb_t* db, crocksdb_column_family_handle_t* handle,
15271527
const char* const* file_list, const size_t list_len,
15281528
const crocksdb_ingestexternalfileoptions_t* opt, char** errptr);
@@ -1581,7 +1581,7 @@ crocksdb_fifo_compaction_options_set_max_table_files_size(
15811581
crocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size);
15821582
extern C_ROCKSDB_LIBRARY_API void
15831583
crocksdb_fifo_compaction_options_set_allow_compaction(
1584-
crocksdb_fifo_compaction_options_t* fifo_opts, bool allow_compaction);
1584+
crocksdb_fifo_compaction_options_t* fifo_opts, unsigned char allow_compaction);
15851585
extern C_ROCKSDB_LIBRARY_API void crocksdb_fifo_compaction_options_destroy(
15861586
crocksdb_fifo_compaction_options_t* fifo_opts);
15871587

@@ -1610,19 +1610,19 @@ extern C_ROCKSDB_LIBRARY_API void crocksdb_delete_files_in_range(
16101610
crocksdb_t* db,
16111611
const char* start_key, size_t start_key_len,
16121612
const char* limit_key, size_t limit_key_len,
1613-
bool include_end, char** errptr);
1613+
unsigned char include_end, char** errptr);
16141614

16151615
extern C_ROCKSDB_LIBRARY_API void crocksdb_delete_files_in_range_cf(
16161616
crocksdb_t* db, crocksdb_column_family_handle_t* column_family,
16171617
const char* start_key, size_t start_key_len,
16181618
const char* limit_key, size_t limit_key_len,
1619-
bool include_end, char** errptr);
1619+
unsigned char include_end, char** errptr);
16201620

16211621
extern C_ROCKSDB_LIBRARY_API void crocksdb_delete_files_in_ranges_cf(
16221622
crocksdb_t* db, crocksdb_column_family_handle_t* cf,
16231623
const char* const* start_keys, const size_t* start_keys_lens,
16241624
const char* const* limit_keys, const size_t* limit_keys_lens,
1625-
size_t num_ranges, bool include_end, char** errptr);
1625+
size_t num_ranges, unsigned char include_end, char** errptr);
16261626

16271627
// referring to convention (3), this should be used by client
16281628
// to free memory that was malloc()ed
@@ -1764,17 +1764,16 @@ crocksdb_options_add_table_properties_collector_factory(
17641764
crocksdb_options_t* opt, crocksdb_table_properties_collector_factory_t* f);
17651765

17661766
/* Get Table Properties */
1767-
17681767
extern C_ROCKSDB_LIBRARY_API crocksdb_table_properties_collection_t*
1769-
crocksdb_get_propeties_of_all_tables(crocksdb_t* db, char** errptr);
1768+
crocksdb_get_properties_of_all_tables(crocksdb_t* db, char** errptr);
17701769

17711770
extern C_ROCKSDB_LIBRARY_API crocksdb_table_properties_collection_t*
1772-
crocksdb_get_propeties_of_all_tables_cf(crocksdb_t* db,
1771+
crocksdb_get_properties_of_all_tables_cf(crocksdb_t* db,
17731772
crocksdb_column_family_handle_t* cf,
17741773
char** errptr);
17751774

17761775
extern C_ROCKSDB_LIBRARY_API crocksdb_table_properties_collection_t*
1777-
crocksdb_get_propeties_of_tables_in_range(
1776+
crocksdb_get_properties_of_tables_in_range(
17781777
crocksdb_t* db, crocksdb_column_family_handle_t* cf, int num_ranges,
17791778
const char* const* start_keys, const size_t* start_keys_lens,
17801779
const char* const* limit_keys, const size_t* limit_keys_lens,
@@ -1797,7 +1796,7 @@ extern C_ROCKSDB_LIBRARY_API const char *
17971796
crocksdb_keyversions_key(const crocksdb_keyversions_t *kvs, int index);
17981797

17991798
extern C_ROCKSDB_LIBRARY_API const char *
1800-
crocksdb_keyversions_key(const crocksdb_keyversions_t *kvs, int index);
1799+
crocksdb_keyversions_value(const crocksdb_keyversions_t *kvs, int index);
18011800

18021801
extern C_ROCKSDB_LIBRARY_API uint64_t
18031802
crocksdb_keyversions_seq(const crocksdb_keyversions_t *kvs, int index);
@@ -2092,7 +2091,7 @@ extern C_ROCKSDB_LIBRARY_API void ctitandb_decode_blob_index(
20922091
char** errptr);
20932092

20942093
extern C_ROCKSDB_LIBRARY_API void ctitandb_encode_blob_index(
2095-
const ctitandb_blob_index_t& index, char** value, size_t* value_size);
2094+
const ctitandb_blob_index_t* index, char** value, size_t* value_size);
20962095

20972096
extern C_ROCKSDB_LIBRARY_API void ctitandb_options_set_disable_background_gc(
20982097
ctitandb_options_t* options, unsigned char disable);
@@ -2145,19 +2144,21 @@ extern C_ROCKSDB_LIBRARY_API size_t ctitandb_options_get_blob_cache_capacity(
21452144
extern C_ROCKSDB_LIBRARY_API void ctitandb_options_set_discardable_ratio(
21462145
ctitandb_options_t* options, double ratio);
21472146

2148-
extern void ctitandb_options_set_sample_ratio(ctitandb_options_t* options,
2147+
extern void C_ROCKSDB_LIBRARY_API ctitandb_options_set_sample_ratio(ctitandb_options_t* options,
21492148
double ratio);
21502149

2150+
extern void C_ROCKSDB_LIBRARY_API ctitandb_options_set_blob_run_mode(ctitandb_options_t* options, int mode);
2151+
21512152
/* TitanReadOptions */
21522153

21532154
extern C_ROCKSDB_LIBRARY_API ctitandb_readoptions_t* ctitandb_readoptions_create();
21542155

21552156
extern C_ROCKSDB_LIBRARY_API void ctitandb_readoptions_destroy(ctitandb_readoptions_t* opts);
21562157

2157-
extern C_ROCKSDB_LIBRARY_API bool ctitandb_readoptions_key_only(ctitandb_readoptions_t* opts);
2158+
extern C_ROCKSDB_LIBRARY_API unsigned char ctitandb_readoptions_key_only(ctitandb_readoptions_t* opts);
21582159

21592160
extern C_ROCKSDB_LIBRARY_API void ctitandb_readoptions_set_key_only(ctitandb_readoptions_t* opts,
2160-
bool v);
2161+
unsigned char v);
21612162

21622163
/* Titan Iterator */
21632164

@@ -2185,19 +2186,19 @@ extern C_ROCKSDB_LIBRARY_API void ctitandb_delete_files_in_range(
21852186
crocksdb_t* db,
21862187
const char* start_key, size_t start_key_len,
21872188
const char* limit_key, size_t limit_key_len,
2188-
bool include_end, char** errptr);
2189+
unsigned char include_end, char** errptr);
21892190

21902191
extern C_ROCKSDB_LIBRARY_API void ctitandb_delete_files_in_range_cf(
21912192
crocksdb_t* db, crocksdb_column_family_handle_t* column_family,
21922193
const char* start_key, size_t start_key_len,
21932194
const char* limit_key, size_t limit_key_len,
2194-
bool include_end, char** errptr);
2195+
unsigned char include_end, char** errptr);
21952196

21962197
extern C_ROCKSDB_LIBRARY_API void ctitandb_delete_files_in_ranges_cf(
21972198
crocksdb_t* db, crocksdb_column_family_handle_t* cf,
21982199
const char* const* start_keys, const size_t* start_keys_lens,
21992200
const char* const* limit_keys, const size_t* limit_keys_lens,
2200-
size_t num_ranges, bool include_end, char** errptr);
2201+
size_t num_ranges, unsigned char include_end, char** errptr);
22012202

22022203
#ifdef __cplusplus
22032204
} /* end extern "C" */

0 commit comments

Comments
 (0)