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
impl Prepared
pub fn parse(frame: &[u8]) -> Result<Self, String>
Sourcepub fn for_read(frame: &[u8]) -> Result<Self, String>
pub fn for_read(frame: &[u8]) -> Result<Self, String>
Serving needs flat programs only; encoder inspection trees are optional.
Sourcepub fn open(frame: &[u8]) -> Result<Self, String>
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.
Sourcepub fn open_parts(frame: &[u8]) -> Result<Self, String>
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.
pub fn parse_parts(frame: &[u8]) -> Result<Self, String>
Sourcepub fn check_parts(
&mut self,
hash: [u8; 32],
digests: Vec<[u8; 32]>,
) -> Result<(), String>
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).
Sourcepub fn compiled_parts(&self) -> usize
pub fn compiled_parts(&self) -> usize
Parts compiled so far.
Sourcepub fn tx(&mut self, index: usize) -> Result<(Vec<u8>, Vec<u8>), String>
pub fn tx(&mut self, index: usize) -> Result<(Vec<u8>, Vec<u8>), String>
Transaction at position index of the block, in original order.
Sourcepub fn tx_with_index(
&mut self,
ledger: usize,
index: u32,
) -> Result<Option<(Vec<u8>, Vec<u8>)>, String>
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.
pub fn patch( &mut self, ledger: usize, index: usize, ) -> Result<([u8; 32], Vec<u8>), String>
Sourcepub fn ledger_count(&self) -> usize
pub fn ledger_count(&self) -> usize
Number of ledgers in the block.
pub fn row(&mut self, index: usize) -> Result<Row, String>
Sourcepub fn header(&mut self, index: usize) -> Result<Vec<u8>, String>
pub fn header(&mut self, index: usize) -> Result<Vec<u8>, String>
Header of ledger index, without touching its transactions or patches.
Sourcepub fn row_txs(&mut self, index: usize) -> Result<Row, String>
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.