Skip to main content

PreparedResponse

Struct PreparedResponse 

Source
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>

Source

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.

Source

pub fn key(&self) -> Option<Key>

Source

pub fn response(&self) -> Response

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<'a> Freeze for PreparedResponse<'a>

§

impl<'a> RefUnwindSafe for PreparedResponse<'a>

§

impl<'a> Send for PreparedResponse<'a>

§

impl<'a> Sync for PreparedResponse<'a>

§

impl<'a> Unpin for PreparedResponse<'a>

§

impl<'a> UnsafeUnpin for PreparedResponse<'a>

§

impl<'a> UnwindSafe for PreparedResponse<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.