pub struct TcService { /* private fields */ }Implementations§
Trait Implementations§
Source§impl Tc for TcService
impl Tc for TcService
Source§fn new_gid<'life0, 'async_trait>(
&'life0 self,
_req: Request<NewGidRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<NewGidReply>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn new_gid<'life0, 'async_trait>(
&'life0 self,
_req: Request<NewGidRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<NewGidReply>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
生成一个全局事务号。生产上更建议直接用业务单号当 gid
Source§fn prepare<'life0, 'async_trait>(
&'life0 self,
req: Request<PrepareRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prepare<'life0, 'async_trait>(
&'life0 self,
req: Request<PrepareRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
第一阶段:msg 建 prepared 事务 + 正向分支;tcc / xa 只建空事务
Source§fn register_branch<'life0, 'async_trait>(
&'life0 self,
req: Request<RegisterBranchRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn register_branch<'life0, 'async_trait>(
&'life0 self,
req: Request<RegisterBranchRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
分支登记。必须先登记再做一阶段 —— 反过来的话一阶段成功但 TC 不知道
有这个分支,回滚时会漏掉它(TCC 是资源泄漏,XA 会留下永久持锁的事务)
Source§fn submit<'life0, 'async_trait>(
&'life0 self,
req: Request<SubmitRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn submit<'life0, 'async_trait>(
&'life0 self,
req: Request<SubmitRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
提交。saga 在这里一次性给出全部步骤;tcc / msg / xa 是把 prepared 推成 submitted
Auto Trait Implementations§
impl !RefUnwindSafe for TcService
impl !UnwindSafe for TcService
impl Freeze for TcService
impl Send for TcService
impl Sync for TcService
impl Unpin for TcService
impl UnsafeUnpin for TcService
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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