pub trait ExternalChunk<T>: Sized + Iterator<Item = Result<T, Self::DeserializationError>> {
    type SerializationError: Error;
    type DeserializationError: Error;
    fn new(reader: Take<BufReader<File>>) -> Self;
fn dump(
        chunk_writer: &mut BufWriter<File>,
        items: impl IntoIterator<Item = T>
    ) -> Result<(), Self::SerializationError>; fn build(
        dir: &TempDir,
        items: impl IntoIterator<Item = T>,
        buf_size: Option<usize>
    ) -> Result<Self, ExternalChunkError<Self::SerializationError>> { ... } }
Expand description

External chunk interface. Provides methods for creating a chunk stored on file system and reading data from it.

Associated Types

Error returned when data serialization failed.

Error returned when data deserialization failed.

Required methods

Creates and instance of an external chunk.

Arguments
  • reader - The reader of the file the chunk is stored in

Dumps items to an external file.

Arguments
  • chunk_writer - The writer of the file the data should be dumped in
  • items - Items to be dumped

Provided methods

Builds an instance of an external chunk creating file and dumping the items to it.

Arguments
  • dir - Directory the chunk file is created in
  • items - Items to be dumped to the chunk
  • buf_size - File I/O buffer size

Implementors