Trait svc_storage::grpc::GrpcLinkService
source · pub trait GrpcLinkServicewhere
Self::LinkedResourceObject: ObjectType<Self::LinkedData> + PsqlType + PsqlSearch + LinkedResource<Self::LinkedData> + From<Ids> + From<Self::LinkedData> + Clone + Sync + Send + 'static,
Self::LinkedData: GrpcDataObjectType + TryFrom<Row> + 'static,
Self::ResourceObject: ObjectType<Self::Data> + PsqlType + PsqlSearch + SimpleResource<Self::Data> + From<Id> + From<Self::Data> + Clone + Sync + Send + 'static,
Self::Data: GrpcDataObjectType + TryFrom<Row> + 'static,
Self::OtherResourceObject: ObjectType<Self::OtherData> + PsqlType + PsqlSearch + SimpleResource<Self::OtherData> + From<Id> + From<Self::OtherData> + Clone + Sync + Send + 'static,
Self::OtherData: GrpcDataObjectType + TryFrom<Row> + 'static,
Self::OtherList: TryFrom<Vec<Row>>,
Status: From<<Self::LinkedData as TryFrom<Row>>::Error> + From<<Self::OtherList as TryFrom<Vec<Row>>>::Error>,{
type LinkedResourceObject;
type LinkedData;
type ResourceObject;
type Data;
type OtherResourceObject;
type OtherList;
type OtherData;
// Provided methods
fn generic_link<'life0, 'async_trait>(
&'life0 self,
id: String,
other_ids: Vec<Uuid>,
replace: bool
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn generic_unlink<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn generic_get_linked_ids<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + 'async_trait>>
where Self: Send + 'async_trait + Sync,
'life0: 'async_trait { ... }
fn generic_get_linked<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + 'async_trait>>
where Self: Send + 'async_trait + Sync,
'life0: 'async_trait { ... }
fn _get_linked<'async_trait>(
id: Id
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>>
where Self: Send + 'async_trait { ... }
fn generic_is_ready<'life0, 'async_trait>(
&'life0 self,
_request: Request<ReadyRequest>
) -> Pin<Box<dyn Future<Output = Result<Response<ReadyResponse>, Status>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Generic gRPC object traits to provide wrappers for common Resource functions
T: ResourceObject<super::Data> Resource type of ‘super’ resource being linked
U: super::Data Data type of ‘super’ resource being linked
V: ResourceObject<Data> combined resource Resource type
W: Data combined resource Data type
Required Associated Types§
sourcetype LinkedResourceObject
type LinkedResourceObject
The type expected for the ResourceObject<Data> type of the linked resource.
Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch,
LinkedResource<Self::Data>, From<Id>, From<Self::Data>,
From<Self::UpdateObject>, Clone, sync, send
sourcetype LinkedData
type LinkedData
The type expected for the Data struct of the linked resource.
Must implement; GrpcDataObjectType, TryFrom<Row>
sourcetype ResourceObject
type ResourceObject
The type expected for the ResourceObject<Data> type of the ‘main’ resource.
Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch,
SimpleResource<Self::Data>, From<Id>, From<Self::Data>,
From<Self::UpdateObject>, Clone, sync, send
sourcetype Data
type Data
The type expected for the Data struct of the ‘main’ resource.
Must implement; GrpcDataObjectType, TryFrom<Row>
sourcetype OtherResourceObject
type OtherResourceObject
The type expected for the ResourceObject<Data> type of the ‘other’ resource.
Must implement; ObjectType<Self::Data>, PsqlType, PsqlSearch,
SimpleResource<Self::Data>, From<Id>, From<Self::Data>,
From<Self::UpdateObject>, Clone, sync, send
Provided Methods§
sourcefn generic_link<'life0, 'async_trait>(
&'life0 self,
id: String,
other_ids: Vec<Uuid>,
replace: bool
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn generic_link<'life0, 'async_trait>(
&'life0 self,
id: String,
other_ids: Vec<Uuid>,
replace: bool
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Returns an empty tonic gRCP Response on success
Inserts new entries into the database for each id, other_id combination if they don’t exist yet.
When replace is set to true, all existing entries will be removed first.
The existence of the provided resource id will be validated before insert.
Errors
Returns Status with Code::NotFound if no record exists for the given id.
Returns Status with Code::Internal if the provided Id can not be converted to a uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.
sourcefn generic_unlink<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn generic_unlink<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<()>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Returns an empty tonic gRCP Response on success
Removes all entries from the link table for the given id.
The existence of the provided resource id will be validated before unlink.
Errors
Returns Status with Code::NotFound if no record exists for the given id.
Returns Status with Code::Internal if the provided Id can not be converted to valid uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.
sourcefn generic_get_linked_ids<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + 'async_trait>>
fn generic_get_linked_ids<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<IdList>, Status>> + Send + 'async_trait>>
Returns a tonic gRCP Response with IdList of found ids on success
The existence of the provided resource id will be validated first.
Errors
Returns Status with Code::NotFound if no record exists for the given id.
Returns Status with Code::Internal if the provided Id can not be converted to a uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.
sourcefn generic_get_linked<'life0, 'async_trait>(
&'life0 self,
request: Request<Id>
) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + 'async_trait>>
fn generic_get_linked<'life0, 'async_trait>( &'life0 self, request: Request<Id> ) -> Pin<Box<dyn Future<Output = Result<Response<Self::OtherList>, Status>> + Send + 'async_trait>>
Returns a tonic gRCP Response containing an object of provided type [Self::OtherList].
The existence of the provided resource id will be validated first.
Errors
Returns Status with Code::NotFound if no record exists for the given id.
Returns Status with Code::Internal if the provided Id can not be converted to a uuid::Uuid.
Returns Status with Code::Internal if any error is returned from the db search result.
sourcefn _get_linked<'async_trait>(
id: Id
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
fn _get_linked<'async_trait>(
id: Id
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ArrErr>> + Send + 'async_trait>>where
Self: Send + 'async_trait,
Internal function used for generic_get_linked_ids and generic_get_linked
sourcefn generic_is_ready<'life0, 'async_trait>(
&'life0 self,
_request: Request<ReadyRequest>
) -> Pin<Box<dyn Future<Output = Result<Response<ReadyResponse>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn generic_is_ready<'life0, 'async_trait>(
&'life0 self,
_request: Request<ReadyRequest>
) -> Pin<Box<dyn Future<Output = Result<Response<ReadyResponse>, Status>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Returns ready:true when service is available