pub trait TransferGate: Sync {
// Required methods
fn reserve(
&self,
len: u64,
) -> Pin<Box<dyn Future<Output = Option<RangeId>> + Send + '_>>;
fn release(&self, range: RangeId);
fn advised(&self, advice: &ServerAdvice);
}Expand description
The scheduler a gated transfer runs under (UploadClient::upload_gated): it holds the
memory each range in flight needs and hears the server’s advice. The push driver implements
it over the device’s UploadQueue, so every range any session sends
reserves its length against the one shared byte budget.
Required Methods§
Sourcefn reserve(
&self,
len: u64,
) -> Pin<Box<dyn Future<Output = Option<RangeId>> + Send + '_>>
fn reserve( &self, len: u64, ) -> Pin<Box<dyn Future<Output = Option<RangeId>> + Send + '_>>
Wait until the shared budget and the session’s ranges window can hold one more range of
len bytes, and reserve it. None means the gate holds no session for this transfer any
more (it was revoked); the range is then sent unreserved and the caller’s own report on
the session decides what happens to it.
Sourcefn release(&self, range: RangeId)
fn release(&self, range: RangeId)
The range range returned (answered, refused or cut): give its bytes back.
Sourcefn advised(&self, advice: &ServerAdvice)
fn advised(&self, advice: &ServerAdvice)
The server sent advice on this transfer’s session create or HEAD.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".