leveldb
Typedefs | Enumerations | Functions
c.h File Reference
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for c.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct leveldb_t leveldb_t
 
typedef struct leveldb_cache_t leveldb_cache_t
 
typedef struct leveldb_comparator_t leveldb_comparator_t
 
typedef struct leveldb_env_t leveldb_env_t
 
typedef struct leveldb_filelock_t leveldb_filelock_t
 
typedef struct leveldb_filterpolicy_t leveldb_filterpolicy_t
 
typedef struct leveldb_iterator_t leveldb_iterator_t
 
typedef struct leveldb_logger_t leveldb_logger_t
 
typedef struct leveldb_options_t leveldb_options_t
 
typedef struct leveldb_randomfile_t leveldb_randomfile_t
 
typedef struct leveldb_readoptions_t leveldb_readoptions_t
 
typedef struct leveldb_seqfile_t leveldb_seqfile_t
 
typedef struct leveldb_snapshot_t leveldb_snapshot_t
 
typedef struct leveldb_writablefile_t leveldb_writablefile_t
 
typedef struct leveldb_writebatch_t leveldb_writebatch_t
 
typedef struct leveldb_writeoptions_t leveldb_writeoptions_t
 

Enumerations

enum  { leveldb_no_compression = 0, leveldb_snappy_compression = 1 }
 

Functions

leveldb_tleveldb_open (const leveldb_options_t *options, const char *name, char **errptr)
 
void leveldb_close (leveldb_t *db)
 
void leveldb_put (leveldb_t *db, const leveldb_writeoptions_t *options, const char *key, size_t keylen, const char *val, size_t vallen, char **errptr)
 
void leveldb_delete (leveldb_t *db, const leveldb_writeoptions_t *options, const char *key, size_t keylen, char **errptr)
 
void leveldb_write (leveldb_t *db, const leveldb_writeoptions_t *options, leveldb_writebatch_t *batch, char **errptr)
 
char * leveldb_get (leveldb_t *db, const leveldb_readoptions_t *options, const char *key, size_t keylen, size_t *vallen, char **errptr)
 
leveldb_iterator_tleveldb_create_iterator (leveldb_t *db, const leveldb_readoptions_t *options)
 
const leveldb_snapshot_tleveldb_create_snapshot (leveldb_t *db)
 
void leveldb_release_snapshot (leveldb_t *db, const leveldb_snapshot_t *snapshot)
 
char * leveldb_property_value (leveldb_t *db, const char *propname)
 
void leveldb_approximate_sizes (leveldb_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)
 
void leveldb_compact_range (leveldb_t *db, const char *start_key, size_t start_key_len, const char *limit_key, size_t limit_key_len)
 
void leveldb_destroy_db (const leveldb_options_t *options, const char *name, char **errptr)
 
void leveldb_repair_db (const leveldb_options_t *options, const char *name, char **errptr)
 
void leveldb_iter_destroy (leveldb_iterator_t *)
 
unsigned char leveldb_iter_valid (const leveldb_iterator_t *)
 
void leveldb_iter_seek_to_first (leveldb_iterator_t *)
 
void leveldb_iter_seek_to_last (leveldb_iterator_t *)
 
void leveldb_iter_seek (leveldb_iterator_t *, const char *k, size_t klen)
 
void leveldb_iter_next (leveldb_iterator_t *)
 
void leveldb_iter_prev (leveldb_iterator_t *)
 
const char * leveldb_iter_key (const leveldb_iterator_t *, size_t *klen)
 
const char * leveldb_iter_value (const leveldb_iterator_t *, size_t *vlen)
 
void leveldb_iter_get_error (const leveldb_iterator_t *, char **errptr)
 
leveldb_writebatch_tleveldb_writebatch_create ()
 
void leveldb_writebatch_destroy (leveldb_writebatch_t *)
 
void leveldb_writebatch_clear (leveldb_writebatch_t *)
 
void leveldb_writebatch_put (leveldb_writebatch_t *, const char *key, size_t klen, const char *val, size_t vlen)
 
void leveldb_writebatch_delete (leveldb_writebatch_t *, const char *key, size_t klen)
 
void leveldb_writebatch_iterate (leveldb_writebatch_t *, void *state, void(*put)(void *, const char *k, size_t klen, const char *v, size_t vlen), void(*deleted)(void *, const char *k, size_t klen))
 
