pub struct NamespaceGuard { /* private fields */ }Expand description
Adapter-boundary guard shared by API, stream, and worker transports.
Implementations§
Source§impl NamespaceGuard
impl NamespaceGuard
Sourcepub const fn new(resolver: NamespaceResolver) -> Self
pub const fn new(resolver: NamespaceResolver) -> Self
Build a guard from the shared namespace resolver.
Sourcepub const fn resolver(&self) -> &NamespaceResolver
pub const fn resolver(&self) -> &NamespaceResolver
Borrow the resolver backing this guard.
Sourcepub async fn scope(
&self,
caller: &CallerIdentity,
operation: &NamespaceOperation<'_>,
) -> Result<ScopedEngine, ServerError>
pub async fn scope( &self, caller: &CallerIdentity, operation: &NamespaceOperation<'_>, ) -> Result<ScopedEngine, ServerError>
Authorize and scope an operation before any engine method can be called.
Workflow-targeted operations verify durable ownership, which reads the target workflow’s recorded history through the resolver’s ownership source.
§Errors
Returns ServerError::Namespace (namespace_denied) when the caller
has no grant for the requested namespace or a subscription selects
another namespace. Returns a not_found wire error when the requested
namespace is granted but a targeted workflow is not visible in it —
foreign-owned and nonexistent workflows are deliberately
indistinguishable so the guard never leaks cross-tenant existence.
Authorize a caller for a single namespace by name, returning the resolved namespace if the grant allows it.
This is the SAME grant check the access hop runs (NamespaceResolver::resolve):
the operator (all-namespaces) is authorized for any name, an enumerated
caller only for a granted one, and single-tenant mode only for the
configured namespace. It carries no workflow/schedule target, so it never
reaches durable ownership — the control-plane create path (POST /namespaces) authorizes namespace existence, not a per-resource probe.
§Errors
Returns ServerError::Namespace (namespace_denied) when the caller
has no grant for namespace, so an unauthorized caller can never create
(or learn the existence of) a namespace it cannot access.
Sourcepub fn scope_worker_namespaces(
&self,
caller: &CallerIdentity,
namespaces: &[String],
) -> Result<Vec<String>, ServerError>
pub fn scope_worker_namespaces( &self, caller: &CallerIdentity, namespaces: &[String], ) -> Result<Vec<String>, ServerError>
Authorize every namespace in a worker registration’s set, returning the resolved namespaces in stable wire order with duplicates removed.
A worker serves a SET of namespaces (NODE affinity model). Each one is an independent correctness boundary, so the worker is authorized for it exactly as a single-namespace operation would be: the whole registration is denied if the caller lacks a grant for any namespace in the set. The set must be non-empty.
§Errors
Returns ServerError::Namespace (namespace_denied) when the set is
empty or the caller has no grant for some namespace in it.
Trait Implementations§
Source§impl Clone for NamespaceGuard
impl Clone for NamespaceGuard
Source§fn clone(&self) -> NamespaceGuard
fn clone(&self) -> NamespaceGuard
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for NamespaceGuard
impl !UnwindSafe for NamespaceGuard
impl Freeze for NamespaceGuard
impl Send for NamespaceGuard
impl Sync for NamespaceGuard
impl Unpin for NamespaceGuard
impl UnsafeUnpin for NamespaceGuard
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
T in a tonic::Request