1use arrow_array::{Array, ArrayRef, UInt32Array};
8use async_trait::async_trait;
9
10pub mod binary;
11pub mod dictionary;
12pub mod plain;
13
14use crate::ReadBatchParams;
15use lance_core::Result;
16
17#[async_trait]
19pub trait Encoder {
20 async fn encode(&mut self, array: &[&dyn Array]) -> Result<usize>;
22}
23
24#[async_trait]
26pub trait Decoder: Send + AsyncIndex<ReadBatchParams> {
27 async fn decode(&self) -> Result<ArrayRef>;
28
29 async fn take(&self, indices: &UInt32Array) -> Result<ArrayRef>;
31}
32
33#[async_trait]
34pub trait AsyncIndex<IndexType> {
35 type Output: Send + Sync;
36
37 async fn get(&self, index: IndexType) -> Self::Output;
38}