leveldb_options_tleveldb_options_create ()
 
void leveldb_options_destroy (leveldb_options_t *)
 
void leveldb_options_set_comparator (leveldb_options_t *, leveldb_comparator_t *)
 
void leveldb_options_set_filter_policy (leveldb_options_t *, leveldb_filterpolicy_t *)
 
void leveldb_options_set_create_if_missing (leveldb_options_t *, unsigned char)
 
void leveldb_options_set_error_if_exists (leveldb_options_t *, unsigned char)
 
void leveldb_options_set_paranoid_checks (leveldb_options_t *, unsigned char)
 
void leveldb_options_set_env (leveldb_options_t *, leveldb_env_t *)
 
void leveldb_options_set_info_log (leveldb_options_t *, leveldb_logger_t *)
 
void leveldb_options_set_write_buffer_size (leveldb_options_t *, size_t)
 
void leveldb_options_set_max_open_files (leveldb_options_t *, int)
 
void leveldb_options_set_cache (leveldb_options_t *, leveldb_cache_t *)
 
void leveldb_options_set_block_size (leveldb_options_t *, size_t)
 
void leveldb_options_set_block_restart_interval (leveldb_options_t *, int)
 
void leveldb_options_set_compression (leveldb_options_t *, int)
 
leveldb_comparator_tleveldb_comparator_create (void *state, void(*destructor)(void *), int(*compare)(void *, const char *a, size_t alen, const char *b, size_t blen), const char *(*name)(void *))
 
void leveldb_comparator_destroy (leveldb_comparator_t *)
 
leveldb_filterpolicy_tleveldb_filterpolicy_create (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), const char *(*name)(void *))
 
void leveldb_filterpolicy_destroy (leveldb_filterpolicy_t *)
 
leveldb_filterpolicy_tleveldb_filterpolicy_create_bloom (int bits_per_key)
 
leveldb_readoptions_tleveldb_readoptions_create ()
 
void leveldb_readoptions_destroy (leveldb_readoptions_t *)
 
void leveldb_readoptions_set_verify_checksums (leveldb_readoptions_t *, unsigned char)
 
void leveldb_readoptions_set_fill_cache (leveldb_readoptions_t *, unsigned char)
 
void leveldb_readoptions_set_snapshot (leveldb_readoptions_t *, const leveldb_snapshot_t *)
 
leveldb_writeoptions_tleveldb_writeoptions_create ()
 
void leveldb_writeoptions_destroy (leveldb_writeoptions_t *)
 
void leveldb_writeoptions_set_sync (leveldb_writeoptions_t *, unsigned char)
 
leveldb_cache_tleveldb_cache_create_lru (size_t capacity)
 
void leveldb_cache_destroy (leveldb_cache_t *cache)
 
leveldb_env_tleveldb_create_default_env ()
 
void leveldb_env_destroy (leveldb_env_t *)
 
void leveldb_free (void *ptr)
 
int leveldb_major_version ()
 
int leveldb_minor_version ()
 

Typedef Documentation

§ leveldb_cache_t

Definition at line 54 of file c.h.

§ leveldb_comparator_t

Definition at line 55 of file c.h.

§ leveldb_env_t

typedef struct leveldb_env_t leveldb_env_t

Definition at line 56 of file c.h.

§ leveldb_filelock_t

Definition at line 57 of file c.h.

§ leveldb_filterpolicy_t

Definition at line 58 of file c.h.

§ leveldb_iterator_t

Definition at line 59 of file c.h.

§ leveldb_logger_t

Definition at line 60 of file c.h.

§ leveldb_options_t

Definition at line 61 of file c.h.

§ leveldb_randomfile_t

Definition at line 62 of file c.h.

§ leveldb_readoptions_t

Definition at line 63 of file c.h.

§ leveldb_seqfile_t

Definition at line 64 of file c.h.

§ leveldb_snapshot_t

Definition at line 65 of file c.h.

§ leveldb_t

typedef struct leveldb_t leveldb_t

Definition at line 53 of file c.h.

§ leveldb_writablefile_t

Definition at line 66 of file c.h.

§ leveldb_writebatch_t

Definition at line 67 of file c.h.

