WorkChunk

Trait WorkChunk 

Source
pub trait WorkChunk {
    // Required methods
    fn chunk_id(&self) -> ChunkId;
    fn to_bytes(&self) -> Vec<u8> ;
    fn from_bytes(bytes: &[u8]) -> Result<Self, FabricError>
       where Self: Sized;
}
Expand description

A serializable unit of work with a stable identity.

Implementations must ensure that chunk_id() returns the same value across serialization round-trips. The coordinator uses chunk IDs to deduplicate outputs and skip already-completed chunks on retry.

Required Methods§

Source

fn chunk_id(&self) -> ChunkId

Return a stable identifier for this chunk.

Source

fn to_bytes(&self) -> Vec<u8>

Serialize this chunk to bytes (e.g. via postcard).

Source

fn from_bytes(bytes: &[u8]) -> Result<Self, FabricError>
where Self: Sized,

Deserialize a chunk from bytes.

§Errors

Returns FabricError::IoError(-200) on decode failure.

Implementors§