Struct building_blocks_storage::chunk::storage::compressible::CompressibleChunkStorage [−][src]
pub struct CompressibleChunkStorage<N, Compr> where
Compr: Compression, { /* fields omitted */ }
Expand description
A two-tier chunk storage. The first tier is an LRU cache of uncompressed chunks. The second tier is a Slab
of compressed
chunks.
Implementations
impl<N, By, Chan> CompressibleChunkStorage<N, FastArrayCompression<N, FastChannelsCompression<By, Chan>>> where
PointN<N>: Copy,
ChunkKey<N>: Clone + Eq + Hash,
FastChannelsCompression<By, Chan>: Compression,
impl<N, By, Chan> CompressibleChunkStorage<N, FastArrayCompression<N, FastChannelsCompression<By, Chan>>> where
PointN<N>: Copy,
ChunkKey<N>: Clone + Eq + Hash,
FastChannelsCompression<By, Chan>: Compression,
impl<N, Compr> CompressibleChunkStorage<N, Compr> where
ChunkKey<N>: Clone + Eq + Hash,
Compr: Compression,
impl<N, Compr> CompressibleChunkStorage<N, Compr> where
ChunkKey<N>: Clone + Eq + Hash,
Compr: Compression,
pub fn reader<'a>(
&'a self,
local_cache: &'a LocalChunkCache<N, Compr::Data>
) -> CompressibleChunkStorageReader<'a, N, Compr>
pub fn reader<'a>(
&'a self,
local_cache: &'a LocalChunkCache<N, Compr::Data>
) -> CompressibleChunkStorageReader<'a, N, Compr>
Returns a reader that implements ChunkReadStorage
.
pub fn copy_without_caching(
&self,
key: ChunkKey<N>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>> where
Compr::Data: Clone,
Compressed<Compr>: Clone,
pub fn copy_without_caching(
&self,
key: ChunkKey<N>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>> where
Compr::Data: Clone,
Compressed<Compr>: Clone,
Returns a copy of the Chunk
at key
.
WARNING: the cache will not be updated. This method should be used for a read-modify-write workflow where it would be inefficient to cache the chunk only for it to be overwritten by the modified version.
pub fn remove(
&mut self,
key: ChunkKey<N>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
pub fn remove(
&mut self,
key: ChunkKey<N>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
Remove the Chunk
at key
.
Compress the least-recently-used, cached chunk. On access, compressed chunks will be decompressed and cached.
Remove the least-recently-used, cached chunk.
This is useful for removing a batch of chunks at a time before compressing them in parallel. Then call
insert_compressed
.
pub fn insert_compressed(
&mut self,
key: ChunkKey<N>,
compressed_chunk: Compressed<Compr>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
pub fn insert_compressed(
&mut self,
key: ChunkKey<N>,
compressed_chunk: Compressed<Compr>
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
Insert a compressed chunk. Returns the old chunk if one exists.
Consumes and flushes the chunk cache into the chunk map. This is not strictly necessary, but it will help with caching efficiency.
pub fn insert_chunk(
&mut self,
key: ChunkKey<N>,
chunk: Compr::Data
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
pub fn insert_chunk(
&mut self,
key: ChunkKey<N>,
chunk: Compr::Data
) -> Option<MaybeCompressed<Compr::Data, Compressed<Compr>>>
Inserts chunk
at key
and returns the old chunk.
Trait Implementations
impl<N, Compr> ChunkWriteStorage<N, <Compr as Compression>::Data> for CompressibleChunkStorage<N, Compr> where
ChunkKey<N>: Clone + Eq + Hash,
Compr: Compression,
impl<N, Compr> ChunkWriteStorage<N, <Compr as Compression>::Data> for CompressibleChunkStorage<N, Compr> where
ChunkKey<N>: Clone + Eq + Hash,
Compr: Compression,
Mutably borrow the chunk at key
.
Mutably borrow the chunk at key
. If it doesn’t exist, insert the return value of create_chunk
.
Replace the chunk at key
with chunk
, returning the old value.
Overwrite the chunk at key
with chunk
. Drops the previous value.