pub trait ArrayPlugin:
'static
+ Send
+ Sync {
// Required methods
fn id(&self) -> ArrayId;
fn read_ids(&self) -> Vec<ArrayId> ⓘ;
fn write_ids(&self) -> Vec<ArrayId> ⓘ;
fn serialize(
&self,
array: &ArrayRef,
session: &VortexSession,
) -> VortexResult<Option<ArraySerialization>>;
fn deserialize(
&self,
parts: ArrayDeserialization<'_>,
session: &VortexSession,
) -> VortexResult<ArrayRef>;
// Provided method
fn is_supported_encoding(&self, id: &ArrayId) -> bool { ... }
}Expand description
Registry trait for serializing and deserializing an in-memory array representation.
A plugin writes one in-memory encoding, identified by id. It declares the wire
IDs that it reads and writes separately, so it can write another encoding’s wire form without
replacing that encoding’s reader. The serialization context validates that the chosen wire ID
is permitted before it is written.
A plugin can retain historical read IDs after it stops writing them. A reader that predates a newer ID has no registration for it and reports it as unknown.
Required Methods§
Sourcefn read_ids(&self) -> Vec<ArrayId> ⓘ
fn read_ids(&self) -> Vec<ArrayId> ⓘ
Returns the wire IDs that deserialize accepts, oldest to newest.
ArraySession::register makes this plugin the
reader of each ID. An ID can stay in this list after the plugin stops writing it, so that
old files stay readable.
Sourcefn serialize(
&self,
array: &ArrayRef,
session: &VortexSession,
) -> VortexResult<Option<ArraySerialization>>
fn serialize( &self, array: &ArrayRef, session: &VortexSession, ) -> VortexResult<Option<ArraySerialization>>
Sourcefn deserialize(
&self,
parts: ArrayDeserialization<'_>,
session: &VortexSession,
) -> VortexResult<ArrayRef>
fn deserialize( &self, parts: ArrayDeserialization<'_>, session: &VortexSession, ) -> VortexResult<ArrayRef>
Deserialize one recognized wire representation into the current in-memory array.
serialized_id identifies the exact representation encountered on disk. The returned
array does not necessarily have to use this plugin’s in-memory ID; this supports legacy
representations that are normalized into another current in-memory array. Implementations
must validate the contract of that exact ID rather than accepting every form understood by
the current in-memory representation under an older ID.
Provided Methods§
Sourcefn is_supported_encoding(&self, id: &ArrayId) -> bool
fn is_supported_encoding(&self, id: &ArrayId) -> bool
Can this plugin emit an array with the given encoding.
By default, this is just the ID of the plugin, but can be overridden if this plugin instance supports reading/writing multiple arrays.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".