pub struct DataStore<'lt> { /* private fields */ }Implementations§
Source§impl<'lt> DataStore<'lt>
impl<'lt> DataStore<'lt>
pub fn load_mapping<P>(file_path: P, readonly: bool) -> Result<MemoryMap>
pub fn load<P>(file_path: P, readonly: bool) -> Result<Self>
Sourcepub const fn derive_index_bounds(total_len: usize) -> (usize, usize, usize)
pub const fn derive_index_bounds(total_len: usize) -> (usize, usize, usize)
store_length_in_bytes -> (index_offset, index_length, data_offset)
- this should only be used when initializing a new
DataStore
pub fn init<P>(file_path: &P) -> Result<Self>
pub fn get_chunk_by_index(&self, index: usize) -> Result<MbufDataChunk<'_>>
pub fn calculate_index_bucket(hash: &Hash, index_modulo: u32) -> u32
pub fn get_bucket_index_chunk_by_hash( &self, hash: &Hash, ) -> Result<(u32, u32, Option<MbufDataChunk<'_>>)>
pub fn get_bucket_by_hash(&'lt self, hash: &Hash) -> Result<u32>
pub fn get_index_by_hash(&'lt self, hash: &Hash) -> Result<u32>
pub fn get_chunk_by_hash(&'lt self, hash: &Hash) -> Result<MbufDataChunk<'lt>>
Sourcepub fn put_opaque_chunk<C: DataChunk>(
&self,
opaque_chunk: &C,
) -> Result<(u32, u32, MbufDataChunk<'_>)>
pub fn put_opaque_chunk<C: DataChunk>( &self, opaque_chunk: &C, ) -> Result<(u32, u32, MbufDataChunk<'_>)>
Stores opaque data and returns a tuple containing the bucket, index, and DataChunk.
§Arguments
opaque_chunk- ADataChunkrepresenting the opaque data to be stored.
§Returns
A Result containing:
Ok((bucket, index, datachunk))on success:bucket(u32): The hashmap index of the chunk.index(u32): The chunk’s index withing the storage file.datachunk(MbufDataChunk): The chunk of data that was stored.
Err(PsDataLakeError)on failure:- An error of type
PsDataLakeErrorindicating the reason for failure.
- An error of type
pub fn put_encrypted_chunk<C: DataChunk>(&'lt self, chunk: &C) -> Result<Hkey>
pub fn put_large_chunk<C: DataChunk>(&'lt self, chunk: &C) -> Result<Hkey>
pub fn put_chunk<C: DataChunk>(&'lt self, chunk: &C) -> Result<Hkey>
pub fn put_large_blob(&'lt self, blob: &[u8]) -> Result<Hkey>
pub fn put_blob(&'lt self, blob: &[u8]) -> Result<Hkey>
Trait Implementations§
Source§impl<'lt> Store for DataStore<'lt>
impl<'lt> Store for DataStore<'lt>
type Chunk<'c> = MbufDataChunk<'c> where 'lt: 'c
type Error = DataLakeError
fn get<'a>(&'a self, hash: &Hash) -> Result<Self::Chunk<'a>, Self::Error>
fn put(&self, data: &[u8]) -> Result<Hkey, Self::Error>
fn put_encrypted<C: DataChunk>(&self, chunk: C) -> Result<(), Self::Error>
Auto Trait Implementations§
impl<'lt> Freeze for DataStore<'lt>
impl<'lt> !RefUnwindSafe for DataStore<'lt>
impl<'lt> Send for DataStore<'lt>
impl<'lt> Sync for DataStore<'lt>
impl<'lt> Unpin for DataStore<'lt>
impl<'lt> UnsafeUnpin for DataStore<'lt>
impl<'lt> !UnwindSafe for DataStore<'lt>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.