Skip to main content

ChannelResolver

Trait ChannelResolver 

Source
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 the create_worker_client helper 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§

Source

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.

Implementations on Foreign Types§

Source§

impl ChannelResolver for Arc<dyn ChannelResolver + Send + Sync>

Source§

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,

Implementors§