§ leveldb_writeoptions_t

Definition at line 68 of file c.h.

Enumeration Type Documentation

§ anonymous enum

anonymous enum
Enumerator
leveldb_no_compression 
leveldb_snappy_compression 

Definition at line 203 of file c.h.

Function Documentation

§ leveldb_approximate_sizes()

void leveldb_approximate_sizes ( leveldb_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 
)

Definition at line 252 of file c.cc.

257  {
258  Range* ranges = new Range[num_ranges];
259  for (int i = 0; i < num_ranges; i++) {
260  ranges[i].start = Slice(range_start_key[i], range_start_key_len[i]);
261  ranges[i].limit = Slice(range_limit_key[i], range_limit_key_len[i]);
262  }
263  db->rep->GetApproximateSizes(ranges, num_ranges, sizes);
264  delete[] ranges;
265 }
virtual void GetApproximateSizes(const Range *range, int n, uint64_t *sizes)=0
Slice limit
Definition: db.h:35
DB * rep
Definition: c.cc:46
Slice start
Definition: db.h:34
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_cache_create_lru()

leveldb_cache_t* leveldb_cache_create_lru ( size_t  capacity)

Definition at line 560 of file c.cc.

560  {
562  c->rep = NewLRUCache(capacity);
563  return c;
564 }
struct leveldb_cache_t leveldb_cache_t
Definition: c.h:54
Cache * rep
Definition: c.cc:53
Cache * NewLRUCache(size_t capacity)
Definition: cache.cc:401
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_cache_destroy()

void leveldb_cache_destroy ( leveldb_cache_t cache)

Definition at line 566 of file c.cc.

566  {
567  delete cache->rep;
568  delete cache;
569 }
Cache * rep
Definition: c.cc:53
Here is the caller graph for this function:

§ leveldb_close()

void leveldb_close ( leveldb_t db)

Definition at line 165 of file c.cc.

165  {
166  delete db->rep;
167  delete db;
168 }
DB * rep
Definition: c.cc:46
Here is the caller graph for this function:

§ leveldb_compact_range()

void leveldb_compact_range ( leveldb_t db,
const char *  start_key,
size_t  start_key_len,
const char *  limit_key,
size_t  limit_key_len 
)

Definition at line 267 of file c.cc.

270  {
271  Slice a, b;
272  db->rep->CompactRange(
273  // Pass NULL Slice if corresponding "const char*" is NULL
274  (start_key ? (a = Slice(start_key, start_key_len), &a) : NULL),
275  (limit_key ? (b = Slice(limit_key, limit_key_len), &b) : NULL));
276 }
virtual void CompactRange(const Slice *begin, const Slice *end)=0
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_comparator_create()

leveldb_comparator_t* leveldb_comparator_create ( void *  state,
void(*)(void *)  destructor,
int(*)(void *, const char *a, size_t alen, const char *b, size_t blen)  compare,
const char *(*)(void *)  name 
)

Definition at line 453 of file c.cc.

460  {
462  result->state_ = state;
463  result->destructor_ = destructor;
464  result->compare_ = compare;
465  result->name_ = name;
466  return result;
467 }
int(* compare_)(void *, const char *a, size_t alen, const char *b, size_t blen)
Definition: c.cc:63
void * state_
Definition: c.cc:61
struct leveldb_comparator_t leveldb_comparator_t
Definition: c.h:55
void(* destructor_)(void *)
Definition: c.cc:62
const char *(* name_)(void *)
Definition: c.cc:67
Here is the caller graph for this function:

§ leveldb_comparator_destroy()

void leveldb_comparator_destroy ( leveldb_comparator_t )

Definition at line 469 of file c.cc.

469  {
470  delete cmp;
471 }
Here is the caller graph for this function:

§ leveldb_create_default_env()

leveldb_env_t* leveldb_create_default_env ( )

Definition at line 571 of file c.cc.

571  {
572  leveldb_env_t* result = new leveldb_env_t;
573  result->rep = Env::Default();
574  result->is_default = true;
575  return result;
576 }
Env * rep
Definition: c.cc:128
struct leveldb_env_t leveldb_env_t
Definition: c.h:56
bool is_default
Definition: c.cc:129
Here is the caller graph for this function:

§ leveldb_create_iterator()

