From 47cb9e2a211e1d7157078ba7bab536beb29e56dc Mon Sep 17 00:00:00 2001 From: cmumford Date: Wed, 25 Oct 2017 16:13:51 -0700 Subject: [PATCH] Add leveldb_options_set_max_file_size to the C API. When the max file size option was added in CL 134391640 the C API was not modified to support this. This change was contributed by GitHub user @olt and fixes issue #439. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=173466388 --- db/c.cc | 4 ++++ db/c_test.c | 1 + include/leveldb/c.h | 2 ++ 3 files changed, 7 insertions(+) diff --git a/db/c.cc b/db/c.cc index 08ff0ad..d242385 100644 --- a/db/c.cc +++ b/db/c.cc @@ -446,6 +446,10 @@ void leveldb_options_set_block_restart_interval(leveldb_options_t* opt, int n) { opt->rep.block_restart_interval = n; } +void leveldb_options_set_max_file_size(leveldb_options_t* opt, size_t s) { + opt->rep.max_file_size = s; +} + void leveldb_options_set_compression(leveldb_options_t* opt, int t) { opt->rep.compression = static_cast(t); } diff --git a/db/c_test.c b/db/c_test.c index 7cd5ee0..4a14151 100644 --- a/db/c_test.c +++ b/db/c_test.c @@ -189,6 +189,7 @@ int main(int argc, char** argv) { leveldb_options_set_max_open_files(options, 10); leveldb_options_set_block_size(options, 1024); leveldb_options_set_block_restart_interval(options, 8); + leveldb_options_set_max_file_size(options, 3 << 20); leveldb_options_set_compression(options, leveldb_no_compression); roptions = leveldb_readoptions_create(); diff --git a/include/leveldb/c.h b/include/leveldb/c.h index 7ac8121..dc6f255 100644 --- a/include/leveldb/c.h +++ b/include/leveldb/c.h @@ -184,6 +184,8 @@ LEVELDB_EXPORT void leveldb_options_set_cache(leveldb_options_t*, LEVELDB_EXPORT void leveldb_options_set_block_size(leveldb_options_t*, size_t); LEVELDB_EXPORT void leveldb_options_set_block_restart_interval( leveldb_options_t*, int); +LEVELDB_EXPORT void leveldb_options_set_max_file_size(leveldb_options_t*, + size_t); enum { leveldb_no_compression = 0,