pub trait CommitLogMarshaller<E>where
    for<'async_trait> E: DeserializeOwned + Serialize + Send + Sync + 'async_trait,{
    // Required methods
    fn entity_type(&self) -> EntityType;
    fn to_compaction_key(&self, entity_id: &EntityId, event: &E) -> Key;
    fn to_entity_id(&self, record: &ConsumerRecord) -> Option<EntityId>;
    fn envelope<'life0, 'async_trait>(
        &'life0 self,
        entity_id: EntityId,
        record: ConsumerRecord
    ) -> Pin<Box<dyn Future<Output = Result<EventEnvelope<E>, CannotConsume>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn producer_record<'life0, 'life1, 'async_trait>(
        &'life0 self,
        topic: Topic,
        entity_id: EntityId,
        seq_nr: u64,
        timestamp: DateTime<Utc>,
        event: &'life1 E
    ) -> Pin<Box<dyn Future<Output = Result<ProducerRecord, CannotProduce>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Provides the ability to transform the the memory representation of Akka Persistence events from and to the records that a CommitLog expects.

Required Methods§

source

fn entity_type(&self) -> EntityType

Declares the entity type to the marshaller.

source

fn to_compaction_key(&self, entity_id: &EntityId, event: &E) -> Key

Provide a key we can use for the purposes of log compaction. A key would generally comprise and event type value held in the high bits, and the entity id in the lower bits.

source

fn to_entity_id(&self, record: &ConsumerRecord) -> Option<EntityId>

Extract an entity id from a consumer envelope.

source

fn envelope<'life0, 'async_trait>( &'life0 self, entity_id: EntityId, record: ConsumerRecord ) -> Pin<Box<dyn Future<Output = Result<EventEnvelope<E>, CannotConsume>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Produce an event envelope from a consumer record. Note that this may not always be possible due to record formats having changed, in which case we want the consumer to continue and skip it. Changes in a record’s layout should not prevent the system from working.

source

fn producer_record<'life0, 'life1, 'async_trait>( &'life0 self, topic: Topic, entity_id: EntityId, seq_nr: u64, timestamp: DateTime<Utc>, event: &'life1 E ) -> Pin<Box<dyn Future<Output = Result<ProducerRecord, CannotProduce>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Produce a producer record from an event and its entity info.

Implementors§