pub struct AtomicStagedFile { /* private fields */ }Expand description
A provider download path that becomes visible at its destination only after the caller has verified the completed file.
Implementations§
Source§impl AtomicStagedFile
impl AtomicStagedFile
pub async fn create(destination: &Path) -> Result<Self, FileError>
pub fn path(&self) -> &Path
pub fn destination(&self) -> &Path
Sourcepub async fn stage_peer(&self, destination: &Path) -> Result<Self, FileError>
pub async fn stage_peer(&self, destination: &Path) -> Result<Self, FileError>
Create another unpublished stage governed by the same durability policy.
pub async fn read_bytes(&self) -> Result<Vec<u8>, FileError>
Sourcepub fn path_for_atomic_replacement(&mut self) -> &Path
pub fn path_for_atomic_replacement(&mut self) -> &Path
Hand the reserved path to a writer that performs its own atomic replacement. The retained descriptor is closed first so publication always names the replacement inode.
pub async fn write_bytes(&mut self, bytes: &[u8]) -> Result<(), FileError>
Sourcepub async fn write_plaintext<R: PlaintextChunkReader>(
&mut self,
source: &mut R,
) -> Result<u64, StreamWriteError<R::Error>>
pub async fn write_plaintext<R: PlaintextChunkReader>( &mut self, source: &mut R, ) -> Result<u64, StreamWriteError<R::Error>>
Fill this unpublished stage from a plaintext stream and apply its file durability barrier. The caller verifies higher-level content facts before publishing the stage.
pub async fn write_byte_stream<E: Send>( self, stream: Pin<Box<dyn Stream<Item = Result<Bytes, E>> + Send>>, ) -> Result<(Self, u64), ByteStreamWriteError<E>>
Sourcepub async fn copy_from(
self,
source: &Path,
) -> Result<(Self, u64, [u8; 32]), FileError>
pub async fn copy_from( self, source: &Path, ) -> Result<(Self, u64, [u8; 32]), FileError>
Fill this unpublished stage from one opened source file while computing the exact identity of the copied bytes from that same descriptor.
pub async fn commit(self) -> Result<(), FileError>
Sourcepub async fn commit_new(self) -> Result<(), CommitNewFileError>
pub async fn commit_new(self) -> Result<(), CommitNewFileError>
Publish a verified user-owned destination without replacing an existing path. The staged file is a sibling, so the no-clobber rename exposes the complete file atomically and fails if another file already owns the name.