Skip to main content

FilePublication

Struct FilePublication 

Source
pub struct FilePublication<'a, R> { /* private fields */ }
Expand description

A complete publication backed by pinned regular-file descriptors. Unlike a selected-cache entry, its names are the actual checksums of complete pack bytes. Neither mutable pathnames nor a shared file cursor are retained.

Construction compares BOTH files byte-for-byte with a fresh publication of this exact repository, including index offsets/CRCs and both trailers. The supplied files must be the stored encoder’s output; arbitrary foreign delta packs are not accepted here. IDs/graph validation remain the provider’s contract; validate an untrusted repository first.

Open descriptors survive rename/unlink but do not prevent in-place writes. The host must keep the raw repository AND both files immutable for the URL’s lifetime, publish refs/HEAD and pack/index together only after success, and isolate each new generation under its own URL. This is not a disk quota, staging cleanup, filesystem durability or distributed-lock implementation.

Implementations§

Source§

impl<'a, R: Repository> FilePublication<'a, R>

Source

pub fn from_fds( repository: &'a R, entries: &'a mut [IndexEntry], pack: OwnedFd, index: OwnedFd, encode_scratch: &mut [u8], compare_scratch: &mut [u8], loose: LooseObjects, ) -> Result<Self>

Source

pub fn checksum(&self) -> ObjectId

Source

pub fn pack_size(&self) -> u64

Source

pub fn index_size(&self) -> u64

Source

pub fn prepare( &self, request: Request<'_>, ) -> Result<Option<FilePublishedResponse<'_, R>>>

Same routing/fallthrough as Publication::prepare. Successful pack/index downloads use only positional reads of the verified files; listing bytes remain generated. Every cursor owns its own offset and cancellation state.

Auto Trait Implementations§

§

impl<'a, R> Freeze for FilePublication<'a, R>
where Publication<'a, R>: Freeze,

§

impl<'a, R> RefUnwindSafe for FilePublication<'a, R>
where Publication<'a, R>: RefUnwindSafe,

§

impl<'a, R> Send for FilePublication<'a, R>
where Publication<'a, R>: Send,

§

impl<'a, R> Sync for FilePublication<'a, R>
where Publication<'a, R>: Sync,

§

impl<'a, R> Unpin for FilePublication<'a, R>
where Publication<'a, R>: Unpin,

§

impl<'a, R> UnsafeUnpin for FilePublication<'a, R>
where Publication<'a, R>: UnsafeUnpin,

§

impl<'a, R> UnwindSafe for FilePublication<'a, R>
where Publication<'a, R>: UnwindSafe,

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.