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(
id: ID,
servers: Vec<ServerConfig>,
clients: Vec<ClientConfig>,
drain_rx: Watch,
message_processor: Arc<MessageProcessor>,
) -> Self
pub fn new( id: ID, servers: Vec<ServerConfig>, clients: Vec<ClientConfig>, drain_rx: Watch, message_processor: Arc<MessageProcessor>, ) -> 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.
§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.
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 fn run_server(
&mut self,
config: ServerConfig,
) -> Result<(), ControllerError>
pub 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 Debug for ControlPlane
impl Debug for ControlPlane
Auto Trait Implementations§
impl Freeze for ControlPlane
impl !RefUnwindSafe for ControlPlane
impl Send for ControlPlane
impl Sync for ControlPlane
impl Unpin for ControlPlane
impl !UnwindSafe for ControlPlane
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> 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::RequestSource§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