pub struct ResourceGroupRegistry { /* private fields */ }Expand description
Node-local registry of resource groups (S1E-002), with configured defaults for every workload class (§13.1 queue set).
The control and replication groups are pinned: they cannot be removed
and cannot be re-registered without reserved (max_concurrency > 0 and
memory_bytes > 0) capacity — spec §13.1 “control and replication have
reserved capacity” and §4.9 bounded resources.
Serde form is a JSON/object map of name → group (sorted by name, so the serialized form is deterministic) for later cluster-settings replication (S1F-001). Deserialization re-asserts the pinned defaults: a replicated settings document that omits or starves the control/replication groups is rejected rather than applied.
Implementations§
Source§impl ResourceGroupRegistry
impl ResourceGroupRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty registry (no defaults). Prefer with_defaults
for any serving node.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
A registry seeded with the configured default group of every workload class (§13.1), control and replication pinned with reserved capacity.
Sourcepub fn register(&self, group: ResourceGroup) -> Result<(), ResourceError>
pub fn register(&self, group: ResourceGroup) -> Result<(), ResourceError>
Registers (or replaces) a group after validation. Replacing a pinned
control/replication group is rejected unless the replacement keeps
reserved (max_concurrency > 0 and memory_bytes > 0) capacity.
Sourcepub fn get(&self, name: &str) -> Option<ResourceGroup>
pub fn get(&self, name: &str) -> Option<ResourceGroup>
Looks up a group by name.
Sourcepub fn lookup(&self, name: &str) -> Result<ResourceGroup, ResourceError>
pub fn lookup(&self, name: &str) -> Result<ResourceGroup, ResourceError>
Like get, but a typed error for the not-found case.
Trait Implementations§
Source§impl Debug for ResourceGroupRegistry
impl Debug for ResourceGroupRegistry
Source§impl Default for ResourceGroupRegistry
impl Default for ResourceGroupRegistry
Source§impl<'de> Deserialize<'de> for ResourceGroupRegistry
impl<'de> Deserialize<'de> for ResourceGroupRegistry
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Restores a registry from its map form, then re-asserts the pinned control/replication defaults: a document that omits or starves them is rejected (reserved capacity is a safety invariant, not a preference).
Auto Trait Implementations§
impl !Freeze for ResourceGroupRegistry
impl !RefUnwindSafe for ResourceGroupRegistry
impl Send for ResourceGroupRegistry
impl Sync for ResourceGroupRegistry
impl Unpin for ResourceGroupRegistry
impl UnsafeUnpin for ResourceGroupRegistry
impl UnwindSafe for ResourceGroupRegistry
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
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more