Struct avml::BlobUploader
source · pub struct BlobUploader { /* private fields */ }Expand description
Concurrently upload a Stream/File to an Azure Blob Store using a SAS URL.
use avml::BlobUploader;
let sas_url = Url::parse("https://contoso.com/container_name/blob_name?sas_token_here=1")
.expect("url parsing failed");
let path = Path::new("/tmp/image.lime");
let uploader = BlobUploader::new(&sas_url)?
.block_size(Some(100))
.concurrency(5);
uploader.upload_file(&path).await?;Implementations
sourceimpl BlobUploader
impl BlobUploader
pub fn new(sas: &Url) -> Result<Self, Error>
sourcepub fn with_blob_client(client: BlobClient) -> Self
pub fn with_blob_client(client: BlobClient) -> Self
Create a BlobUploader with a BlobClient from azure_storage_blobs.
Ref: https://docs.rs/azure_storage_blobs/latest/azure_storage_blobs/prelude/struct.BlobClient.html
sourcepub fn size(self, size: usize) -> Self
pub fn size(self, size: usize) -> Self
Specify the size of the file to upload (in bytes)
If the anticipated upload size is not specified, the maximum file uploaded will be approximately 5TB.
sourcepub fn block_size(self, block_size: Option<usize>) -> Self
pub fn block_size(self, block_size: Option<usize>) -> Self
Specify the block size in multiples of 1MB
If the block size is not specified and the size of the content to be uploaded is provided, the default block size will be calculated to fit within the bounds of the allowed number of blocks and the minimum minimum required to hit high-throughput block blob performance thresholds.
pub fn concurrency(self, concurrency: usize) -> Self
sourcepub async fn upload_file(self, filename: &Path) -> Result<(), Error>
pub async fn upload_file(self, filename: &Path) -> Result<(), Error>
Upload a file to Azure Blob Store using a fully qualified SAS token
Trait Implementations
sourceimpl Clone for BlobUploader
impl Clone for BlobUploader
sourcefn clone(&self) -> BlobUploader
fn clone(&self) -> BlobUploader
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more