Skip to content

Commit a276903

Browse files
committed
Fixing up some old copied KV language
Signed-off-by: itowlson <[email protected]>
1 parent fbffdf6 commit a276903

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

crates/factor-blobstore/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ impl Factor for BlobStoreFactor {
7676
let (state, table) = get_data_with_table(data);
7777
BlobStoreDispatch::new(
7878
state.allowed_containers.clone(),
79-
state.store_manager.clone(),
79+
state.container_manager.clone(),
8080
table,
8181
state.containers.clone(),
8282
state.incoming_values.clone(),
@@ -97,12 +97,12 @@ impl Factor for BlobStoreFactor {
9797
&self,
9898
mut ctx: ConfigureAppContext<T, Self>,
9999
) -> anyhow::Result<Self::AppState> {
100-
let store_managers = ctx.take_runtime_config().unwrap_or_default();
100+
let runtime_config = ctx.take_runtime_config().unwrap_or_default();
101101

102-
let delegating_manager = DelegatingContainerManager::new(store_managers);
102+
let delegating_manager = DelegatingContainerManager::new(runtime_config);
103103
let container_manager = Arc::new(delegating_manager);
104104

105-
// Build component -> allowed stores map
105+
// Build component -> allowed containers map
106106
let mut component_allowed_containers = HashMap::new();
107107
for component in ctx.app().components() {
108108
let component_id = component.id().to_string();
@@ -114,11 +114,11 @@ impl Factor for BlobStoreFactor {
114114
for label in &containers {
115115
ensure!(
116116
container_manager.is_defined(label),
117-
"unknown blob_stores label {label:?} for component {component_id:?}"
117+
"unknown {} label {label:?} for component {component_id:?}",
118+
BLOB_CONTAINERS_KEY.as_ref(),
118119
);
119120
}
120121
component_allowed_containers.insert(component_id, containers);
121-
// TODO: warn (?) on unused store?
122122
}
123123

124124
Ok(AppState {
@@ -135,11 +135,11 @@ impl Factor for BlobStoreFactor {
135135
let allowed_containers = app_state
136136
.component_allowed_containers
137137
.get(ctx.app_component().id())
138-
.expect("component should be in component_stores")
138+
.expect("component should be in component_allowed_containers")
139139
.clone();
140140
let capacity = u32::MAX;
141141
Ok(InstanceBuilder {
142-
store_manager: app_state.container_manager.clone(),
142+
container_manager: app_state.container_manager.clone(),
143143
allowed_containers,
144144
containers: Arc::new(RwLock::new(Table::new(capacity))),
145145
incoming_values: Arc::new(RwLock::new(Table::new(capacity))),
@@ -161,7 +161,7 @@ pub struct AppState {
161161

162162
pub struct InstanceBuilder {
163163
/// The container manager for the app. This contains *all* container mappings.
164-
store_manager: Arc<DelegatingContainerManager>,
164+
container_manager: Arc<DelegatingContainerManager>,
165165
/// The allowed containers for this component instance.
166166
allowed_containers: HashSet<String>,
167167
/// There are multiple WASI interfaces in play here. The factor adds each of them

crates/factor-blobstore/src/runtime_config.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::{collections::HashMap, sync::Arc};
44

55
use crate::ContainerManager;
66

7-
/// Runtime configuration for all key value stores.
7+
/// Runtime configuration for all blob containers.
88
#[derive(Default, Clone)]
99
pub struct RuntimeConfig {
1010
/// Map of container names to container managers.
@@ -23,7 +23,7 @@ impl RuntimeConfig {
2323
self.container_managers.insert(label, container_manager);
2424
}
2525

26-
/// Returns whether a container manager exists for the store with the given label.
26+
/// Returns whether a container manager exists for the given label.
2727
pub fn has_container_manager(&self, label: &str) -> bool {
2828
self.container_managers.contains_key(label)
2929
}

crates/factor-blobstore/src/util.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{Container, ContainerManager, Error};
22
use spin_core::async_trait;
33
use std::{collections::HashMap, sync::Arc};
44

5-
/// A [`ContainerManager`] which delegates to other `ContainerManager`s based on the store label.
5+
/// A [`ContainerManager`] which delegates to other `ContainerManager`s based on the label.
66
pub struct DelegatingContainerManager {
77
delegates: HashMap<String, Arc<dyn ContainerManager>>,
88
}
@@ -18,12 +18,12 @@ impl DelegatingContainerManager {
1818
impl ContainerManager for DelegatingContainerManager {
1919
async fn get(&self, name: &str) -> Result<Arc<dyn Container>, Error> {
2020
match self.delegates.get(name) {
21-
Some(store) => store.get(name).await,
21+
Some(cm) => cm.get(name).await,
2222
None => Err("no such container".to_string()),
2323
}
2424
}
2525

26-
fn is_defined(&self, store_name: &str) -> bool {
27-
self.delegates.contains_key(store_name)
26+
fn is_defined(&self, label: &str) -> bool {
27+
self.delegates.contains_key(label)
2828
}
2929
}

0 commit comments

Comments
 (0)