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>
impl<'a, R: Repository> FilePublication<'a, R>
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>
pub fn checksum(&self) -> ObjectId
pub fn pack_size(&self) -> u64
pub fn index_size(&self) -> u64
Sourcepub fn prepare(
&self,
request: Request<'_>,
) -> Result<Option<FilePublishedResponse<'_, R>>>
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.