pub struct EmbeddedBuilder { /* private fields */ }Implementations§
Source§impl EmbeddedBuilder
impl EmbeddedBuilder
Sourcepub fn handler<F, Fut>(self, name: &str, f: F) -> EmbeddedBuilder
pub fn handler<F, Fut>(self, name: &str, f: F) -> EmbeddedBuilder
注册一个进程内分支。名字对应 local://名字。
pub fn owner(self, o: &str) -> EmbeddedBuilder
Sourcepub fn tick(self, d: Duration) -> EmbeddedBuilder
pub fn tick(self, d: Duration) -> EmbeddedBuilder
推进器轮询间隔。默认 200ms —— 进程内调用很快,不需要像跨网络那样保守
Sourcepub fn workflow<F, Fut>(self, name: &str, f: F) -> EmbeddedBuilderwhere
F: Fn(WorkflowCtx) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<(), WorkflowError>> + Send + 'static,
pub fn workflow<F, Fut>(self, name: &str, f: F) -> EmbeddedBuilderwhere
F: Fn(WorkflowCtx) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<(), WorkflowError>> + Send + 'static,
注册一个 workflow:把整个事务流程写成一个普通函数。
跟 saga 的区别是步骤由函数自己决定 —— 可以有 if、有循环、 可以依赖前一步的返回值。崩溃后靠重放 + 结果记忆化续跑。
详见 crate::workflow,尤其是「你的函数必须是确定性的」那节。
pub async fn start(self) -> Result<Embedded, Error>
Auto Trait Implementations§
impl !RefUnwindSafe for EmbeddedBuilder
impl !UnwindSafe for EmbeddedBuilder
impl Freeze for EmbeddedBuilder
impl Send for EmbeddedBuilder
impl Sync for EmbeddedBuilder
impl Unpin for EmbeddedBuilder
impl UnsafeUnpin for EmbeddedBuilder
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