leveldb_iterator_t* leveldb_create_iterator ( leveldb_t db,
const leveldb_readoptions_t options 
)

Definition at line 218 of file c.cc.

220  {
222  result->rep = db->rep->NewIterator(options->rep);
223  return result;
224 }
struct leveldb_iterator_t leveldb_iterator_t
Definition: c.h:59
Iterator * rep
Definition: c.cc:47
ReadOptions rep
Definition: c.cc:50
virtual Iterator * NewIterator(const ReadOptions &options)=0
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_create_snapshot()

const leveldb_snapshot_t* leveldb_create_snapshot ( leveldb_t db)

Definition at line 226 of file c.cc.

227  {
229  result->rep = db->rep->GetSnapshot();
230  return result;
231 }
struct leveldb_snapshot_t leveldb_snapshot_t
Definition: c.h:65
const Snapshot * rep
Definition: c.cc:49
virtual const Snapshot * GetSnapshot()=0
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_delete()

void leveldb_delete ( leveldb_t db,
const leveldb_writeoptions_t options,
const char *  key,
size_t  keylen,
char **  errptr 
)

Definition at line 180 of file c.cc.

184  {
185  SaveError(errptr, db->rep->Delete(options->rep, Slice(key, keylen)));
186 }
WriteOptions rep
Definition: c.cc:51
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
virtual Status Delete(const WriteOptions &options, const Slice &key)=0
Definition: db_impl.cc:1482
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_destroy_db()

void leveldb_destroy_db ( const leveldb_options_t options,
const char *  name,
char **  errptr 
)

Definition at line 278 of file c.cc.

281  {
282  SaveError(errptr, DestroyDB(name, options->rep));
283 }
Options rep
Definition: c.cc:52
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
Status DestroyDB(const std::string &dbname, const Options &options)
Definition: db_impl.cc:1537
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_env_destroy()

void leveldb_env_destroy ( leveldb_env_t )

Definition at line 578 of file c.cc.

578  {
579  if (!env->is_default) delete env->rep;
580  delete env;
581 }
Here is the caller graph for this function:

§ leveldb_filterpolicy_create()

leveldb_filterpolicy_t* leveldb_filterpolicy_create ( void *  state,
void(*)(void *)  destructor,
char *(*)(void *, const char *const *key_array, const size_t *key_length_array, int num_keys, size_t *filter_length)  create_filter,
unsigned char(*)(void *, const char *key, size_t length, const char *filter, size_t filter_length)  key_may_match,
const char *(*)(void *)  name 
)

Definition at line 473 of file c.cc.

485  {
487  result->state_ = state;
488  result->destructor_ = destructor;
489  result->create_ = create_filter;
490  result->key_match_ = key_may_match;
491  result->name_ = name;
492  return result;
493 }
struct leveldb_filterpolicy_t leveldb_filterpolicy_t
Definition: c.h:58
void(* destructor_)(void *)
Definition: c.cc:88
const char *(* name_)(void *)
Definition: c.cc:89
char *(* create_)(void *, const char *const *key_array, const size_t *key_length_array, int num_keys, size_t *filter_length)
Definition: c.cc:90
void * state_
Definition: c.cc:87
unsigned char(* key_match_)(void *, const char *key, size_t length, const char *filter, size_t filter_length)
Definition: c.cc:95
Here is the caller graph for this function:

§ leveldb_filterpolicy_create_bloom()

leveldb_filterpolicy_t* leveldb_filterpolicy_create_bloom ( int  bits_per_key)

Definition at line 499 of file c.cc.

