pub struct FileObject { /* private fields */ }Expand description
One object’s uncompressed body in an owned file descriptor.
The body may occupy the whole file or a byte range in a shared data file. Git loose zlib files and compressed pack entries require decoding first. IDs and kinds come from the caller’s manifest; use ValidatedRepository to verify them and the complete graph. An open descriptor pins the file across renames, replacement and unlinking, but the host must prevent in-place writes for the lifetime of the repository and its URL. This is not a disk snapshot.
Implementations§
Source§impl FileObject
impl FileObject
Sourcepub fn open_at(
directory: impl AsFd,
path: &CStr,
kind: ObjectKind,
id: ObjectId,
) -> Result<Self>
pub fn open_at( directory: impl AsFd, path: &CStr, kind: ObjectKind, id: ObjectId, ) -> Result<Self>
Open relative to a directory without allocating a path. The final path component must be a regular file rather than a symlink. This is ordinary openat, not confinement of arbitrary paths to the supplied directory.
Sourcepub fn from_fd(fd: OwnedFd, kind: ObjectKind, id: ObjectId) -> Result<Self>
pub fn from_fd(fd: OwnedFd, kind: ObjectKind, id: ObjectId) -> Result<Self>
Take ownership of an open regular file; its whole current body is used.
Sourcepub fn from_range(
fd: OwnedFd,
offset: u64,
info: ObjectInfo,
id: ObjectId,
) -> Result<Self>
pub fn from_range( fd: OwnedFd, offset: u64, info: ObjectInfo, id: ObjectId, ) -> Result<Self>
Take ownership of an open descriptor and a raw body range. Ranges must fit the current file length and signed 64-bit native file offsets.