Struct mz_rocksdb::RocksDBInstance
source · pub struct RocksDBInstance<K, V> {
pub(crate) tx: Sender<Command<K, V>>,
pub(crate) multi_get_scratch: Vec<K>,
pub(crate) multi_get_results_scratch: Vec<Option<GetResult<V>>>,
pub(crate) multi_update_scratch: Vec<(K, KeyUpdate<V>, Option<i64>)>,
pub(crate) dynamic_config: RocksDBDynamicConfig,
pub supports_merges: bool,
}
Expand description
An async wrapper around RocksDB.
Fields§
§tx: Sender<Command<K, V>>
§multi_get_scratch: Vec<K>
§multi_get_results_scratch: Vec<Option<GetResult<V>>>
§multi_update_scratch: Vec<(K, KeyUpdate<V>, Option<i64>)>
§dynamic_config: RocksDBDynamicConfig
§supports_merges: bool
Whether this instance supports merge operations (whether a merge operator was set at creation time)
Implementations§
source§impl<K, V> RocksDBInstance<K, V>
impl<K, V> RocksDBInstance<K, V>
sourcepub async fn new<M, O, IM, F>(
instance_path: &Path,
options: InstanceOptions<O, V, F>,
tuning_config: RocksDBConfig,
shared_metrics: M,
instance_metrics: IM,
) -> Result<Self, Error>
pub async fn new<M, O, IM, F>( instance_path: &Path, options: InstanceOptions<O, V, F>, tuning_config: RocksDBConfig, shared_metrics: M, instance_metrics: IM, ) -> Result<Self, Error>
Start a new RocksDB instance at the path, using
the Options
and RocksDBTuningParameters
to
configure the instance.
metrics
is a set of metric types that this type will keep
up to date. enc_opts
is the bincode
options used to
serialize and deserialize the keys and values.
sourcepub async fn multi_get<'r, G, R, Ret, Placement>(
&mut self,
gets: G,
results_out: R,
placement: Placement,
) -> Result<MultiGetResult, Error>where
G: IntoIterator<Item = K>,
R: IntoIterator<Item = &'r mut Ret>,
Ret: 'r,
Placement: Fn(Option<GetResult<V>>) -> Ret,
pub async fn multi_get<'r, G, R, Ret, Placement>(
&mut self,
gets: G,
results_out: R,
placement: Placement,
) -> Result<MultiGetResult, Error>where
G: IntoIterator<Item = K>,
R: IntoIterator<Item = &'r mut Ret>,
Ret: 'r,
Placement: Fn(Option<GetResult<V>>) -> Ret,
For each unique key in gets
, place the stored value (if any) in results_out
.
Panics if gets
and results_out
are not the same length.
pub(crate) async fn multi_get_inner<'r, G, R, Ret, Placement>(
&mut self,
gets: G,
results_out: R,
placement: &Placement,
) -> Result<MultiGetResult, Error>where
G: IntoIterator<Item = K>,
R: IntoIterator<Item = &'r mut Ret>,
Ret: 'r,
Placement: Fn(Option<GetResult<V>>) -> Ret,
sourcepub async fn multi_update<P>(
&mut self,
puts: P,
) -> Result<MultiUpdateResult, Error>
pub async fn multi_update<P>( &mut self, puts: P, ) -> Result<MultiUpdateResult, Error>
For each key in puts, store the given value, or delete it if
the value is None
. If the same key
appears multiple times,
the last value for the key wins.
The third item in each tuple is an optional diff multiplier that when present,
will be multiplied by the size of the encoded value written to the database and
summed into the MultiUpdateResult::size_diff
field.
pub(crate) async fn multi_update_inner<P>( &mut self, updates: P, ) -> Result<MultiUpdateResult, Error>
sourcepub async fn manual_compaction(&self) -> Result<(), Error>
pub async fn manual_compaction(&self) -> Result<(), Error>
Trigger manual compaction of the RocksDB instance.
Auto Trait Implementations§
impl<K, V> Freeze for RocksDBInstance<K, V>
impl<K, V> !RefUnwindSafe for RocksDBInstance<K, V>
impl<K, V> Send for RocksDBInstance<K, V>
impl<K, V> Sync for RocksDBInstance<K, V>
impl<K, V> Unpin for RocksDBInstance<K, V>
impl<K, V> !UnwindSafe for RocksDBInstance<K, V>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.