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§
Required Methods§
Sourcefn encode(e: TxnsEntry) -> (Self::Key, Self::Val)
fn encode(e: TxnsEntry) -> (Self::Key, Self::Val)
Encodes a TxnsEntry in the format persisted in the txns shard.
Sourcefn decode(key: Self::Key, val: Self::Val) -> TxnsEntry
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.
Sourcefn should_fetch_part(data_id: &ShardId, stats: &PartStats) -> Option<bool>
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)
.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.