Struct ciruela::blocks::ThreadedBlockReader
[−]
[src]
pub struct ThreadedBlockReader { /* fields omitted */ }
A default threaded block reader
It starts 40 threads (by default) and reads every block requested from server. The number of threads is large to allow disk subsystem to reorder and optimize requests. Threads should be quite cheap in rust.
Note: no prefetching or caching blocks implemented because it's expected that servers request different blocks. Also, we don't know which blocks will be requested because in the average case most blocks are already on server because of similar images. Also, OS file cache is good enough.
Methods
impl ThreadedBlockReader
[src]
fn new() -> ThreadedBlockReader
[src]
Create a reader with default number of threads (40 at the moment)
fn new_num_threads(num: usize) -> ThreadedBlockReader
[src]
Create a reader with specified number of threads
fn register_dir<P: AsRef<Path>>(
&self,
dir: P,
virtual_path: &VPath,
index_data: &[u8]
) -> Result<(), DirError>
[src]
&self,
dir: P,
virtual_path: &VPath,
index_data: &[u8]
) -> Result<(), DirError>
Register a filesystem directory to respond to get_block request from
Trait Implementations
impl Debug for ThreadedBlockReader
[src]
impl Clone for ThreadedBlockReader
[src]
fn clone(&self) -> ThreadedBlockReader
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl GetBlock for ThreadedBlockReader
[src]
type Data = Vec<u8>
A block data returned Read more
type Error = ReadError
Error returned by future Read more
type Future = FutureBlock
Future returned by read_block
fn read_block(&self, hash: BlockHash, _hint: BlockHint) -> FutureBlock
[src]
Read block by hash