Skip to main content

SubmitTask

Struct SubmitTask 

Source
pub struct SubmitTask {
    pub tenant_id: String,
    pub namespace: String,
    pub queue: String,
    pub program: ProgramRef,
    pub correlation_key: Option<String>,
    pub data: Value,
    pub retry_policy: RetryPolicy,
    pub attempt_timeout_ms: u64,
}
Expand description

A request to create one logical task, before assigning run or attempt IDs.

data may be any JSON value, with at most 64 nested arrays/objects and a compact serialized size of 1 MiB. Strings, including escaped U+0000, remain application-owned. Integer tokens must fit i64/u64; fractional/exponent tokens use finite binary64, as in the worker protocol.

Tenant, namespace, and queue must contain 1–128 UTF-8 bytes and no Unicode control characters or Unicode noncharacters, matching the platform identifier rules. Optional correlation contains at most 512 UTF-8 bytes and no control characters. Program identifiers use ProgramRef::validate. The default retry policy is supplied by RetryPolicy::default; omitted attempt timeout is 300,000 ms and must be between 60,000 and 86,400,000 ms. Unknown submission fields are rejected.

Use Self::semantically_matches rather than ordinary JSON equality for idempotency: integer and floating values, and positive/negative floating zero, have intentionally different normalized representations.

Fields§

§tenant_id: String§namespace: String§queue: String§program: ProgramRef§correlation_key: Option<String>§data: Value§retry_policy: RetryPolicy§attempt_timeout_ms: u64

Implementations§

Source§

impl SubmitTask

Source

pub fn validate(&self) -> Result<()>

Validate a constructed submission, including bounded JSON encoding.

This cannot detect duplicate keys or preexisting numeric rounding in a Value; incoming transport bytes must pass through Self::decode.

Source

pub fn decode(bytes: &[u8]) -> Result<Self>

Decode a complete JSON request without duplicate-key collapse or out-of-range integer rounding, then validate its fields and limits.

Duplicate keys are rejected at every depth, including inside user data; keys with equivalent JSON escape spellings are also duplicates. Trailing bytes, invalid UTF-8, nonfinite numbers, and unknown fields are rejected.

Source

pub fn canonical_bytes(&self) -> Result<Vec<u8>>

Return a deterministic JSON encoding for semantic request comparison.

Object keys are sorted recursively. Array order and string values remain significant. Missing defaults normalize to their explicit values, and a missing or null correlation key normalizes to absence. Integer 1 and float 1.0 differ; equivalent binary64 spellings such as 1e0 and 1.0 match. Positive and negative floating zero differ. The existing parser treats the spelling -0 as floating negative zero, matching -0.0.

This is Ledgence’s comparison encoding, not an implementation of RFC 8785 or arbitrary-precision numeric canonicalization.

Source

pub fn semantically_matches(&self, other: &Self) -> Result<bool>

Compare validated submissions using Self::canonical_bytes.

Every field in this type participates, including scope, correlation, immutable program identity, and the normalized execution policy.

Trait Implementations§

Source§

impl Clone for SubmitTask

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for SubmitTask

Source§

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

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

impl<'de> Deserialize<'de> for SubmitTask

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for SubmitTask

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> ArtifactLease for T
where T: Send + Sync,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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<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