refactor(tvix/castore): remove remaining lazy_static usage
Change-Id: I86480cf625a457c4aa8153262f829d34c230b084 Co-authored-by: edef <edef@edef.eu> Reviewed-on: https://cl.tvl.fyi/c/depot/+/12613 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: edef <edef@edef.eu>
This commit is contained in:
parent
cdbdd2d04e
commit
f0d594789e
4 changed files with 8 additions and 16 deletions
1
tvix/Cargo.lock
generated
1
tvix/Cargo.lock
generated
|
@ -4584,7 +4584,6 @@ dependencies = [
|
||||||
"futures",
|
"futures",
|
||||||
"hex-literal",
|
"hex-literal",
|
||||||
"hyper-util",
|
"hyper-util",
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
"libc",
|
||||||
"object_store",
|
"object_store",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
|
|
@ -15179,10 +15179,6 @@ rec {
|
||||||
name = "hyper-util";
|
name = "hyper-util";
|
||||||
packageId = "hyper-util";
|
packageId = "hyper-util";
|
||||||
}
|
}
|
||||||
{
|
|
||||||
name = "lazy_static";
|
|
||||||
packageId = "lazy_static";
|
|
||||||
}
|
|
||||||
{
|
{
|
||||||
name = "libc";
|
name = "libc";
|
||||||
packageId = "libc";
|
packageId = "libc";
|
||||||
|
|
|
@ -14,7 +14,6 @@ data-encoding = { workspace = true }
|
||||||
digest = { workspace = true }
|
digest = { workspace = true }
|
||||||
fastcdc = { workspace = true, features = ["tokio"] }
|
fastcdc = { workspace = true, features = ["tokio"] }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
lazy_static = { workspace = true }
|
|
||||||
object_store = { workspace = true, features = ["http"] }
|
object_store = { workspace = true, features = ["http"] }
|
||||||
parking_lot = { workspace = true }
|
parking_lot = { workspace = true }
|
||||||
pin-project-lite = { workspace = true }
|
pin-project-lite = { workspace = true }
|
||||||
|
|
|
@ -99,7 +99,6 @@
|
||||||
use erased_serde::deserialize;
|
use erased_serde::deserialize;
|
||||||
use futures::future::BoxFuture;
|
use futures::future::BoxFuture;
|
||||||
use futures::FutureExt;
|
use futures::FutureExt;
|
||||||
use lazy_static::lazy_static;
|
|
||||||
use serde::de::DeserializeOwned;
|
use serde::de::DeserializeOwned;
|
||||||
use serde_tagged::de::{BoxFnSeed, SeedFactory};
|
use serde_tagged::de::{BoxFnSeed, SeedFactory};
|
||||||
use serde_tagged::util::TagString;
|
use serde_tagged::util::TagString;
|
||||||
|
@ -108,7 +107,7 @@ use std::cell::Cell;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use std::sync::Arc;
|
use std::sync::{Arc, LazyLock};
|
||||||
use tonic::async_trait;
|
use tonic::async_trait;
|
||||||
|
|
||||||
/// Resolves tag names to the corresponding Config type.
|
/// Resolves tag names to the corresponding Config type.
|
||||||
|
@ -261,14 +260,13 @@ pub fn with_registry<R>(reg: &'static Registry, f: impl FnOnce() -> R) -> R {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static! {
|
/// The provided registry of tvix_castore, with all builtin BlobStore/DirectoryStore implementations
|
||||||
/// The provided registry of tvix_castore, with all builtin BlobStore/DirectoryStore implementations
|
pub static REG: LazyLock<&'static Registry> = LazyLock::new(|| {
|
||||||
pub static ref REG: Registry = {
|
let mut reg = Default::default();
|
||||||
let mut reg = Default::default();
|
add_default_services(&mut reg);
|
||||||
add_default_services(&mut reg);
|
// explicitly leak to get an &'static, so that we gain `&Registry: Send` from `Registry: Sync`
|
||||||
reg
|
Box::leak(Box::new(reg))
|
||||||
};
|
});
|
||||||
}
|
|
||||||
|
|
||||||
// ---------- End of generic registry code --------- //
|
// ---------- End of generic registry code --------- //
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue