Skip to main content

LaunchConfig

Struct LaunchConfig 

Source
#[non_exhaustive]
pub struct LaunchConfig {
Show 15 fields pub drain_budget: Duration, pub request_timeout: Duration, pub max_in_flight: usize, pub max_body_bytes: usize, pub cache_max_entries: usize, pub cache_sweep_interval: Duration, pub ws_drain_deadline: Duration, pub cors: Option<CorsConfig>, pub shutdown_trigger: Option<Arc<Notify>>, pub expose_docs: bool, pub ws_outbound_buffer: usize, pub ws_max_connections: usize, pub ws_ping_interval: Duration, pub adaptive_shed_target: Duration, pub ws_idle_timeout: Duration,
}
Expand description

Tunables for the launch contract. Start from Default and adjust:

App::launch_configured::<AppModule>(addr, info, plugins, LaunchConfig {
    request_timeout: Duration::from_secs(10),
    max_in_flight: 4_096,
    cors: Some(CorsConfig::for_origins(["https://app.example.com"])),
    ..Default::default()
}).await

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.
§drain_budget: Duration

Per-plugin budget for on_shutdown / start-failure rollback (and the concurrent on_draining notification). A plugin exceeding it is skipped with a logged warning — it can never wedge the process. Default 5s.

§request_timeout: Duration

Process-wide request deadline. Routes without #[Timeout] are cancelled (worker freed) and answered 504 past this. ZERO disables. Default 30s.

§max_in_flight: usize

Hard cap on concurrent in-flight requests — beyond it requests are shed with 503 + Retry-After before any body is read (one atomic counter, no locks). 0 = unlimited. Default 0.

§max_body_bytes: usize

Request body cap for every entry point. Default 8 MiB.

§cache_max_entries: usize

Ceiling on #[CacheTTL] store entries — the key includes the query string, so an unbounded store is a memory-DoS vector. Default 10 000.

§cache_sweep_interval: Duration

How often the cache sweeper reclaims expired entries. Default 30s.

§ws_drain_deadline: Duration

After a shutdown signal, WebSocket clients get this long to finish before the server sends Close frames — otherwise live sockets keep the HTTP drain (and therefore plugin on_shutdown) waiting until the supervisor SIGKILLs. Default 10s.

§cors: Option<CorsConfig>

CORS policy. None (default) mounts no CORS layer at all.

§shutdown_trigger: Option<Arc<Notify>>

Programmatic shutdown trigger — notifying it behaves exactly like receiving SIGTERM (drain flag, WS deadline, plugin hooks). Wired by testing::TestServer::shutdown; production should keep None and use real signals.

§expose_docs: bool

Mount /docs (Swagger UI) and /openapi.json. Default true; disable in hardened deployments that publish the spec elsewhere.

§ws_outbound_buffer: usize

Per-socket outbound queue depth — the slow-client memory ceiling; a client that can’t drain it is evicted. Default 256.

§ws_max_connections: usize

Hard cap on concurrent WebSocket connections across all gateways; beyond it upgrades get 503 before any socket exists. 0 = unlimited. Default 0.

§ws_ping_interval: Duration

Server→client Ping cadence; pongs feed the idle sweeper. ZERO disables. Default 20s.

§adaptive_shed_target: Duration

Adaptive latency shedding: when the EWMA of request latency exceeds this target, a pressure-proportional slice of traffic is shed with 503 (capped at 90% so the EWMA can recover). ZERO disables. Default ZERO (opt-in).

§ws_idle_timeout: Duration

Reap sockets with no inbound activity for this long — dead TCP links (NAT drops) never send Close and would linger forever. ZERO disables. Default 60s.

Implementations§

Source§

impl LaunchConfig

Source

pub fn drain_budget(self, v: Duration) -> Self

Source

pub fn request_timeout(self, v: Duration) -> Self

Source

pub fn max_in_flight(self, v: usize) -> Self

Source

pub fn max_body_bytes(self, v: usize) -> Self

Source

pub fn cache_max_entries(self, v: usize) -> Self

Source

pub fn cache_sweep_interval(self, v: Duration) -> Self

Source

pub fn ws_drain_deadline(self, v: Duration) -> Self

Source

pub fn adaptive_shed_target(self, v: Duration) -> Self

Source

pub fn cors(self, v: CorsConfig) -> Self

Source

pub fn shutdown_trigger(self, v: Arc<Notify>) -> Self

Source

pub fn expose_docs(self, v: bool) -> Self

Source

pub fn ws_outbound_buffer(self, v: usize) -> Self

Source

pub fn ws_max_connections(self, v: usize) -> Self

Source

pub fn ws_ping_interval(self, v: Duration) -> Self

Source

pub fn ws_idle_timeout(self, v: Duration) -> Self

Source

pub fn with_env_overrides(self) -> Self

Apply ARCLY_* environment overrides on top of the coded values — applied automatically by the launch path so operators can retune a deployment (incident response, load tests) without a rebuild:

VariableField
ARCLY_REQUEST_TIMEOUT_MSrequest_timeout (0 disables)
ARCLY_MAX_IN_FLIGHTmax_in_flight (0 = unlimited)
ARCLY_MAX_BODY_BYTESmax_body_bytes
ARCLY_CACHE_MAX_ENTRIEScache_max_entries
ARCLY_WS_DRAIN_DEADLINE_MSws_drain_deadline
ARCLY_DRAIN_BUDGET_MSdrain_budget
ARCLY_EXPOSE_DOCSexpose_docs (true/false/1/0)

Unparseable values are ignored with a warning — a typo must never change behaviour silently or stop the boot.

Trait Implementations§

Source§

impl Clone for LaunchConfig

Source§

fn clone(&self) -> LaunchConfig

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 LaunchConfig

Source§

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

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

impl Default for LaunchConfig

Source§

fn default() -> Self

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> AggregateExpressionMethods for T

Source§

fn aggregate_distinct(self) -> Self::Output
where Self: DistinctDsl,

DISTINCT modifier for aggregate functions Read more
Source§

fn aggregate_all(self) -> Self::Output
where Self: AllDsl,

ALL modifier for aggregate functions Read more
Source§

fn aggregate_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add an aggregate function filter Read more
Source§

fn aggregate_order<O>(self, o: O) -> Self::Output
where Self: OrderAggregateDsl<O>,

Add an aggregate function order Read more
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> DowncastSend for T
where T: Any + Send,

Source§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> FutureExt for T

Source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
Source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<T> IntoSql for T

Source§

fn into_sql<T>(self) -> Self::Expression

Convert self to an expression for Diesel’s query builder. Read more
Source§

fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
where &'a Self: AsExpression<T>, T: SqlType + TypedExpressionType,

Convert &self to an expression for Diesel’s query builder. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WindowExpressionMethods for T

Source§

fn over(self) -> Self::Output
where Self: OverDsl,

Turn a function call into a window function call Read more
Source§

fn window_filter<P>(self, f: P) -> Self::Output
where P: AsExpression<Bool>, Self: FilterDsl<<P as AsExpression<Bool>>::Expression>,

Add a filter to the current window function Read more
Source§

fn partition_by<E>(self, expr: E) -> Self::Output
where Self: PartitionByDsl<E>,

Add a partition clause to the current window function Read more
Source§

fn window_order<E>(self, expr: E) -> Self::Output
where Self: OrderWindowDsl<E>,

Add a order clause to the current window function Read more
Source§

fn frame_by<E>(self, expr: E) -> Self::Output
where Self: FrameDsl<E>,

Add a frame clause to the current window function Read more
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