pub struct Embedded { /* private fields */ }Implementations§
Source§impl Embedded
impl Embedded
pub fn builder(db: &str) -> EmbeddedBuilder
pub fn saga(&self, gid: &str) -> SagaBuilder<'_>
Sourcepub async fn submit_workflow(
&self,
gid: &str,
name: &str,
input: &str,
) -> Result<()>
pub async fn submit_workflow( &self, gid: &str, name: &str, input: &str, ) -> Result<()>
提交一个 workflow 事务。
name 必须是 EmbeddedBuilder::workflow 注册过的名字 ——
这里就检查,宁可提交报错,也别等推到一半才发现函数不存在。
input 原样透传给函数(WorkflowCtx::input)。gid 本身通常就是业务单号,
简单场景可以传空串。
pub async fn status(&self, gid: &str) -> Result<Option<GlobalStatus>>
Sourcepub async fn wait_final(
&self,
gid: &str,
timeout: Duration,
) -> Result<GlobalStatus>
pub async fn wait_final( &self, gid: &str, timeout: Duration, ) -> Result<GlobalStatus>
等到事务落终态。只是为了测试和“同步等结果“的场景方便 —— 生产上事务是异步推进的,别在请求路径里等。
pub fn store(&self) -> &Store
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Embedded
impl !UnwindSafe for Embedded
impl Freeze for Embedded
impl Send for Embedded
impl Sync for Embedded
impl Unpin for Embedded
impl UnsafeUnpin for Embedded
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