pub struct WorkerOptions {Show 13 fields
pub endpoint: String,
pub pool: String,
pub slots: u32,
pub token: Option<String>,
pub name: String,
pub tls: Option<WorkerTls>,
pub reconnect: bool,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub drain_timeout: Duration,
pub max_message_bytes: usize,
pub labels: Vec<(String, String)>,
pub insecure_redirect_http: bool,
}Expand description
Worker settings.
Fields§
§endpoint: StringServer gRPC endpoint (http:// or https://).
pool: StringPool to serve.
slots: u32Leases run concurrently (the server may grant fewer).
token: Option<String>Bearer token (role worker).
name: StringName shown in server logs.
tls: Option<WorkerTls>TLS settings; they need an https:// endpoint (an https:// endpoint without them uses
the system roots).
reconnect: boolReconnect after the connection drops or the server steps down (default true).
initial_backoff: DurationFirst reconnect delay (doubles up to max_backoff).
max_backoff: DurationLongest reconnect delay.
drain_timeout: DurationHow long running handlers may take to finish after shutdown resolves.
max_message_bytes: usizeLargest lease message accepted from the server.
labels: Vec<(String, String)>Labels of this worker: tasks that require labels are leased only to workers that have all of them.
insecure_redirect_http: boolFollow redirects to plain http:// endpoints on other hosts with the token (default
false: only loopback); for trusted networks without TLS.
Implementations§
Source§impl WorkerOptions
impl WorkerOptions
Sourcepub fn new(endpoint: impl Into<String>, pool: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>, pool: impl Into<String>) -> Self
Options for serving pool on the server at endpoint, with one slot.
Sourcepub fn insecure_redirect_http(self, on: bool) -> Self
pub fn insecure_redirect_http(self, on: bool) -> Self
Allow redirects to plain http:// endpoints on other hosts with the token.
Sourcepub fn label(self, name: impl Into<String>, value: impl Into<String>) -> Self
pub fn label(self, name: impl Into<String>, value: impl Into<String>) -> Self
Add a label (name = value) to this worker.
Sourcepub fn drain_timeout(self, d: Duration) -> Self
pub fn drain_timeout(self, d: Duration) -> Self
Time running handlers get to finish on shutdown.
Trait Implementations§
Source§impl Clone for WorkerOptions
impl Clone for WorkerOptions
Auto Trait Implementations§
impl Freeze for WorkerOptions
impl RefUnwindSafe for WorkerOptions
impl Send for WorkerOptions
impl Sync for WorkerOptions
impl Unpin for WorkerOptions
impl UnsafeUnpin for WorkerOptions
impl UnwindSafe for WorkerOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request