pub trait DecodeEntry {
    // Required methods
    fn put(
        &mut self,
        pack_id: u32,
        offset: u64,
        data: &[u8],
        kind: Kind,
        compressed_size: usize
    );
    fn get(
        &mut self,
        pack_id: u32,
        offset: u64,
        out: &mut Vec<u8>
    ) -> Option<(Kind, usize)>;
}
Expand description

A trait to model putting objects at a given pack offset into a cache, and fetching them.

It is used to speed up pack traversals.

Required Methods§

source

fn put( &mut self, pack_id: u32, offset: u64, data: &[u8], kind: Kind, compressed_size: usize )

Store a fully decoded object at offset of kind with compressed_size and data in the cache.

It is up to the cache implementation whether that actually happens or not.

source

fn get( &mut self, pack_id: u32, offset: u64, out: &mut Vec<u8> ) -> Option<(Kind, usize)>

Attempt to fetch the object at offset and store its decoded bytes in out, as previously stored with DecodeEntry::put(), and return its (object kind, decompressed_size)

Implementations on Foreign Types§

source§

impl<T: DecodeEntry + ?Sized> DecodeEntry for Box<T>

source§

fn put( &mut self, pack_id: u32, offset: u64, data: &[u8], kind: Kind, compressed_size: usize )

source§

fn get( &mut self, pack_id: u32, offset: u64, out: &mut Vec<u8> ) -> Option<(Kind, usize)>

Implementors§

source§

impl DecodeEntry for MemoryCappedHashmap

Available on crate feature pack-cache-lru-dynamic and (crate features pack-cache-lru-dynamic or pack-cache-lru-static) only.
source§

impl DecodeEntry for Never

source§

impl<const SIZE: usize> DecodeEntry for StaticLinkedList<SIZE>

Available on crate feature pack-cache-lru-static and (crate features pack-cache-lru-dynamic or pack-cache-lru-static) only.