pub struct ClusterState {
pub raft: Arc<OrcaRaft>,
pub store: Arc<ClusterStore>,
}Expand description
Cluster state manager wrapping Raft consensus.
Fields§
§raft: Arc<OrcaRaft>The Raft node.
store: Arc<ClusterStore>Local state store (reads served directly).
Implementations§
Source§impl ClusterState
impl ClusterState
Sourcepub fn new(raft: Arc<OrcaRaft>, store: Arc<ClusterStore>) -> Self
pub fn new(raft: Arc<OrcaRaft>, store: Arc<ClusterStore>) -> Self
Create a new cluster state manager.
Sourcepub fn get_services(&self) -> Result<HashMap<String, ServiceConfig>>
pub fn get_services(&self) -> Result<HashMap<String, ServiceConfig>>
Get all service configs.
Sourcepub fn get_all_assignments(&self) -> Result<Vec<Assignment>>
pub fn get_all_assignments(&self) -> Result<Vec<Assignment>>
Get all workload assignments.
Sourcepub fn get_assignments(&self, service: &str) -> Result<Vec<Assignment>>
pub fn get_assignments(&self, service: &str) -> Result<Vec<Assignment>>
Get assignments for a specific service.
Sourcepub fn get_node_assignments(&self, node_id: u64) -> Result<Vec<Assignment>>
pub fn get_node_assignments(&self, node_id: u64) -> Result<Vec<Assignment>>
Get assignments for a specific node.
Sourcepub async fn propose_deploy(&self, services: &[ServiceConfig]) -> Result<()>
pub async fn propose_deploy(&self, services: &[ServiceConfig]) -> Result<()>
Deploy services — proposes SetService entries to Raft.
Sourcepub async fn register_node(
&self,
node_id: u64,
address: String,
labels: HashMap<String, String>,
) -> Result<()>
pub async fn register_node( &self, node_id: u64, address: String, labels: HashMap<String, String>, ) -> Result<()>
Register a node in the cluster.
Auto Trait Implementations§
impl Freeze for ClusterState
impl !RefUnwindSafe for ClusterState
impl Send for ClusterState
impl Sync for ClusterState
impl Unpin for ClusterState
impl UnsafeUnpin for ClusterState
impl !UnwindSafe for ClusterState
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> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
Set the “status” flags for the
self file descriptor. Read moreSource§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> 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::Request