pub struct TenantCtx {Show 17 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 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.
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_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_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.