pub struct TaskFilter { /* private fields */ }Expand description
The filter half of a RunSelector (V1TaskFilter). Every condition
set here has to hold.
A filter that narrows nothing is refused. With no statuses, no
workflow ids and no metadata, the filter matches every run of the
tenant in its time window; RunsApi::cancel and RunsApi::replay
return Error::InvalidArgument instead of sending it. since and
until alone do not count as narrowing. This is the SDK’s rule, not the
engine’s — the same one hatchet-client’s TasksFilter applies.
use std::time::{Duration, SystemTime};
use hatchet_rest::{TaskFilter, TaskStatus};
let filter = TaskFilter::new()
.since(SystemTime::now() - Duration::from_secs(3600))
.statuses([TaskStatus::Failed])
.additional_metadata([("customer", "acme")]);Implementations§
Source§impl TaskFilter
impl TaskFilter
Sourcepub fn new() -> Self
pub fn new() -> Self
A filter with no conditions yet. The API requires since; without
since the filter is sent with 1970-01-01.
Sourcepub fn since(self, since: SystemTime) -> Self
pub fn since(self, since: SystemTime) -> Self
Runs created at or after since.
Sourcepub fn until(self, until: SystemTime) -> Self
pub fn until(self, until: SystemTime) -> Self
Runs created before until.
Sourcepub fn statuses(self, statuses: impl IntoIterator<Item = TaskStatus>) -> Self
pub fn statuses(self, statuses: impl IntoIterator<Item = TaskStatus>) -> Self
Only these statuses.
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
Only these workflows (by id).
Sourcepub fn additional_metadata<K: AsRef<str>, V: AsRef<str>>(
self,
pairs: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn additional_metadata<K: AsRef<str>, V: AsRef<str>>( self, pairs: impl IntoIterator<Item = (K, V)>, ) -> Self
Only runs carrying these metadata pairs, sent as "key:value".
Trait Implementations§
Source§impl Clone for TaskFilter
impl Clone for TaskFilter
Source§impl Debug for TaskFilter
impl Debug for TaskFilter
Auto Trait Implementations§
impl Forget for TaskFilter
impl Freeze for TaskFilter
impl Move for TaskFilter
impl RefUnwindSafe for TaskFilter
impl Send for TaskFilter
impl Sync for TaskFilter
impl Unpin for TaskFilter
impl UnsafeUnpin for TaskFilter
impl UnwindSafe for TaskFilter
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