pub struct PreparedResponse<'a> { /* private fields */ }Expand description
A prepared response whose raw pack has not yet been exposed to transport. Only raw PACK bytes may be persisted; request-specific ACKs, boundaries and sideband framing stay in the retained response encoder.
Implementations§
Source§impl<'a> PreparedResponse<'a>
impl<'a> PreparedResponse<'a>
Sourcepub fn new(
encoder: ResponseEncoder<'a>,
repository: &impl Repository,
ids: &mut [ObjectId],
) -> Result<Self>
pub fn new( encoder: ResponseEncoder<'a>, repository: &impl Repository, ids: &mut [ObjectId], ) -> Result<Self>
Consume a freshly prepared, unread response. Authorization, selection, graph limits and control-buffer admission must already have succeeded. A response without a pack (including negotiation/probes) has no cache key.
pub fn key(&self) -> Option<Key>
pub fn response(&self) -> Response
Sourcepub fn read_pack(
&mut self,
repository: &impl Repository,
output: &mut [u8],
) -> Result<usize>
pub fn read_pack( &mut self, repository: &impl Repository, output: &mut [u8], ) -> Result<usize>
Generate raw bytes on a miss without exposing any HTTP/protocol output.
Pulls remain bounded by output; zero denotes complete PACK EOF. The
immutable repository must be the one used to prepare this response.
Discard staging on error. A fresh preparation is needed to restart it.
Sourcepub fn attach(
self,
bytes: &'a [u8],
ids: &mut [ObjectId],
byte_limit: usize,
) -> Result<ResponseEncoder<'a>>
pub fn attach( self, bytes: &'a [u8], ids: &mut [ObjectId], byte_limit: usize, ) -> Result<ResponseEncoder<'a>>
Verify framing, checksums, canonical IDs and the exact selected set before returning an ordinary response cursor. Works for hits and generated misses. Cache bytes are borrowed and must remain immutable through transport EOF. Publication must be awaited separately before exposing the returned cursor.
Sourcepub fn without_pack(self) -> Result<ResponseEncoder<'a>>
pub fn without_pack(self) -> Result<ResponseEncoder<'a>>
Finish a non-pack response without consulting storage. Pack responses require authenticated attachment, even after complete miss generation.