Skip to main content

Endpoint

Struct Endpoint 

pub struct Endpoint {
    pub url: String,
    pub types: Vec<String>,
    pub secret: Option<Secret>,
    pub concurrency: u32,
    pub budget: Duration,
    pub max_shards: u32,
    pub grace: Duration,
    pub tls: Option<Tls>,
}
Expand description

An HTTP endpoint the server invokes workers at.

Fields§

§url: String

http:// or https://.

§types: Vec<String>

Workflow types this endpoint has code for; empty: every type.

§secret: Option<Secret>

Signs each request (sign). None sends no signature: only for an endpoint that checks the server’s client certificate instead.

§concurrency: u32

Invocations in flight at once, at most.

§budget: Duration

How long one invocation may take, at most the platform’s limit.

§max_shards: u32

Shards per invocation, at most; 0: no limit.

§grace: Duration

How much longer than the budget the server waits for an answer before it fences the invocation. Default 30 s.

§tls: Option<Tls>

For https://: the CA that signs the endpoint’s certificate (the system bundle if None), and the server’s client certificate for mutual TLS.

Implementations§

§

impl Endpoint

pub fn new(url: impl Into<String>, secret: Option<Secret>) -> Self

An endpoint with the defaults: every type, 16 invocations at once, a 60 s budget, no limit on shards per invocation.

pub fn types(self, types: &[&str]) -> Self

pub fn concurrency(self, n: u32) -> Self

pub fn budget(self, d: Duration) -> Self

pub fn max_shards(self, n: u32) -> Self

pub fn grace(self, d: Duration) -> Self

pub fn tls(self, tls: Tls) -> Self

pub fn from_json(v: &Value) -> Result<Self>

An endpoint from its configuration: {"url": ..., "types": [...], "secretFile": PATH, "concurrency": N, "budgetMs": N, "shards": N, "graceMs": N, "ca": PATH, "cert": PATH, "key": PATH}; only url is required. Unknown keys are refused, so a misspelt one never silently drops a setting.

pub fn from_config_file(path: impl AsRef<Path>) -> Result<Vec<Self>>

Endpoints from a configuration file: {"endpoints": [...]} (see from_json).

Trait Implementations§

§

impl Clone for Endpoint

§

fn clone(&self) -> Endpoint

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
§

impl Debug for Endpoint

§

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

Formats the value using the given formatter. 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> 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, 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> Same for T

Source§

type Output = T

Should always be Self
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.