Skip to content

Commit

Permalink
Merge pull request faust-streaming#7 from NightTsarina/options_helper…
Browse files Browse the repository at this point in the history
…_classes

Options helper classes
  • Loading branch information
FdelMazo authored Feb 25, 2022
2 parents 3904b51 + 1d0ef3a commit 35753b2
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 3 deletions.
54 changes: 54 additions & 0 deletions rocksdb/compaction_filter.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
from libcpp cimport bool as cpp_bool
from libcpp.string cimport string
from libcpp.vector cimport vector
from libcpp.memory cimport unique_ptr
from libc.stdint cimport uint32_t
from .slice_ cimport Slice

cdef extern from "rocksdb/compaction_filter.h" namespace "rocksdb":
cdef cppclass CompactionFilterContext:
cpp_bool is_full_compaction
cpp_bool is_manual_compaction

cdef enum ValueType "rocksdb::CompactionFilter::ValueType":
ValueType_kValue "rocksdb::CompactionFilter::ValueType::kValue"
ValueType_kMergeOperand "rocksdb::CompactionFilter::ValueType::kMergeOperand"
ValueType_kBlobIndex "rocksdb::CompactionFilter::ValueType::kBlobIndex"

cdef enum Decision "rocksdb::CompactionFilter::Decision":
Decision_kKeep "rocksdb::CompactionFilter::Decision::kKeep"
Decision_kRemove "rocksdb::CompactionFilter::Decision::kRemove"
Decision_kChangeValue "rocksdb::CompactionFilter::Decision::kChangeValue"
Decision_kRemoveAndSkipUntil "rocksdb::CompactionFilter::Decision::kRemoveAndSkipUntil"

cdef enum BlobDecision "rocksdb::CompactionFilter::BlobDecision":
BlobDecision_kKeep "rocksdb::CompactionFilter::BlobDecision::kKeep"
BlobDecision_kChangeValue "rocksdb::CompactionFilter::BlobDecision::kChangeValue"
BlobDecision_kCorruption "rocksdb::CompactionFilter::BlobDecision::kCorruption"
BlobDecision_kIOError "rocksdb::CompactionFilter::BlobDecision::kIOError"

cdef cppclass Context "rocksdb::CompactionFilter::Context":
cpp_bool is_full_compaction
cpp_bool is_manual_compaction
uint32_t column_family_id

cdef cppclass CompactionFilter:
cpp_bool Filter(int, const Slice&,
const Slice&,
string*,
cpp_bool*) nogil except+
cpp_bool FilterMergeOperand(int, const Slice&,
const Slice&) nogil except+
Decision FilterV2(int level, const Slice&, ValueType,
const Slice&, string*,
string*)
BlobDecision PrepareBlobOutput(const Slice&,
const Slice&,
string*)
cpp_bool IgnoreSnapshots()
const char* Name()

cdef cppclass CompactionFilterFactory:
unique_ptr[CompactionFilter] CreateCompactionFilter(
const Context&)
const char* Name()
11 changes: 11 additions & 0 deletions rocksdb/concurrent_task_limiter.pxd
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from libcpp.string cimport string
from libc.stdint cimport int32_t

cdef extern from "rocksdb/concurrent_task_limiter.h" namespace "rocksdb":
cdef cppclass ConcurrentTaskLimiter:
const string& GetName()
void SetMaxOutstandingTask(int32_t)
void ResetMaxOutstandingTask()
int32_t GetOutstandingTask()

ConcurrentTaskLimiter* NewConcurrentTaskLimiter(const string&, int32_t)
8 changes: 5 additions & 3 deletions rocksdb/options.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ from .advanced_options cimport CompressionOptions
from .advanced_options cimport AdvancedColumnFamilyOptions
from .env cimport Env
from .types cimport SequenceNumber
from .compaction_filter cimport CompactionFilter, CompactionFilterFactory
from .concurrent_task_limiter cimport ConcurrentTaskLimiter

cdef extern from "rocksdb/options.h" namespace "rocksdb":
ctypedef enum CpuPriority:
Expand Down Expand Up @@ -48,8 +50,8 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
ColumnFamilyOptions* OptimizeUniversalStyleCompaction(uint64_t)
const Comparator* comparator
shared_ptr[MergeOperator] merge_operator
# TODO: compaction_filter
# TODO: compaction_filter_factory
CompactionFilter* compaction_filter
shared_ptr[CompactionFilterFactory] compaction_filter_factory
size_t write_buffer_size
advanced_options.CompressionType compression
advanced_options.CompressionType bottommost_compression
Expand All @@ -65,7 +67,7 @@ cdef extern from "rocksdb/options.h" namespace "rocksdb":
shared_ptr[TableFactory] table_factory

vector[DbPath] cf_paths
# TODO shared_ptr[ConcurrentTaskLimiter] compaction_thread_limiter
shared_ptr[ConcurrentTaskLimiter] compaction_thread_limiter
ColumnFamilyOptions()
ColumnFamilyOptions(const Options& options)
void Dump(Logger*)
Expand Down

0 comments on commit 35753b2

Please sign in to comment.