Trait openvet_common::storage::Storage
source · pub trait Storage: Sized {
// Required methods
async fn ping(self, context: Context, message: String) -> String;
async fn version(self, context: Context) -> Version;
async fn crate_write(self, context: Context, name: CrateInfo);
async fn crate_list(self, context: Context) -> BTreeSet<CrateName>;
async fn crate_info(
self,
context: Context,
krate: CrateName,
) -> Option<CrateInfo>;
async fn object_get(self, context: Context, hash: Checksum) -> Option<Bytes>;
async fn object_exists(self, context: Context, hash: Checksum) -> bool;
async fn object_write(self, context: Context, bytes: Bytes) -> Checksum;
async fn object_gc(self, context: Context);
async fn sources_missing(
self,
context: Context,
limit: usize,
) -> BTreeSet<CrateVersion>;
async fn crate_tree_write(
self,
context: Context,
krate: CrateVersion,
root: Node,
);
// Provided method
fn serve(self) -> ServeStorage<Self> { ... }
}Required Methods§
sourceasync fn ping(self, context: Context, message: String) -> String
async fn ping(self, context: Context, message: String) -> String
Ping message, should respond with the same message.
sourceasync fn crate_write(self, context: Context, name: CrateInfo)
async fn crate_write(self, context: Context, name: CrateInfo)
Create a crate, if it does not exist.
sourceasync fn crate_list(self, context: Context) -> BTreeSet<CrateName>
async fn crate_list(self, context: Context) -> BTreeSet<CrateName>
Get list of crates
sourceasync fn crate_info(
self,
context: Context,
krate: CrateName,
) -> Option<CrateInfo>
async fn crate_info( self, context: Context, krate: CrateName, ) -> Option<CrateInfo>
Get full crate info
sourceasync fn object_get(self, context: Context, hash: Checksum) -> Option<Bytes>
async fn object_get(self, context: Context, hash: Checksum) -> Option<Bytes>
Get an object
sourceasync fn object_exists(self, context: Context, hash: Checksum) -> bool
async fn object_exists(self, context: Context, hash: Checksum) -> bool
Check if an object exists
sourceasync fn object_write(self, context: Context, bytes: Bytes) -> Checksum
async fn object_write(self, context: Context, bytes: Bytes) -> Checksum
Write an object
sourceasync fn sources_missing(
self,
context: Context,
limit: usize,
) -> BTreeSet<CrateVersion>
async fn sources_missing( self, context: Context, limit: usize, ) -> BTreeSet<CrateVersion>
List all crate-versions which are missing sources
async fn crate_tree_write( self, context: Context, krate: CrateVersion, root: Node, )
Provided Methods§
sourcefn serve(self) -> ServeStorage<Self>
fn serve(self) -> ServeStorage<Self>
Returns a serving function to use with InFlightRequest::execute.
Object Safety§
This trait is not object safe.