pub struct ScopeKey {
pub namespace: String,
pub domain: Option<String>,
pub workspace_id: Option<String>,
pub repo_id: Option<String>,
}Expand description
Compact, hashable representation of all scope dimensions.
This is the canonical partition key for the stack. Two ScopeKeys
are equal iff all four fields match exactly.
§Display format
namespace[/domain][@workspace_id][#repo_id]
Examples:
prod— namespace onlyprod/code— with domainprod/code@ws1#myrepo— fully specified
Fields§
§namespace: String§domain: Option<String>§workspace_id: Option<String>§repo_id: Option<String>Implementations§
Source§impl ScopeKey
impl ScopeKey
Sourcepub fn namespace_only(ns: impl Into<String>) -> Self
pub fn namespace_only(ns: impl Into<String>) -> Self
Create from just a namespace (all other dimensions None).
Sourcepub fn from_legacy_namespace(namespace: impl Into<String>) -> Self
pub fn from_legacy_namespace(namespace: impl Into<String>) -> Self
Deterministic migration from a legacy bare namespace string.
This is the canonical namespace→ScopeKey mapping. All bridge, importer, and test code must use this for legacy namespace conversion.
Mapping: "foo" → ScopeKey { namespace: "foo", domain: None, workspace_id: None, repo_id: None }
Sourcepub fn to_legacy_namespace(&self) -> &str
pub fn to_legacy_namespace(&self) -> &str
Reverse mapping: extract the legacy namespace string.
This is only valid for ScopeKeys that were created from a legacy namespace
(i.e. all dimensions except namespace are None). For multi-dimensional
scopes, use the namespace field directly.
Sourcepub fn is_namespace_only(&self) -> bool
pub fn is_namespace_only(&self) -> bool
Returns true if this scope has only a namespace (no domain/workspace/repo).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ScopeKey
impl<'de> Deserialize<'de> for ScopeKey
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>,
Source§impl JsonSchema for ScopeKey
impl JsonSchema for ScopeKey
Source§fn schema_name() -> String
fn schema_name() -> String
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn is_referenceable() -> bool
fn is_referenceable() -> bool
$ref keyword. Read more