Skip to main content

RefRepository

Struct RefRepository 

Source
pub struct RefRepository<'refs, 'repo, R>
where R: Repository + ?Sized,
{ /* private fields */ }
Expand description

Attach a caller-owned sorted ref manifest and HEAD to an object provider. Construction validates refs and symbolic links, without reading object bodies. Use ValidatedRepository to check IDs, target kinds, tags and the union graph.

Implementations§

Source§

impl<'refs, 'repo, R> RefRepository<'refs, 'repo, R>
where R: Repository + ?Sized,

Source

pub fn new( source: &'repo R, head: Head<'refs>, references: &'refs [Reference<'refs>], ) -> Result<RefRepository<'refs, 'repo, R>, Error>

Trait Implementations§

Source§

impl<R> Repository for RefRepository<'_, '_, R>
where R: Repository + ?Sized,

Source§

fn head(&self) -> ObjectId

Resolved commit ID, or the all-zero sentinel for an unborn HEAD. Use head_state().id() when absence needs to be distinguished.
Source§

fn object_format(&self) -> ObjectFormat

Fixed for the entire repository, including unborn HEAD. Defaults to SHA-1; SHA-256 providers must override this independently of object_id.
Source§

fn head_state(&self) -> Head<'_>

Source§

fn head_ref(&self) -> &str

Source§

fn object_count(&self) -> usize

Source§

fn object(&self, index: usize) -> Option<Object<'_>>

Optional borrowed-body fast path. Streaming providers can leave this as None and implement object_info, read_object, and object_id instead.
Source§

fn object_info(&self, index: usize) -> Result<ObjectInfo, Error>

Source§

fn object_id(&self, index: usize) -> Option<ObjectId>

Return an object’s ID. Streaming providers must supply precomputed IDs; ObjectHasher computes them incrementally with caller-owned scratch.
Source§

fn read_object( &self, index: usize, offset: u64, storage: &mut [u8], ) -> Result<usize, Error>

Read at most storage.len() body bytes starting at a byte offset. Short reads are allowed. Return zero only at EOF or for empty storage. Calls must be independent of earlier reads, enabling interleaved readers and retries. Errors may modify storage but must not change the object.
Source§

fn find_index(&self, id: ObjectId) -> Option<usize>

Lookup without requiring a borrowed body. Metadata providers can index it.
Source§

fn reference_count(&self) -> usize

Source§

fn reference_name(&self, index: usize) -> Option<&str>

Source§

fn reference_id(&self, index: usize) -> Option<ObjectId>

Defaults preserve snapshot commit aliases. Override for independent tips.
Source§

fn reference_symbolic_target(&self, index: usize) -> Option<&str>

Source§

fn reference_peeled(&self, index: usize) -> Option<ObjectId>

Source§

fn find(&self, id: ObjectId) -> Option<Object<'_>>

Auto Trait Implementations§

§

impl<'refs, 'repo, R> Freeze for RefRepository<'refs, 'repo, R>
where &'repo R: Freeze, R: ?Sized,

§

impl<'refs, 'repo, R> RefUnwindSafe for RefRepository<'refs, 'repo, R>

§

impl<'refs, 'repo, R> Send for RefRepository<'refs, 'repo, R>
where &'repo R: Send, R: ?Sized,

§

impl<'refs, 'repo, R> Sync for RefRepository<'refs, 'repo, R>
where &'repo R: Sync, R: ?Sized,

§

impl<'refs, 'repo, R> Unpin for RefRepository<'refs, 'repo, R>
where &'repo R: Unpin, R: ?Sized,

§

impl<'refs, 'repo, R> UnsafeUnpin for RefRepository<'refs, 'repo, R>

§

impl<'refs, 'repo, R> UnwindSafe for RefRepository<'refs, 'repo, R>

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.