Skip to main content

WriteGate

Trait WriteGate 

Source
pub trait WriteGate: Send + Sync {
    // Required methods
    fn admit(
        &mut self,
        payload: &WritePayload,
    ) -> Result<WriteReceipt, GateError>;
    fn verify_receipt(&self, receipt: &WriteReceipt) -> bool;
    fn chain_root(&self) -> [u8; 32];
    fn len(&self) -> usize;
    fn variant(&self) -> GateVariant;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

Core admission gate trait for vector writes.

Each gate variant encapsulates one integrity strategy. Callers insert a WritePayload and receive a WriteReceipt that commits the gate’s current chain state. Receipts can be stored alongside the vector index entry and verified offline.

Required Methods§

Source

fn admit(&mut self, payload: &WritePayload) -> Result<WriteReceipt, GateError>

Admit a payload and return a tamper-evident receipt.

Source

fn verify_receipt(&self, receipt: &WriteReceipt) -> bool

Verify that a receipt is consistent with the gate’s internal state.

Source

fn chain_root(&self) -> [u8; 32]

Current chain commitment (root or chain head). Changes after every successful admit().

Source

fn len(&self) -> usize

Number of writes admitted so far.

Source

fn variant(&self) -> GateVariant

Gate variant identifier.

Provided Methods§

Source

fn is_empty(&self) -> bool

Returns true if no writes have been admitted.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§