Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Etcd as a data store backend #742

Closed
wants to merge 11 commits into from
118 changes: 118 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions crates/main/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ tokio = { version = "1.23", features = ["full"] }
jemallocator = "0.5.0"

[features]
default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "enterprise"]
#default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "foundationdb", "enterprise"]
default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "etcd", "enterprise"]
#default = ["sqlite", "postgres", "mysql", "rocks", "elastic", "s3", "redis", "etcd", "foundationdb", "enterprise"]
sqlite = ["store/sqlite"]
foundationdb = ["store/foundation", "common/foundation"]
postgres = ["store/postgres"]
Expand All @@ -44,4 +44,5 @@ rocks = ["store/rocks"]
elastic = ["store/elastic"]
s3 = ["store/s3"]
redis = ["store/redis"]
etcd = ["store/etcd"]
enterprise = ["jmap/enterprise", "common/enterprise", "store/enterprise", "managesieve/enterprise", "directory/enterprise"]
5 changes: 3 additions & 2 deletions crates/store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ deadpool = { version = "0.12", features = ["managed"], optional = true }
bincode = "1.3.3"
arc-swap = "1.6.0"
bitpacking = "0.9.2"
# You may need to have protoc, Debian/Ubuntu: protobuf-compiler (https://askubuntu.com/a/1135342/432270)
etcd-client = { version = "0.14", optional = true, default-features = false, features = ["tls"] }

[dev-dependencies]
tokio = { version = "1.23", features = ["full"] }
Expand All @@ -59,8 +61,7 @@ s3 = ["rust-s3"]
foundation = ["foundationdb", "futures"]
fdb-chunked-bm = []
redis = ["dep:redis", "deadpool"]
etcd = ["etcd-client"]
enterprise = []

test_mode = []


6 changes: 6 additions & 0 deletions crates/store/src/backend/composite/distributed_blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ impl DistributedBlob {
Store::MySQL(store) => store.get_blob(key, read_range).await,
#[cfg(feature = "rocks")]
Store::RocksDb(store) => store.get_blob(key, read_range).await,
#[cfg(feature = "etcd")]
Store::Etcd(_) => store.get_blob(key, read_range).await,
#[cfg(all(
feature = "enterprise",
any(feature = "postgres", feature = "mysql")
Expand Down Expand Up @@ -101,6 +103,8 @@ impl DistributedBlob {
Store::MySQL(store) => store.put_blob(key, data).await,
#[cfg(feature = "rocks")]
Store::RocksDb(store) => store.put_blob(key, data).await,
#[cfg(feature = "etcd")]
Store::Etcd(_) => store.put_blob(key, data).await,
#[cfg(all(
feature = "enterprise",
any(feature = "postgres", feature = "mysql")
Expand Down Expand Up @@ -131,6 +135,8 @@ impl DistributedBlob {
Store::MySQL(store) => store.delete_blob(key).await,
#[cfg(feature = "rocks")]
Store::RocksDb(store) => store.delete_blob(key).await,
#[cfg(feature = "etcd")]
Store::Etcd(_) => store.delete_blob(key).await,
#[cfg(all(
feature = "enterprise",
any(feature = "postgres", feature = "mysql")
Expand Down
Loading