pub enum SubmitOutcome {
Missing,
Advanced(Box<GlobalRow>),
Already,
}Expand description
之所以要区分三种情况:submit 既要处理「tcc/msg/xa 把 prepared 推成
submitted」,也要处理「saga 第一次提交,事务还不存在」,还要保证
重复提交返回成功而不是报错(见 api::submit 的注释)。
Variants§
Missing
gid 不存在 —— 调用方该按新事务建
Advanced(Box<GlobalRow>)
本来停在 prepared,已经推成 submitted 并排进调度队列。
带上事务体:调用方要是顺便占了租约(见 submit_prepared 的
owner 参数),可以拿它直接开推,不用再读一次。为这个多带的返回值,
两种后端都没有多付往返 —— Redis 是脚本尾巴上加一个 HGETALL,
SQL 是把本来就要发的那条 SELECT 从「只取 status」改成取全行
Already
已经提交过了。必须当成功返回,否则客户端会以为没受理
Trait Implementations§
Source§impl Clone for SubmitOutcome
impl Clone for SubmitOutcome
Source§fn clone(&self) -> SubmitOutcome
fn clone(&self) -> SubmitOutcome
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 SubmitOutcome
impl RefUnwindSafe for SubmitOutcome
impl Send for SubmitOutcome
impl Sync for SubmitOutcome
impl Unpin for SubmitOutcome
impl UnsafeUnpin for SubmitOutcome
impl UnwindSafe for SubmitOutcome
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> 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 more