Skip to main content

NamespaceRecord

Struct NamespaceRecord 

Source
pub struct NamespaceRecord {
    pub name: String,
    pub created_at: DateTime<Utc>,
    pub last_seen: DateTime<Utc>,
    pub origin: NamespaceOrigin,
    pub config: NamespaceConfig,
    pub placement: NamespacePlacement,
    pub state: NamespaceState,
}
Expand description

One durable namespace registry entry.

The control-plane source of truth for “this namespace exists”: listable, failover-survivable, and the anchor for future per-namespace policy (quotas, placement, retention).

Fields§

§name: String

The namespace name. Free-form, exactly as carried on the wire (StartWorkflowRequest.namespace / RegisterWorker.namespaces). Primary key.

§created_at: DateTime<Utc>

When the registry first minted this namespace (first reference).

§last_seen: DateTime<Utc>

Most recent time a worker/start referenced it — refreshed on mint-touch. Drives staleness/observability; never drives reaping while durable state exists.

§origin: NamespaceOrigin

How it came to exist: worker-mint, explicit POST, or inferred-from-state.

§config: NamespaceConfig

Reserved per-namespace policy blob (retention, quotas, auth scope). Phase 1 writes NamespaceConfig::default; Phase 2 fills it. Present day-one to avoid a later data migration.

§placement: NamespacePlacement

Reserved placement directive (node/shard-range affinity). Phase 1 is NamespacePlacement::Unplaced. Present day-one so physical isolation is a later policy, not a migration.

§state: NamespaceState

Lifecycle state, so a namespace can be retired (deprecate-before-delete) without losing its durable history.

Implementations§

Source§

impl NamespaceRecord

Source

pub fn new_minted( name: &str, origin: NamespaceOrigin, now: DateTime<Utc>, ) -> Self

Builds a freshly minted record for name.

created_at and last_seen are both set to now (a brand-new namespace has been seen exactly once, at creation), state is NamespaceState::Active, and config/placement take their reserved Phase-1 defaults.

Source

pub fn bump_last_seen(&mut self, now: DateTime<Utc>)

Advances last_seen to now, leaving every other field untouched.

Used by the idempotent mint-touch path: re-referencing an existing namespace refreshes its staleness signal without altering existence, origin, or lifecycle state. now is applied unconditionally — callers supply a monotonic clock.

Source

pub fn encode(&self) -> Result<Vec<u8>, StoreError>

Encodes the record to opaque bytes for store persistence.

Mirrors the package codec: serde_json over a stable on-disk form with instants rendered as RFC 3339 text. The store backend never parses the result beyond NamespaceRecord::decode.

§Errors

Returns StoreError::Serialization if the record cannot be encoded.

Source

pub fn decode(bytes: &[u8]) -> Result<Self, StoreError>

Decodes a record previously produced by NamespaceRecord::encode.

§Errors

Returns StoreError::Serialization if bytes is not a valid encoded record (malformed JSON or an unparseable instant).

Trait Implementations§

Source§

impl Clone for NamespaceRecord

Source§

fn clone(&self) -> NamespaceRecord

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NamespaceRecord

Source§

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

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

impl Eq for NamespaceRecord

Source§

impl PartialEq for NamespaceRecord

Source§

fn eq(&self, other: &NamespaceRecord) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NamespaceRecord

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.