Skip to main content

ArrayPlugin

Trait ArrayPlugin 

Source
pub trait ArrayPlugin:
    'static
    + Send
    + Sync {
    // Required methods
    fn id(&self) -> ArrayId;
    fn serialize(
        &self,
        array: &ArrayRef,
        session: &VortexSession,
    ) -> VortexResult<Option<Vec<u8>>>;
    fn deserialize(
        &self,
        dtype: &DType,
        len: usize,
        metadata: &[u8],
        buffers: &[BufferHandle],
        children: &dyn ArrayChildren,
        session: &VortexSession,
    ) -> VortexResult<ArrayRef>;
}
Expand description

Registry trait for ID-based deserialization of arrays.

Plugins are registered in the session by their ArrayId. When a serialized array is encountered, the session resolves the ID to the plugin and calls deserialize to reconstruct the value as an ArrayRef.

Required Methods§

Source

fn id(&self) -> ArrayId

Returns the ID for this array encoding.

Source

fn serialize( &self, array: &ArrayRef, session: &VortexSession, ) -> VortexResult<Option<Vec<u8>>>

Serialize the array metadata.

This function will only be called for arrays where the encoding ID matches that of this plugin.

Source

fn deserialize( &self, dtype: &DType, len: usize, metadata: &[u8], buffers: &[BufferHandle], children: &dyn ArrayChildren, session: &VortexSession, ) -> VortexResult<ArrayRef>

Deserialize an array from serialized components.

The returned array doesn’t necessary have to match this plugin’s encoding ID. This is useful for implementing back-compat logic and deserializing arrays into the new version.

Trait Implementations§

Source§

impl Debug for dyn ArrayPlugin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Implementors§