pub struct EventStream { /* private fields */ }Expand description
Event stream for polling job events.
Implementations§
Source§impl EventStream
impl EventStream
Sourcepub fn new(client: HttpClient, base_url: &str, job_id: &str) -> Self
pub fn new(client: HttpClient, base_url: &str, job_id: &str) -> Self
Create a new event stream for a job.
Sourcepub fn with_start_seq(self, seq: i64) -> Self
pub fn with_start_seq(self, seq: i64) -> Self
Set the starting sequence number.
Sourcepub fn with_deduplicate(self, dedupe: bool) -> Self
pub fn with_deduplicate(self, dedupe: bool) -> Self
Enable or disable deduplication.
Sourcepub fn with_max_events(self, max: i32) -> Self
pub fn with_max_events(self, max: i32) -> Self
Set max events per poll.
Sourcepub async fn poll_events(&mut self) -> Result<Vec<ParsedEvent>, CoreError>
pub async fn poll_events(&mut self) -> Result<Vec<ParsedEvent>, CoreError>
Poll for new events.
Returns events since the last sequence number.
Sourcepub async fn stream_until<F, T>(
&mut self,
on_event: F,
timeout: Duration,
poll_interval: Duration,
is_terminal: T,
) -> Result<(), CoreError>
pub async fn stream_until<F, T>( &mut self, on_event: F, timeout: Duration, poll_interval: Duration, is_terminal: T, ) -> Result<(), CoreError>
Stream events until a terminal condition with callback.
§Arguments
on_event- Callback for each eventtimeout- Maximum time to streampoll_interval- Time between pollsis_terminal- Optional check for terminal status
Auto Trait Implementations§
impl Freeze for EventStream
impl !RefUnwindSafe for EventStream
impl Send for EventStream
impl Sync for EventStream
impl Unpin for EventStream
impl !UnwindSafe for EventStream
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
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