|
|
|
@ -12,8 +12,9 @@ const char DBPath[] = "/tmp/rocksdb_simple_example"; |
|
|
|
|
int main(int argc, char **argv) { |
|
|
|
|
rocksdb_t *db; |
|
|
|
|
rocksdb_options_t *options = rocksdb_options_create(); |
|
|
|
|
// Optimize RocksDB. This is the easiest way to get RocksDB to perform well
|
|
|
|
|
int cpus = sysconf (_SC_NPROCESSORS_ONLN); // get number of online cores
|
|
|
|
|
// Optimize RocksDB. This is the easiest way to
|
|
|
|
|
// get RocksDB to perform well
|
|
|
|
|
int cpus = sysconf(_SC_NPROCESSORS_ONLN); // get # of online cores
|
|
|
|
|
rocksdb_options_increase_parallelism(options, cpus); |
|
|
|
|
rocksdb_options_optimize_level_style_compaction(options, 0); |
|
|
|
|
// create the DB if it's not already present
|
|
|
|
@ -28,7 +29,8 @@ int main (int argc, char **argv) { |
|
|
|
|
rocksdb_writeoptions_t *writeoptions = rocksdb_writeoptions_create(); |
|
|
|
|
const char key[] = "key"; |
|
|
|
|
char *value = "value"; |
|
|
|
|
rocksdb_put (db, writeoptions, key, strlen (key), value, strlen (value), &err); |
|
|
|
|
rocksdb_put(db, writeoptions, key, strlen (key), value, \
|
|
|
|
|
strlen (value), &err); |
|
|
|
|
assert(!err); |
|
|
|
|
// Get value
|
|
|
|
|
rocksdb_readoptions_t *readoptions = rocksdb_readoptions_create(); |
|
|
|
|