pub struct ControlPlane { /* private fields */ }Expand description
The ControlPlane service is the main entry point for the controller service.
Implementations§
Source§impl ControlPlane
ControlPlane implements the service trait for the controller service.
impl ControlPlane
ControlPlane implements the service trait for the controller service.
Sourcepub fn new(config: ControlPlaneSettings) -> Self
pub fn new(config: ControlPlaneSettings) -> Self
Create a new ControlPlane service instance This function initializes the ControlPlane with the given ID, servers, clients, and message processor. It also sets up the internal state, including the connections and channels.
§Arguments
id- The ID of the SLIM instance.servers- A vector of server configurations.clients- A vector of client configurations.drain_rx- A drain watch channel for graceful shutdown.message_processor- An Arc to the message processor instance.pubsub_servers- A slice of server configurations for pub/sub connections.
§Returns
A new instance of ControlPlane.
Sourcepub fn with_clients(self, clients: Vec<ClientConfig>) -> Self
pub fn with_clients(self, clients: Vec<ClientConfig>) -> Self
Take an existing ControlPlane instance and return a new one with the provided clients.
Sourcepub fn with_servers(self, servers: Vec<ServerConfig>) -> Self
pub fn with_servers(self, servers: Vec<ServerConfig>) -> Self
Take an existing ControlPlane instance and return a new one with the provided servers.
Sourcepub async fn run(&mut self) -> Result<(), ControllerError>
pub async fn run(&mut self) -> Result<(), ControllerError>
Run the clients and servers of the ControlPlane service. This function starts all the servers and clients defined in the ControlPlane.
§Returns
A Result indicating success or failure of the operation.
§Errors
If there is an error starting any of the servers or clients, it will return a ControllerError.
pub async fn shutdown(&self) -> Result<(), ControllerError>
Sourcepub fn stop(&mut self)
pub fn stop(&mut self)
Stop the ControlPlane service. This function stops all running listeners and cancels any ongoing operations. It cleans up the internal state and ensures that all resources are released properly.
Sourcepub async fn run_server(
&mut self,
config: ServerConfig,
) -> Result<(), ControllerError>
pub async fn run_server( &mut self, config: ServerConfig, ) -> Result<(), ControllerError>
Run a server configuration. This function starts a server using the provided server configuration. It checks if the server is already running and if not, it starts a new server.
Trait Implementations§
Source§impl Drop for ControlPlane
ControllerServiceInternal implements Drop trait to cancel all running listeners and
clean up resources.
impl Drop for ControlPlane
ControllerServiceInternal implements Drop trait to cancel all running listeners and clean up resources.
Auto Trait Implementations§
impl !Freeze for ControlPlane
impl !RefUnwindSafe for ControlPlane
impl Send for ControlPlane
impl Sync for ControlPlane
impl Unpin for ControlPlane
impl UnsafeUnpin for ControlPlane
impl !UnwindSafe for ControlPlane
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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>
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>
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>
T in a tonic::Request