Skip to main content

VTable

Trait VTable 

Source
pub trait VTable:
    'static
    + Clone
    + Send
    + Sync
    + Debug {
    type LayoutData: 'static + Clone + Send + Sync + Debug;
    type Metadata: SerializeMetadata + DeserializeMetadata + Debug;

    // Required methods
    fn id(&self) -> LayoutId;
    fn metadata(layout: &Layout<Self>) -> Self::Metadata;
    fn deserialize(
        &self,
        args: &LayoutDeserializeArgs<'_>,
        metadata: &<Self::Metadata as DeserializeMetadata>::Output,
    ) -> VortexResult<Self::LayoutData>;
    fn child_dtype(layout: &Layout<Self>, idx: usize) -> VortexResult<DType>;
    fn child_type(layout: &Layout<Self>, idx: usize) -> LayoutChildType;
    fn new_reader(
        layout: &Layout<Self>,
        name: Arc<str>,
        segment_source: Arc<dyn SegmentSource>,
        session: &VortexSession,
        ctx: &LayoutReaderContext,
    ) -> VortexResult<LayoutReaderRef>;

    // Provided method
    fn build(
        vtable: &Self,
        dtype: &DType,
        row_count: u64,
        metadata: &<Self::Metadata as DeserializeMetadata>::Output,
        segment_ids: Vec<SegmentId>,
        children: &dyn LayoutChildren,
        build_ctx: &LayoutBuildContext<'_>,
    ) -> VortexResult<Layout<Self>> { ... }
}
Expand description

Layout-specific behavior for a typed Layout.

Common serialized fields are stored by Layout. Implementations own only their layout-specific data, metadata codec, child typing, and reader construction.

Required Associated Types§

Source

type LayoutData: 'static + Clone + Send + Sync + Debug

Layout-specific data.

Source

type Metadata: SerializeMetadata + DeserializeMetadata + Debug

Serialized metadata type.

Required Methods§

Source

fn id(&self) -> LayoutId

Returns the globally unique layout ID.

Source

fn metadata(layout: &Layout<Self>) -> Self::Metadata

Returns the serializable metadata for a layout.

Source

fn deserialize( &self, args: &LayoutDeserializeArgs<'_>, metadata: &<Self::Metadata as DeserializeMetadata>::Output, ) -> VortexResult<Self::LayoutData>

Deserialize and validate layout-specific data.

Source

fn child_dtype(layout: &Layout<Self>, idx: usize) -> VortexResult<DType>

Returns the expected dtype of child idx.

Source

fn child_type(layout: &Layout<Self>, idx: usize) -> LayoutChildType

Returns the relationship between child idx and its parent.

Source

fn new_reader( layout: &Layout<Self>, name: Arc<str>, segment_source: Arc<dyn SegmentSource>, session: &VortexSession, ctx: &LayoutReaderContext, ) -> VortexResult<LayoutReaderRef>

Construct a reader for this layout.

Provided Methods§

Source

fn build( vtable: &Self, dtype: &DType, row_count: u64, metadata: &<Self::Metadata as DeserializeMetadata>::Output, segment_ids: Vec<SegmentId>, children: &dyn LayoutChildren, build_ctx: &LayoutBuildContext<'_>, ) -> VortexResult<Layout<Self>>

Construct a typed layout from deserialized common fields.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§