Skip to main content

TenantCtx

Struct TenantCtx 

Source
pub struct TenantCtx {
Show 19 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 i18n_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: EnvId

Environment scope (for example dev, staging, or prod).

§tenant: TenantId

Tenant identifier for the current execution.

§tenant_id: TenantId

Stable 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.

§i18n_id: Option<String>

Optional locale/translation identifier for the session.

§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: u32

Attempt 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

Source

pub fn identity(&self) -> TenantIdentity

Returns the tenant identity derived from this context.

Source

pub fn tenant_context(&self) -> TenantContext

Returns the lightweight tenant context shared with tooling.

Source

pub fn impersonated_by(&self) -> Option<&Impersonation>

Returns the impersonation context, when present.

Source

pub fn with_identity(self, identity: TenantIdentity) -> TenantCtx

Updates the identity fields to match the provided value.

Source§

impl TenantCtx

Source

pub fn new(env: EnvId, tenant: TenantId) -> TenantCtx

Creates a new tenant context with the provided environment and tenant identifiers.

Source

pub fn with_team(self, team: Option<TeamId>) -> TenantCtx

Updates the team information ensuring legacy and shared fields stay aligned.

Source

pub fn with_user(self, user: Option<UserId>) -> TenantCtx

Updates the user information ensuring legacy and shared fields stay aligned.

Source

pub fn with_session(self, session: impl Into<String>) -> TenantCtx

Updates the session identifier.

Source

pub fn with_flow(self, flow: impl Into<String>) -> TenantCtx

Updates the flow identifier.

Source

pub fn with_node(self, node: impl Into<String>) -> TenantCtx

Updates the node identifier.

Source

pub fn with_provider(self, provider: impl Into<String>) -> TenantCtx

Updates the provider identifier.

Source

pub fn with_attributes(self, attributes: BTreeMap<String, String>) -> TenantCtx

Attaches or replaces the attributes map.

Source

pub fn with_impersonation( self, impersonation: Option<Impersonation>, ) -> TenantCtx

Sets the impersonation context.

Source

pub fn with_attempt(self, attempt: u32) -> TenantCtx

Returns a copy of the context with the provided attempt value.

Source

pub fn with_deadline(self, deadline: Option<InvocationDeadline>) -> TenantCtx

Updates the deadline metadata for subsequent invocations.

Source

pub fn session_id(&self) -> Option<&str>

Returns the session identifier, when present.

Source

pub fn flow_id(&self) -> Option<&str>

Returns the flow identifier, when present.

Source

pub fn node_id(&self) -> Option<&str>

Returns the node identifier, when present.

Source

pub fn provider_id(&self) -> Option<&str>

Returns the provider identifier, when present.

Trait Implementations§

Source§

impl Clone for TenantCtx

Source§

fn clone(&self) -> TenantCtx

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TenantCtx

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TenantCtx

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TenantCtx, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for TenantCtx

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl JsonSchema for TenantCtx

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl PartialEq for TenantCtx

Source§

fn eq(&self, other: &TenantCtx) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for TenantCtx

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl TryFrom<TenantCtx> for TenantCtx

Source§

type Error = GreenticError

The type returned in the event of a conversion error.
Source§

fn try_from(value: TenantCtx) -> Result<TenantCtx, GreenticError>

Performs the conversion.
Source§

impl Eq for TenantCtx

Source§

impl StructuralPartialEq for TenantCtx

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromBase64 for T
where T: for<'de> Deserialize<'de>,

Source§

fn from_base64<Input>(raw: &Input) -> Result<T, Error>
where Input: AsRef<[u8]> + ?Sized,

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
Source§

impl<T> GetSetFdFlags for T

Source§

fn get_fd_flags(&self) -> Result<FdFlags, Error>
where T: AsFilelike,

Query the “status” flags for the self file descriptor.
Source§

fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>
where T: AsFilelike,

Create a new SetFdFlags value for use with set_fd_flags. Read more
Source§

fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>
where T: AsFilelike,

Set the “status” flags for the self file descriptor. Read more
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<C> SignWithKey<String> for C
where C: ToBase64,

Source§

impl<T> ToBase64 for T
where T: Serialize,

Source§

fn to_base64(&self) -> Result<Cow<'_, str>, Error>

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,