pub trait DirectoryService: Send + Sync + 'static {
type GetStream: Stream<Item = Result<Directory, Status>> + Send + 'static;
// Required methods
fn get<'life0, 'async_trait>(
&'life0 self,
request: Request<GetDirectoryRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn put<'life0, 'async_trait>(
&'life0 self,
request: Request<Streaming<Directory>>,
) -> Pin<Box<dyn Future<Output = Result<Response<PutDirectoryResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
Generated trait containing gRPC methods that should be implemented for use with DirectoryServiceServer.
Required Associated Types§
Required Methods§
sourcefn get<'life0, 'async_trait>(
&'life0 self,
request: Request<GetDirectoryRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
request: Request<GetDirectoryRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::GetStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get retrieves a stream of Directory messages, by using the lookup parameters in GetDirectoryRequest. Keep in mind multiple DirectoryNodes in different parts of the graph might have the same digest if they have the same underlying contents, so sending subsequent ones can be omitted.
It is okay for certain implementations to only allow retrieval of Directory digests that are at the “root”, aka the last element that’s sent in a Put. This makes sense for implementations bundling closures of directories together in batches.
sourcefn put<'life0, 'async_trait>(
&'life0 self,
request: Request<Streaming<Directory>>,
) -> Pin<Box<dyn Future<Output = Result<Response<PutDirectoryResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn put<'life0, 'async_trait>(
&'life0 self,
request: Request<Streaming<Directory>>,
) -> Pin<Box<dyn Future<Output = Result<Response<PutDirectoryResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Put uploads a graph of Directory messages. Individual Directory messages need to be send in an order walking up from the leaves to the root - a Directory message can only refer to Directory messages previously sent in the same stream. Keep in mind multiple DirectoryNodes in different parts of the graph might have the same digest if they have the same underlying contents, so sending subsequent ones can be omitted. We might add a separate method, allowing to send partial graphs at a later time, if requiring to send the full graph turns out to be a problem.