dynamo_runtime/component/
registry.rs1use anyhow::Result;
5use async_once_cell::OnceCell;
6use std::{
7 collections::HashMap,
8 sync::{Arc, Weak},
9};
10use tokio::sync::Mutex;
11
12use crate::component::{Registry, RegistryInner};
13
14impl Default for Registry {
15 fn default() -> Self {
16 Self::new()
17 }
18}
19
20impl Registry {
21 pub fn new() -> Self {
22 Self {
23 inner: Arc::new(Mutex::new(RegistryInner::default())),
24 is_static: false,
25 }
26 }
27
28 pub fn new_with_static(is_static: bool) -> Self {
29 Self {
30 inner: Arc::new(Mutex::new(RegistryInner::default())),
31 is_static,
32 }
33 }
34
35 pub fn is_static(&self) -> bool {
37 self.is_static
38 }
39}