Wrap the RepairDB function.
This commit is contained in:
parent
a670ec2aa1
commit
8fba5ffa1d
4 changed files with 29 additions and 3 deletions
|
@ -421,8 +421,20 @@ WriteBatchIterator
|
||||||
Third item (value):
|
Third item (value):
|
||||||
The value for this operation. Empty for ``"Delete"``.
|
The value for this operation. Empty for ``"Delete"``.
|
||||||
|
|
||||||
changelog
|
Repair DB
|
||||||
tutoro
|
=========
|
||||||
|
|
||||||
|
.. py:function:: repair_db(db_name, opts)
|
||||||
|
|
||||||
|
:param unicode db_name: Name of the database to open
|
||||||
|
:param opts: Options for this specific database
|
||||||
|
:type opts: :py:class:`rocksdb.Options`
|
||||||
|
|
||||||
|
If a DB cannot be opened, you may attempt to call this method to
|
||||||
|
resurrect as much of the contents of the database as possible.
|
||||||
|
Some data may be lost, so be careful when calling this function
|
||||||
|
on a database that contains important information.
|
||||||
|
|
||||||
|
|
||||||
Errors
|
Errors
|
||||||
======
|
======
|
||||||
|
|
|
@ -3,7 +3,9 @@ Changelog
|
||||||
|
|
||||||
Version 0.4
|
Version 0.4
|
||||||
-----------
|
-----------
|
||||||
Nothing in yet.
|
|
||||||
|
* Added :py:func:`repair_db`
|
||||||
|
|
||||||
|
|
||||||
Version 0.3
|
Version 0.3
|
||||||
-----------
|
-----------
|
||||||
|
|
|
@ -1615,6 +1615,16 @@ cdef class DB(object):
|
||||||
def __get__(self):
|
def __get__(self):
|
||||||
return self.opts
|
return self.opts
|
||||||
|
|
||||||
|
|
||||||
|
def repair_db(db_name, Options opts):
|
||||||
|
cdef Status st
|
||||||
|
cdef string db_path
|
||||||
|
|
||||||
|
db_path = path_to_string(db_name)
|
||||||
|
st = db.RepairDB(db_path, deref(opts.opts))
|
||||||
|
check_status(st)
|
||||||
|
|
||||||
|
|
||||||
@cython.no_gc_clear
|
@cython.no_gc_clear
|
||||||
@cython.internal
|
@cython.internal
|
||||||
cdef class Snapshot(object):
|
cdef class Snapshot(object):
|
||||||
|
|
|
@ -140,3 +140,5 @@ cdef extern from "rocksdb/db.h" namespace "rocksdb":
|
||||||
const string&,
|
const string&,
|
||||||
DB**,
|
DB**,
|
||||||
cpp_bool) nogil except+
|
cpp_bool) nogil except+
|
||||||
|
|
||||||
|
cdef Status RepairDB(const string& dbname, const options.Options&)
|
||||||
|
|
Loading…
Reference in a new issue