datadog_agent_runtime/facade/
stage.rs1use std::time::Instant;
7
8use datadog_agent_remote_config::{RemoteConfigurationClient, RemoteConfigurationWorker};
9use saluki_core::{
10 accounting::ComponentRegistry,
11 health::HealthRegistry,
12 runtime::{state::ResourceRegistry, Supervisor},
13};
14
15use super::RemoteAgentSpecification;
16use crate::{env::RemoteAgentEnvironmentProvider, logging::LoggingTranslator, remote_agent::RemoteAgentBootstrap};
17
18pub enum Unstarted {}
20
21pub enum Started {}
25
26pub enum Initialized {}
30
31mod sealed {
32 pub trait Sealed {}
33
34 impl Sealed for super::Unstarted {}
35 impl Sealed for super::Started {}
36 impl Sealed for super::Initialized {}
37}
38
39pub trait Stage: sealed::Sealed {
43 #[doc(hidden)]
45 type Data<R: RemoteAgentSpecification>;
46}
47
48impl Stage for Unstarted {
49 type Data<R: RemoteAgentSpecification> = data::UnstartedData<R>;
50}
51
52impl Stage for Started {
53 type Data<R: RemoteAgentSpecification> = data::StartedData<R>;
54}
55
56impl Stage for Initialized {
57 type Data<R: RemoteAgentSpecification> = data::InitializedData<R>;
58}
59
60pub(super) use self::data::{InitializedData, StartedData, UnstartedData};
61
62mod data {
63 use super::*;
64
65 pub struct UnstartedData<R: RemoteAgentSpecification> {
66 pub local: R::LocalConfiguration,
67 pub translator: LoggingTranslator,
68 pub start_time: Instant,
69 }
70
71 pub struct StartedData<R: RemoteAgentSpecification> {
72 pub config: R::AuthoritativeConfiguration,
73 pub ra_bootstrap: Option<RemoteAgentBootstrap>,
74 pub config_updates: Option<R::ConfigurationUpdates>,
75 pub bootstrap_supervisor: Supervisor,
76 pub start_time: Instant,
77 }
78
79 pub struct InitializedData<R: RemoteAgentSpecification> {
80 pub started: StartedData<R>,
81 pub root_supervisor: Supervisor,
82 pub component_registry: ComponentRegistry,
83 pub health_registry: HealthRegistry,
84 pub resource_registry: ResourceRegistry,
85 pub env_provider: RemoteAgentEnvironmentProvider,
86 pub env_supervisor: Option<Supervisor>,
87 pub remote_config: Option<(RemoteConfigurationClient, RemoteConfigurationWorker)>,
88 }
89}