Skip to main content

Upcaster

Trait Upcaster 

Source
pub trait Upcaster:
    Send
    + Sync
    + Debug {
    // Required methods
    fn current_version(&self, kind: &str) -> u16;
    fn upcast(
        &self,
        kind: &str,
        version: u16,
        payload: Value,
    ) -> Result<Value, StoreError>;
}
Expand description

A pure, total transform from an older record version to the current one.

Lives inside the deterministic zone: given the same (kind, version, payload) it must always produce the same output, in this process and in one started a year from now.

Required Methods§

Source

fn current_version(&self, kind: &str) -> u16

Highest version this upcaster knows how to produce.

Source

fn upcast( &self, kind: &str, version: u16, payload: Value, ) -> Result<Value, StoreError>

Lift one payload one or more versions forward.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§