pub struct WorkerOptions { /* private fields */ }Expand description
Configures a pull crate::Worker and its outbound Dex connection.
Defaults connect to Dex at 127.0.0.1:8801, use PullWorkerOptions::default, and allow
two minutes for Attribute-index synchronization. Workers need only an outbound connection.
Changed in 1.25.0: every Worker uses pull mode; no listener or Worker target is configured.
Implementations§
Source§impl WorkerOptions
impl WorkerOptions
Sourcepub fn flow_definition_paths<P: Into<PathBuf>>(
self,
value: impl IntoIterator<Item = P>,
) -> Self
pub fn flow_definition_paths<P: Into<PathBuf>>( self, value: impl IntoIterator<Item = P>, ) -> Self
Sets the Flow Definition Graph files that the Worker uploads to the Dex Server at start.
Dex Web draws each Flow type’s graph from the uploaded document. Generate the files with
dexcli visualize. Each path must exist and be readable. An explicitly listed file must be
a Flow Definition Graph 2.x: a UTF-8 JSON object whose schemaVersion starts with 2. and
whose flow.name is a non-empty string; its extension is not checked. A directory is read
recursively for files whose extension is .json in any case; a file there that is not a
Flow Definition Graph 2.x is skipped with an info log, so a directory may hold other JSON
files.
The Flow type of a file is its flow.name. Its generation time is its top-level
generatedAt, which must be strict RFC 3339 such as 2026-11-01T00:00:00Z, or the file
modification time when that is missing. Every generation time is truncated to whole
milliseconds.
crate::Worker::try_new reads the files and returns crate::SdkError::FlowDefinition
for a missing or unreadable path, an invalid explicit file, an invalid generatedAt, or a
Flow type configured twice. crate::Worker::start uploads only documents for Flow types
that the Registry registers, after protocol negotiation and Attribute-index synchronization
and before it opens task streams, and sends nothing when none is left. An absolute
top-level source.path, including a Windows drive or UNC path, is replaced by a path
relative to the working directory, or by the file name when the file is elsewhere or the
working directory is unknown. Requests hold at most 256 documents and 16 MiB of content and
share one Self::attribute_index_sync_timeout deadline. crate::Worker::stop cancels
an upload in progress. An upload failure, including an older Server without upload
support, is logged as a warning; the Worker still starts. The default is no paths. Each
call replaces the previous paths.
Since 1.45.0.
use dex_sdk::WorkerOptions;
let options = WorkerOptions::new()
.server_address("dex:8801")
.flow_definition_paths(["flow-definitions"]);Sourcepub fn flow_definitions(
self,
value: impl IntoIterator<Item = FlowDefinitionDocument>,
) -> Self
pub fn flow_definitions( self, value: impl IntoIterator<Item = FlowDefinitionDocument>, ) -> Self
Sets in-memory Flow Definition Graph documents that the Worker uploads at start.
Use this when the application builds documents itself, for example from a template with
a fixed generation time. Uploading, filtering to registered Flow types, the source.path
rewrite, and failure handling work as for Self::flow_definition_paths. A Flow type may
come from only one document across both settings. The default is no documents. Each call
replaces the previous documents. crate::Worker::try_new returns
crate::SdkError::FlowDefinition when a document is not a UTF-8 JSON object whose
schemaVersion starts with 2., its flow.name differs from its Flow type, or two sources share a Flow type. See FlowDefinitionDocument for an
example.
Since 1.45.0.
Sourcepub fn server_address(self, value: impl Into<String>) -> Self
pub fn server_address(self, value: impl Into<String>) -> Self
Sets the Dex FlowService address used by the Worker.
With TLS, accepts host:port, dns:///host:port, or dns://authority/host:port.
Sourcepub fn flow_service_tls(self, value: FlowServiceTlsOptions) -> Self
pub fn flow_service_tls(self, value: FlowServiceTlsOptions) -> Self
Enables TLS for every outbound Worker FlowService connection.
Omitted by default, preserving plaintext gRPC. Takes ownership of value and returns
these options with TLS enabled. crate::Worker::try_new validates the address,
additional roots, and server name, returning crate::SdkError::InvalidArgument for
invalid input. See FlowServiceTlsOptions for defaults and a complete example.
Sourcepub fn credential(self, value: Arc<dyn Credential>) -> Self
pub fn credential(self, value: Arc<dyn Credential>) -> Self
Sends a bearer token on FlowService calls and pull Worker task streams.
The default sends no authorization metadata. The credential may be called concurrently;
errors fail calls locally. Pull streams evaluate it at opening and again on reconnect.
Enable Self::flow_service_tls to protect the token on the network.
Sourcepub fn pull(self, value: PullWorkerOptions) -> Self
pub fn pull(self, value: PullWorkerOptions) -> Self
Configures pull capacity, queue registration, and graceful shutdown.
Every Worker uses pull; this builder overrides PullWorkerOptions::default.
Takes ownership of value and returns these Worker options with its settings applied.
crate::Worker::try_new validates capacity, identity, and timeout settings.
See PullWorkerOptions for defaults and a complete Worker and Client example.
Sourcepub fn attribute_index_sync_timeout(self, value: Duration) -> Self
pub fn attribute_index_sync_timeout(self, value: Duration) -> Self
Sets the startup Indexed Attribute synchronization deadline.
The default is two minutes. Worker::try_new
rejects Duration::ZERO.
Trait Implementations§
Source§impl Clone for WorkerOptions
impl Clone for WorkerOptions
Source§impl Debug for WorkerOptions
impl Debug for WorkerOptions
Auto Trait Implementations§
impl !RefUnwindSafe for WorkerOptions
impl !UnwindSafe for WorkerOptions
impl Forget for WorkerOptions
impl Freeze for WorkerOptions
impl Move for WorkerOptions
impl Send for WorkerOptions
impl Sync for WorkerOptions
impl Unpin for WorkerOptions
impl UnsafeUnpin 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> 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> 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