This commit is contained in:
Dominik Werder
2024-09-06 22:25:33 +02:00
parent e701c1b379
commit 490c1ed0a0
3 changed files with 11 additions and 7 deletions
@@ -1,5 +1,6 @@
use err::thiserror; use err::thiserror;
use err::ThisError; use err::ThisError;
use futures_util::FutureExt;
use futures_util::Stream; use futures_util::Stream;
use items_2::binsdim0::BinsDim0; use items_2::binsdim0::BinsDim0;
use netpod::BinnedRange; use netpod::BinnedRange;
@@ -14,6 +15,14 @@ pub struct Reading {
fut: Pin<Box<dyn Future<Output = Result<BinsDim0<f32>, Box<dyn std::error::Error>>> + Send>>, fut: Pin<Box<dyn Future<Output = Result<BinsDim0<f32>, Box<dyn std::error::Error>>> + Send>>,
} }
impl Future for Reading {
type Output = Result<BinsDim0<f32>, Box<dyn std::error::Error>>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll<Self::Output> {
self.fut.poll_unpin(cx)
}
}
pub trait CacheReadProvider: Send { pub trait CacheReadProvider: Send {
fn read(&self) -> Reading; fn read(&self) -> Reading;
} }
-6
View File
@@ -52,12 +52,6 @@ impl TimeBinnedFromLayers {
range, range,
bin_len_layers bin_len_layers
); );
// cases:
// if this bin_len is a cachable bin_len:
// - have to attempt to read from cache.
// expect to read bins in a stream (randomize to small max len for testing).
// also, if this bin_len is a cachable bin_len:
// must produce bins missing in cache from separate stream.
let bin_len = DtMs::from_ms_u64(range.bin_len.ms()); let bin_len = DtMs::from_ms_u64(range.bin_len.ms());
if bin_len_layers.contains(&bin_len) { if bin_len_layers.contains(&bin_len) {
info!("{}::new bin_len in layers", Self::type_name()); info!("{}::new bin_len in layers", Self::type_name());
+2 -1
View File
@@ -64,6 +64,7 @@ impl Stream for GapFill {
// It does not attempt to read the given bin-len from a cache, because we just did attempt that. // It does not attempt to read the given bin-len from a cache, because we just did attempt that.
// It still requires that bin-len is cacheable. (NO! it must work with the layering that I passed!) // It still requires that bin-len is cacheable. (NO! it must work with the layering that I passed!)
// Then it finds the next cacheable // Then it finds the next cacheable
Ready(None) // Ready(None)
todo!("poll the already created cached reader, detect and fill in gaps, send off to cache-write")
} }
} }