pub struct StdinWriter<'a>(/* private fields */);Expand description
The writer a stdin producer is handed: kopia’s stdin, with the ability to CLOSE it removed.
The runner’s ownership of that pipe IS the safety property. kopia finalizes
the snapshot when — and only when — stdin reaches EOF, so whoever can close
the pipe decides whether the snapshot commits. A producer that called
shutdown() on a bare ChildStdin would hand kopia EOF while the runner
still believed it held the commit point, and a subsequent
StdinOutcome::Abort would then arrive too late: the kill would land on a
kopia that had already written a manifest for a TRUNCATED dump.
No producer in this repository does that. This type means none ever can — which is the difference between a bad state being untaken and being unrepresentable.
[tokio::io::AsyncWrite] is implemented so tokio::io::copy still works (the
pipe-to-pipe transfer must stay constant-memory and must never buffer the
user’s dump), but poll_shutdown is a deliberate NO-OP: it reports success
without touching the pipe, so AsyncWriteExt::shutdown() cannot reach it
either.
Trait Implementations§
Source§impl AsyncWrite for StdinWriter<'_>
impl AsyncWrite for StdinWriter<'_>
Source§fn poll_shutdown(
self: Pin<&mut Self>,
_cx: &mut Context<'_>,
) -> Poll<Result<()>>
fn poll_shutdown( self: Pin<&mut Self>, _cx: &mut Context<'_>, ) -> Poll<Result<()>>
Deliberately does NOT close the pipe. Closing it is the COMMIT decision,
and it belongs to the runner alone — see the type’s own documentation.
Reports success so a producer that flushes-and-shuts-down (the idiomatic
end of a tokio::io::copy pipeline) is not made to look like a failure.
Source§fn poll_write(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
buf: &[u8],
) -> Poll<Result<usize>>
fn poll_write( self: Pin<&mut Self>, cx: &mut Context<'_>, buf: &[u8], ) -> Poll<Result<usize>>
buf into the object. Read moreSource§fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_flush(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<()>>
§fn poll_write_vectored(
self: Pin<&mut Self>,
cx: &mut Context<'_>,
bufs: &[IoSlice<'_>],
) -> Poll<Result<usize, Error>>
fn poll_write_vectored( self: Pin<&mut Self>, cx: &mut Context<'_>, bufs: &[IoSlice<'_>], ) -> Poll<Result<usize, Error>>
poll_write, except that it writes from a slice of buffers. Read more§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
poll_write_vectored
implementation. Read more