pub struct TenantCtx {Show 13 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 trace_id: Option<String>,
pub correlation_id: Option<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.
trace_id: Option<String>Distributed tracing identifier when available.
correlation_id: Option<String>Correlation identifier for linking related events.
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 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_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.