pub struct TransactionContext {
pub transaction_id: String,
pub user_id: String,
pub session_id: String,
pub request_id: String,
pub started_at: DateTime<Utc>,
pub isolation_level: IsolationLevel,
pub state: TransactionState,
pub key_version: u32,
pub operations: Vec<String>,
pub metadata: HashMap<String, String>,
pub user_role: Option<String>,
pub client_ip: Option<String>,
}Expand description
Context for transaction with encryption awareness
Fields§
§transaction_id: StringUnique transaction ID
user_id: StringUser initiating transaction
session_id: StringUser session ID
request_id: StringHTTP request ID for correlation
started_at: DateTime<Utc>Transaction start time
isolation_level: IsolationLevelIsolation level
state: TransactionStateCurrent state
key_version: u32Encryption key version used in transaction
operations: Vec<String>List of operations in transaction
metadata: HashMap<String, String>Additional context data
user_role: Option<String>User role for access control
client_ip: Option<String>Client IP address for audit
Implementations§
Source§impl TransactionContext
impl TransactionContext
Sourcepub fn new(
user_id: impl Into<String>,
session_id: impl Into<String>,
request_id: impl Into<String>,
) -> Self
pub fn new( user_id: impl Into<String>, session_id: impl Into<String>, request_id: impl Into<String>, ) -> Self
Create new transaction context
Sourcepub fn with_isolation(self, level: IsolationLevel) -> Self
pub fn with_isolation(self, level: IsolationLevel) -> Self
Set isolation level
Sourcepub fn with_key_version(self, version: u32) -> Self
pub fn with_key_version(self, version: u32) -> Self
Set key version
Sourcepub fn add_operation(&mut self, operation: impl Into<String>)
pub fn add_operation(&mut self, operation: impl Into<String>)
Add operation to transaction
Sourcepub fn with_metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn with_metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> Self
Add metadata
Sourcepub fn with_client_ip(self, ip: impl Into<String>) -> Self
pub fn with_client_ip(self, ip: impl Into<String>) -> Self
Set client IP
Sourcepub fn operation_count(&self) -> usize
pub fn operation_count(&self) -> usize
Get operation count
Trait Implementations§
Source§impl Clone for TransactionContext
impl Clone for TransactionContext
Source§fn clone(&self) -> TransactionContext
fn clone(&self) -> TransactionContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for TransactionContext
impl RefUnwindSafe for TransactionContext
impl Send for TransactionContext
impl Sync for TransactionContext
impl Unpin for TransactionContext
impl UnwindSafe for TransactionContext
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§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>
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 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>
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 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>
Wrap the input message
T in a tonic::Request