Skip to main content

Prepared

Struct Prepared 

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

Prepared block: shared literal arena plus flat document instructions. Preparing does not itself authenticate the archive or recompute ledger roots.

JC06 blocks (added during integration) are cut into parts that compile on their own; open compiles a part the first time one of its ledgers is read. Ledgers stored in hash order are put back into it only when a whole ledger is read.

Implementations§

Source§

impl Prepared

Source

pub fn parse(frame: &[u8]) -> Result<Self, String>

Source

pub fn for_read(frame: &[u8]) -> Result<Self, String>

Serving needs flat programs only; encoder inspection trees are optional.

Source

pub fn open(frame: &[u8]) -> Result<Self, String>

For reading: JC02-JC05 frame, compiled except for the hash order of ledgers, which is restored when a whole ledger is read.

Source

pub fn open_parts(frame: &[u8]) -> Result<Self, String>

JC06 frame (payload mode 2): open_parts compiles no part yet, parse_parts all of them with inspection trees.

Source

pub fn parse_parts(frame: &[u8]) -> Result<Self, String>

Source

pub fn check_parts( &mut self, hash: [u8; 32], digests: Vec<[u8; 32]>, ) -> Result<(), String>

Checks every part against its digest before compiling it: the block passed the full check when the digests were taken (pool seals).

Source

pub fn compiled_parts(&self) -> usize

Parts compiled so far.

Source

pub fn tx(&mut self, index: usize) -> Result<(Vec<u8>, Vec<u8>), String>

Transaction at position index of the block, in original order.

Source

pub fn tx_with_index( &mut self, ledger: usize, index: u32, ) -> Result<Option<(Vec<u8>, Vec<u8>)>, String>

Transaction of ledger ledger whose metadata has TransactionIndex index, without the rest of the ledger. Ledgers are encoded in TransactionIndex order, so the position is tried first.

Source

pub fn patch( &mut self, ledger: usize, index: usize, ) -> Result<([u8; 32], Vec<u8>), String>

Source

pub fn ledger_count(&self) -> usize

Number of ledgers in the block.

Source

pub fn seq(&self, index: usize) -> Option<u32>

Sequence of ledger index.

Source

pub fn txs_in(&self, index: usize) -> Option<usize>

Transactions in ledger index.

Source

pub fn row(&mut self, index: usize) -> Result<Row, String>

Source

pub fn header(&mut self, index: usize) -> Result<Vec<u8>, String>

Header of ledger index, without touching its transactions or patches.

Source

pub fn row_txs(&mut self, index: usize) -> Result<Row, String>

Ledger index with its transactions but without patches (left empty): readers that serve transactions don’t pay for state changes.

Source

pub fn all_rows(&mut self) -> Result<Vec<Row>, String>

Source

pub fn memory_bytes(&self) -> usize

Trait Implementations§

Source§

impl Debug for Prepared

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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.

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.