iggy
iggy copied to clipboard
Improve `IggyClient` interface
Currently, if someone wants to use IggyClient
with custom server TCP address, following code is absolute minimum:
let tcp_client_config = TcpClientConfig {
server_address: get_tcp_server_addr(),
..TcpClientConfig::default()
};
let tcp_client = Box::new(TcpClient::create(Arc::new(tcp_client_config)).unwrap());
let client = IggyClient::create(tcp_client, IggyClientConfig::default(), None, None, None);
client.connect().await?;
(...)
The aim of this task is to improve IggyClientBuilder
and hide TcpClient
, QuicClient
and HttpClient
.
IggyClientConfig
should be renamed to something like IggyClientBackgroundConfig
After this task is done, IggyClientBuilder
should look something like:
let config = TcpClientConfig {
server_address: "127.0.0.1:8090".to_string(),
reconnection_retries: 3,
reconnection_interval: 1000,
tls_enabled: false,
tls_domain: "localhost".to_string(),
}
let client = IggyClientBuilder::new().with_config(config).build()?;
or
let client = IggyClientBuilder::new().with_tcp_config(config).build()?; // or http / quic if trait isn't possible
-
ClientProviderConfig
can go away or at least be not preferred interface - we aim for simplicity
- extra parameters should be set via
IggyClientBuilder
methods
As discussed, I'll try to tackle this one. I'll ping you guys on Discord if/when I have some questions/proposal.