pub struct ControlGrpcServer { /* private fields */ }Expand description
Control gRPC server implementation
Implementations§
Source§impl ControlGrpcServer
impl ControlGrpcServer
pub fn new() -> Self
Sourcepub async fn get_http_port(&self) -> Option<u16>
pub async fn get_http_port(&self) -> Option<u16>
Get the registered HTTP port (if any)
Sourcepub async fn has_handler(&self, handler_type: &str, resource_name: &str) -> bool
pub async fn has_handler(&self, handler_type: &str, resource_name: &str) -> bool
Check if a handler is registered
Sourcepub async fn get_handlers(&self) -> Vec<HandlerRegistration>
pub async fn get_handlers(&self) -> Vec<HandlerRegistration>
Get all registered handlers
Sourcepub async fn wait_for_http_server(&self) -> Option<u16>
pub async fn wait_for_http_server(&self) -> Option<u16>
Wait for HTTP server to be registered
Sourcepub async fn send_task(
&self,
task: Task,
timeout: Duration,
) -> Result<TaskResult, String>
pub async fn send_task( &self, task: Task, timeout: Duration, ) -> Result<TaskResult, String>
Send a task to the application and wait for the result. This is used for all task types - the runtime must wait for the app to process before acknowledging to the platform (storage/cron/queue) or submitting responses (commands).
Sourcepub fn into_service(self) -> ControlServiceServer<Self>
pub fn into_service(self) -> ControlServiceServer<Self>
Convert to tonic service
Trait Implementations§
Source§impl Clone for ControlGrpcServer
impl Clone for ControlGrpcServer
Source§fn clone(&self) -> ControlGrpcServer
fn clone(&self) -> ControlGrpcServer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl ControlService for ControlGrpcServer
impl ControlService for ControlGrpcServer
Source§type WaitForTasksStream = Pin<Box<dyn Stream<Item = Result<Task, Status>> + Send>>
type WaitForTasksStream = Pin<Box<dyn Stream<Item = Result<Task, Status>> + Send>>
Server streaming response type for the WaitForTasks method.
Source§fn register_http_server<'life0, 'async_trait>(
&'life0 self,
request: Request<RegisterHttpServerRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<RegisterHttpServerResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_http_server<'life0, 'async_trait>(
&'life0 self,
request: Request<RegisterHttpServerRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<RegisterHttpServerResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
App registers that it has an HTTP server listening on a port
Source§fn register_event_handler<'life0, 'async_trait>(
&'life0 self,
request: Request<RegisterEventHandlerRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<RegisterEventHandlerResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_event_handler<'life0, 'async_trait>(
&'life0 self,
request: Request<RegisterEventHandlerRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<RegisterEventHandlerResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
App registers an event handler for a specific resource
Source§fn wait_for_tasks<'life0, 'async_trait>(
&'life0 self,
request: Request<WaitForTasksRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::WaitForTasksStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_for_tasks<'life0, 'async_trait>(
&'life0 self,
request: Request<WaitForTasksRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::WaitForTasksStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
App waits for tasks - this is a server-streaming RPC
Runtime sends tasks as they arrive, app processes them
Source§fn send_task_result<'life0, 'async_trait>(
&'life0 self,
request: Request<SendTaskResultRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SendTaskResultResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_task_result<'life0, 'async_trait>(
&'life0 self,
request: Request<SendTaskResultRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<SendTaskResultResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
App sends result for a processed task
Auto Trait Implementations§
impl Freeze for ControlGrpcServer
impl !RefUnwindSafe for ControlGrpcServer
impl Send for ControlGrpcServer
impl Sync for ControlGrpcServer
impl Unpin for ControlGrpcServer
impl UnsafeUnpin for ControlGrpcServer
impl !UnwindSafe for ControlGrpcServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestCreates a shared type from an unshared type.