Trait exocore_chain::block::Block [−][src]
pub trait Block {
type UnderlyingFrame: FrameReader<OwnedType = Bytes>;
Show 14 methods
fn offset(&self) -> BlockOffset;
fn header(&self) -> &BlockHeaderFrame<Self::UnderlyingFrame>;
fn operations_data(&self) -> &[u8];
fn signatures(&self) -> &SignaturesFrame<Self::UnderlyingFrame>;
fn total_size(&self) -> usize { ... }
fn next_offset(&self) -> BlockOffset { ... }
fn copy_data_into(&self, data: &mut [u8]) { ... }
fn as_data_vec(&self) -> Bytes { ... }
fn to_owned(&self) -> DataBlock<Bytes> { ... }
fn get_height(&self) -> Result<BlockHeight, Error> { ... }
fn get_proposed_operation_id(&self) -> Result<OperationId, Error> { ... }
fn operations_iter(&self) -> Result<BlockOperationsIterator<'_>, Error> { ... }
fn get_operation(
&self,
operation_id: OperationId
) -> Result<Option<OperationFrame<&[u8]>>, Error> { ... }
fn validate<PB: Block>(
&self,
previous_block: Option<PB>
) -> Result<(), Error> { ... }
}
Expand description
A trait representing a block stored or to be stored in the chain.
It can either be a referenced block (BlockRef
) or a in-memory block
(BlockOwned
).
A block consists of 3 parts:
- Block header
- Operations’ bytes (capnp serialized
chain_operation
frames) - Block signatures
The block header and operations’ data are the same on all nodes. Since a node writes a block as soon as it has enough signatures, signatures can differ from one node to the other. Signatures frame is pre-allocated, which means that not all signatures may fit. But in theory, it should always contain enough space for all nodes to add their own signature.