Skip to content

Commit b997d8b

Browse files
fix(*)!: update actor_id to component_id
Signed-off-by: Brooks Townsend <brooksmtownsend@gmail.com>
1 parent 404523f commit b997d8b

File tree

7 files changed

+25
-25
lines changed

7 files changed

+25
-25
lines changed

src/events/types.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ pub struct ComponentScaled {
369369
pub image_ref: String,
370370
pub max_instances: usize,
371371
// TODO: Once we update to the 1.0 release candidate, this will be component_id
372-
pub actor_id: String,
372+
pub component_id: String,
373373
#[serde(default)]
374374
pub host_id: String,
375375
}
@@ -388,7 +388,7 @@ pub struct ComponentScaleFailed {
388388
pub image_ref: String,
389389
pub max_instances: usize,
390390
// TODO: Once we update to the 1.0 release candidate, this will be component_id
391-
pub actor_id: String,
391+
pub component_id: String,
392392
#[serde(default)]
393393
pub host_id: String,
394394
pub error: String,

src/scaler/daemonscaler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ActorDaemonScaler<S> {
8787
match event {
8888
// TODO: React to ComponentScaleFailed with an exponential backoff, can't just immediately retry since that
8989
// would cause a very tight loop of failures
90-
Event::ComponentScaled(evt) if evt.actor_id == self.config.component_id => {
90+
Event::ComponentScaled(evt) if evt.component_id == self.config.component_id => {
9191
self.reconcile().await
9292
}
9393
Event::HostStopped(HostStopped { labels, .. })

src/scaler/spreadscaler/link.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ where
8383
async fn handle_event(&self, event: &Event) -> Result<Vec<Command>> {
8484
match event {
8585
// Trigger linkdef creation if this actor starts and belongs to this model
86-
Event::ComponentScaled(evt) if evt.actor_id == self.config.source_id => {
86+
Event::ComponentScaled(evt) if evt.component_id == self.config.source_id => {
8787
self.reconcile().await
8888
}
8989
Event::ProviderHealthCheckPassed(ProviderHealthCheckPassed {
@@ -680,7 +680,7 @@ mod test {
680680
)]),
681681
claims: None,
682682
image_ref: echo_ref,
683-
actor_id: echo_id.to_string(),
683+
component_id: echo_id.to_string(),
684684
max_instances: 1,
685685
host_id: host_id_one.to_string(),
686686
}))

src/scaler/spreadscaler/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<S: ReadStore + Send + Sync + Clone> Scaler for ActorSpreadScaler<S> {
8282
match event {
8383
// TODO: React to ComponentScaleFailed with an exponential backoff, can't just immediately retry since that
8484
// would cause a very tight loop of failures
85-
Event::ComponentScaled(evt) if evt.actor_id == self.config.component_id => {
85+
Event::ComponentScaled(evt) if evt.component_id == self.config.component_id => {
8686
self.reconcile().await
8787
}
8888
Event::HostStopped(HostStopped { labels, .. })
@@ -1434,7 +1434,7 @@ mod test {
14341434

14351435
let modifying_event = ComponentScaled {
14361436
annotations: spreadscaler_annotations("CrossRegionReal", blobby_spreadscaler.id()),
1437-
actor_id: blobby_id.to_string(),
1437+
component_id: blobby_id.to_string(),
14381438
image_ref: blobby_ref.to_string(),
14391439
host_id: host_id_two.to_string(),
14401440
max_instances: 0,

src/storage/state.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ impl From<ComponentScaled> for Component {
212212
fn from(value: ComponentScaled) -> Self {
213213
let (name, issuer) = value.claims.map(|c| (c.name, c.issuer)).unwrap_or_default();
214214
Component {
215-
id: value.actor_id,
215+
id: value.component_id,
216216
name,
217217
issuer,
218218
reference: value.image_ref,
@@ -230,7 +230,7 @@ impl From<ComponentScaled> for Component {
230230
impl From<&ComponentScaled> for Component {
231231
fn from(value: &ComponentScaled) -> Self {
232232
Component {
233-
id: value.actor_id.clone(),
233+
id: value.component_id.clone(),
234234
name: value
235235
.claims
236236
.as_ref()

src/workers/event.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ where
208208
Ok(())
209209
}
210210

211-
#[instrument(level = "debug", skip(self, actor), fields(component_id = %actor.actor_id, host_id = %actor.host_id))]
211+
#[instrument(level = "debug", skip(self, actor), fields(component_id = %actor.component_id, host_id = %actor.host_id))]
212212
async fn handle_component_scaled(
213213
&self,
214214
lattice_id: &str,
@@ -222,7 +222,7 @@ where
222222
let mut actor_data = Component::from(actor);
223223
if let Some(mut current) = self
224224
.store
225-
.get::<Component>(lattice_id, &actor.actor_id)
225+
.get::<Component>(lattice_id, &actor.component_id)
226226
.await?
227227
{
228228
trace!(actor = ?current, "Found existing actor data");
@@ -263,10 +263,10 @@ where
263263
trace!(host = ?host, "Found existing host data");
264264

265265
if actor.max_instances == 0 {
266-
host.components.remove(&actor.actor_id);
266+
host.components.remove(&actor.component_id);
267267
} else {
268268
host.components
269-
.entry(actor.actor_id.clone())
269+
.entry(actor.component_id.clone())
270270
.and_modify(|count| *count = actor.max_instances)
271271
.or_insert(actor.max_instances);
272272
}
@@ -278,12 +278,12 @@ where
278278

279279
if actor_data.instances.is_empty() {
280280
self.store
281-
.delete::<Component>(lattice_id, &actor.actor_id)
281+
.delete::<Component>(lattice_id, &actor.component_id)
282282
.await
283283
.map_err(anyhow::Error::from)
284284
} else {
285285
self.store
286-
.store(lattice_id, actor.actor_id.clone(), actor_data)
286+
.store(lattice_id, actor.component_id.clone(), actor_data)
287287
.await
288288
.map_err(anyhow::Error::from)
289289
}
@@ -1392,7 +1392,7 @@ mod test {
13921392
..Default::default()
13931393
}),
13941394
image_ref: "coruscant.galactic.empire/tarkin:0.1.0".into(),
1395-
actor_id: "TARKIN".into(),
1395+
component_id: "TARKIN".into(),
13961396
host_id: host1_id.clone(),
13971397
annotations: BTreeMap::default(),
13981398
max_instances: 500,
@@ -1406,7 +1406,7 @@ mod test {
14061406
let hosts = store.list::<Host>(lattice_id).await.unwrap();
14071407
let host = hosts.get(&host1_id).expect("Host should exist in state");
14081408
assert_eq!(
1409-
host.components.get(&actor1_scaled.actor_id),
1409+
host.components.get(&actor1_scaled.component_id),
14101410
Some(&500),
14111411
"Actor count in host should be updated"
14121412
);
@@ -1425,7 +1425,7 @@ mod test {
14251425
..Default::default()
14261426
}),
14271427
image_ref: "coruscant.galactic.empire/tarkin:0.1.0".into(),
1428-
actor_id: "TARKIN".into(),
1428+
component_id: "TARKIN".into(),
14291429
host_id: host1_id.clone(),
14301430
annotations: BTreeMap::default(),
14311431
max_instances: 200,
@@ -1439,7 +1439,7 @@ mod test {
14391439
let hosts = store.list::<Host>(lattice_id).await.unwrap();
14401440
let host = hosts.get(&host1_id).expect("Host should exist in state");
14411441
assert_eq!(
1442-
host.components.get(&actor1_scaled.actor_id),
1442+
host.components.get(&actor1_scaled.component_id),
14431443
Some(&200),
14441444
"Actor count in host should be updated"
14451445
);
@@ -1458,7 +1458,7 @@ mod test {
14581458
..Default::default()
14591459
}),
14601460
image_ref: "coruscant.galactic.empire/tarkin:0.1.0".into(),
1461-
actor_id: "TARKIN".into(),
1461+
component_id: "TARKIN".into(),
14621462
host_id: host1_id.clone(),
14631463
annotations: BTreeMap::default(),
14641464
max_instances: 0,
@@ -1472,7 +1472,7 @@ mod test {
14721472
let hosts = store.list::<Host>(lattice_id).await.unwrap();
14731473
let host = hosts.get(&host1_id).expect("Host should exist in state");
14741474
assert_eq!(
1475-
host.components.get(&actor1_scaled.actor_id),
1475+
host.components.get(&actor1_scaled.component_id),
14761476
None,
14771477
"Actor in host should be removed"
14781478
);
@@ -1491,7 +1491,7 @@ mod test {
14911491
..Default::default()
14921492
}),
14931493
image_ref: "coruscant.galactic.empire/tarkin:0.1.0".into(),
1494-
actor_id: "TARKIN".into(),
1494+
component_id: "TARKIN".into(),
14951495
host_id: host1_id.clone(),
14961496
annotations: BTreeMap::default(),
14971497
max_instances: 1,
@@ -1505,7 +1505,7 @@ mod test {
15051505
let hosts = store.list::<Host>(lattice_id).await.unwrap();
15061506
let host = hosts.get(&host1_id).expect("Host should exist in state");
15071507
assert_eq!(
1508-
host.components.get(&actor1_scaled.actor_id),
1508+
host.components.get(&actor1_scaled.component_id),
15091509
Some(&1),
15101510
"Actor in host should be readded from scratch"
15111511
);

test/data/events.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
},
2121
"host_id": "NCBAWBHRT6JNSQIYQEURM3AQZ74I6HTQRRCFMTVPC3OAX4BUTCNTYADZ",
2222
"image_ref": "wasmcloud.azurecr.io/echo:0.3.4",
23-
"actor_id": "wasmcloud_azurecr_io_echo_0_3_4",
23+
"component_id": "wasmcloud_azurecr_io_echo_0_3_4",
2424
"max_instances": 10
2525
}
2626
},
@@ -36,7 +36,7 @@
3636
"error": "actor is already running with a different image reference `wasmcloud.azurecr.io/echo:0.3.4`",
3737
"host_id": "NCBAWBHRT6JNSQIYQEURM3AQZ74I6HTQRRCFMTVPC3OAX4BUTCNTYADZ",
3838
"image_ref": "wasmcloud.azurecr.io/echo:0.3.8",
39-
"actor_id": "wasmcloud_azurecr_io_echo_0_3_4",
39+
"component_id": "wasmcloud_azurecr_io_echo_0_3_4",
4040
"max_instances": 11,
4141
"public_key": "MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5"
4242
}

0 commit comments

Comments
 (0)