2014-01-13 19:52:22 +01:00
|
|
|
cimport options
|
2018-11-02 19:27:14 +01:00
|
|
|
from libc.stdint cimport uint64_t, uint32_t
|
2014-01-13 19:52:22 +01:00
|
|
|
from status cimport Status
|
|
|
|
from libcpp cimport bool as cpp_bool
|
|
|
|
from libcpp.string cimport string
|
|
|
|
from libcpp.vector cimport vector
|
|
|
|
from slice_ cimport Slice
|
|
|
|
from snapshot cimport Snapshot
|
|
|
|
from iterator cimport Iterator
|
|
|
|
|
|
|
|
cdef extern from "rocksdb/write_batch.h" namespace "rocksdb":
|
|
|
|
cdef cppclass WriteBatch:
|
2014-01-17 20:06:17 +01:00
|
|
|
WriteBatch() nogil except+
|
|
|
|
WriteBatch(string) nogil except+
|
|
|
|
void Put(const Slice&, const Slice&) nogil except+
|
2018-11-02 19:27:14 +01:00
|
|
|
void Put(ColumnFamilyHandle*, const Slice&, const Slice&) nogil except+
|
2014-01-17 20:06:17 +01:00
|
|
|
void Merge(const Slice&, const Slice&) nogil except+
|
2018-11-02 19:27:14 +01:00
|
|
|
void Merge(ColumnFamilyHandle*, const Slice&, const Slice&) nogil except+
|
2014-01-17 20:06:17 +01:00
|
|
|
void Delete(const Slice&) nogil except+
|
2018-11-02 19:27:14 +01:00
|
|
|
void Delete(ColumnFamilyHandle*, const Slice&) nogil except+
|
2014-01-17 20:06:17 +01:00
|
|
|
void PutLogData(const Slice&) nogil except+
|
|
|
|
void Clear() nogil except+
|
2014-04-27 16:39:50 +02:00
|
|
|
const string& Data() nogil except+
|
|
|
|
int Count() nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2015-07-05 13:35:15 +02:00
|
|
|
cdef extern from "cpp/write_batch_iter_helper.hpp" namespace "py_rocks":
|
|
|
|
cdef enum BatchItemOp "RecordItemsHandler::Optype":
|
|
|
|
BatchItemOpPut "py_rocks::RecordItemsHandler::Optype::PutRecord"
|
|
|
|
BatchItemOpMerge "py_rocks::RecordItemsHandler::Optype::MergeRecord"
|
|
|
|
BatchItemOpDelte "py_rocks::RecordItemsHandler::Optype::DeleteRecord"
|
|
|
|
|
|
|
|
cdef cppclass BatchItem "py_rocks::RecordItemsHandler::BatchItem":
|
|
|
|
BatchItemOp op
|
2018-11-02 19:27:14 +01:00
|
|
|
uint32_t column_family_id
|
2015-07-05 13:35:15 +02:00
|
|
|
Slice key
|
|
|
|
Slice value
|
|
|
|
|
|
|
|
Status get_batch_items(WriteBatch* batch, vector[BatchItem]* items)
|
|
|
|
|
|
|
|
|
2014-01-13 19:52:22 +01:00
|
|
|
cdef extern from "rocksdb/db.h" namespace "rocksdb":
|
|
|
|
ctypedef uint64_t SequenceNumber
|
2018-11-02 19:27:14 +01:00
|
|
|
string kDefaultColumnFamilyName
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
cdef struct LiveFileMetaData:
|
|
|
|
string name
|
|
|
|
int level
|
2015-04-12 14:09:02 +02:00
|
|
|
uint64_t size
|
2014-01-13 19:52:22 +01:00
|
|
|
string smallestkey
|
|
|
|
string largestkey
|
|
|
|
SequenceNumber smallest_seqno
|
|
|
|
SequenceNumber largest_seqno
|
|
|
|
|
|
|
|
cdef cppclass Range:
|
|
|
|
Range(const Slice&, const Slice&)
|
|
|
|
|
|
|
|
cdef cppclass DB:
|
|
|
|
Status Put(
|
|
|
|
const options.WriteOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Slice&,
|
2014-01-17 20:06:17 +01:00
|
|
|
const Slice&) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
Status Delete(
|
|
|
|
const options.WriteOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-17 20:06:17 +01:00
|
|
|
const Slice&) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
Status Merge(
|
|
|
|
const options.WriteOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Slice&,
|
2014-01-17 20:06:17 +01:00
|
|
|
const Slice&) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
Status Write(
|
|
|
|
const options.WriteOptions&,
|
2014-01-17 20:06:17 +01:00
|
|
|
WriteBatch*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
Status Get(
|
|
|
|
const options.ReadOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Slice&,
|
2014-01-17 20:06:17 +01:00
|
|
|
string*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
vector[Status] MultiGet(
|
|
|
|
const options.ReadOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
const vector[ColumnFamilyHandle*]&,
|
2014-01-13 19:52:22 +01:00
|
|
|
const vector[Slice]&,
|
2014-01-17 20:06:17 +01:00
|
|
|
vector[string]*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
cpp_bool KeyMayExist(
|
|
|
|
const options.ReadOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
Slice&,
|
|
|
|
string*,
|
2014-01-17 20:06:17 +01:00
|
|
|
cpp_bool*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
cpp_bool KeyMayExist(
|
|
|
|
const options.ReadOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
Slice&,
|
2014-01-17 20:06:17 +01:00
|
|
|
string*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
Iterator* NewIterator(
|
2018-11-02 19:27:14 +01:00
|
|
|
const options.ReadOptions&,
|
|
|
|
ColumnFamilyHandle*) nogil except+
|
|
|
|
|
|
|
|
void NewIterators(
|
|
|
|
const options.ReadOptions&,
|
|
|
|
vector[ColumnFamilyHandle*]&,
|
|
|
|
vector[Iterator*]*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2014-01-17 20:06:17 +01:00
|
|
|
const Snapshot* GetSnapshot() nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2014-01-17 20:06:17 +01:00
|
|
|
void ReleaseSnapshot(const Snapshot*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
cpp_bool GetProperty(
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Slice&,
|
2014-01-17 20:06:17 +01:00
|
|
|
string*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
void GetApproximateSizes(
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Range*
|
|
|
|
int,
|
2014-01-17 20:06:17 +01:00
|
|
|
uint64_t*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2014-05-31 17:59:29 +02:00
|
|
|
Status CompactRange(
|
2015-08-27 21:45:09 +02:00
|
|
|
const options.CompactRangeOptions&,
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle*,
|
2014-01-13 19:52:22 +01:00
|
|
|
const Slice*,
|
2015-08-27 21:45:09 +02:00
|
|
|
const Slice*) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2018-11-02 19:27:14 +01:00
|
|
|
Status CreateColumnFamily(
|
|
|
|
const options.ColumnFamilyOptions&,
|
|
|
|
const string&,
|
|
|
|
ColumnFamilyHandle**) nogil except+
|
|
|
|
|
|
|
|
Status DropColumnFamily(
|
|
|
|
ColumnFamilyHandle*) nogil except+
|
|
|
|
|
|
|
|
int NumberLevels(ColumnFamilyHandle*) nogil except+
|
|
|
|
int MaxMemCompactionLevel(ColumnFamilyHandle*) nogil except+
|
|
|
|
int Level0StopWriteTrigger(ColumnFamilyHandle*) nogil except+
|
2014-01-17 20:06:17 +01:00
|
|
|
const string& GetName() nogil except+
|
2018-11-02 19:27:14 +01:00
|
|
|
const options.Options& GetOptions(ColumnFamilyHandle*) nogil except+
|
|
|
|
Status Flush(const options.FlushOptions&, ColumnFamilyHandle*) nogil except+
|
2014-01-17 20:06:17 +01:00
|
|
|
Status DisableFileDeletions() nogil except+
|
|
|
|
Status EnableFileDeletions() nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
# TODO: Status GetSortedWalFiles(VectorLogPtr& files)
|
|
|
|
# TODO: SequenceNumber GetLatestSequenceNumber()
|
|
|
|
# TODO: Status GetUpdatesSince(
|
|
|
|
# SequenceNumber seq_number,
|
|
|
|
# unique_ptr[TransactionLogIterator]*)
|
|
|
|
|
2014-01-17 20:06:17 +01:00
|
|
|
Status DeleteFile(string) nogil except+
|
|
|
|
void GetLiveFilesMetaData(vector[LiveFileMetaData]*) nogil except+
|
2018-11-02 19:27:14 +01:00
|
|
|
ColumnFamilyHandle* DefaultColumnFamily()
|
2014-01-13 19:52:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
cdef Status DB_Open "rocksdb::DB::Open"(
|
|
|
|
const options.Options&,
|
|
|
|
const string&,
|
2014-01-17 20:06:17 +01:00
|
|
|
DB**) nogil except+
|
2014-01-13 19:52:22 +01:00
|
|
|
|
2018-11-02 19:27:14 +01:00
|
|
|
cdef Status DB_Open_ColumnFamilies "rocksdb::DB::Open"(
|
|
|
|
const options.Options&,
|
|
|
|
const string&,
|
|
|
|
const vector[ColumnFamilyDescriptor]&,
|
|
|
|
vector[ColumnFamilyHandle*]*,
|
|
|
|
DB**) nogil except+
|
|
|
|
|
2014-01-13 19:52:22 +01:00
|
|
|
cdef Status DB_OpenForReadOnly "rocksdb::DB::OpenForReadOnly"(
|
|
|
|
const options.Options&,
|
|
|
|
const string&,
|
|
|
|
DB**,
|
2014-01-17 20:06:17 +01:00
|
|
|
cpp_bool) nogil except+
|
2015-08-15 16:34:35 +02:00
|
|
|
|
2018-11-02 19:27:14 +01:00
|
|
|
cdef Status DB_OpenForReadOnly_ColumnFamilies "rocksdb::DB::OpenForReadOnly"(
|
|
|
|
const options.Options&,
|
|
|
|
const string&,
|
|
|
|
const vector[ColumnFamilyDescriptor]&,
|
|
|
|
vector[ColumnFamilyHandle*]*,
|
|
|
|
DB**,
|
|
|
|
cpp_bool) nogil except+
|
|
|
|
|
2015-08-15 16:34:35 +02:00
|
|
|
cdef Status RepairDB(const string& dbname, const options.Options&)
|
2018-11-02 19:27:14 +01:00
|
|
|
|
|
|
|
cdef Status ListColumnFamilies "rocksdb::DB::ListColumnFamilies" (
|
|
|
|
const options.Options&,
|
|
|
|
const string&,
|
|
|
|
vector[string]*) nogil except+
|
|
|
|
|
|
|
|
cdef cppclass ColumnFamilyHandle:
|
|
|
|
const string& GetName() nogil except+
|
|
|
|
int GetID() nogil except+
|
|
|
|
|
|
|
|
cdef cppclass ColumnFamilyDescriptor:
|
|
|
|
ColumnFamilyDescriptor() nogil except+
|
|
|
|
ColumnFamilyDescriptor(
|
|
|
|
const string&,
|
|
|
|
const options.ColumnFamilyOptions&) nogil except+
|
|
|
|
string name
|
|
|
|
options.ColumnFamilyOptions options
|
2020-03-12 20:51:57 +01:00
|
|
|
|
|
|
|
cdef extern from "rocksdb/convenience.h" namespace "rocksdb":
|
|
|
|
void CancelAllBackgroundWork(DB*, cpp_bool) nogil except+
|