disk_blob/blob/
mod.rs

1// Copyright (c) Microsoft Corporation.
2// Licensed under the MIT License.
3
4//! The blob trait and blob implementations.
5
6pub mod file;
7pub mod http;
8
9use async_trait::async_trait;
10use inspect::Inspect;
11
12/// Trait for a read-only blob.
13#[async_trait]
14pub trait Blob: Inspect {
15    /// Reads data at `offset` into `buf`.
16    ///
17    /// If `buf` is not completely filled, then this should return
18    /// [`std::io::ErrorKind::UnexpectedEof`] rather than any kind of partial
19    /// success.
20    async fn read(&self, buf: &mut [u8], offset: u64) -> std::io::Result<()>;
21
22    /// Returns the length of the blob in bytes.
23    fn len(&self) -> u64;
24}