Skip to main content

PackStore

Struct PackStore 

Source
pub struct PackStore { /* private fields */ }
Expand description

Per-objects/ cache of pack indexes, bytes, MIDX views, and delta-base LRU state.

crate::odb::Odb owns an Arc<PackStore>; Odb clones share it. Independently opened Odb handles for the same path get separate stores. Alternate object directories get separate stores retained on the parent Odb.

Implementations§

Source§

impl PackStore

Source

pub fn new(objects_dir: PathBuf) -> Self

Create a fresh store for objects_dir (not shared with other independent Odb opens).

Source

pub fn objects_dir(&self) -> &Path

objects/ path for this store.

Source

pub fn has_context() -> bool

Whether this thread already has an active pack-read store context.

Source

pub fn with_context<R>(store: Arc<Self>, f: impl FnOnce() -> R) -> R

Run f with store as the pack-read context on this thread.

Source

pub fn invalidate_packs(&self)

Drop cached pack listings, indexes, pack bytes, and delta bases.

Source

pub fn invalidate_midx(&self)

Drop MIDX bytes and tip cache under this store’s objects/pack/.

Source

pub fn invalidate_all(&self)

Full pack + MIDX invalidation (after repack/gc/index-pack in-process).

Source

pub fn configure_delta_base_from_config(&self, cfg: Option<&ConfigSet>)

Apply core.deltaBaseCacheLimit from config to this store’s delta-base LRU.

Source

pub fn invalidate_all_legacy()

Clear legacy thread-local stores (tests/benches calling crate::pack::clear_pack_cache).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.