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§
Sourcefn serialize(
&self,
array: &ArrayRef,
session: &VortexSession,
) -> VortexResult<Option<Vec<u8>>>
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.
Sourcefn deserialize(
&self,
dtype: &DType,
len: usize,
metadata: &[u8],
buffers: &[BufferHandle],
children: &dyn ArrayChildren,
session: &VortexSession,
) -> VortexResult<ArrayRef>
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.