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§

source

async fn ping(self, context: Context, message: String) -> String

Ping message, should respond with the same message.

source

async fn version(self, context: Context) -> Version

Get version of storage server.

source

async fn crate_write(self, context: Context, name: CrateInfo)

Create a crate, if it does not exist.

source

async fn crate_list(self, context: Context) -> BTreeSet<CrateName>

Get list of crates

source

async fn crate_info( self, context: Context, krate: CrateName, ) -> Option<CrateInfo>

Get full crate info

source

async fn object_get(self, context: Context, hash: Checksum) -> Option<Bytes>

Get an object

source

async fn object_exists(self, context: Context, hash: Checksum) -> bool

Check if an object exists

source

async fn object_write(self, context: Context, bytes: Bytes) -> Checksum

Write an object

source

async fn object_gc(self, context: Context)

Run garbage collection over objects

source

async fn sources_missing( self, context: Context, limit: usize, ) -> BTreeSet<CrateVersion>

List all crate-versions which are missing sources

source

async fn crate_tree_write( self, context: Context, krate: CrateVersion, root: Node, )

Provided Methods§

source

fn serve(self) -> ServeStorage<Self>

Returns a serving function to use with InFlightRequest::execute.

Object Safety§

This trait is not object safe.

Implementors§