Trait wezterm_blob_leases::BlobStorage
source · pub trait BlobStorage {
// Required methods
fn store(
&self,
content_id: ContentId,
data: &[u8],
lease_id: LeaseId
) -> Result<(), Error>;
fn lease_by_content(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<(), Error>;
fn get_data(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<Vec<u8>, Error>;
fn get_reader(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<BoxedReader, Error>;
fn advise_lease_dropped(
&self,
lease_id: LeaseId,
content_id: ContentId
) -> Result<(), Error>;
fn advise_of_pid(&self, pid: u32) -> Result<(), Error>;
fn advise_pid_terminated(&self, pid: u32) -> Result<(), Error>;
}
Expand description
Implements the actual storage mechanism for blobs
Required Methods§
sourcefn store(
&self,
content_id: ContentId,
data: &[u8],
lease_id: LeaseId
) -> Result<(), Error>
fn store( &self, content_id: ContentId, data: &[u8], lease_id: LeaseId ) -> Result<(), Error>
Store data with the provided content_id. lease_id is provided by the caller to identify this store. The underlying store is expected to dedup storing data with the same content_id.
sourcefn lease_by_content(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<(), Error>
fn lease_by_content( &self, content_id: ContentId, lease_id: LeaseId ) -> Result<(), Error>
Resolve the data associated with content_id. If found, establish a lease with the given lease_id. If not found, returns Err(Error::ContentNotFound)
sourcefn get_data(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<Vec<u8>, Error>
fn get_data( &self, content_id: ContentId, lease_id: LeaseId ) -> Result<Vec<u8>, Error>
Retrieves the data identified by content_id. lease_id is provided in order to advise the storage system which lease fetched it, so that it can choose to record that information to track the liveness of a lease
sourcefn get_reader(
&self,
content_id: ContentId,
lease_id: LeaseId
) -> Result<BoxedReader, Error>
fn get_reader( &self, content_id: ContentId, lease_id: LeaseId ) -> Result<BoxedReader, Error>
Retrieves the data identified by content_id as a readable+seekable buffered handle.
lease_id is provided in order to advise the storage system which lease fetched it, so that it can choose to record that information to track the liveness of a lease.
The returned handle serves to extend the lifetime of the lease.
sourcefn advise_lease_dropped(
&self,
lease_id: LeaseId,
content_id: ContentId
) -> Result<(), Error>
fn advise_lease_dropped( &self, lease_id: LeaseId, content_id: ContentId ) -> Result<(), Error>
Advises the storage manager that a particular lease has been dropped.