use crate::completion::{CompletionHandle, ContractResponse};
use crate::runtime::RuntimeResourceRef;
pub trait DataSource: Send + Sync {
type Sample: ?Sized + bb_ir::types::Storage;
type Error: std::error::Error + std::fmt::Display + Send + Sync + 'static;
#[allow(clippy::type_complexity)]
fn next_batch(
&mut self,
ctx: &mut RuntimeResourceRef<'_>,
completion: CompletionHandle<(Box<Self::Sample>, Box<Self::Sample>), Self::Error>,
) -> ContractResponse<(Box<Self::Sample>, Box<Self::Sample>), Self::Error>;
fn reset(
&mut self,
ctx: &mut RuntimeResourceRef<'_>,
completion: CompletionHandle<(), Self::Error>,
) -> ContractResponse<(), Self::Error>;
fn on_data_loaded(
&mut self,
ctx: &mut RuntimeResourceRef<'_>,
completion: CompletionHandle<(), Self::Error>,
) -> ContractResponse<(), Self::Error>;
}