pub struct TasksFilter { /* private fields */ }Expand description
Which runs a cancel_matching or
replay_matching call acts on.
Every condition set here has to hold. An empty condition is not a
condition: a filter with no statuses matches runs in any state, and a
filter with no since matches runs of any age.
A filter with no narrowing criterion at all — no statuses, no workflow
ids, no metadata — is refused with Error::InvalidArgument before any
call is made. since and until alone do not count as narrowing:
left on their own they still let the filter match every run of the whole
tenant that started in the window, which for an old since (or none at
all) is effectively everything. Requiring at least one of statuses,
workflow_ids or additional_metadata is this SDK’s own rule, not the
engine’s — the plain shape is dangerous enough (see the warning on
RunsClient::cancel_matching) that
a call which cannot possibly narrow anything is refused rather than sent.
use std::time::{Duration, SystemTime};
use hatchet_client::{RunStatus, TasksFilter};
let last_hour = SystemTime::now() - Duration::from_secs(3600);
let filter = TasksFilter::new()
.since(last_hour)
.statuses([RunStatus::Queued])
.additional_metadata([("customer", "acme")]);Implementations§
Source§impl TasksFilter
impl TasksFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty filter: add at least one of statuses,
workflow_ids or
additional_metadata before
using it — see the type’s docs.
Sourcepub fn since(self, at: SystemTime) -> Self
pub fn since(self, at: SystemTime) -> Self
Also: runs that started at or after at. Omitted, runs of any age
match.
Sourcepub fn until(self, at: SystemTime) -> Self
pub fn until(self, at: SystemTime) -> Self
Also: runs that started at or before at.
Sourcepub fn statuses(self, statuses: impl IntoIterator<Item = RunStatus>) -> Self
pub fn statuses(self, statuses: impl IntoIterator<Item = RunStatus>) -> Self
Also: runs in one of these states. Setting it twice replaces it.
Sourcepub fn workflow_ids(
self,
ids: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn workflow_ids( self, ids: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Also: runs of these workflows. These are workflow definition ids
(what PutWorkflow answers with), not run ids.
Sourcepub fn additional_metadata(
self,
pairs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>,
) -> Self
pub fn additional_metadata( self, pairs: impl IntoIterator<Item = (impl Into<String>, impl Into<String>)>, ) -> Self
Also: runs triggered with all of these metadata pairs — the ones a
RunOpts::metadata call set. Setting the
same key twice keeps the last value.
Trait Implementations§
Source§impl Clone for TasksFilter
impl Clone for TasksFilter
Source§impl Debug for TasksFilter
impl Debug for TasksFilter
Auto Trait Implementations§
impl Forget for TasksFilter
impl Freeze for TasksFilter
impl Move for TasksFilter
impl RefUnwindSafe for TasksFilter
impl Send for TasksFilter
impl Sync for TasksFilter
impl Unpin for TasksFilter
impl UnsafeUnpin for TasksFilter
impl UnwindSafe for TasksFilter
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
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request