Trait mz_persist_types::txn::TxnsCodec

source ·
pub trait TxnsCodec: Debug {
    type Key: Debug + Codec;
    type Val: Debug + Codec;

    // Required methods
    fn schemas() -> (<Self::Key as Codec>::Schema, <Self::Val as Codec>::Schema);
    fn encode(e: TxnsEntry) -> (Self::Key, Self::Val);
    fn decode(key: Self::Key, val: Self::Val) -> TxnsEntry;
    fn should_fetch_part(data_id: &ShardId, stats: &PartStats) -> Option<bool>;
}
Expand description

An abstraction over the encoding format of TxnsEntry.

This enables users of this crate to control how data is written to the txns shard (which will allow mz to present it as a normal introspection source).

Required Associated Types§

source

type Key: Debug + Codec

The K type used in the txns shard.

source

type Val: Debug + Codec

The V type used in the txns shard.

Required Methods§

source

fn schemas() -> (<Self::Key as Codec>::Schema, <Self::Val as Codec>::Schema)

Returns the Schemas to use with Self::Key and Self::Val.

source

fn encode(e: TxnsEntry) -> (Self::Key, Self::Val)

Encodes a TxnsEntry in the format persisted in the txns shard.

source

fn decode(key: Self::Key, val: Self::Val) -> TxnsEntry

Decodes a TxnsEntry from the format persisted in the txns shard.

Implementations should panic if the values are invalid.

source

fn should_fetch_part(data_id: &ShardId, stats: &PartStats) -> Option<bool>

Returns if a part might include the given data shard based on pushdown stats.

False positives are okay (needless fetches) but false negatives are not (incorrectness). Returns an Option to make ? convenient, None is treated the same as Some(true).

Object Safety§

This trait is not object safe.

Implementors§