Skip to main content

vecgraph_client/
config.rs

1use std::time::Duration;
2
3#[derive(Clone, Debug)]
4pub struct RemoteGraphStoreConfig {
5    pub endpoint: String,
6    pub connect_lazy: bool,
7    pub connect_timeout: Option<Duration>,
8    pub request_timeout: Option<Duration>,
9}
10
11impl RemoteGraphStoreConfig {
12    pub fn new(endpoint: impl Into<String>) -> Self {
13        Self {
14            endpoint: endpoint.into(),
15            connect_lazy: false,
16            connect_timeout: Some(Duration::from_secs(5)),
17            request_timeout: Some(Duration::from_secs(30)),
18        }
19    }
20
21    pub fn with_connect_timeout(mut self, timeout: Duration) -> Self {
22        self.connect_timeout = Some(timeout);
23        self
24    }
25
26    pub fn with_request_timeout(mut self, timeout: Duration) -> Self {
27        self.request_timeout = Some(timeout);
28        self
29    }
30
31    pub fn with_connect_lazy(mut self, connect_lazy: bool) -> Self {
32        self.connect_lazy = connect_lazy;
33        self
34    }
35}