499  {
500  // Make a leveldb_filterpolicy_t, but override all of its methods so
501  // they delegate to a NewBloomFilterPolicy() instead of user
502  // supplied C functions.
503  struct Wrapper : public leveldb_filterpolicy_t {
504  const FilterPolicy* rep_;
505  ~Wrapper() { delete rep_; }
506  const char* Name() const { return rep_->Name(); }
507  void CreateFilter(const Slice* keys, int n, std::string* dst) const {
508  return rep_->CreateFilter(keys, n, dst);
509  }
510  bool KeyMayMatch(const Slice& key, const Slice& filter) const {
511  return rep_->KeyMayMatch(key, filter);
512  }
513  static void DoNothing(void*) { }
514  };
515  Wrapper* wrapper = new Wrapper;
516  wrapper->rep_ = NewBloomFilterPolicy(bits_per_key);
517  wrapper->state_ = NULL;
518  wrapper->destructor_ = &Wrapper::DoNothing;
519  return wrapper;
520 }
virtual bool KeyMayMatch(const Slice &key, const Slice &filter) const =0
virtual const char * Name() const =0
virtual const char * Name() const
Definition: c.cc:104
const FilterPolicy * NewBloomFilterPolicy(int bits_per_key)
Definition: bloom.cc:91
virtual bool KeyMayMatch(const Slice &key, const Slice &filter) const
Definition: c.cc:121
virtual void CreateFilter(const Slice *keys, int n, std::string *dst) const =0
virtual void CreateFilter(const Slice *keys, int n, std::string *dst) const
Definition: c.cc:108
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_filterpolicy_destroy()

void leveldb_filterpolicy_destroy ( leveldb_filterpolicy_t )

Definition at line 495 of file c.cc.

495  {
496  delete filter;
497 }
Here is the caller graph for this function:

§ leveldb_free()

void leveldb_free ( void *  ptr)

Definition at line 583 of file c.cc.

583  {
584  free(ptr);
585 }
Here is the caller graph for this function:

§ leveldb_get()

char* leveldb_get ( leveldb_t db,
const leveldb_readoptions_t options,
const char *  key,
size_t  keylen,
size_t *  vallen,
char **  errptr 
)

Definition at line 197 of file c.cc.

202  {
203  char* result = NULL;
204  std::string tmp;
205  Status s = db->rep->Get(options->rep, Slice(key, keylen), &tmp);
206  if (s.ok()) {
207  *vallen = tmp.size();
208  result = CopyString(tmp);
209  } else {
210  *vallen = 0;
211  if (!s.IsNotFound()) {
212  SaveError(errptr, s);
213  }
214  }
215  return result;
216 }
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
static char * CopyString(const std::string &str)
Definition: c.cc:146
virtual Status Get(const ReadOptions &options, const Slice &key, std::string *value)=0
ReadOptions rep
Definition: c.cc:50
bool ok() const
Definition: status.h:52
DB * rep
Definition: c.cc:46
bool IsNotFound() const
Definition: status.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_destroy()

void leveldb_iter_destroy ( leveldb_iterator_t )

Definition at line 292 of file c.cc.

292  {
293  delete iter->rep;
294  delete iter;
295 }
Here is the caller graph for this function:

§ leveldb_iter_get_error()

void leveldb_iter_get_error ( const leveldb_iterator_t ,
char **  errptr 
)

Definition at line 333 of file c.cc.

333  {
334  SaveError(errptr, iter->rep->status());
335 }
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_key()

const char* leveldb_iter_key ( const leveldb_iterator_t ,
size_t *  klen 
)

Definition at line 321 of file c.cc.

321  {
322  Slice s = iter->rep->key();
323  *klen = s.size();
324  return s.data();
325 }
const char * data() const
Definition: slice.h:40
size_t size() const
Definition: slice.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_next()

void leveldb_iter_next ( leveldb_iterator_t )

Definition at line 313 of file c.cc.

