pub struct WrappedDB<D, T>where
D: DB,{ /* private fields */ }Expand description
A tagged newtype wrapper for DBs, to support creating disjoint default
storage DBs of the same type, concurrently.
Disjoint default storage for the same DB type are needed, for example, when writing tests that need to run in isolation.
See self::tests::persist_to_disk and
self::tests::test_default_storage for example usage.
Implementations§
Trait Implementations§
Source§impl<D, T> DB for WrappedDB<D, T>
A pass-thru implementation of DB.
impl<D, T> DB for WrappedDB<D, T>
A pass-thru implementation of DB.
§Foot-gun
If the DB trait ever grows another method with a default implementation,
we’ll need to be sure to add the pass-thru here, to preserve any possibly
overriding implementations provided by the wrapped db.
Source§fn get_node(
&self,
key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>,
) -> Option<OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>>
fn get_node( &self, key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, ) -> Option<OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>>
Get node in DAG with key
key.Source§fn get_unreachable_keys(
&self,
) -> Vec<ArenaHash<<WrappedDB<D, T> as DB>::Hasher>>
fn get_unreachable_keys( &self, ) -> Vec<ArenaHash<<WrappedDB<D, T> as DB>::Hasher>>
Get the keys for all the unreachable nodes, i.e. the nodes with
ref_count == 0, which aren’t marked as GC roots.Source§fn insert_node(
&mut self,
key: ArenaHash<<WrappedDB<D, T> as DB>::Hasher>,
object: OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>,
)
fn insert_node( &mut self, key: ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, object: OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>, )
Insert a DAG node with key
key.Source§fn delete_node(&mut self, key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>)
fn delete_node(&mut self, key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>)
Remove the DAG node with key
key.Source§fn get_root_count(
&self,
key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>,
) -> u32
fn get_root_count( &self, key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, ) -> u32
Get the number of times the node with key
key has been marked as a GC
root. Returns 0 if the node is not a GC root.Source§fn set_root_count(
&mut self,
key: ArenaHash<<WrappedDB<D, T> as DB>::Hasher>,
count: u32,
)
fn set_root_count( &mut self, key: ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, count: u32, )
Set the root count of the node with key
key to count. If count is
0, the node will no longer be a GC root.Source§fn get_roots(&self) -> HashMap<ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, u32>
fn get_roots(&self) -> HashMap<ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, u32>
Return a mapping from key to root count, for all the roots in this
DB. All mapped root counts will be positive.
Source§fn batch_update<I>(&mut self, iter: I)
fn batch_update<I>(&mut self, iter: I)
Batch update the database. Read more
Source§fn batch_get_nodes<I>(
&self,
keys: I,
) -> Vec<(ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, Option<OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>>)>
fn batch_get_nodes<I>( &self, keys: I, ) -> Vec<(ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, Option<OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>>)>
Batch get nodes. Read more
Source§fn bfs_get_nodes<C>(
&self,
key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>,
cache_get: C,
truncate: bool,
max_depth: Option<usize>,
max_count: Option<usize>,
) -> Vec<(ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>)>
fn bfs_get_nodes<C>( &self, key: &ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, cache_get: C, truncate: bool, max_depth: Option<usize>, max_count: Option<usize>, ) -> Vec<(ArenaHash<<WrappedDB<D, T> as DB>::Hasher>, OnDiskObject<<WrappedDB<D, T> as DB>::Hasher>)>
Get all nodes reachable from the node with key
key using a breadth
first search. Read moreimpl<D, T> DummyArbitrary for WrappedDB<D, T>where
D: DB + DummyArbitrary,
Auto Trait Implementations§
impl<D, T> Freeze for WrappedDB<D, T>where
D: Freeze,
impl<D, T> RefUnwindSafe for WrappedDB<D, T>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<D, T> Send for WrappedDB<D, T>where
T: Send,
impl<D, T> Sync for WrappedDB<D, T>where
T: Sync,
impl<D, T> Unpin for WrappedDB<D, T>
impl<D, T> UnsafeUnpin for WrappedDB<D, T>where
D: UnsafeUnpin,
impl<D, T> UnwindSafe for WrappedDB<D, T>where
D: UnwindSafe,
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
Causes
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
Causes
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
Causes
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
Causes
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
Causes
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
Causes
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
Causes
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
Causes
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Immutable access to the
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
Mutable access to the
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
Immutable access to the
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
Mutable access to the
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Immutable access to the
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Mutable access to the
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
Calls
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
Calls
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
Calls
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
Calls
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
Calls
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
Calls
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
Calls
.tap_deref() only in debug builds, and is erased in release
builds.