pub struct Worker { /* private fields */ }Implementations§
Source§impl Worker
impl Worker
Sourcepub fn from_session_builder(
session_builder: impl WorkerSessionBuilder + Send + Sync + 'static,
) -> Self
pub fn from_session_builder( session_builder: impl WorkerSessionBuilder + Send + Sync + 'static, ) -> Self
Builds a Worker with a custom WorkerSessionBuilder. Use this
method whenever you need to add custom stuff to the SessionContext that executes the query.
Sourcepub fn with_runtime_env(self, runtime_env: Arc<RuntimeEnv>) -> Self
pub fn with_runtime_env(self, runtime_env: Arc<RuntimeEnv>) -> Self
Sets a RuntimeEnv to be used in all the queries this Worker will handle during its lifetime.
Sourcepub fn add_on_plan_hook(
&mut self,
hook: impl Fn(Arc<dyn ExecutionPlan>) -> Arc<dyn ExecutionPlan> + Sync + Send + 'static,
)
pub fn add_on_plan_hook( &mut self, hook: impl Fn(Arc<dyn ExecutionPlan>) -> Arc<dyn ExecutionPlan> + Sync + Send + 'static, )
Adds a callback for when an ExecutionPlan is received in the set_plan call.
The callback takes the plan and returns another plan that must be either the same, or equivalent in terms of execution. Mutating the plan by adding nodes or removing them will make the query blow up in unexpected ways.
Sourcepub fn with_max_message_size(self, size: usize) -> Self
pub fn with_max_message_size(self, size: usize) -> Self
Set the maximum message size for FlightData chunks.
Defaults to usize::MAX to minimize chunking overhead for internal communication.
See FlightDataEncoderBuilder::with_max_flight_data_size for details.
If you change this to a lower value, ensure you configure the server’s
max_encoding_message_size and max_decoding_message_size to at least 2x this value
to allow for overhead. For most use cases, the default of usize::MAX is appropriate.
Sourcepub fn into_worker_server(self) -> WorkerServiceServer<Self>
pub fn into_worker_server(self) -> WorkerServiceServer<Self>
Converts this Worker into a WorkerServiceServer with high default message size limits.
This is a convenience method that wraps the endpoint in a WorkerServiceServer and
configures it with max_decoding_message_size(usize::MAX) and
max_encoding_message_size(usize::MAX) to avoid message size limitations for internal
communication.
You can further customize the returned server by chaining additional tonic methods.
§Example
let worker = Worker::default();
let server = worker.into_worker_server();
Server::builder()
.add_service(Worker::default().into_worker_server())
.serve(SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 8080))
.await;
Sourcepub fn with_observability_service(
&self,
worker_resolver: Arc<dyn WorkerResolver + Send + Sync>,
) -> ObservabilityServiceServer<ObservabilityServiceImpl>
pub fn with_observability_service( &self, worker_resolver: Arc<dyn WorkerResolver + Send + Sync>, ) -> ObservabilityServiceServer<ObservabilityServiceImpl>
Creates an ObservabilityServiceServer that exposes task progress and cluster
worker discovery via the provided WorkerResolver.
The returned server is meant to be added to the same tonic::transport::Server as the
Flight service — gRPC multiplexes both services on a single port.
Sourcepub fn with_version(self, version: impl Into<Cow<'static, str>>) -> Self
pub fn with_version(self, version: impl Into<Cow<'static, str>>) -> Self
Sets a version string reported by the GetWorkerInfo gRPC endpoint.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Worker
impl !UnwindSafe for Worker
impl Freeze for Worker
impl Send for Worker
impl Sync for Worker
impl Unpin for Worker
impl UnsafeUnpin for Worker
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> 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