pub trait ChannelResolver {
// Required method
fn get_worker_client_for_url<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<WorkerServiceClient<BoxCloneSyncChannel>, DataFusionError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Allows users to customize the way Worker clients are created. A common use case is to wrap the client with tower layers or schedule it in an IO-specific tokio runtime.
There is a default implementation of this trait that should be enough for the most common use-cases.
§Implementation Notes
-
This is called per gRPC request, so implementors of this trait should make sure that clients are reused across method calls instead of building a new Worker client every time.
-
When implementing
get_worker_client_for_url, it is recommended to use thecreate_worker_clienthelper function to ensure clients are configured with appropriate message size limits for internal communication. This helps avoid message size errors when transferring large datasets.
Required Methods§
Sourcefn get_worker_client_for_url<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<WorkerServiceClient<BoxCloneSyncChannel>, DataFusionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_worker_client_for_url<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 Url,
) -> Pin<Box<dyn Future<Output = Result<WorkerServiceClient<BoxCloneSyncChannel>, DataFusionError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
For a given URL, get a Worker gRPC client for communicating to it.
WARNING: This method is called for every gRPC request, so to not create one client connection for each request, users are required to reuse generated clients. It’s recommended to rely on DefaultChannelResolver either by delegating method calls to it or by copying the implementation.
Consider using create_worker_client to create the client with appropriate
default message size limits.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".