mod adaptive;
mod full;
mod partitioned;
pub use adaptive::{AdaptiveIndexWriter, DEFAULT_SPILL_THRESHOLD};
pub use full::FullIndexWriter;
pub use partitioned::PartitionedIndexWriter;
use crate::{
CompressionType, checksum::ChecksummedWriter, encryption::EncryptionProvider,
table::index_block::KeyedBlockHandle,
};
use alloc::sync::Arc;
#[cfg(not(feature = "std"))]
use alloc::{boxed::Box, vec::Vec};
pub trait BlockIndexWriter<W: crate::io::Write + crate::io::Seek> {
fn register_data_block(&mut self, block_handle: KeyedBlockHandle) -> crate::Result<()>;
fn finish(
self: Box<Self>,
file_writer: &mut crate::sfa::Writer<ChecksummedWriter<W>>,
) -> crate::Result<(usize, Vec<u8>)>;
fn use_compression(
self: Box<Self>,
compression: CompressionType,
) -> Box<dyn BlockIndexWriter<W>>;
fn use_restart_interval(self: Box<Self>, interval: u8) -> Box<dyn BlockIndexWriter<W>>;
fn use_partition_size(self: Box<Self>, size: u32) -> Box<dyn BlockIndexWriter<W>>;
fn use_encryption(
self: Box<Self>,
encryption: Option<Arc<dyn EncryptionProvider>>,
) -> Box<dyn BlockIndexWriter<W>>;
fn use_table_id(self: Box<Self>, table_id: crate::TableId) -> Box<dyn BlockIndexWriter<W>>;
fn use_ecc(
self: Box<Self>,
ecc: Option<crate::table::block::EccParams>,
) -> Box<dyn BlockIndexWriter<W>>;
}