use std::future::Future;
use std::pin::Pin;
use bytes::Bytes;
use xet_client::cas_types::FileRange;
use xet_runtime::utils::adjustable_semaphore::AdjustableSemaphorePermit;
use super::super::Result;
#[cfg(not(target_family = "wasm"))]
pub type DataFuture = Pin<Box<dyn Future<Output = Result<Bytes>> + Send + 'static>>;
#[cfg(target_family = "wasm")]
pub type DataFuture = Pin<Box<dyn Future<Output = Result<Bytes>> + 'static>>;
#[cfg_attr(not(target_family = "wasm"), async_trait::async_trait)]
#[cfg_attr(target_family = "wasm", async_trait::async_trait(?Send))]
pub trait DataWriter: Send + 'static {
async fn set_next_term_data_source(
&mut self,
byte_range: FileRange,
permit: Option<AdjustableSemaphorePermit>,
data_future: DataFuture,
) -> Result<()>;
async fn finish(mut self: Box<Self>) -> Result<u64>;
}