fast_pull/base/
puller.rs

1use crate::ProgressEntry;
2use bytes::Bytes;
3use core::time::Duration;
4use futures::TryStream;
5
6pub trait PullStream<E>:
7    TryStream<Ok = Bytes, Error = (E, Option<Duration>)> + Send + Unpin
8{
9}
10impl<E, T: TryStream<Ok = Bytes, Error = (E, Option<Duration>)> + Send + Unpin> PullStream<E>
11    for T
12{
13}
14pub type PullResult<E, S> = Result<S, (E, Option<Duration>)>;
15
16pub trait RandPuller: Send + Clone {
17    type Error: Send;
18    fn pull(
19        &mut self,
20        range: &ProgressEntry,
21    ) -> impl Future<Output = PullResult<Self::Error, impl PullStream<Self::Error>>> + Send;
22}
23
24pub trait SeqPuller: Send {
25    type Error: Send;
26    fn pull(
27        &mut self,
28    ) -> impl Future<Output = PullResult<Self::Error, impl PullStream<Self::Error>>> + Send;
29}