Skip to main content

ResourceGroupRegistry

Struct ResourceGroupRegistry 

Source
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

Source

pub fn new() -> Self

An empty registry (no defaults). Prefer with_defaults for any serving node.

Source

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.

Source

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.

Source

pub fn get(&self, name: &str) -> Option<ResourceGroup>

Looks up a group by name.

Source

pub fn lookup(&self, name: &str) -> Result<ResourceGroup, ResourceError>

Like get, but a typed error for the not-found case.

Source

pub fn remove(&self, name: &str) -> Result<bool, ResourceError>

Removes a group by name. Pinned control/replication groups cannot be removed (§13.1 reserved capacity). Returns true if a group was removed.

Source

pub fn names(&self) -> Vec<String>

Sorted names of every registered group.

Source

pub fn len(&self) -> usize

Number of registered groups.

Source

pub fn is_empty(&self) -> bool

Whether no groups are registered.

Trait Implementations§

Source§

impl Debug for ResourceGroupRegistry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ResourceGroupRegistry

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ResourceGroupRegistry

Source§

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).

Source§

impl Serialize for ResourceGroupRegistry

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serializes as a name → group map (BTreeMap order: deterministic).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.