LayoutStrategy

Trait LayoutStrategy 

Source
pub trait LayoutStrategy:
    'static
    + Send
    + Sync {
    // Required method
    fn write_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 ArrayContext,
        sequence_writer: SequenceWriter,
        stream: SendableSequentialStream,
    ) -> Pin<Box<dyn Future<Output = VortexResult<LayoutRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

Source

fn write_stream<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 ArrayContext, sequence_writer: SequenceWriter, stream: SendableSequentialStream, ) -> Pin<Box<dyn Future<Output = VortexResult<LayoutRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Asynchronously process an ordered stream of array chunks, emitting them into a sink and returning the Layout instance that can be parsed to retrieve the data from rest.

This trait uses the #[async_trait] attribute to denote that trait objects of this type can be Boxed or Arced and shared around. Commonly, these strategies are composed to form a pipeline of operations, each of which modifies the chunk stream in some way before passing the data on to a downstream writer.

§Blocking operations

This is an async trait method, which will return a BoxFuture that you can await from any runtime. Implementations should avoid directly performing blocking work within the write_stream, and should instead spawn it onto an appropriate runtime or threadpool dedicated to such work.

Such operations are common, and include things like compression and parsing large blobs of data, or serializing very large messages to flatbuffers.

Consider accepting a TaskExecutor as an input to your strategy to support spawning this work in the background.

Implementors§