From 833cf082dac0b8296ba4b41935e15196b5210abe Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 7 May 2023 00:51:31 +0200 Subject: [PATCH 1/8] Remove unnecessary/unused "timeago" features To decrease dependency bloat and binary size. --- Cargo.lock | 37 ------------------------- Cargo.nix | 64 +------------------------------------------ src/garage/Cargo.toml | 2 +- 3 files changed, 2 insertions(+), 101 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 89d25740..684a9b72 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1757,15 +1757,6 @@ dependencies = [ "windows-sys", ] -[[package]] -name = "isolang" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b64fd6448ee8a45ce6e4365c58e4fa7d8740cba2ed70db3e9ab4879ebd93eaaa" -dependencies = [ - "phf", -] - [[package]] name = "itertools" version = "0.4.19" @@ -2546,24 +2537,6 @@ dependencies = [ "indexmap", ] -[[package]] -name = "phf" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259" -dependencies = [ - "phf_shared", -] - -[[package]] -name = "phf_shared" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096" -dependencies = [ - "siphasher", -] - [[package]] name = "pin-project" version = "1.0.12" @@ -3406,12 +3379,6 @@ dependencies = [ "libc", ] -[[package]] -name = "siphasher" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de" - [[package]] name = "slab" version = "0.4.7" @@ -3678,10 +3645,6 @@ name = "timeago" version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5082dc942361cdfb74eab98bf995762d6015e5bb3a20bf7c5c71213778b4fcb4" -dependencies = [ - "chrono", - "isolang", -] [[package]] name = "tinyvec" diff --git a/Cargo.nix b/Cargo.nix index d9fb0a28..14877083 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -32,7 +32,7 @@ args@{ ignoreLockHash, }: let - nixifiedLockHash = "e7f8df7901f8d217b438e374398eb3d4532e901770070ac5c8343624c0f45ca5"; + nixifiedLockHash = "fdd68f4fc55534ea423284de294a3da29395e7474a31bc0a8bd0527a2288719f"; workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc; currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock); lockHashIgnored = if ignoreLockHash @@ -2450,20 +2450,6 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".isolang."2.2.0" = overridableMkRustCrate (profileName: rec { - name = "isolang"; - version = "2.2.0"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "b64fd6448ee8a45ce6e4365c58e4fa7d8740cba2ed70db3e9ab4879ebd93eaaa"; }; - features = builtins.concatLists [ - [ "default" ] - [ "english_names" ] - ]; - dependencies = { - phf = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".phf."0.10.1" { inherit profileName; }).out; - }; - }); - "registry+https://github.com/rust-lang/crates.io-index".itertools."0.4.19" = overridableMkRustCrate (profileName: rec { name = "itertools"; version = "0.4.19"; @@ -3579,33 +3565,6 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".phf."0.10.1" = overridableMkRustCrate (profileName: rec { - name = "phf"; - version = "0.10.1"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "fabbf1ead8a5bcbc20f5f8b939ee3f5b0f6f281b6ad3468b84656b658b455259"; }; - features = builtins.concatLists [ - [ "default" ] - [ "std" ] - ]; - dependencies = { - phf_shared = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".phf_shared."0.10.0" { inherit profileName; }).out; - }; - }); - - "registry+https://github.com/rust-lang/crates.io-index".phf_shared."0.10.0" = overridableMkRustCrate (profileName: rec { - name = "phf_shared"; - version = "0.10.0"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "b6796ad771acdc0123d2a88dc428b5e38ef24456743ddb1744ed628f9815c096"; }; - features = builtins.concatLists [ - [ "std" ] - ]; - dependencies = { - siphasher = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".siphasher."0.3.10" { inherit profileName; }).out; - }; - }); - "registry+https://github.com/rust-lang/crates.io-index".pin-project."1.0.12" = overridableMkRustCrate (profileName: rec { name = "pin-project"; version = "1.0.12"; @@ -4749,17 +4708,6 @@ in }; }); - "registry+https://github.com/rust-lang/crates.io-index".siphasher."0.3.10" = overridableMkRustCrate (profileName: rec { - name = "siphasher"; - version = "0.3.10"; - registry = "registry+https://github.com/rust-lang/crates.io-index"; - src = fetchCratesIo { inherit name version; sha256 = "7bd3e3206899af3f8b12af284fafc038cc1dc2b41d1b89dd17297221c5d225de"; }; - features = builtins.concatLists [ - [ "default" ] - [ "std" ] - ]; - }); - "registry+https://github.com/rust-lang/crates.io-index".slab."0.4.7" = overridableMkRustCrate (profileName: rec { name = "slab"; version = "0.4.7"; @@ -5100,16 +5048,6 @@ in version = "0.4.1"; registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "5082dc942361cdfb74eab98bf995762d6015e5bb3a20bf7c5c71213778b4fcb4"; }; - features = builtins.concatLists [ - [ "chrono" ] - [ "default" ] - [ "isolang" ] - [ "translations" ] - ]; - dependencies = { - chrono = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".chrono."0.4.23" { inherit profileName; }).out; - isolang = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".isolang."2.2.0" { inherit profileName; }).out; - }; }); "registry+https://github.com/rust-lang/crates.io-index".tinyvec."1.6.0" = overridableMkRustCrate (profileName: rec { diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml index 0cbdf890..c8f87560 100644 --- a/src/garage/Cargo.toml +++ b/src/garage/Cargo.toml @@ -33,7 +33,7 @@ garage_web = { version = "0.8.2", path = "../web" } backtrace = "0.3" bytes = "1.0" bytesize = "1.1" -timeago = "0.4" +timeago = { version = "0.4", default-features = false } parse_duration = "2.1" hex = "0.4" tracing = { version = "0.1" } From 6d3ace1ea9561386bb89b0a3e66b881e8e7be5e4 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 7 May 2023 17:01:11 +0200 Subject: [PATCH 2/8] Fix undefined macro warn! on 32-bit Compiling garage_db v0.8.2 (garage-0.8.2/src/db) error: cannot find macro `warn` in this scope --> src/db/lmdb_adapter.rs:352:2 | 352 | warn!("LMDB is not recommended on 32-bit systems, database size will be limited"); | ^^^^ | = help: consider importing this macro: tracing::warn = note: `warn` is in scope, but it is an attribute: `#[warn]` error: could not compile `garage_db` due to previous error --- src/db/lmdb_adapter.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/db/lmdb_adapter.rs b/src/db/lmdb_adapter.rs index 31956612..ecbc3b81 100644 --- a/src/db/lmdb_adapter.rs +++ b/src/db/lmdb_adapter.rs @@ -349,6 +349,6 @@ pub fn recommended_map_size() -> usize { #[cfg(target_pointer_width = "32")] pub fn recommended_map_size() -> usize { - warn!("LMDB is not recommended on 32-bit systems, database size will be limited"); + tracing::warn!("LMDB is not recommended on 32-bit systems, database size will be limited"); 1usize << 30 } From d5e39d11ebe393242d83b5b9910c4c6682912d7c Mon Sep 17 00:00:00 2001 From: Jonatan Steuernagel Date: Mon, 8 May 2023 07:47:31 +0200 Subject: [PATCH 3/8] Helm: Include newer config parameters as values Add all missing parameters from the reference manual. Primarily to enable the use of the new lmdb engine --- script/helm/garage/values.yaml | 36 +++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/script/helm/garage/values.yaml b/script/helm/garage/values.yaml index 3a1e41b9..02a6651b 100644 --- a/script/helm/garage/values.yaml +++ b/script/helm/garage/values.yaml @@ -4,9 +4,28 @@ # Garage configuration. These values go to garage.toml garage: + # Can be changed for better performance on certain systems + # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#db-engine-since-v0-8-0 + dbEngine: "sled" + + # Defaults is 1MB + # An increase can result in better performance in certain scenarios + # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#block-size + blockSize: "1048576" + + # Tuning parameters for the sled DB engine + # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#sled-cache-capacity + sledCacheCapacity: "134217728" + sledFlushEveryMs: "2000" + # Default to 3 replicas, see the replication_mode section at - # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/ + # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#replication-mode replicationMode: "3" + + # zstd compression level of stored blocks + # https://garagehq.deuxfleurs.fr/documentation/reference-manual/configuration/#compression-level + compressionLevel: "1" + rpcBindAddr: "[::]:3901" # If not given, a random secret will be generated and stored in a Secret object rpcSecret: "" @@ -27,8 +46,19 @@ garage: metadata_dir = "/mnt/meta" data_dir = "/mnt/data" + db_engine = "{{ .Values.garage.dbEngine }}" + + block_size = {{ .Values.garage.blockSize }} + + {{- if eq .Values.garage.dbEngine "sled"}} + sled_cache_capacity = {{ .Values.garage.sledCacheCapacity }} + sled_flush_every_ms = {{ .Values.garage.sledFlushEveryMs }} + {{- end }} + replication_mode = "{{ .Values.garage.replicationMode }}" + compression_level = {{ .Values.garage.compressionLevel }} + rpc_bind_addr = "{{ .Values.garage.rpcBindAddr }}" # rpc_secret will be populated by the init container from a k8s secret object rpc_secret = "__RPC_SECRET_REPLACE__" @@ -49,7 +79,7 @@ garage: bind_addr = "[::]:3902" root_domain = "{{ .Values.garage.s3.web.rootDomain }}" index = "{{ .Values.garage.s3.web.index }}" - + [admin] api_bind_addr = "[::]:3903" {{- if .Values.monitoring.tracing.sink }} @@ -211,4 +241,4 @@ monitoring: scrapeTimeout: 10s relabelings: [] tracing: - sink: "" \ No newline at end of file + sink: "" From 4ea7983093256bf8395f9c0f0887bb5d1ba26499 Mon Sep 17 00:00:00 2001 From: Jonatan Steuernagel Date: Mon, 8 May 2023 08:03:21 +0200 Subject: [PATCH 4/8] Helm: Increment patch version --- script/helm/garage/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/helm/garage/Chart.yaml b/script/helm/garage/Chart.yaml index 82b2e106..86f1239f 100644 --- a/script/helm/garage/Chart.yaml +++ b/script/helm/garage/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.4.0 +version: 0.4.1 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to From d2deee0b8bc22de5e8f1115f65a8a979b1beba18 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 7 May 2023 18:12:01 +0200 Subject: [PATCH 5/8] Declare garage crates using workspace.dependencies This will allow to really disable "sled" feature without declaring `default-features = false` in every Cargo.toml where garage_db and garage_model is used. See https://doc.rust-lang.org/cargo/reference/workspaces.html#the-dependencies-table --- Cargo.toml | 10 ++++++++++ src/api/Cargo.toml | 10 +++++----- src/block/Cargo.toml | 8 ++++---- src/garage/Cargo.toml | 16 ++++++++-------- src/k2v-client/Cargo.toml | 2 +- src/model/Cargo.toml | 10 +++++----- src/rpc/Cargo.toml | 2 +- src/table/Cargo.toml | 6 +++--- src/util/Cargo.toml | 2 +- src/web/Cargo.toml | 8 ++++---- 10 files changed, 42 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a9fd4423..386804f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,16 @@ members = [ default-members = ["src/garage"] +[workspace.dependencies] +garage_api = { version = "0.8.2", path = "src/api" } +garage_block = { version = "0.8.2", path = "src/block" } +garage_db = { version = "0.8.2", path = "src/db" } +garage_model = { version = "0.8.2", path = "src/model" } +garage_rpc = { version = "0.8.2", path = "src/rpc" } +garage_table = { version = "0.8.2", path = "src/table" } +garage_util = { version = "0.8.2", path = "src/util" } +garage_web = { version = "0.8.2", path = "src/web" } + [profile.dev] lto = "off" diff --git a/src/api/Cargo.toml b/src/api/Cargo.toml index 9babec02..747f70ab 100644 --- a/src/api/Cargo.toml +++ b/src/api/Cargo.toml @@ -14,11 +14,11 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_model = { version = "0.8.2", path = "../model" } -garage_table = { version = "0.8.2", path = "../table" } -garage_block = { version = "0.8.2", path = "../block" } -garage_util = { version = "0.8.2", path = "../util" } -garage_rpc = { version = "0.8.2", path = "../rpc" } +garage_model.workspace = true +garage_table.workspace = true +garage_block.workspace = true +garage_util.workspace = true +garage_rpc.workspace = true async-trait = "0.1.7" base64 = "0.21" diff --git a/src/block/Cargo.toml b/src/block/Cargo.toml index c6985754..3bf1c40a 100644 --- a/src/block/Cargo.toml +++ b/src/block/Cargo.toml @@ -14,10 +14,10 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_db = { version = "0.8.2", path = "../db" } -garage_rpc = { version = "0.8.2", path = "../rpc" } -garage_util = { version = "0.8.2", path = "../util" } -garage_table = { version = "0.8.2", path = "../table" } +garage_db.workspace = true +garage_rpc.workspace = true +garage_util.workspace = true +garage_table.workspace = true opentelemetry = "0.17" diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml index c8f87560..9935ce10 100644 --- a/src/garage/Cargo.toml +++ b/src/garage/Cargo.toml @@ -21,14 +21,14 @@ path = "tests/lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_db = { version = "0.8.2", path = "../db" } -garage_api = { version = "0.8.2", path = "../api" } -garage_block = { version = "0.8.2", path = "../block" } -garage_model = { version = "0.8.2", path = "../model" } -garage_rpc = { version = "0.8.2", path = "../rpc" } -garage_table = { version = "0.8.2", path = "../table" } -garage_util = { version = "0.8.2", path = "../util" } -garage_web = { version = "0.8.2", path = "../web" } +garage_db.workspace = true +garage_api.workspace = true +garage_block.workspace = true +garage_model.workspace = true +garage_rpc.workspace = true +garage_table.workspace = true +garage_util.workspace = true +garage_web.workspace = true backtrace = "0.3" bytes = "1.0" diff --git a/src/k2v-client/Cargo.toml b/src/k2v-client/Cargo.toml index 52c16d89..27e85651 100644 --- a/src/k2v-client/Cargo.toml +++ b/src/k2v-client/Cargo.toml @@ -23,7 +23,7 @@ tokio = "1.24" # cli deps clap = { version = "4.1", optional = true, features = ["derive", "env"] } -garage_util = { version = "0.8.2", path = "../util", optional = true } +garage_util = { workspace = true, optional = true } [features] diff --git a/src/model/Cargo.toml b/src/model/Cargo.toml index 2b525a42..6dc954d4 100644 --- a/src/model/Cargo.toml +++ b/src/model/Cargo.toml @@ -14,11 +14,11 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_db = { version = "0.8.2", default-features = false, path = "../db" } -garage_rpc = { version = "0.8.2", path = "../rpc" } -garage_table = { version = "0.8.2", path = "../table" } -garage_block = { version = "0.8.2", path = "../block" } -garage_util = { version = "0.8.2", path = "../util" } +garage_db.workspace = true +garage_rpc.workspace = true +garage_table.workspace = true +garage_block.workspace = true +garage_util.workspace = true async-trait = "0.1.7" arc-swap = "1.0" diff --git a/src/rpc/Cargo.toml b/src/rpc/Cargo.toml index dcf44f4a..f0fde7a7 100644 --- a/src/rpc/Cargo.toml +++ b/src/rpc/Cargo.toml @@ -14,7 +14,7 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_util = { version = "0.8.2", path = "../util" } +garage_util.workspace = true arc-swap = "1.0" bytes = "1.0" diff --git a/src/table/Cargo.toml b/src/table/Cargo.toml index c794c924..d0776945 100644 --- a/src/table/Cargo.toml +++ b/src/table/Cargo.toml @@ -14,9 +14,9 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_db = { version = "0.8.2", path = "../db" } -garage_rpc = { version = "0.8.2", path = "../rpc" } -garage_util = { version = "0.8.2", path = "../util" } +garage_db.workspace = true +garage_rpc.workspace = true +garage_util.workspace = true opentelemetry = "0.17" diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml index 2e6231f6..08fb5553 100644 --- a/src/util/Cargo.toml +++ b/src/util/Cargo.toml @@ -14,7 +14,7 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_db = { version = "0.8.2", path = "../db" } +garage_db.workspace = true arc-swap = "1.0" async-trait = "0.1" diff --git a/src/web/Cargo.toml b/src/web/Cargo.toml index d0a23af4..423d3829 100644 --- a/src/web/Cargo.toml +++ b/src/web/Cargo.toml @@ -14,10 +14,10 @@ path = "lib.rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -garage_api = { version = "0.8.2", path = "../api" } -garage_model = { version = "0.8.2", path = "../model" } -garage_util = { version = "0.8.2", path = "../util" } -garage_table = { version = "0.8.2", path = "../table" } +garage_api.workspace = true +garage_model.workspace = true +garage_util.workspace = true +garage_table.workspace = true err-derive = "0.3" tracing = "0.1" From 75759a163c2e6929d9fa7de542a72371a589efaa Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Sun, 7 May 2023 18:15:48 +0200 Subject: [PATCH 6/8] Allow to really disable sled feature --- Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 386804f6..05eb767a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,8 +18,8 @@ default-members = ["src/garage"] [workspace.dependencies] garage_api = { version = "0.8.2", path = "src/api" } garage_block = { version = "0.8.2", path = "src/block" } -garage_db = { version = "0.8.2", path = "src/db" } -garage_model = { version = "0.8.2", path = "src/model" } +garage_db = { version = "0.8.2", path = "src/db", default-features = false } +garage_model = { version = "0.8.2", path = "src/model", default-features = false } garage_rpc = { version = "0.8.2", path = "src/rpc" } garage_table = { version = "0.8.2", path = "src/table" } garage_util = { version = "0.8.2", path = "src/util" } From 9c788059e2335fb9d1a145ce3b6a64070a54a202 Mon Sep 17 00:00:00 2001 From: Jonathan Davies Date: Mon, 8 May 2023 18:57:10 +0100 Subject: [PATCH 7/8] block/manager.rs: In is_block_compressed - check which compression_level is configured on a node and check for raw block first if compression is disabled (to help reduce syscalls during a scrub). --- src/block/manager.rs | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/block/manager.rs b/src/block/manager.rs index 26278974..3ece9a8a 100644 --- a/src/block/manager.rs +++ b/src/block/manager.rs @@ -600,12 +600,32 @@ impl BlockManager { /// Utility: check if block is stored compressed. Error if block is not stored async fn is_block_compressed(&self, hash: &Hash) -> Result { let mut path = self.block_path(hash); - path.set_extension("zst"); - if fs::metadata(&path).await.is_ok() { - return Ok(true); + + // If compression is disabled on node - check for the raw block + // first and then a compressed one (as compression may have been + // previously enabled). + match self.compression_level { + None => { + if fs::metadata(&path).await.is_ok() { + return Ok(false); + } + + path.set_extension("zst"); + + fs::metadata(&path).await.map(|_| true).map_err(Into::into) + } + _ => { + path.set_extension("zst"); + + if fs::metadata(&path).await.is_ok() { + return Ok(true); + } + + path.set_extension(""); + + fs::metadata(&path).await.map(|_| false).map_err(Into::into) + } } - path.set_extension(""); - fs::metadata(&path).await.map(|_| false).map_err(Into::into) } async fn lock_mutate(&self, hash: &Hash) -> MutexGuard<'_, BlockManagerLocked> { From 9e0a9c1c15cc8a6849de8c23bc1b0e711ab4fc8f Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Wed, 3 May 2023 16:43:08 +0200 Subject: [PATCH 8/8] move git-version dependency to main crate to reduce rebuilds --- Cargo.lock | 2 +- Cargo.nix | 64 +++++++++++++++++++++---------------------- src/garage/Cargo.toml | 1 + src/garage/main.rs | 6 ++++ src/util/Cargo.toml | 1 - src/util/version.rs | 12 +++----- 6 files changed, 44 insertions(+), 42 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 684a9b72..6acbce53 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1095,6 +1095,7 @@ dependencies = [ "garage_table", "garage_util", "garage_web", + "git-version", "hex", "hmac 0.12.1", "http", @@ -1298,7 +1299,6 @@ dependencies = [ "err-derive", "futures", "garage_db", - "git-version", "hex", "hexdump", "http", diff --git a/Cargo.nix b/Cargo.nix index 14877083..b93a2003 100644 --- a/Cargo.nix +++ b/Cargo.nix @@ -32,7 +32,7 @@ args@{ ignoreLockHash, }: let - nixifiedLockHash = "fdd68f4fc55534ea423284de294a3da29395e7474a31bc0a8bd0527a2288719f"; + nixifiedLockHash = "c456543cc85b781f177914f8901fdfffd342edb0e5e5d0069fb51c9fd74e91dd"; workspaceSrc = if args.workspaceSrc == null then ./. else args.workspaceSrc; currentLockHash = builtins.hashFile "sha256" (workspaceSrc + /Cargo.lock); lockHashIgnored = if ignoreLockHash @@ -936,18 +936,18 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "01a9af1f4c2ef74bb8aa1f7e19706bc72d03598c8a570bb5de72243c7a9d9d5a"; }; features = builtins.concatLists [ - [ "alloc" ] - [ "default" ] - [ "std" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "alloc") + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "default") + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "std") ]; dependencies = { - cfg_if = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; - crossbeam_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; }).out; - memoffset = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memoffset."0.7.1" { inherit profileName; }).out; - scopeguard = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".scopeguard."1.1.0" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "cfg_if" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".cfg-if."1.0.0" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "crossbeam_utils" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "memoffset" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".memoffset."0.7.1" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "scopeguard" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".scopeguard."1.1.0" { inherit profileName; }).out; }; buildDependencies = { - autocfg = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "autocfg" else null } = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; }).out; }; }); @@ -973,7 +973,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f"; }; features = builtins.concatLists [ - [ "default" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "default") [ "std" ] ]; dependencies = { @@ -1365,8 +1365,8 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "9564fc758e15025b46aa6643b1b77d047d1a56a1aea6e01002ac0c7026876213"; }; dependencies = { - ${ if hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; }).out; - ${ if hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; + ${ if (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") && hostPlatform.isUnix then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; }).out; + ${ if (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") && hostPlatform.isWindows then "winapi" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".winapi."0.3.9" { inherit profileName; }).out; }; }); @@ -1527,7 +1527,7 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"; }; dependencies = { - byteorder = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".byteorder."1.4.3" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "byteorder" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".byteorder."1.4.3" { inherit profileName; }).out; }; }); @@ -1567,6 +1567,7 @@ in garage_table = (rustPackages."unknown".garage_table."0.8.2" { inherit profileName; }).out; garage_util = (rustPackages."unknown".garage_util."0.8.2" { inherit profileName; }).out; garage_web = (rustPackages."unknown".garage_web."0.8.2" { inherit profileName; }).out; + git_version = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".git-version."0.3.5" { inherit profileName; }).out; hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out; sodiumoxide = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".kuska-sodiumoxide."0.2.5-0" { inherit profileName; }).out; netapp = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".netapp."0.5.2" { inherit profileName; }).out; @@ -1693,12 +1694,12 @@ in (lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default" || rootFeatures' ? "garage_db/bundled-libs") "bundled-libs") (lib.optional (rootFeatures' ? "garage_db/clap" || rootFeatures' ? "garage_db/cli") "clap") (lib.optional (rootFeatures' ? "garage_db/cli") "cli") - [ "default" ] + (lib.optional (rootFeatures' ? "garage_db/default") "default") (lib.optional (rootFeatures' ? "garage/lmdb" || rootFeatures' ? "garage_db/heed" || rootFeatures' ? "garage_db/lmdb" || rootFeatures' ? "garage_model/lmdb") "heed") (lib.optional (rootFeatures' ? "garage/lmdb" || rootFeatures' ? "garage_db/lmdb" || rootFeatures' ? "garage_model/lmdb") "lmdb") (lib.optional (rootFeatures' ? "garage_db/cli" || rootFeatures' ? "garage_db/pretty_env_logger") "pretty_env_logger") (lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sqlite" || rootFeatures' ? "garage_db/bundled-libs" || rootFeatures' ? "garage_db/rusqlite" || rootFeatures' ? "garage_db/sqlite" || rootFeatures' ? "garage_model/sqlite") "rusqlite") - [ "sled" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "sled") (lib.optional (rootFeatures' ? "garage/sqlite" || rootFeatures' ? "garage_db/sqlite" || rootFeatures' ? "garage_model/sqlite") "sqlite") ]; dependencies = { @@ -1708,7 +1709,7 @@ in hexdump = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hexdump."0.1.1" { inherit profileName; }).out; ${ if rootFeatures' ? "garage_db/cli" || rootFeatures' ? "garage_db/pretty_env_logger" then "pretty_env_logger" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".pretty_env_logger."0.4.0" { inherit profileName; }).out; ${ if rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sqlite" || rootFeatures' ? "garage_db/bundled-libs" || rootFeatures' ? "garage_db/rusqlite" || rootFeatures' ? "garage_db/sqlite" || rootFeatures' ? "garage_model/sqlite" then "rusqlite" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".rusqlite."0.28.0" { inherit profileName; }).out; - sled = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".sled."0.34.7" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "sled" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".sled."0.34.7" { inherit profileName; }).out; tracing = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".tracing."0.1.37" { inherit profileName; }).out; }; devDependencies = { @@ -1722,10 +1723,10 @@ in registry = "unknown"; src = fetchCrateLocal (workspaceSrc + "/src/model"); features = builtins.concatLists [ - [ "default" ] + (lib.optional (rootFeatures' ? "garage_model/default") "default") (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v" || rootFeatures' ? "garage_model/k2v") "k2v") (lib.optional (rootFeatures' ? "garage/lmdb" || rootFeatures' ? "garage_model/lmdb") "lmdb") - [ "sled" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "sled") (lib.optional (rootFeatures' ? "garage/sqlite" || rootFeatures' ? "garage_model/sqlite") "sqlite") ]; dependencies = { @@ -1840,7 +1841,6 @@ in err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out; futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.25" { inherit profileName; }).out; garage_db = (rustPackages."unknown".garage_db."0.8.2" { inherit profileName; }).out; - git_version = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".git-version."0.3.5" { inherit profileName; }).out; hex = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hex."0.4.3" { inherit profileName; }).out; hexdump = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".hexdump."0.1.1" { inherit profileName; }).out; http = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".http."0.2.8" { inherit profileName; }).out; @@ -2963,10 +2963,10 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4"; }; features = builtins.concatLists [ - [ "default" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "default") ]; buildDependencies = { - autocfg = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "autocfg" else null } = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".autocfg."1.1.0" { profileName = "__noProfile"; }).out; }; }); @@ -4728,18 +4728,18 @@ in registry = "registry+https://github.com/rust-lang/crates.io-index"; src = fetchCratesIo { inherit name version; sha256 = "7f96b4737c2ce5987354855aed3797279def4ebf734436c6aa4552cf8e169935"; }; features = builtins.concatLists [ - [ "default" ] - [ "no_metrics" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "default") + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "no_metrics") ]; dependencies = { - crc32fast = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crc32fast."1.3.2" { inherit profileName; }).out; - crossbeam_epoch = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-epoch."0.9.13" { inherit profileName; }).out; - crossbeam_utils = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; }).out; - ${ if hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "windows" then "fs2" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fs2."0.4.3" { inherit profileName; }).out; - fxhash = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fxhash."0.2.1" { inherit profileName; }).out; - libc = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; }).out; - log = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; - parking_lot = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.11.2" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "crc32fast" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crc32fast."1.3.2" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "crossbeam_epoch" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-epoch."0.9.13" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "crossbeam_utils" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".crossbeam-utils."0.8.14" { inherit profileName; }).out; + ${ if (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") && (hostPlatform.parsed.kernel.name == "linux" || hostPlatform.parsed.kernel.name == "darwin" || hostPlatform.parsed.kernel.name == "windows") then "fs2" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fs2."0.4.3" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "fxhash" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".fxhash."0.2.1" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "libc" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".libc."0.2.139" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "log" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".log."0.4.17" { inherit profileName; }).out; + ${ if rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled" then "parking_lot" else null } = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".parking_lot."0.11.2" { inherit profileName; }).out; }; }); @@ -5941,7 +5941,7 @@ in [ "objbase" ] [ "pdh" ] [ "processenv" ] - [ "processthreadsapi" ] + (lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/sled" || rootFeatures' ? "garage_db/default" || rootFeatures' ? "garage_db/sled" || rootFeatures' ? "garage_model/default" || rootFeatures' ? "garage_model/sled") "processthreadsapi") [ "profileapi" ] [ "roapi" ] [ "shlobj" ] diff --git a/src/garage/Cargo.toml b/src/garage/Cargo.toml index 9935ce10..2b366ff1 100644 --- a/src/garage/Cargo.toml +++ b/src/garage/Cargo.toml @@ -41,6 +41,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] } rand = "0.8" async-trait = "0.1.7" sodiumoxide = { version = "0.2.5-0", package = "kuska-sodiumoxide" } +git-version = "0.3.4" serde = { version = "1.0", default-features = false, features = ["derive", "rc"] } serde_bytes = "0.11" diff --git a/src/garage/main.rs b/src/garage/main.rs index 1ab18bb2..e8aee892 100644 --- a/src/garage/main.rs +++ b/src/garage/main.rs @@ -108,6 +108,12 @@ async fn main() { ][..]; if let Some(git_version) = option_env!("GIT_VERSION") { garage_util::version::init_version(git_version); + } else { + garage_util::version::init_version(git_version::git_version!( + prefix = "git:", + cargo_prefix = "cargo:", + fallback = "unknown" + )); } garage_util::version::init_features(features); diff --git a/src/util/Cargo.toml b/src/util/Cargo.toml index 08fb5553..f72051b9 100644 --- a/src/util/Cargo.toml +++ b/src/util/Cargo.toml @@ -22,7 +22,6 @@ blake2 = "0.10" bytes = "1.0" digest = "0.10" err-derive = "0.3" -git-version = "0.3.4" hexdump = "0.1" xxhash-rust = { version = "0.8", default-features = false, features = ["xxh3"] } hex = "0.4" diff --git a/src/util/version.rs b/src/util/version.rs index 2b2ea271..19907ed1 100644 --- a/src/util/version.rs +++ b/src/util/version.rs @@ -1,18 +1,14 @@ use std::sync::Arc; -use arc_swap::{ArcSwap, ArcSwapOption}; +use arc_swap::ArcSwapOption; lazy_static::lazy_static! { - static ref VERSION: ArcSwap<&'static str> = ArcSwap::new(Arc::new(git_version::git_version!( - prefix = "git:", - cargo_prefix = "cargo:", - fallback = "unknown" - ))); + static ref VERSION: ArcSwapOption<&'static str> = ArcSwapOption::new(None); static ref FEATURES: ArcSwapOption<&'static [&'static str]> = ArcSwapOption::new(None); } pub fn garage_version() -> &'static str { - &VERSION.load() + VERSION.load().as_ref().unwrap() } pub fn garage_features() -> Option<&'static [&'static str]> { @@ -20,7 +16,7 @@ pub fn garage_features() -> Option<&'static [&'static str]> { } pub fn init_version(version: &'static str) { - VERSION.store(Arc::new(version)); + VERSION.store(Some(Arc::new(version))); } pub fn init_features(features: &'static [&'static str]) {