Skip to main content

WriteObjectLayout

Struct WriteObjectLayout 

Source
pub struct WriteObjectLayout { /* private fields */ }
Expand description

Sealed layout cursor, retaining header metadata rather than object bytes. Writers start at the header. Readers start after opening the header with WriteObjectPrefix::opened_header. Hash each encoded piece, including the prefix and length fields, before the final signature.

Implementations§

Source§

impl WriteObjectLayout

Source

pub fn new( prefix: WriteObjectPrefix, header: &[u8], part_lengths: Vec<u64>, ) -> Result<Self, Error>

Begin producing a write from its header bytes and declared part lengths. Exactly one key is required for every part; lengths come from the header’s plaintext codec, which remains responsible for validating its fields.

Source

pub fn prefix(&self) -> Result<Vec<u8>, Error>

Encode the cleartext prefix before supplying sealed chunks.

Source

pub fn next_chunk(&self) -> Option<ObjectChunk>

Coordinates for the next sealed chunk, or None when only the signature remains.

Source

pub fn chunk_length(&self, prefix: &[u8]) -> Result<usize, Error>

Validate a chunk length prefix against the next exact boundary before allocating.

Source

pub fn encode_chunk(&mut self, bytes: &[u8]) -> Result<Vec<u8>, Error>

Write the next length-prefixed sealed chunk, advancing only on success.

Source

pub fn decode_chunk<'a>( &mut self, piece: &'a [u8], ) -> Result<(ObjectChunk, &'a [u8]), Error>

Read the next complete piece without opening or copying it. A reader lacking this part’s key can skip the returned bytes while hashing them.

Source

pub fn tail(&mut self, tail: &HeaderTail) -> Result<Vec<u8>, Error>

Write the part roots and header signature, only right after the header.

Source

pub fn signature(&mut self, signature: &Signature) -> Result<[u8; 64], Error>

Write a signature only after every declared chunk.

Source

pub fn read_signature(&mut self, bytes: &[u8]) -> Result<Signature, Error>

Read the final 64-byte signature. Crypto verifies it against the author, path and accumulated digest; this method only checks layout.

Source

pub fn finish(&self, trailing: &[u8]) -> Result<(), Error>

Check EOF after the signature. No additional bytes may follow it.

Auto Trait Implementations§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,