aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Cargo.toml3
-rw-r--r--src/util/config.rs16
-rw-r--r--src/util/error.rs3
3 files changed, 20 insertions, 2 deletions
diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml
index f13c1589..95cde531 100644
--- a/src/util/Cargo.toml
+++ b/src/util/Cargo.toml
@@ -41,3 +41,6 @@ http = "0.2"
hyper = "0.14"
opentelemetry = { version = "0.17", features = [ "rt-tokio", "metrics", "trace" ] }
+
+[features]
+k2v = []
diff --git a/src/util/config.rs b/src/util/config.rs
index e4d96476..4d66bfe4 100644
--- a/src/util/config.rs
+++ b/src/util/config.rs
@@ -73,7 +73,11 @@ pub struct Config {
pub sled_flush_every_ms: u64,
/// Configuration for S3 api
- pub s3_api: ApiConfig,
+ pub s3_api: S3ApiConfig,
+
+ /// Configuration for K2V api
+ #[cfg(feature = "k2v")]
+ pub k2v_api: Option<K2VApiConfig>,
/// Configuration for serving files as normal web server
pub s3_web: WebConfig,
@@ -85,7 +89,7 @@ pub struct Config {
/// Configuration for S3 api
#[derive(Deserialize, Debug, Clone)]
-pub struct ApiConfig {
+pub struct S3ApiConfig {
/// Address and port to bind for api serving
pub api_bind_addr: SocketAddr,
/// S3 region to use
@@ -95,6 +99,14 @@ pub struct ApiConfig {
pub root_domain: Option<String>,
}
+/// Configuration for K2V api
+#[cfg(feature = "k2v")]
+#[derive(Deserialize, Debug, Clone)]
+pub struct K2VApiConfig {
+ /// Address and port to bind for api serving
+ pub api_bind_addr: SocketAddr,
+}
+
/// Configuration for serving files as normal web server
#[derive(Deserialize, Debug, Clone)]
pub struct WebConfig {
diff --git a/src/util/error.rs b/src/util/error.rs
index bdb3a69b..8734a0c8 100644
--- a/src/util/error.rs
+++ b/src/util/error.rs
@@ -44,6 +44,9 @@ pub enum Error {
#[error(display = "Tokio semaphore acquire error: {}", _0)]
TokioSemAcquire(#[error(source)] tokio::sync::AcquireError),
+ #[error(display = "Tokio broadcast receive error: {}", _0)]
+ TokioBcastRecv(#[error(source)] tokio::sync::broadcast::error::RecvError),
+
#[error(display = "Remote error: {}", _0)]
RemoteError(String),