pub struct TenantCtx {Show 18 fields
pub env: EnvId,
pub tenant: TenantId,
pub tenant_id: TenantId,
pub team: Option<TeamId>,
pub team_id: Option<TeamId>,
pub user: Option<UserId>,
pub user_id: Option<UserId>,
pub session_id: Option<String>,
pub flow_id: Option<String>,
pub node_id: Option<String>,
pub provider_id: Option<String>,
pub trace_id: Option<String>,
pub correlation_id: Option<String>,
pub attributes: BTreeMap<String, String>,
pub deadline: Option<InvocationDeadline>,
pub attempt: u32,
pub idempotency_key: Option<String>,
pub impersonation: Option<Impersonation>,
}Expand description
Context that accompanies every invocation across Greentic runtimes.
Fields§
§env: EnvIdEnvironment scope (for example dev, staging, or prod).
tenant: TenantIdTenant identifier for the current execution.
tenant_id: TenantIdStable tenant identifier reference used across systems.
team: Option<TeamId>Optional team identifier scoped to the tenant.
team_id: Option<TeamId>Optional team identifier accessible via the shared schema.
user: Option<UserId>Optional user identifier scoped to the tenant.
user_id: Option<UserId>Optional user identifier aligned with the shared schema.
session_id: Option<String>Optional session identifier propagated by the runtime.
flow_id: Option<String>Optional flow identifier for the current execution.
node_id: Option<String>Optional node identifier within the flow.
provider_id: Option<String>Optional provider identifier describing the runtime surface.
trace_id: Option<String>Distributed tracing identifier when available.
correlation_id: Option<String>Correlation identifier for linking related events.
attributes: BTreeMap<String, String>Free-form attributes for routing and tracing.
deadline: Option<InvocationDeadline>Deadline when the invocation should finish.
attempt: u32Attempt counter for retried invocations (starting at zero).
idempotency_key: Option<String>Stable idempotency key propagated across retries.
impersonation: Option<Impersonation>Optional impersonation context describing the acting identity.
Implementations§
Source§impl TenantCtx
impl TenantCtx
Sourcepub fn identity(&self) -> TenantIdentity
pub fn identity(&self) -> TenantIdentity
Returns the tenant identity derived from this context.
Sourcepub fn tenant_context(&self) -> TenantContext
pub fn tenant_context(&self) -> TenantContext
Returns the lightweight tenant context shared with tooling.
Sourcepub fn impersonated_by(&self) -> Option<&Impersonation>
pub fn impersonated_by(&self) -> Option<&Impersonation>
Returns the impersonation context, when present.
Sourcepub fn with_identity(self, identity: TenantIdentity) -> TenantCtx
pub fn with_identity(self, identity: TenantIdentity) -> TenantCtx
Updates the identity fields to match the provided value.
Source§impl TenantCtx
impl TenantCtx
Sourcepub fn new(env: EnvId, tenant: TenantId) -> TenantCtx
pub fn new(env: EnvId, tenant: TenantId) -> TenantCtx
Creates a new tenant context with the provided environment and tenant identifiers.
Sourcepub fn with_team(self, team: Option<TeamId>) -> TenantCtx
pub fn with_team(self, team: Option<TeamId>) -> TenantCtx
Updates the team information ensuring legacy and shared fields stay aligned.
Sourcepub fn with_user(self, user: Option<UserId>) -> TenantCtx
pub fn with_user(self, user: Option<UserId>) -> TenantCtx
Updates the user information ensuring legacy and shared fields stay aligned.
Sourcepub fn with_session(self, session: impl Into<String>) -> TenantCtx
pub fn with_session(self, session: impl Into<String>) -> TenantCtx
Updates the session identifier.
Sourcepub fn with_provider(self, provider: impl Into<String>) -> TenantCtx
pub fn with_provider(self, provider: impl Into<String>) -> TenantCtx
Updates the provider identifier.
Sourcepub fn with_attributes(self, attributes: BTreeMap<String, String>) -> TenantCtx
pub fn with_attributes(self, attributes: BTreeMap<String, String>) -> TenantCtx
Attaches or replaces the attributes map.
Sourcepub fn with_impersonation(
self,
impersonation: Option<Impersonation>,
) -> TenantCtx
pub fn with_impersonation( self, impersonation: Option<Impersonation>, ) -> TenantCtx
Sets the impersonation context.
Sourcepub fn with_attempt(self, attempt: u32) -> TenantCtx
pub fn with_attempt(self, attempt: u32) -> TenantCtx
Returns a copy of the context with the provided attempt value.
Sourcepub fn with_deadline(self, deadline: Option<InvocationDeadline>) -> TenantCtx
pub fn with_deadline(self, deadline: Option<InvocationDeadline>) -> TenantCtx
Updates the deadline metadata for subsequent invocations.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
Returns the session identifier, when present.
Sourcepub fn provider_id(&self) -> Option<&str>
pub fn provider_id(&self) -> Option<&str>
Returns the provider identifier, when present.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TenantCtx
impl<'de> Deserialize<'de> for TenantCtx
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<TenantCtx, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<TenantCtx, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for TenantCtx
impl Serialize for TenantCtx
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for TenantCtx
impl StructuralPartialEq for TenantCtx
Auto Trait Implementations§
impl Freeze for TenantCtx
impl RefUnwindSafe for TenantCtx
impl Send for TenantCtx
impl Sync for TenantCtx
impl Unpin for TenantCtx
impl UnwindSafe for TenantCtx
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read moreSource§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> 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 moreSource§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