add estimate_num_keys
to prefix interface
This commit is contained in:
parent
6a5ff0636c
commit
937adbf439
2 changed files with 6 additions and 0 deletions
|
@ -139,3 +139,6 @@ class BasePrefixDB:
|
||||||
|
|
||||||
def stage_raw_delete(self, key: bytes, value: bytes):
|
def stage_raw_delete(self, key: bytes, value: bytes):
|
||||||
self._op_stack.append_op(RevertableDelete(key, value))
|
self._op_stack.append_op(RevertableDelete(key, value))
|
||||||
|
|
||||||
|
def estimate_num_keys(self, column_family: 'rocksdb.ColumnFamilyHandle' = None):
|
||||||
|
return int(self._db.get_property(b'rocksdb.estimate-num-keys', column_family).decode())
|
||||||
|
|
|
@ -144,6 +144,9 @@ class PrefixRow(metaclass=PrefixRowType):
|
||||||
def unpack_item(cls, key: bytes, value: bytes):
|
def unpack_item(cls, key: bytes, value: bytes):
|
||||||
return cls.unpack_key(key), cls.unpack_value(value)
|
return cls.unpack_key(key), cls.unpack_value(value)
|
||||||
|
|
||||||
|
def estimate_num_keys(self) -> int:
|
||||||
|
return int(self._db.get_property(b'rocksdb.estimate-num-keys', self._column_family).decode())
|
||||||
|
|
||||||
|
|
||||||
class UTXOKey(NamedTuple):
|
class UTXOKey(NamedTuple):
|
||||||
hashX: bytes
|
hashX: bytes
|
||||||
|
|
Loading…
Add table
Reference in a new issue