pub struct ClientBuilder<AK, D> { /* private fields */ }live only.Expand description
A type-safe builder for the LiveClient. It will not allow you to call
Self::build() before setting the required fields:
keydataset
Implementations§
Source§impl<AK, D> ClientBuilder<AK, D>
impl<AK, D> ClientBuilder<AK, D>
Sourcepub fn send_ts_out(self, send_ts_out: bool) -> Self
pub fn send_ts_out(self, send_ts_out: bool) -> Self
Sets ts_out, which when enabled instructs the gateway to send a send timestamp
after every record. These can be decoded with the special WithTsOut type.
Sourcepub fn upgrade_policy(self, upgrade_policy: VersionUpgradePolicy) -> Self
pub fn upgrade_policy(self, upgrade_policy: VersionUpgradePolicy) -> Self
Sets upgrade_policy, which controls how to decode data from prior DBN
versions. The current default is to upgrade them to the latest version while
decoding.
Sourcepub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
pub fn heartbeat_interval(self, heartbeat_interval: Duration) -> Self
Sets heartbeat_interval, which controls the interval at which the gateway
will send heartbeat records if no other data records are sent. If no heartbeat
interval is configured, the gateway default will be used. Minimum interval
is 5 seconds.
Note that granularity of less than a second is not supported and will be ignored.
Sourcepub fn buffer_size(self, size: usize) -> Self
pub fn buffer_size(self, size: usize) -> Self
Sets the initial size of the internal buffer used for reading data from the TCP socket.
Sourcepub async fn addr(self, addr: impl ToSocketAddrs) -> Result<Self>
pub async fn addr(self, addr: impl ToSocketAddrs) -> Result<Self>
Overrides the address of the gateway the client will connect to. This is an advanced method.
§Errors
This function returns an error when addr fails to resolve.
Sourcepub fn user_agent_extension(self, extension: String) -> Self
pub fn user_agent_extension(self, extension: String) -> Self
Extends the user agent. Intended for library authors.
Sourcepub fn compression(self, compression: Compression) -> Self
pub fn compression(self, compression: Compression) -> Self
Sets the compression mode for the read stream. Default is Compression::None.
Sourcepub fn slow_reader_behavior(
self,
slow_reader_behavior: SlowReaderBehavior,
) -> Self
pub fn slow_reader_behavior( self, slow_reader_behavior: SlowReaderBehavior, ) -> Self
Sets the behavior of the gateway when the client falls behind real time.
Source§impl ClientBuilder<Unset, Unset>
impl ClientBuilder<Unset, Unset>
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ClientBuilder.
Source§impl<D> ClientBuilder<Unset, D>
impl<D> ClientBuilder<Unset, D>
Sourcepub fn key_from_env(self) -> Result<ClientBuilder<ApiKey, D>>
pub fn key_from_env(self) -> Result<ClientBuilder<ApiKey, D>>
Sets the API key reading it from the DATABENTO_API_KEY environment
variable.
§Errors
This function returns an error when the environment variable is not set or the API key is invalid.
Source§impl<AK> ClientBuilder<AK, Unset>
impl<AK> ClientBuilder<AK, Unset>
Sourcepub fn dataset(self, dataset: impl ToString) -> ClientBuilder<AK, String>
pub fn dataset(self, dataset: impl ToString) -> ClientBuilder<AK, String>
Sets the dataset.
Trait Implementations§
Source§impl<AK: Clone, D: Clone> Clone for ClientBuilder<AK, D>
impl<AK: Clone, D: Clone> Clone for ClientBuilder<AK, D>
Source§fn clone(&self) -> ClientBuilder<AK, D>
fn clone(&self) -> ClientBuilder<AK, D>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more