refactor(tvix/store): remove use of lazy_static
This is now supported in the standard library via std::sync::LazyLock, but requires some manual shuffling around of code. Change-Id: Ifca792f4d2dbc36b703de4a4dfa406015ab86da7 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12614 Autosubmit: flokli <flokli@flokli.de> Reviewed-by: flokli <flokli@flokli.de> Reviewed-by: edef <edef@edef.eu> Tested-by: BuildkiteCI
This commit is contained in:
parent
f0d594789e
commit
1c80bc4b5b
9 changed files with 118 additions and 122 deletions
|
|
@ -1,17 +1,16 @@
|
|||
use lazy_static::lazy_static;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
pub use tvix_castore::composition::*;
|
||||
|
||||
lazy_static! {
|
||||
/// The provided registry of tvix_store, which has all the builtin
|
||||
/// tvix_castore (BlobStore/DirectoryStore) and tvix_store
|
||||
/// (PathInfoService) implementations.
|
||||
pub static ref REG: Registry = {
|
||||
let mut reg = Default::default();
|
||||
add_default_services(&mut reg);
|
||||
reg
|
||||
};
|
||||
}
|
||||
/// The provided registry of tvix_store, which has all the builtin
|
||||
/// tvix_castore (BlobStore/DirectoryStore) and tvix_store
|
||||
/// (PathInfoService) implementations.
|
||||
pub static REG: LazyLock<&'static Registry> = LazyLock::new(|| {
|
||||
let mut reg = Default::default();
|
||||
add_default_services(&mut reg);
|
||||
// explicitly leak to get an &'static, so that we gain `&Registry: Send` from `Registry: Sync`
|
||||
Box::leak(Box::new(reg))
|
||||
});
|
||||
|
||||
/// Register the builtin services of tvix_castore and tvix_store with the given
|
||||
/// registry. This is useful for creating your own registry with the builtin
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue