parallel_processor/buckets/readers/
lock_free_decoder.rs1use crate::buckets::readers::binary_reader::ChunkDecoder;
2use crate::buckets::writers::lock_free_binary_writer::LOCK_FREE_BUCKET_MAGIC;
3use crate::memory_fs::file::reader::FileReader;
4use std::io::{Read, Take};
5
6pub struct LockFreeStreamDecoder;
7
8impl ChunkDecoder for LockFreeStreamDecoder {
9 const MAGIC_HEADER: &'static [u8; 16] = LOCK_FREE_BUCKET_MAGIC;
10 type ReaderType = Take<FileReader>;
11
12 fn decode_stream(reader: FileReader, size: u64) -> Self::ReaderType {
13 reader.take(size)
14 }
15
16 fn dispose_stream(stream: Self::ReaderType) -> FileReader {
17 stream.into_inner()
18 }
19}