313  {
314  iter->rep->Next();
315 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_prev()

void leveldb_iter_prev ( leveldb_iterator_t )

Definition at line 317 of file c.cc.

317  {
318  iter->rep->Prev();
319 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_seek()

void leveldb_iter_seek ( leveldb_iterator_t ,
const char *  k,
size_t  klen 
)

Definition at line 309 of file c.cc.

309  {
310  iter->rep->Seek(Slice(k, klen));
311 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_seek_to_first()

void leveldb_iter_seek_to_first ( leveldb_iterator_t )

Definition at line 301 of file c.cc.

301  {
302  iter->rep->SeekToFirst();
303 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_seek_to_last()

void leveldb_iter_seek_to_last ( leveldb_iterator_t )

Definition at line 305 of file c.cc.

305  {
306  iter->rep->SeekToLast();
307 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_valid()

unsigned char leveldb_iter_valid ( const leveldb_iterator_t )

Definition at line 297 of file c.cc.

297  {
298  return iter->rep->Valid();
299 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_iter_value()

const char* leveldb_iter_value ( const leveldb_iterator_t ,
size_t *  vlen 
)

Definition at line 327 of file c.cc.

327  {
328  Slice s = iter->rep->value();
329  *vlen = s.size();
330  return s.data();
331 }
const char * data() const
Definition: slice.h:40
size_t size() const
Definition: slice.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_major_version()

int leveldb_major_version ( )

Definition at line 587 of file c.cc.

587  {
588  return kMajorVersion;
589 }
static const int kMajorVersion
Definition: db.h:16
Here is the caller graph for this function:

§ leveldb_minor_version()

int leveldb_minor_version ( )

Definition at line 591 of file c.cc.

591  {
592  return kMinorVersion;
593 }
static const int kMinorVersion
Definition: db.h:17
Here is the caller graph for this function:

§ leveldb_open()

leveldb_t* leveldb_open ( const leveldb_options_t options,
const char *  name,
char **  errptr 
)

Definition at line 152 of file c.cc.

155  {
156  DB* db;
157  if (SaveError(errptr, DB::Open(options->rep, std::string(name), &db))) {
158  return NULL;
159  }
160  leveldb_t* result = new leveldb_t;
161  result->rep = db;
162  return result;
163 }
Options rep
Definition: c.cc:52
Definition: c.cc:46
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
struct leveldb_t leveldb_t
Definition: c.h:53
DB * rep
Definition: c.cc:46
Definition: db.h:44
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_options_create()

leveldb_options_t* leveldb_options_create ( )

Definition at line 386 of file c.cc.

386  {
387  return new leveldb_options_t;
388 }
struct leveldb_options_t leveldb_options_t
Definition: c.h:61
Here is the caller graph for this function:

§ leveldb_options_destroy()

void leveldb_options_destroy ( leveldb_options_t )

Definition at line 390 of file c.cc.

390  {
391  delete options;
392 }
Here is the caller graph for this function:

§ leveldb_options_set_block_restart_interval()

void leveldb_options_set_block_restart_interval ( leveldb_options_t ,
int   
)

Definition at line 445 of file c.cc.

445  {
446  opt->rep.block_restart_interval = n;
447 }
Here is the caller graph for this function:

§ leveldb_options_set_block_size()

void leveldb_options_set_block_size ( leveldb_options_t ,
size_t   
)

Definition at line 441 of file c.cc.

441  {
442  opt->rep.block_size = s;
443 }
Here is the caller graph for this function:

§ leveldb_options_set_cache()

void leveldb_options_set_cache ( leveldb_options_t ,
leveldb_cache_t  
)

Definition at line 437 of file c.cc.

437  {
438  opt->rep.block_cache = c->rep;
439 }
Here is the caller graph for this function:

§ leveldb_options_set_comparator()

void leveldb_options_set_comparator ( leveldb_options_t ,
leveldb_comparator_t  
)

Definition at line 394 of file c.cc.

396  {
397  opt->rep.comparator = cmp;
398 }
Here is the caller graph for this function:

§ leveldb_options_set_compression()

void leveldb_options_set_compression ( leveldb_options_t ,
int   
)

Definition at line 449 of file c.cc.

449  {
450  opt->rep.compression = static_cast<CompressionType>(t);
451 }
CompressionType
Definition: options.h:23
Here is the caller graph for this function:

§ leveldb_options_set_create_if_missing()

void leveldb_options_set_create_if_missing ( leveldb_options_t ,
unsigned  char 
)

Definition at line 406 of file c.cc.

407  {
408  opt->rep.create_if_missing = v;
409 }
Here is the caller graph for this function:

§ leveldb_options_set_env()

void leveldb_options_set_env ( leveldb_options_t ,
leveldb_env_t  
)

Definition at line 421 of file c.cc.

421  {
422  opt->rep.env = (env ? env->rep : NULL);
423 }
Here is the caller graph for this function:

§ leveldb_options_set_error_if_exists()

void leveldb_options_set_error_if_exists ( leveldb_options_t ,
unsigned  char 
)

Definition at line 411 of file c.cc.

412  {
413  opt->rep.error_if_exists = v;
414 }
Here is the caller graph for this function:

§ leveldb_options_set_filter_policy()

void leveldb_options_set_filter_policy ( leveldb_options_t ,
leveldb_filterpolicy_t  
)

Definition at line 400 of file c.cc.

402  {
403  opt->rep.filter_policy = policy;
404 }
Here is the caller graph for this function:

§ leveldb_options_set_info_log()

void leveldb_options_set_info_log ( leveldb_options_t ,
leveldb_logger_t  
)

Definition at line 425 of file c.cc.

425  {
426  opt->rep.info_log = (l ? l->rep : NULL);
427 }
Here is the caller graph for this function:

§ leveldb_options_set_max_open_files()

void leveldb_options_set_max_open_files ( leveldb_options_t ,
int   
)

Definition at line 433 of file c.cc.

433  {
434  opt->rep.max_open_files = n;
435 }
Here is the caller graph for this function:

§ leveldb_options_set_paranoid_checks()

void leveldb_options_set_paranoid_checks ( leveldb_options_t ,
unsigned  char 
)

Definition at line 416 of file c.cc.

417  {
418  opt->rep.paranoid_checks = v;
419 }
Here is the caller graph for this function:

§ leveldb_options_set_write_buffer_size()

void leveldb_options_set_write_buffer_size ( leveldb_options_t ,
size_t   
)

Definition at line 429 of file c.cc.

429  {
430  opt->rep.write_buffer_size = s;
431 }
Here is the caller graph for this function:

§ leveldb_property_value()

char* leveldb_property_value ( leveldb_t db,
const char *  propname 
)

Definition at line 240 of file c.cc.

242  {
243  std::string tmp;
244  if (db->rep->GetProperty(Slice(propname), &tmp)) {
245  // We use strdup() since we expect human readable output.
246  return strdup(tmp.c_str());
247  } else {
248  return NULL;
249  }
250 }
virtual bool GetProperty(const Slice &property, std::string *value)=0
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_put()

void leveldb_put ( leveldb_t db,
const leveldb_writeoptions_t options,
const char *  key,
size_t  keylen,
const char *  val,
size_t  vallen,
char **  errptr 
)

Definition at line 170 of file c.cc.

175  {
176  SaveError(errptr,
177  db->rep->Put(options->rep, Slice(key, keylen), Slice(val, vallen)));
178 }
WriteOptions rep
Definition: c.cc:51
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
virtual Status Put(const WriteOptions &options, const Slice &key, const Slice &value)=0
Definition: db_impl.cc:1476
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_readoptions_create()

leveldb_readoptions_t* leveldb_readoptions_create ( )

Definition at line 522 of file c.cc.

522  {
523  return new leveldb_readoptions_t;
524 }
struct leveldb_readoptions_t leveldb_readoptions_t
Definition: c.h:63
Here is the caller graph for this function:

§ leveldb_readoptions_destroy()

void leveldb_readoptions_destroy ( leveldb_readoptions_t )

Definition at line 526 of file c.cc.

526  {
527  delete opt;
528 }
Here is the caller graph for this function:

§ leveldb_readoptions_set_fill_cache()

void leveldb_readoptions_set_fill_cache ( leveldb_readoptions_t ,
unsigned  char 
)

Definition at line 536 of file c.cc.

537  {
538  opt->rep.fill_cache = v;
539 }
Here is the caller graph for this function:

§ leveldb_readoptions_set_snapshot()

void leveldb_readoptions_set_snapshot ( leveldb_readoptions_t ,
const leveldb_snapshot_t  
)

Definition at line 541 of file c.cc.

543  {
544  opt->rep.snapshot = (snap ? snap->rep : NULL);
545 }
Here is the caller graph for this function:

§ leveldb_readoptions_set_verify_checksums()

void leveldb_readoptions_set_verify_checksums ( leveldb_readoptions_t ,
unsigned  char 
)

Definition at line 530 of file c.cc.

532  {
533  opt->rep.verify_checksums = v;
534 }
Here is the caller graph for this function:

§ leveldb_release_snapshot()

void leveldb_release_snapshot ( leveldb_t db,
const leveldb_snapshot_t snapshot 
)

Definition at line 233 of file c.cc.

235  {
236  db->rep->ReleaseSnapshot(snapshot->rep);
237  delete snapshot;
238 }
virtual void ReleaseSnapshot(const Snapshot *snapshot)=0
const Snapshot * rep
Definition: c.cc:49
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_repair_db()

void leveldb_repair_db ( const leveldb_options_t options,
const char *  name,
char **  errptr 
)

Definition at line 285 of file c.cc.

288  {
289  SaveError(errptr, RepairDB(name, options->rep));
290 }
Options rep
Definition: c.cc:52
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
Status RepairDB(const std::string &dbname, const Options &options)
Definition: repair.cc:456
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_write()

void leveldb_write ( leveldb_t db,
const leveldb_writeoptions_t options,
leveldb_writebatch_t batch,
char **  errptr 
)

Definition at line 189 of file c.cc.

193  {
194  SaveError(errptr, db->rep->Write(options->rep, &batch->rep));
195 }
WriteOptions rep
Definition: c.cc:51
static bool SaveError(char **errptr, const Status &s)
Definition: c.cc:132
virtual Status Write(const WriteOptions &options, WriteBatch *updates)=0
WriteBatch rep
Definition: c.cc:48
DB * rep
Definition: c.cc:46
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_writebatch_clear()

void leveldb_writebatch_clear ( leveldb_writebatch_t )

Definition at line 345 of file c.cc.

345  {
346  b->rep.Clear();
347 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_writebatch_create()

leveldb_writebatch_t* leveldb_writebatch_create ( )

Definition at line 337 of file c.cc.

337  {
338  return new leveldb_writebatch_t;
339 }
struct leveldb_writebatch_t leveldb_writebatch_t
Definition: c.h:67
Here is the caller graph for this function:

§ leveldb_writebatch_delete()

void leveldb_writebatch_delete ( leveldb_writebatch_t ,
const char *  key,
size_t  klen 
)

Definition at line 356 of file c.cc.

358  {
359  b->rep.Delete(Slice(key, klen));
360 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_writebatch_destroy()

void leveldb_writebatch_destroy ( leveldb_writebatch_t )

Definition at line 341 of file c.cc.

341  {
342  delete b;
343 }
Here is the caller graph for this function:

§ leveldb_writebatch_iterate()

void leveldb_writebatch_iterate ( leveldb_writebatch_t ,
void *  state,
void(*)(void *, const char *k, size_t klen, const char *v, size_t vlen)  put,
void(*)(void *, const char *k, size_t klen)  deleted 
)

Definition at line 362 of file c.cc.

366  {
367  class H : public WriteBatch::Handler {
368  public:
369  void* state_;
370  void (*put_)(void*, const char* k, size_t klen, const char* v, size_t vlen);
371  void (*deleted_)(void*, const char* k, size_t klen);
372  virtual void Put(const Slice& key, const Slice& value) {
373  (*put_)(state_, key.data(), key.size(), value.data(), value.size());
374  }
375  virtual void Delete(const Slice& key) {
376  (*deleted_)(state_, key.data(), key.size());
377  }
378  };
379  H handler;
380  handler.state_ = state;
381  handler.put_ = put;
382  handler.deleted_ = deleted;
383  b->rep.Iterate(&handler);
384 }
const char * data() const
Definition: slice.h:40
size_t size() const
Definition: slice.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_writebatch_put()

void leveldb_writebatch_put ( leveldb_writebatch_t ,
const char *  key,
size_t  klen,
const char *  val,
size_t  vlen 
)

Definition at line 349 of file c.cc.

352  {
353  b->rep.Put(Slice(key, klen), Slice(val, vlen));
354 }
Here is the call graph for this function:
Here is the caller graph for this function:

§ leveldb_writeoptions_create()

leveldb_writeoptions_t* leveldb_writeoptions_create ( )

Definition at line 547 of file c.cc.

547  {
548  return new leveldb_writeoptions_t;
549 }
struct leveldb_writeoptions_t leveldb_writeoptions_t
Definition: c.h:68
Here is the caller graph for this function:

§ leveldb_writeoptions_destroy()

void leveldb_writeoptions_destroy ( leveldb_writeoptions_t )

Definition at line 551 of file c.cc.

551  {
552  delete opt;
553 }
Here is the caller graph for this function:

§ leveldb_writeoptions_set_sync()

void leveldb_writeoptions_set_sync ( leveldb_writeoptions_t ,
unsigned  char 
)

Definition at line 555 of file c.cc.

556  {
557  opt->rep.sync = v;
558 }
Here is the caller graph for this function: