Struct mz_adapter::catalog::Cluster
source · pub struct Cluster {
pub name: String,
pub id: StorageInstanceId,
pub config: ClusterConfig,
pub log_indexes: BTreeMap<LogVariant, GlobalId>,
pub linked_object_id: Option<GlobalId>,
pub bound_objects: BTreeSet<GlobalId>,
pub replica_id_by_name_: BTreeMap<String, ReplicaId>,
pub replicas_by_id_: BTreeMap<ReplicaId, ClusterReplica>,
pub owner_id: RoleId,
pub privileges: PrivilegeMap,
}
Fields§
§name: String
§id: StorageInstanceId
§config: ClusterConfig
§log_indexes: BTreeMap<LogVariant, GlobalId>
§linked_object_id: Option<GlobalId>
§bound_objects: BTreeSet<GlobalId>
Objects bound to this cluster. Does not include introspection source indexes.
replica_id_by_name_: BTreeMap<String, ReplicaId>
§replicas_by_id_: BTreeMap<ReplicaId, ClusterReplica>
§owner_id: RoleId
§privileges: PrivilegeMap
Implementations§
source§impl Cluster
impl Cluster
sourcepub fn role(&self) -> ClusterRole
pub fn role(&self) -> ClusterRole
The role of the cluster. Currently used to set alert severity.
sourcepub fn is_managed(&self) -> bool
pub fn is_managed(&self) -> bool
Returns true
if the cluster is a managed cluster.
sourcepub fn user_replicas(&self) -> impl Iterator<Item = &ClusterReplica>
pub fn user_replicas(&self) -> impl Iterator<Item = &ClusterReplica>
Lists the user replicas, which are those that do not have the internal flag set.
sourcepub fn replicas(&self) -> impl Iterator<Item = &ClusterReplica>
pub fn replicas(&self) -> impl Iterator<Item = &ClusterReplica>
Lists all replicas in the cluster
sourcepub fn replica(&self, replica_id: ReplicaId) -> Option<&ClusterReplica>
pub fn replica(&self, replica_id: ReplicaId) -> Option<&ClusterReplica>
Lookup a replica by ID.
sourcepub fn replica_mut(
&mut self,
replica_id: ReplicaId
) -> Option<&mut ClusterReplica>
pub fn replica_mut( &mut self, replica_id: ReplicaId ) -> Option<&mut ClusterReplica>
Lookup a replica by ID and return a mutable reference.
sourcepub fn replica_id(&self, name: &str) -> Option<ReplicaId>
pub fn replica_id(&self, name: &str) -> Option<ReplicaId>
Lookup a replica ID by name.
sourcepub fn insert_replica(&mut self, replica: ClusterReplica)
pub fn insert_replica(&mut self, replica: ClusterReplica)
Insert a new replica into the cluster.
Panics if the name or ID are reused.
sourcepub fn remove_replica(&mut self, replica_id: ReplicaId)
pub fn remove_replica(&mut self, replica_id: ReplicaId)
Remove a replica from this cluster.
Panics if the replica ID does not exist, or if the internal state is inconsistent.
sourcepub fn rename_replica(&mut self, replica_id: ReplicaId, to_name: String)
pub fn rename_replica(&mut self, replica_id: ReplicaId, to_name: String)
Renames a replica to a new name.
Panics if the replica ID is unknown, or new name is not unique, or the internal state is inconsistent.
Trait Implementations§
source§impl CatalogCluster<'_> for Cluster
impl CatalogCluster<'_> for Cluster
source§fn id(&self) -> StorageInstanceId
fn id(&self) -> StorageInstanceId
Returns a stable ID for the cluster.
source§fn linked_object_id(&self) -> Option<GlobalId>
fn linked_object_id(&self) -> Option<GlobalId>
Returns the ID of the object this cluster is linked to, if
any.
source§fn bound_objects(&self) -> &BTreeSet<GlobalId>
fn bound_objects(&self) -> &BTreeSet<GlobalId>
Returns the objects that are bound to this cluster.
source§fn replica_ids(&self) -> &BTreeMap<String, ReplicaId>
fn replica_ids(&self) -> &BTreeMap<String, ReplicaId>
Returns the replicas of the cluster as a map from replica name to
replica ID.
source§fn replicas(&self) -> Vec<&dyn CatalogClusterReplica<'_>>
fn replicas(&self) -> Vec<&dyn CatalogClusterReplica<'_>>
Returns the replicas of the cluster.
source§fn replica(&self, id: ReplicaId) -> &dyn CatalogClusterReplica<'_>
fn replica(&self, id: ReplicaId) -> &dyn CatalogClusterReplica<'_>
Returns the replica belonging to the cluster with replica ID
id
.source§fn privileges(&self) -> &PrivilegeMap
fn privileges(&self) -> &PrivilegeMap
Returns the privileges associated with the cluster.
source§fn is_managed(&self) -> bool
fn is_managed(&self) -> bool
Returns true if this cluster is a managed cluster.
source§impl Serialize for Cluster
impl Serialize for Cluster
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl RefUnwindSafe for Cluster
impl Send for Cluster
impl Sync for Cluster
impl Unpin for Cluster
impl UnwindSafe for Cluster
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> 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>
Wrap the input message
T
in a tonic::Request
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> PreferredContainer for Twhere
T: Clone,
impl<T> PreferredContainer for Twhere T: Clone,
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See
RustType::into_proto
.