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) -> Self
pub fn with_identity(self, identity: TenantIdentity) -> Self
Updates the identity fields to match the provided value.
Source§impl TenantCtx
impl TenantCtx
Sourcepub fn new(env: EnvId, tenant: TenantId) -> Self
pub fn new(env: EnvId, tenant: TenantId) -> Self
Creates a new tenant context with the provided environment and tenant identifiers.
Sourcepub fn with_team(self, team: Option<TeamId>) -> Self
pub fn with_team(self, team: Option<TeamId>) -> Self
Updates the team information ensuring legacy and shared fields stay aligned.
Sourcepub fn with_user(self, user: Option<UserId>) -> Self
pub fn with_user(self, user: Option<UserId>) -> Self
Updates the user information ensuring legacy and shared fields stay aligned.
Sourcepub fn with_session(self, session: impl Into<String>) -> Self
pub fn with_session(self, session: impl Into<String>) -> Self
Updates the session identifier.
Sourcepub fn with_provider(self, provider: impl Into<String>) -> Self
pub fn with_provider(self, provider: impl Into<String>) -> Self
Updates the provider identifier.
Sourcepub fn with_attributes(self, attributes: BTreeMap<String, String>) -> Self
pub fn with_attributes(self, attributes: BTreeMap<String, String>) -> Self
Attaches or replaces the attributes map.
Sourcepub fn with_impersonation(self, impersonation: Option<Impersonation>) -> Self
pub fn with_impersonation(self, impersonation: Option<Impersonation>) -> Self
Sets the impersonation context.
Sourcepub fn with_attempt(self, attempt: u32) -> Self
pub fn with_attempt(self, attempt: u32) -> Self
Returns a copy of the context with the provided attempt value.
Sourcepub fn with_deadline(self, deadline: Option<InvocationDeadline>) -> Self
pub fn with_deadline(self, deadline: Option<InvocationDeadline>) -> Self
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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl From<&TenantCtx> for TenantContext
impl From<&TenantCtx> for TenantContext
Source§impl From<&TenantCtx> for TenantIdentity
impl From<&TenantCtx> for TenantIdentity
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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.