2016-02-10 00:12:00 +01:00
|
|
|
/* Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
|
2013-11-18 19:12:08 +01:00
|
|
|
This source code is licensed under the BSD-style license found in the
|
|
|
|
LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
Copyright (c) 2011 The LevelDB Authors. All rights reserved.
|
2011-08-05 22:40:49 +02:00
|
|
|
Use of this source code is governed by a BSD-style license that can be
|
|
|
|
found in the LICENSE file. See the AUTHORS file for names of contributors.
|
|
|
|
|
2014-07-31 05:42:36 +02:00
|
|
|
C bindings for rocksdb. May be useful as a stable ABI that can be
|
|
|
|
used by programs that keep rocksdb in a shared library, or for
|
2011-08-05 22:40:49 +02:00
|
|
|
a JNI api.
|
|
|
|
|
|
|
|
Does not support:
|
|
|
|
. getters for the option types
|
|
|
|
. custom comparators that implement key shortening
|
|
|
|
. capturing post-write-snapshot
|
|
|
|
. custom iter, db, env, cache implementations using just the C bindings
|
|
|
|
|
|
|
|
Some conventions:
|
|
|
|
|
|
|
|
(1) We expose just opaque struct pointers and functions to clients.
|
|
|
|
This allows us to change internal representations without having to
|
|
|
|
recompile clients.
|
|
|
|
|
|
|
|
(2) For simplicity, there is no equivalent to the Slice type. Instead,
|
|
|
|
the caller has to pass the pointer and length as separate
|
|
|
|
arguments.
|
|
|
|
|
|
|
|
(3) Errors are represented by a null-terminated c string. NULL
|
|
|
|
means no error. All operations that can raise an error are passed
|
|
|
|
a "char** errptr" as the last argument. One of the following must
|
|
|
|
be true on entry:
|
|
|
|
*errptr == NULL
|
|
|
|
*errptr points to a malloc()ed null-terminated error message
|
|
|
|
On success, a leveldb routine leaves *errptr unchanged.
|
|
|
|
On failure, leveldb frees the old value of *errptr and
|
|
|
|
set *errptr to a malloc()ed error message.
|
|
|
|
|
|
|
|
(4) Bools have the type unsigned char (0 == false; rest == true)
|
|
|
|
|
|
|
|
(5) All of the pointer arguments must be non-NULL.
|
|
|
|
*/
|
|
|
|
|
2013-08-23 17:38:13 +02:00
|
|
|
#ifndef STORAGE_ROCKSDB_INCLUDE_C_H_
|
|
|
|
#define STORAGE_ROCKSDB_INCLUDE_C_H_
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
#pragma once
|
|
|
|
|
2015-07-16 21:10:16 +02:00
|
|
|
#ifdef _WIN32
|
2015-07-13 21:11:05 +02:00
|
|
|
#ifdef ROCKSDB_DLL
|
|
|
|
#ifdef ROCKSDB_LIBRARY_EXPORTS
|
|
|
|
#define ROCKSDB_LIBRARY_API __declspec(dllexport)
|
2015-07-02 01:13:49 +02:00
|
|
|
#else
|
2015-07-13 21:11:05 +02:00
|
|
|
#define ROCKSDB_LIBRARY_API __declspec(dllimport)
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define ROCKSDB_LIBRARY_API
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define ROCKSDB_LIBRARY_API
|
2015-07-02 01:13:49 +02:00
|
|
|
#endif
|
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
/* Exported types */
|
|
|
|
|
2014-02-12 22:49:00 +01:00
|
|
|
typedef struct rocksdb_t rocksdb_t;
|
2015-01-31 13:47:49 +01:00
|
|
|
typedef struct rocksdb_backup_engine_t rocksdb_backup_engine_t;
|
2015-02-07 12:25:10 +01:00
|
|
|
typedef struct rocksdb_backup_engine_info_t rocksdb_backup_engine_info_t;
|
|
|
|
typedef struct rocksdb_restore_options_t rocksdb_restore_options_t;
|
2014-02-12 22:49:00 +01:00
|
|
|
typedef struct rocksdb_cache_t rocksdb_cache_t;
|
2014-06-18 04:23:47 +02:00
|
|
|
typedef struct rocksdb_compactionfilter_t rocksdb_compactionfilter_t;
|
2014-07-04 01:52:22 +02:00
|
|
|
typedef struct rocksdb_compactionfiltercontext_t
|
|
|
|
rocksdb_compactionfiltercontext_t;
|
|
|
|
typedef struct rocksdb_compactionfilterfactory_t
|
|
|
|
rocksdb_compactionfilterfactory_t;
|
2014-02-12 22:49:00 +01:00
|
|
|
typedef struct rocksdb_comparator_t rocksdb_comparator_t;
|
|
|
|
typedef struct rocksdb_env_t rocksdb_env_t;
|
2014-07-08 06:12:25 +02:00
|
|
|
typedef struct rocksdb_fifo_compaction_options_t rocksdb_fifo_compaction_options_t;
|
2014-02-12 22:49:00 +01:00
|
|
|
typedef struct rocksdb_filelock_t rocksdb_filelock_t;
|
|
|
|
typedef struct rocksdb_filterpolicy_t rocksdb_filterpolicy_t;
|
|
|
|
typedef struct rocksdb_flushoptions_t rocksdb_flushoptions_t;
|
|
|
|
typedef struct rocksdb_iterator_t rocksdb_iterator_t;
|
|
|
|
typedef struct rocksdb_logger_t rocksdb_logger_t;
|
|
|
|
typedef struct rocksdb_mergeoperator_t rocksdb_mergeoperator_t;
|
|
|
|
typedef struct rocksdb_options_t rocksdb_options_t;
|
2014-08-25 23:22:05 +02:00
|
|
|
typedef struct rocksdb_block_based_table_options_t
|
|
|
|
rocksdb_block_based_table_options_t;
|
2014-11-14 01:57:01 +01:00
|
|
|
typedef struct rocksdb_cuckoo_table_options_t
|
|
|
|
rocksdb_cuckoo_table_options_t;
|
2014-02-12 22:49:00 +01:00
|
|
|
typedef struct rocksdb_randomfile_t rocksdb_randomfile_t;
|
|
|
|
typedef struct rocksdb_readoptions_t rocksdb_readoptions_t;
|
|
|
|
typedef struct rocksdb_seqfile_t rocksdb_seqfile_t;
|
|
|
|
typedef struct rocksdb_slicetransform_t rocksdb_slicetransform_t;
|
|
|
|
typedef struct rocksdb_snapshot_t rocksdb_snapshot_t;
|
|
|
|
typedef struct rocksdb_writablefile_t rocksdb_writablefile_t;
|
|
|
|
typedef struct rocksdb_writebatch_t rocksdb_writebatch_t;
|
|
|
|
typedef struct rocksdb_writeoptions_t rocksdb_writeoptions_t;
|
2013-12-14 08:58:18 +01:00
|
|
|
typedef struct rocksdb_universal_compaction_options_t rocksdb_universal_compaction_options_t;
|
2014-02-25 19:32:28 +01:00
|
|
|
typedef struct rocksdb_livefiles_t rocksdb_livefiles_t;
|
2014-07-07 10:18:52 +02:00
|
|
|
typedef struct rocksdb_column_family_handle_t rocksdb_column_family_handle_t;
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* DB operations */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open_for_read_only(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name,
|
|
|
|
unsigned char error_if_log_file_exist, char** errptr);
|
2014-04-27 21:57:10 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_backup_engine_t* rocksdb_backup_engine_open(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* path, char** errptr);
|
2015-01-31 13:47:49 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_create_new_backup(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_backup_engine_t* be, rocksdb_t* db, char** errptr);
|
2015-01-31 13:47:49 +01:00
|
|
|
|
2016-04-22 22:49:59 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_purge_old_backups(
|
|
|
|
rocksdb_backup_engine_t* be, uint32_t num_backups_to_keep, char** errptr);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_restore_options_t*
|
|
|
|
rocksdb_restore_options_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_restore_options_destroy(
|
|
|
|
rocksdb_restore_options_t* opt);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_restore_options_set_keep_log_files(
|
2015-02-07 12:25:10 +01:00
|
|
|
rocksdb_restore_options_t* opt, int v);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_backup_engine_restore_db_from_latest_backup(
|
|
|
|
rocksdb_backup_engine_t* be, const char* db_dir, const char* wal_dir,
|
|
|
|
const rocksdb_restore_options_t* restore_options, char** errptr);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const rocksdb_backup_engine_info_t*
|
|
|
|
rocksdb_backup_engine_get_backup_info(rocksdb_backup_engine_t* be);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API int rocksdb_backup_engine_info_count(
|
2015-02-07 12:25:10 +01:00
|
|
|
const rocksdb_backup_engine_info_t* info);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API int64_t
|
|
|
|
rocksdb_backup_engine_info_timestamp(const rocksdb_backup_engine_info_t* info,
|
|
|
|
int index);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API uint32_t
|
|
|
|
rocksdb_backup_engine_info_backup_id(const rocksdb_backup_engine_info_t* info,
|
|
|
|
int index);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API uint64_t
|
|
|
|
rocksdb_backup_engine_info_size(const rocksdb_backup_engine_info_t* info,
|
|
|
|
int index);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API uint32_t rocksdb_backup_engine_info_number_files(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_backup_engine_info_t* info, int index);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_info_destroy(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_backup_engine_info_t* info);
|
2015-02-07 12:25:10 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_backup_engine_close(
|
2015-02-07 12:25:10 +01:00
|
|
|
rocksdb_backup_engine_t* be);
|
2015-01-31 13:47:49 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_t* rocksdb_open_column_families(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name, int num_column_families,
|
2014-07-07 23:41:54 +02:00
|
|
|
const char** column_family_names,
|
|
|
|
const rocksdb_options_t** column_family_options,
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_column_family_handle_t** column_family_handles, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_t*
|
|
|
|
rocksdb_open_for_read_only_column_families(
|
|
|
|
const rocksdb_options_t* options, const char* name, int num_column_families,
|
2014-07-07 23:41:54 +02:00
|
|
|
const char** column_family_names,
|
|
|
|
const rocksdb_options_t** column_family_options,
|
2014-07-07 10:18:52 +02:00
|
|
|
rocksdb_column_family_handle_t** column_family_handles,
|
2015-07-13 21:11:05 +02:00
|
|
|
unsigned char error_if_log_file_exist, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-08 01:58:20 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char** rocksdb_list_column_families(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name, size_t* lencf,
|
2014-07-07 10:18:52 +02:00
|
|
|
char** errptr);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_list_column_families_destroy(
|
|
|
|
char** list, size_t len);
|
2015-07-02 01:13:49 +02:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_column_family_handle_t*
|
|
|
|
rocksdb_create_column_family(rocksdb_t* db,
|
|
|
|
const rocksdb_options_t* column_family_options,
|
|
|
|
const char* column_family_name, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_drop_column_family(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, rocksdb_column_family_handle_t* handle, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_column_family_handle_destroy(
|
|
|
|
rocksdb_column_family_handle_t*);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_close(rocksdb_t* db);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_put(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
|
|
|
|
size_t keylen, const char* val, size_t vallen, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_put_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options,
|
|
|
|
rocksdb_column_family_handle_t* column_family, const char* key,
|
|
|
|
size_t keylen, const char* val, size_t vallen, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_delete(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
|
|
|
|
size_t keylen, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-08 01:58:20 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_delete_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options,
|
|
|
|
rocksdb_column_family_handle_t* column_family, const char* key,
|
|
|
|
size_t keylen, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_merge(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options, const char* key,
|
|
|
|
size_t keylen, const char* val, size_t vallen, char** errptr);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_merge_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options,
|
|
|
|
rocksdb_column_family_handle_t* column_family, const char* key,
|
|
|
|
size_t keylen, const char* val, size_t vallen, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_write(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_writeoptions_t* options,
|
|
|
|
rocksdb_writebatch_t* batch, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Returns NULL if not found. A malloc()ed array otherwise.
|
|
|
|
Stores the length of the array in *vallen. */
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char* rocksdb_get(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options, const char* key,
|
|
|
|
size_t keylen, size_t* vallen, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char* rocksdb_get_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options,
|
|
|
|
rocksdb_column_family_handle_t* column_family, const char* key,
|
|
|
|
size_t keylen, size_t* vallen, char** errptr);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-06-04 02:57:42 +02:00
|
|
|
// if values_list[i] == NULL and errs[i] == NULL,
|
|
|
|
// then we got status.IsNotFound(), which we will not return.
|
|
|
|
// all errors except status status.ok() and status.IsNotFound() are returned.
|
|
|
|
//
|
|
|
|
// errs, values_list and values_list_sizes must be num_keys in length,
|
|
|
|
// allocated by the caller.
|
|
|
|
// errs is a list of strings as opposed to the conventional one error,
|
|
|
|
// where errs[i] is the status for retrieval of keys_list[i].
|
|
|
|
// each non-NULL errs entry is a malloc()ed, null terminated string.
|
|
|
|
// each non-NULL values_list entry is a malloc()ed array, with
|
|
|
|
// the length for each stored in values_list_sizes[i].
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_multi_get(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options, size_t num_keys,
|
|
|
|
const char* const* keys_list, const size_t* keys_list_sizes,
|
|
|
|
char** values_list, size_t* values_list_sizes, char** errs);
|
2015-06-04 02:57:42 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_multi_get_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options,
|
2015-06-04 02:57:42 +02:00
|
|
|
const rocksdb_column_family_handle_t* const* column_families,
|
|
|
|
size_t num_keys, const char* const* keys_list,
|
2015-07-13 21:11:05 +02:00
|
|
|
const size_t* keys_list_sizes, char** values_list,
|
|
|
|
size_t* values_list_sizes, char** errs);
|
2015-06-04 02:57:42 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_iterator_t* rocksdb_create_iterator(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_iterator_t* rocksdb_create_iterator_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_readoptions_t* options,
|
2014-07-07 10:18:52 +02:00
|
|
|
rocksdb_column_family_handle_t* column_family);
|
|
|
|
|
2016-04-22 22:22:21 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_create_iterators(
|
|
|
|
rocksdb_t *db, rocksdb_readoptions_t* opts,
|
|
|
|
rocksdb_column_family_handle_t** column_families,
|
|
|
|
rocksdb_iterator_t** iterators, size_t size, char** errptr);
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const rocksdb_snapshot_t* rocksdb_create_snapshot(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_t* db);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_release_snapshot(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_snapshot_t* snapshot);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Returns NULL if property name is unknown.
|
|
|
|
Else returns a pointer to a malloc()-ed null-terminated value. */
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char* rocksdb_property_value(rocksdb_t* db,
|
|
|
|
const char* propname);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char* rocksdb_property_value_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
|
2014-07-07 10:18:52 +02:00
|
|
|
const char* propname);
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, int num_ranges, const char* const* range_start_key,
|
|
|
|
const size_t* range_start_key_len, const char* const* range_limit_key,
|
|
|
|
const size_t* range_limit_key_len, uint64_t* sizes);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_approximate_sizes_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
|
|
|
|
int num_ranges, const char* const* range_start_key,
|
|
|
|
const size_t* range_start_key_len, const char* const* range_limit_key,
|
|
|
|
const size_t* range_limit_key_len, uint64_t* sizes);
|
|
|
|
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_compact_range(rocksdb_t* db,
|
|
|
|
const char* start_key,
|
|
|
|
size_t start_key_len,
|
|
|
|
const char* limit_key,
|
|
|
|
size_t limit_key_len);
|
2012-04-17 17:36:46 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_compact_range_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
|
|
|
|
const char* start_key, size_t start_key_len, const char* limit_key,
|
|
|
|
size_t limit_key_len);
|
2014-07-07 10:18:52 +02:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_delete_file(rocksdb_t* db,
|
|
|
|
const char* name);
|
2014-02-25 19:32:28 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const rocksdb_livefiles_t* rocksdb_livefiles(
|
2014-02-25 19:32:28 +01:00
|
|
|
rocksdb_t* db);
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_flush(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, const rocksdb_flushoptions_t* options, char** errptr);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_disable_file_deletions(rocksdb_t* db,
|
|
|
|
char** errptr);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_enable_file_deletions(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_t* db, unsigned char force, char** errptr);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
/* Management operations */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_destroy_db(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_repair_db(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* options, const char* name, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Iterator */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_destroy(rocksdb_iterator_t*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API unsigned char rocksdb_iter_valid(
|
|
|
|
const rocksdb_iterator_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek_to_first(rocksdb_iterator_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek_to_last(rocksdb_iterator_t*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_seek(rocksdb_iterator_t*,
|
|
|
|
const char* k, size_t klen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_next(rocksdb_iterator_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_prev(rocksdb_iterator_t*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_key(
|
|
|
|
const rocksdb_iterator_t*, size_t* klen);
|
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_iter_value(
|
|
|
|
const rocksdb_iterator_t*, size_t* vlen);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_iter_get_error(
|
|
|
|
const rocksdb_iterator_t*, char** errptr);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Write batch */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create();
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_writebatch_t* rocksdb_writebatch_create_from(
|
|
|
|
const char* rep, size_t size);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_destroy(
|
|
|
|
rocksdb_writebatch_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_clear(rocksdb_writebatch_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API int rocksdb_writebatch_count(rocksdb_writebatch_t*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put(rocksdb_writebatch_t*,
|
|
|
|
const char* key,
|
|
|
|
size_t klen,
|
|
|
|
const char* val,
|
|
|
|
size_t vlen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
|
|
|
|
const char* key, size_t klen, const char* val, size_t vlen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_putv(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
|
|
|
|
const size_t* keys_list_sizes, int num_values,
|
|
|
|
const char* const* values_list, const size_t* values_list_sizes);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_putv_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
|
|
|
|
int num_keys, const char* const* keys_list, const size_t* keys_list_sizes,
|
2015-06-04 02:07:36 +02:00
|
|
|
int num_values, const char* const* values_list,
|
|
|
|
const size_t* values_list_sizes);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_merge(rocksdb_writebatch_t*,
|
|
|
|
const char* key,
|
|
|
|
size_t klen,
|
|
|
|
const char* val,
|
|
|
|
size_t vlen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_merge_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
|
|
|
|
const char* key, size_t klen, const char* val, size_t vlen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_mergev(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
|
|
|
|
const size_t* keys_list_sizes, int num_values,
|
|
|
|
const char* const* values_list, const size_t* values_list_sizes);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_mergev_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
|
|
|
|
int num_keys, const char* const* keys_list, const size_t* keys_list_sizes,
|
2015-06-04 02:07:36 +02:00
|
|
|
int num_values, const char* const* values_list,
|
|
|
|
const size_t* values_list_sizes);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_delete(rocksdb_writebatch_t*,
|
|
|
|
const char* key,
|
|
|
|
size_t klen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_delete_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t*, rocksdb_column_family_handle_t* column_family,
|
2014-07-07 10:18:52 +02:00
|
|
|
const char* key, size_t klen);
|
2015-07-08 01:58:20 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, int num_keys, const char* const* keys_list,
|
2015-06-04 02:07:36 +02:00
|
|
|
const size_t* keys_list_sizes);
|
2015-07-08 01:58:20 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_deletev_cf(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t* b, rocksdb_column_family_handle_t* column_family,
|
|
|
|
int num_keys, const char* const* keys_list, const size_t* keys_list_sizes);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_put_log_data(
|
|
|
|
rocksdb_writebatch_t*, const char* blob, size_t len);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writebatch_iterate(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_writebatch_t*, void* state,
|
2011-08-05 22:40:49 +02:00
|
|
|
void (*put)(void*, const char* k, size_t klen, const char* v, size_t vlen),
|
|
|
|
void (*deleted)(void*, const char* k, size_t klen));
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_writebatch_data(
|
|
|
|
rocksdb_writebatch_t*, size_t* size);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2014-08-25 23:22:05 +02:00
|
|
|
/* Block based table options */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_block_based_table_options_t*
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_block_based_options_create();
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_destroy(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_block_size(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options, size_t block_size);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_block_size_deviation(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options, int block_size_deviation);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_block_restart_interval(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options, int block_restart_interval);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_filter_policy(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options,
|
|
|
|
rocksdb_filterpolicy_t* filter_policy);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_no_block_cache(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options, unsigned char no_block_cache);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_block_cache(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options, rocksdb_cache_t* block_cache);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_block_cache_compressed(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t* options,
|
|
|
|
rocksdb_cache_t* block_cache_compressed);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_whole_key_filtering(
|
2014-08-25 23:22:05 +02:00
|
|
|
rocksdb_block_based_table_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_format_version(
|
2015-05-23 07:34:08 +02:00
|
|
|
rocksdb_block_based_table_options_t*, int);
|
|
|
|
enum {
|
|
|
|
rocksdb_block_based_table_index_type_binary_search = 0,
|
|
|
|
rocksdb_block_based_table_index_type_hash_search = 1,
|
|
|
|
};
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_block_based_options_set_index_type(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_block_based_table_options_t*, int); // uses one of the above enums
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_hash_index_allow_collision(
|
2015-05-23 07:34:08 +02:00
|
|
|
rocksdb_block_based_table_options_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_block_based_options_set_cache_index_and_filter_blocks(
|
2015-05-23 07:34:08 +02:00
|
|
|
rocksdb_block_based_table_options_t*, unsigned char);
|
2015-10-31 02:33:01 +01:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
Adding pin_l0_filter_and_index_blocks_in_cache feature and related fixes.
Summary:
When a block based table file is opened, if prefetch_index_and_filter is true, it will prefetch the index and filter blocks, putting them into the block cache.
What this feature adds: when a L0 block based table file is opened, if pin_l0_filter_and_index_blocks_in_cache is true in the options (and prefetch_index_and_filter is true), then the filter and index blocks aren't released back to the block cache at the end of BlockBasedTableReader::Open(). Instead the table reader takes ownership of them, hence pinning them, ie. the LRU cache will never push them out. Meanwhile in the table reader, further accesses will not hit the block cache, thus avoiding lock contention.
Test Plan:
'export TEST_TMPDIR=/dev/shm/ && DISABLE_JEMALLOC=1 OPT=-g make all valgrind_check -j32' is OK.
I didn't run the Java tests, I don't have Java set up on my devserver.
Reviewers: sdong
Reviewed By: sdong
Subscribers: andrewkr, dhruba
Differential Revision: https://reviews.facebook.net/D56133
2016-04-01 19:42:39 +02:00
|
|
|
rocksdb_block_based_options_set_pin_l0_filter_and_index_blocks_in_cache(
|
|
|
|
rocksdb_block_based_table_options_t*, unsigned char);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
2015-10-31 02:33:01 +01:00
|
|
|
rocksdb_block_based_options_set_skip_table_builder_flush(
|
|
|
|
rocksdb_block_based_table_options_t* options, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_block_based_table_factory(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t* opt, rocksdb_block_based_table_options_t* table_options);
|
2014-08-25 23:22:05 +02:00
|
|
|
|
2014-11-14 01:57:01 +01:00
|
|
|
/* Cuckoo table options */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_cuckoo_table_options_t*
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_cuckoo_options_create();
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_destroy(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_hash_ratio(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options, double v);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_max_search_depth(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options, uint32_t v);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_cuckoo_block_size(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options, uint32_t v);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_cuckoo_options_set_identity_as_first_hash(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options, unsigned char v);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cuckoo_options_set_use_module_hash(
|
2014-11-14 01:57:01 +01:00
|
|
|
rocksdb_cuckoo_table_options_t* options, unsigned char v);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_cuckoo_table_factory(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t* opt, rocksdb_cuckoo_table_options_t* table_options);
|
2014-11-14 01:57:01 +01:00
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
/* Options */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_options_t* rocksdb_options_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_destroy(rocksdb_options_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_increase_parallelism(
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_options_t* opt, int total_threads);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_for_point_lookup(
|
2014-08-26 23:15:00 +02:00
|
|
|
rocksdb_options_t* opt, uint64_t block_cache_size_mb);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_optimize_level_style_compaction(
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_optimize_universal_style_compaction(
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_options_t* opt, uint64_t memtable_memory_budget);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_filter(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t*, rocksdb_compactionfilter_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_filter_factory(
|
2014-07-04 06:04:55 +02:00
|
|
|
rocksdb_options_t*, rocksdb_compactionfilterfactory_t*);
|
2016-04-22 22:24:09 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_compaction_readahead_size(
|
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_comparator(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t*, rocksdb_comparator_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_merge_operator(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t*, rocksdb_mergeoperator_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_uint64add_merge_operator(
|
|
|
|
rocksdb_options_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression_per_level(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_options_t* opt, int* level_values, size_t num_levels);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_create_if_missing(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_create_missing_column_families(rocksdb_options_t*,
|
|
|
|
unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_error_if_exists(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_paranoid_checks(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_env(rocksdb_options_t*,
|
|
|
|
rocksdb_env_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_info_log(rocksdb_options_t*,
|
|
|
|
rocksdb_logger_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_info_log_level(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_write_buffer_size(
|
|
|
|
rocksdb_options_t*, size_t);
|
2016-04-22 22:24:09 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_db_write_buffer_size(
|
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_open_files(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_total_wal_size(
|
|
|
|
rocksdb_options_t* opt, uint64_t n);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression_options(
|
2016-04-28 03:30:04 +02:00
|
|
|
rocksdb_options_t*, int, int, int, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_prefix_extractor(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, rocksdb_slicetransform_t*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_num_levels(
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_level0_file_num_compaction_trigger(rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_level0_slowdown_writes_trigger(rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_level0_stop_writes_trigger(
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_mem_compaction_level(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_target_file_size_base(
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_target_file_size_multiplier(
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_bytes_for_level_base(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_max_bytes_for_level_multiplier(rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_max_bytes_for_level_multiplier_additional(
|
2014-04-03 10:47:07 +02:00
|
|
|
rocksdb_options_t*, int* level_values, size_t num_levels);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_enable_statistics(
|
|
|
|
rocksdb_options_t*);
|
2015-05-16 13:29:39 +02:00
|
|
|
|
|
|
|
/* returns a pointer to a malloc()-ed, null terminated string */
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API char* rocksdb_options_statistics_get_string(
|
|
|
|
rocksdb_options_t* opt);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_write_buffer_number(
|
Support saving history in memtable_list
Summary:
For transactions, we are using the memtables to validate that there are no write conflicts. But after flushing, we don't have any memtables, and transactions could fail to commit. So we want to someone keep around some extra history to use for conflict checking. In addition, we want to provide a way to increase the size of this history if too many transactions fail to commit.
After chatting with people, it seems like everyone prefers just using Memtables to store this history (instead of a separate history structure). It seems like the best place for this is abstracted inside the memtable_list. I decide to create a separate list in MemtableListVersion as using the same list complicated the flush/installalflushresults logic too much.
This diff adds a new parameter to control how much memtable history to keep around after flushing. However, it sounds like people aren't too fond of adding new parameters. So I am making the default size of flushed+not-flushed memtables be set to max_write_buffers. This should not change the maximum amount of memory used, but make it more likely we're using closer the the limit. (We are now postponing deleting flushed memtables until the max_write_buffer limit is reached). So while we might use more memory on average, we are still obeying the limit set (and you could argue it's better to go ahead and use up memory now instead of waiting for a write stall to happen to test this limit).
However, if people are opposed to this default behavior, we can easily set it to 0 and require this parameter be set in order to use transactions.
Test Plan: Added a xfunc test to play around with setting different values of this parameter in all tests. Added testing in memtablelist_test and planning on adding more testing here.
Reviewers: sdong, rven, igor
Reviewed By: igor
Subscribers: dhruba, leveldb
Differential Revision: https://reviews.facebook.net/D37443
2015-05-29 01:34:24 +02:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_min_write_buffer_number_to_merge(rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_max_write_buffer_number_to_maintain(rocksdb_options_t*,
|
|
|
|
int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_compactions(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_background_flushes(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_log_file_size(
|
|
|
|
rocksdb_options_t*, size_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_log_file_time_to_roll(
|
|
|
|
rocksdb_options_t*, size_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_keep_log_file_num(
|
|
|
|
rocksdb_options_t*, size_t);
|
2015-10-08 03:06:28 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_recycle_log_file_num(
|
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_soft_rate_limit(
|
|
|
|
rocksdb_options_t*, double);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hard_rate_limit(
|
|
|
|
rocksdb_options_t*, double);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_rate_limit_delay_max_milliseconds(rocksdb_options_t*,
|
|
|
|
unsigned int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_manifest_file_size(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_table_cache_numshardbits(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_table_cache_remove_scan_count_limit(rocksdb_options_t*,
|
|
|
|
int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_arena_block_size(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_use_fsync(
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_db_log_dir(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, const char*);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_wal_dir(rocksdb_options_t*,
|
|
|
|
const char*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_WAL_ttl_seconds(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_WAL_size_limit_MB(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_manifest_preallocation_size(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_purge_redundant_kvs_while_flush(rocksdb_options_t*,
|
|
|
|
unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_os_buffer(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_mmap_reads(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_allow_mmap_writes(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_is_fd_close_on_exec(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_skip_log_error_on_recovery(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_stats_dump_period_sec(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_advise_random_on_open(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_access_hint_on_compaction_start(rocksdb_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_use_adaptive_mutex(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_bytes_per_sync(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_verify_checksums_in_compaction(rocksdb_options_t*,
|
|
|
|
unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_filter_deletes(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_max_sequential_skip_in_iterations(rocksdb_options_t*,
|
|
|
|
uint64_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_data_sync(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_disable_auto_compactions(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_delete_obsolete_files_period_micros(rocksdb_options_t*,
|
|
|
|
uint64_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_prepare_for_bulk_load(
|
|
|
|
rocksdb_options_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_vector_rep(
|
|
|
|
rocksdb_options_t*);
|
2016-09-08 20:31:06 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_compaction_bytes(
|
|
|
|
rocksdb_options_t*, uint64_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_skip_list_rep(
|
|
|
|
rocksdb_options_t*, size_t, int32_t, int32_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_hash_link_list_rep(
|
|
|
|
rocksdb_options_t*, size_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_plain_table_factory(
|
|
|
|
rocksdb_options_t*, uint32_t, int, double, size_t);
|
2014-02-25 19:32:28 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_level_to_compress(
|
|
|
|
rocksdb_options_t* opt, int level);
|
2014-02-25 19:32:28 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_prefix_bloom_bits(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, uint32_t);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_memtable_prefix_bloom_probes(rocksdb_options_t*, uint32_t);
|
2016-07-27 03:05:30 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_memtable_huge_page_size(
|
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_max_successive_merges(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_options_t*, size_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_min_partial_merge_operands(
|
2014-04-03 10:47:07 +02:00
|
|
|
rocksdb_options_t*, uint32_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_bloom_locality(
|
2014-04-03 10:47:07 +02:00
|
|
|
rocksdb_options_t*, uint32_t);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_inplace_update_support(
|
2014-04-03 10:47:07 +02:00
|
|
|
rocksdb_options_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_inplace_update_num_locks(
|
2014-04-03 10:47:07 +02:00
|
|
|
rocksdb_options_t*, size_t);
|
2016-05-23 22:13:47 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_report_bg_io_stats(
|
|
|
|
rocksdb_options_t*, int);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
enum {
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_no_compression = 0,
|
2013-12-14 08:58:18 +01:00
|
|
|
rocksdb_snappy_compression = 1,
|
2014-02-08 03:12:30 +01:00
|
|
|
rocksdb_zlib_compression = 2,
|
|
|
|
rocksdb_bz2_compression = 3,
|
|
|
|
rocksdb_lz4_compression = 4,
|
|
|
|
rocksdb_lz4hc_compression = 5
|
2011-08-05 22:40:49 +02:00
|
|
|
};
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compression(
|
|
|
|
rocksdb_options_t*, int);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2013-12-14 08:58:18 +01:00
|
|
|
enum {
|
|
|
|
rocksdb_level_compaction = 0,
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_universal_compaction = 1,
|
|
|
|
rocksdb_fifo_compaction = 2
|
2013-12-14 08:58:18 +01:00
|
|
|
};
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_compaction_style(
|
|
|
|
rocksdb_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_options_set_universal_compaction_options(
|
|
|
|
rocksdb_options_t*, rocksdb_universal_compaction_options_t*);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_options_set_fifo_compaction_options(
|
|
|
|
rocksdb_options_t* opt, rocksdb_fifo_compaction_options_t* fifo);
|
2014-06-18 04:23:47 +02:00
|
|
|
|
|
|
|
/* Compaction Filter */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_compactionfilter_t*
|
|
|
|
rocksdb_compactionfilter_create(
|
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
unsigned char (*filter)(void*, int level, const char* key,
|
|
|
|
size_t key_length, const char* existing_value,
|
|
|
|
size_t value_length, char** new_value,
|
|
|
|
size_t* new_value_length,
|
|
|
|
unsigned char* value_changed),
|
2014-06-18 04:23:47 +02:00
|
|
|
const char* (*name)(void*));
|
2016-08-18 03:48:43 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilter_set_ignore_snapshots(
|
|
|
|
rocksdb_compactionfilter_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilter_destroy(
|
|
|
|
rocksdb_compactionfilter_t*);
|
2014-06-18 04:23:47 +02:00
|
|
|
|
2014-07-04 01:52:22 +02:00
|
|
|
/* Compaction Filter Context */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API unsigned char
|
|
|
|
rocksdb_compactionfiltercontext_is_full_compaction(
|
2014-07-04 01:52:22 +02:00
|
|
|
rocksdb_compactionfiltercontext_t* context);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API unsigned char
|
|
|
|
rocksdb_compactionfiltercontext_is_manual_compaction(
|
2014-07-04 01:52:22 +02:00
|
|
|
rocksdb_compactionfiltercontext_t* context);
|
|
|
|
|
|
|
|
/* Compaction Filter Factory */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_compactionfilterfactory_t*
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_compactionfilterfactory_create(
|
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
rocksdb_compactionfilter_t* (*create_compaction_filter)(
|
|
|
|
void*, rocksdb_compactionfiltercontext_t* context),
|
|
|
|
const char* (*name)(void*));
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_compactionfilterfactory_destroy(
|
2014-07-04 01:52:22 +02:00
|
|
|
rocksdb_compactionfilterfactory_t*);
|
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
/* Comparator */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_comparator_t* rocksdb_comparator_create(
|
2015-07-13 21:11:05 +02:00
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
int (*compare)(void*, const char* a, size_t alen, const char* b,
|
|
|
|
size_t blen),
|
2011-08-05 22:40:49 +02:00
|
|
|
const char* (*name)(void*));
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_comparator_destroy(
|
|
|
|
rocksdb_comparator_t*);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2012-04-17 17:36:46 +02:00
|
|
|
/* Filter policy */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t* rocksdb_filterpolicy_create(
|
2015-07-13 21:11:05 +02:00
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
char* (*create_filter)(void*, const char* const* key_array,
|
|
|
|
const size_t* key_length_array, int num_keys,
|
|
|
|
size_t* filter_length),
|
|
|
|
unsigned char (*key_may_match)(void*, const char* key, size_t length,
|
|
|
|
const char* filter, size_t filter_length),
|
|
|
|
void (*delete_filter)(void*, const char* filter, size_t filter_length),
|
2012-04-17 17:36:46 +02:00
|
|
|
const char* (*name)(void*));
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_filterpolicy_destroy(
|
|
|
|
rocksdb_filterpolicy_t*);
|
2012-04-17 17:36:46 +02:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t*
|
|
|
|
rocksdb_filterpolicy_create_bloom(int bits_per_key);
|
2015-12-29 20:47:51 +01:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_filterpolicy_t*
|
|
|
|
rocksdb_filterpolicy_create_bloom_full(int bits_per_key);
|
2012-04-17 17:36:46 +02:00
|
|
|
|
2014-02-12 22:49:00 +01:00
|
|
|
/* Merge Operator */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_mergeoperator_t*
|
|
|
|
rocksdb_mergeoperator_create(
|
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
char* (*full_merge)(void*, const char* key, size_t key_length,
|
|
|
|
const char* existing_value,
|
|
|
|
size_t existing_value_length,
|
|
|
|
const char* const* operands_list,
|
|
|
|
const size_t* operands_list_length, int num_operands,
|
|
|
|
unsigned char* success, size_t* new_value_length),
|
|
|
|
char* (*partial_merge)(void*, const char* key, size_t key_length,
|
|
|
|
const char* const* operands_list,
|
|
|
|
const size_t* operands_list_length, int num_operands,
|
|
|
|
unsigned char* success, size_t* new_value_length),
|
|
|
|
void (*delete_value)(void*, const char* value, size_t value_length),
|
2014-02-12 22:49:00 +01:00
|
|
|
const char* (*name)(void*));
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_mergeoperator_destroy(
|
|
|
|
rocksdb_mergeoperator_t*);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
/* Read options */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_readoptions_t* rocksdb_readoptions_create();
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_destroy(
|
|
|
|
rocksdb_readoptions_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_verify_checksums(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_readoptions_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_fill_cache(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_readoptions_t*, unsigned char);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_snapshot(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_readoptions_t*, const rocksdb_snapshot_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_iterate_upper_bound(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_readoptions_t*, const char* key, size_t keylen);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_read_tier(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_readoptions_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_tailing(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_readoptions_t*, unsigned char);
|
2016-06-01 19:48:50 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_readoptions_set_readahead_size(
|
|
|
|
rocksdb_readoptions_t*, size_t);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Write options */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_writeoptions_t*
|
|
|
|
rocksdb_writeoptions_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_destroy(
|
|
|
|
rocksdb_writeoptions_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_set_sync(
|
2013-12-10 09:45:07 +01:00
|
|
|
rocksdb_writeoptions_t*, unsigned char);
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_writeoptions_disable_WAL(
|
|
|
|
rocksdb_writeoptions_t* opt, int disable);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2014-02-12 22:49:00 +01:00
|
|
|
/* Flush options */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_flushoptions_t*
|
|
|
|
rocksdb_flushoptions_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_flushoptions_destroy(
|
|
|
|
rocksdb_flushoptions_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_flushoptions_set_wait(
|
2014-02-12 22:49:00 +01:00
|
|
|
rocksdb_flushoptions_t*, unsigned char);
|
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
/* Cache */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_cache_t* rocksdb_cache_create_lru(
|
|
|
|
size_t capacity);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cache_destroy(rocksdb_cache_t* cache);
|
2016-06-03 15:04:51 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_cache_set_capacity(
|
|
|
|
rocksdb_cache_t* cache, size_t capacity);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
|
|
|
/* Env */
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_default_env();
|
2016-04-22 22:25:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_env_t* rocksdb_create_mem_env();
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_env_set_background_threads(
|
|
|
|
rocksdb_env_t* env, int n);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n);
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_env_join_all_threads(
|
|
|
|
rocksdb_env_t* env);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_env_destroy(rocksdb_env_t*);
|
2011-08-05 22:40:49 +02:00
|
|
|
|
2014-02-12 22:49:00 +01:00
|
|
|
/* SliceTransform */
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
|
|
|
|
rocksdb_slicetransform_create(
|
|
|
|
void* state, void (*destructor)(void*),
|
|
|
|
char* (*transform)(void*, const char* key, size_t length,
|
|
|
|
size_t* dst_length),
|
|
|
|
unsigned char (*in_domain)(void*, const char* key, size_t length),
|
|
|
|
unsigned char (*in_range)(void*, const char* key, size_t length),
|
2014-02-12 22:49:00 +01:00
|
|
|
const char* (*name)(void*));
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
|
|
|
|
rocksdb_slicetransform_create_fixed_prefix(size_t);
|
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_slicetransform_t*
|
|
|
|
rocksdb_slicetransform_create_noop();
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_slicetransform_destroy(
|
|
|
|
rocksdb_slicetransform_t*);
|
2014-02-12 22:49:00 +01:00
|
|
|
|
2013-12-14 08:58:18 +01:00
|
|
|
/* Universal Compaction options */
|
|
|
|
|
|
|
|
enum {
|
|
|
|
rocksdb_similar_size_compaction_stop_style = 0,
|
|
|
|
rocksdb_total_size_compaction_stop_style = 1
|
|
|
|
};
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_universal_compaction_options_t*
|
|
|
|
rocksdb_universal_compaction_options_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_size_ratio(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_min_merge_width(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_max_merge_width(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_max_size_amplification_percent(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_compression_size_percent(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_universal_compaction_options_set_stop_style(
|
|
|
|
rocksdb_universal_compaction_options_t*, int);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_universal_compaction_options_destroy(
|
2015-07-13 21:11:05 +02:00
|
|
|
rocksdb_universal_compaction_options_t*);
|
2013-12-14 08:58:18 +01:00
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API rocksdb_fifo_compaction_options_t*
|
|
|
|
rocksdb_fifo_compaction_options_create();
|
|
|
|
extern ROCKSDB_LIBRARY_API void
|
|
|
|
rocksdb_fifo_compaction_options_set_max_table_files_size(
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_fifo_compaction_options_t* fifo_opts, uint64_t size);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_fifo_compaction_options_destroy(
|
2014-07-08 06:12:25 +02:00
|
|
|
rocksdb_fifo_compaction_options_t* fifo_opts);
|
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_count(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_name(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*, int index);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API int rocksdb_livefiles_level(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*, int index);
|
|
|
|
extern ROCKSDB_LIBRARY_API size_t
|
|
|
|
rocksdb_livefiles_size(const rocksdb_livefiles_t*, int index);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_smallestkey(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*, int index, size_t* size);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API const char* rocksdb_livefiles_largestkey(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*, int index, size_t* size);
|
2015-07-02 01:13:49 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_livefiles_destroy(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_livefiles_t*);
|
2014-02-25 19:32:28 +01:00
|
|
|
|
2015-07-02 01:13:49 +02:00
|
|
|
/* Utility Helpers */
|
|
|
|
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_get_options_from_string(
|
2015-07-13 21:11:05 +02:00
|
|
|
const rocksdb_options_t* base_options, const char* opts_str,
|
|
|
|
rocksdb_options_t* new_options, char** errptr);
|
2015-07-02 01:13:49 +02:00
|
|
|
|
2016-05-23 13:19:47 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_delete_file_in_range(
|
|
|
|
rocksdb_t* db, const char* start_key, size_t start_key_len,
|
|
|
|
const char* limit_key, size_t limit_key_len, char** errptr);
|
|
|
|
|
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_delete_file_in_range_cf(
|
|
|
|
rocksdb_t* db, rocksdb_column_family_handle_t* column_family,
|
|
|
|
const char* start_key, size_t start_key_len, const char* limit_key,
|
|
|
|
size_t limit_key_len, char** errptr);
|
|
|
|
|
2015-07-13 21:11:05 +02:00
|
|
|
// referring to convention (3), this should be used by client
|
2015-07-02 01:13:49 +02:00
|
|
|
// to free memory that was malloc()ed
|
2015-07-13 21:11:05 +02:00
|
|
|
extern ROCKSDB_LIBRARY_API void rocksdb_free(void* ptr);
|
2015-07-02 01:13:49 +02:00
|
|
|
|
2011-08-05 22:40:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* end extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2013-08-23 17:38:13 +02:00
|
|
|
#endif /* STORAGE_ROCKSDB_INCLUDE_C_H_ */
|