pub struct BranchBuilder<'a> { /* private fields */ }Implementations§
Source§impl BranchBuilder<'_>
impl BranchBuilder<'_>
Sourcepub fn on_rollback(self, compensate: &str) -> Self
pub fn on_rollback(self, compensate: &str) -> Self
登记这个分支的补偿。地址跟 saga 的补偿一样,可以是
local://名字 / http://... / grpc://...。
不登记补偿的分支在回滚时不会被补偿 —— 只适合本来就没副作用的步骤 (比如纯查询)。有副作用就一定要给。
Sourcepub async fn run<F, Fut>(self, f: F) -> WorkflowResult<()>
pub async fn run<F, Fut>(self, f: F) -> WorkflowResult<()>
跑这个分支(不带返回数据)。
Sourcepub async fn run_with<F, Fut>(self, f: F) -> WorkflowResult<String>
pub async fn run_with<F, Fut>(self, f: F) -> WorkflowResult<String>
跑这个分支,并记住它的返回数据。重放时原样还回来,不会重新执行。
数据大小受 trans_branch_op.payload 列限制(MySQL 上是 VARCHAR),
放个 id 或一小段 JSON 就好,别塞大对象。
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for BranchBuilder<'a>
impl<'a> !UnwindSafe for BranchBuilder<'a>
impl<'a> Freeze for BranchBuilder<'a>
impl<'a> Send for BranchBuilder<'a>
impl<'a> Sync for BranchBuilder<'a>
impl<'a> Unpin for BranchBuilder<'a>
impl<'a> UnsafeUnpin for BranchBuilder<'a>
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