pub struct Transfer { /* private fields */ }Expand description
Concurrent transfer queue. One Transfer is bound to one LFS endpoint
(the api client) and one local store; create more if you need more.
Implementations§
Source§impl Transfer
impl Transfer
Sourcepub fn new(api: ApiClient, store: Store, config: TransferConfig) -> Self
pub fn new(api: ApiClient, store: Store, config: TransferConfig) -> Self
Build a transfer queue. The reqwest::Client used for the action-URL
transfers is created fresh; if you need to share a connection pool,
use with_http_client.
Sourcepub fn with_http_client(
api: ApiClient,
store: Store,
config: TransferConfig,
http: Client,
) -> Self
pub fn with_http_client( api: ApiClient, store: Store, config: TransferConfig, http: Client, ) -> Self
Build a transfer queue around an existing reqwest::Client.
Use this when the caller already has an HTTP client wired up for the LFS endpoint (with custom TLS config, headers, cookies, etc.) and wants the transfer queue to reuse its connection pool rather than spawn a fresh one.
Sourcepub async fn download(
&self,
objects: Vec<ObjectSpec>,
ref: Option<Ref>,
events: Option<UnboundedSender<Event>>,
) -> Result<Report, TransferError>
pub async fn download( &self, objects: Vec<ObjectSpec>, ref: Option<Ref>, events: Option<UnboundedSender<Event>>, ) -> Result<Report, TransferError>
Download the given objects into the local store. Each object is
hash-verified by the store before being committed; corrupt downloads
are surfaced in Report::failed.
Sourcepub async fn upload(
&self,
objects: Vec<ObjectSpec>,
ref: Option<Ref>,
events: Option<UnboundedSender<Event>>,
) -> Result<Report, TransferError>
pub async fn upload( &self, objects: Vec<ObjectSpec>, ref: Option<Ref>, events: Option<UnboundedSender<Event>>, ) -> Result<Report, TransferError>
Upload the given objects from the local store. Objects the server
already has are reported in Report::succeeded without any byte
transfer.