Skip to content

Commit 2c37d72

Browse files
committed
refactor(api): rename app state constructors
1 parent 4d6854a commit 2c37d72

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

guest-agent-simulator/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async fn main() -> Result<()> {
125125
}
126126
let attestation =
127127
simulator::load_versioned_attestation(&sim_config.simulator.attestation_file)?;
128-
let state = AppState::new(
128+
let state = AppState::new_with_platform(
129129
sim_config.core,
130130
Arc::new(SimulatorPlatform::new(
131131
attestation,

guest-agent/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ async fn main() -> Result<()> {
2727
}
2828
let args = Args::parse();
2929
let figment = config::load_config_figment(args.config.as_deref());
30-
let state = AppState::new_real(figment.focus("core").extract()?)
30+
let state = AppState::new(figment.focus("core").extract()?)
3131
.await
3232
.context("Failed to create app state")?;
3333
run_server(state, figment, args.watchdog).await

guest-agent/src/rpc_service.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ impl AppState {
132132
});
133133
}
134134

135-
pub async fn new(config: Config, platform: Arc<dyn PlatformBackend>) -> Result<Self> {
135+
pub async fn new_with_platform(
136+
config: Config,
137+
platform: Arc<dyn PlatformBackend>,
138+
) -> Result<Self> {
136139
let keys: AppKeys = serde_json::from_str(&fs::read_to_string(&config.keys_file)?)
137140
.context("Failed to parse app keys")?;
138141
let sys_config: SysConfig =
@@ -157,8 +160,8 @@ impl AppState {
157160
Ok(me)
158161
}
159162

160-
pub async fn new_real(config: Config) -> Result<Self> {
161-
Self::new(config, Arc::new(RealPlatform)).await
163+
pub async fn new(config: Config) -> Result<Self> {
164+
Self::new_with_platform(config, Arc::new(RealPlatform)).await
162165
}
163166

164167
pub fn config(&self) -> &Config {

0 commit comments

Comments
 (0)