Task

Struct Task 

Source
#[non_exhaustive]
pub struct Task { pub name: String, pub schedule_time: Option<Timestamp>, pub create_time: Option<Timestamp>, pub dispatch_deadline: Option<Duration>, pub dispatch_count: i32, pub response_count: i32, pub first_attempt: Option<Attempt>, pub last_attempt: Option<Attempt>, pub view: View, pub message_type: Option<MessageType>, /* private fields */ }
Expand description

A unit of scheduled work.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Optionally caller-specified in CreateTask.

The task name.

The task name must have the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID/tasks/TASK_ID

  • PROJECT_ID can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see Identifying projects
  • LOCATION_ID is the canonical ID for the task’s location. The list of available locations can be obtained by calling [ListLocations][google.cloud.location.Locations.ListLocations]. For more information, see https://cloud.google.com/about/locations/.
  • QUEUE_ID can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters.
  • TASK_ID can contain only letters ([A-Za-z]), numbers ([0-9]), hyphens (-), or underscores (_). The maximum length is 500 characters.
§schedule_time: Option<Timestamp>

The time when the task is scheduled to be attempted or retried.

schedule_time will be truncated to the nearest microsecond.

§create_time: Option<Timestamp>

Output only. The time that the task was created.

create_time will be truncated to the nearest second.

§dispatch_deadline: Option<Duration>

The deadline for requests sent to the worker. If the worker does not respond by this deadline then the request is cancelled and the attempt is marked as a DEADLINE_EXCEEDED failure. Cloud Tasks will retry the task according to the RetryConfig.

Note that when the request is cancelled, Cloud Tasks will stop listening for the response, but whether the worker stops processing depends on the worker. For example, if the worker is stuck, it may not react to cancelled requests.

The default and maximum values depend on the type of request:

  • For HTTP tasks, the default is 10 minutes. The deadline must be in the interval [15 seconds, 30 minutes].

  • For App Engine tasks, 0 indicates that the request has the default deadline. The default deadline depends on the scaling type of the service: 10 minutes for standard apps with automatic scaling, 24 hours for standard apps with manual and basic scaling, and 60 minutes for flex apps. If the request deadline is set, it must be in the interval [15 seconds, 24 hours 15 seconds]. Regardless of the task’s dispatch_deadline, the app handler will not run for longer than than the service’s timeout. We recommend setting the dispatch_deadline to at most a few seconds more than the app handler’s timeout. For more information see Timeouts.

dispatch_deadline will be truncated to the nearest millisecond. The deadline is an approximate deadline.

§dispatch_count: i32

Output only. The number of attempts dispatched.

This count includes attempts which have been dispatched but haven’t received a response.

§response_count: i32

Output only. The number of attempts which have received a response.

§first_attempt: Option<Attempt>

Output only. The status of the task’s first attempt.

Only dispatch_time will be set. The other Attempt information is not retained by Cloud Tasks.

§last_attempt: Option<Attempt>

Output only. The status of the task’s last attempt.

§view: View

Output only. The view specifies which subset of the Task has been returned.

§message_type: Option<MessageType>

Required. The message to send to the worker.

Implementations§

Source§

impl Task

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

Source

pub fn set_schedule_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of schedule_time.

Source

pub fn set_or_clear_schedule_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of schedule_time.

Source

pub fn set_create_time<T>(self, v: T) -> Self
where T: Into<Timestamp>,

Sets the value of create_time.

Source

pub fn set_or_clear_create_time<T>(self, v: Option<T>) -> Self
where T: Into<Timestamp>,

Sets or clears the value of create_time.

Source

pub fn set_dispatch_deadline<T>(self, v: T) -> Self
where T: Into<Duration>,

Sets the value of dispatch_deadline.

Source

pub fn set_or_clear_dispatch_deadline<T>(self, v: Option<T>) -> Self
where T: Into<Duration>,

Sets or clears the value of dispatch_deadline.

Source

pub fn set_dispatch_count<T: Into<i32>>(self, v: T) -> Self

Sets the value of dispatch_count.

Source

pub fn set_response_count<T: Into<i32>>(self, v: T) -> Self

Sets the value of response_count.

Source

pub fn set_first_attempt<T>(self, v: T) -> Self
where T: Into<Attempt>,

Sets the value of first_attempt.

Source

pub fn set_or_clear_first_attempt<T>(self, v: Option<T>) -> Self
where T: Into<Attempt>,

Sets or clears the value of first_attempt.

Source

pub fn set_last_attempt<T>(self, v: T) -> Self
where T: Into<Attempt>,

Sets the value of last_attempt.

Source

pub fn set_or_clear_last_attempt<T>(self, v: Option<T>) -> Self
where T: Into<Attempt>,

Sets or clears the value of last_attempt.

Source

pub fn set_view<T: Into<View>>(self, v: T) -> Self

Sets the value of view.

Source

pub fn set_message_type<T: Into<Option<MessageType>>>(self, v: T) -> Self

Sets the value of message_type.

Note that all the setters affecting message_type are mutually exclusive.

Source

pub fn app_engine_http_request(&self) -> Option<&Box<AppEngineHttpRequest>>

The value of message_type if it holds a AppEngineHttpRequest, None if the field is not set or holds a different branch.

Source

pub fn set_app_engine_http_request<T: Into<Box<AppEngineHttpRequest>>>( self, v: T, ) -> Self

Sets the value of message_type to hold a AppEngineHttpRequest.

Note that all the setters affecting message_type are mutually exclusive.

Source

pub fn http_request(&self) -> Option<&Box<HttpRequest>>

The value of message_type if it holds a HttpRequest, None if the field is not set or holds a different branch.

Source

pub fn set_http_request<T: Into<Box<HttpRequest>>>(self, v: T) -> Self

Sets the value of message_type to hold a HttpRequest.

Note that all the setters affecting message_type are mutually exclusive.

Trait Implementations§

Source§

impl Clone for Task

Source§

fn clone(&self) -> Task

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Task

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Task

Source§

fn default() -> Task

Returns the “default value” for a type. Read more
Source§

impl Message for Task

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Task

Source§

fn eq(&self, other: &Task) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Task

Auto Trait Implementations§

§

impl Freeze for Task

§

impl RefUnwindSafe for Task

§

impl Send for Task

§

impl Sync for Task

§

impl Unpin for Task

§

impl UnwindSafe for Task

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,