Skip to content

Commit

Permalink
Merge pull request #2825 from fermyon/key-value-key
Browse files Browse the repository at this point in the history
Ensure key-value metadata key is exposed for usage
  • Loading branch information
rylev authored Sep 12, 2024
2 parents 99002e0 + 2902c75 commit 8de5926
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
3 changes: 0 additions & 3 deletions crates/factor-key-value/src/host.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
use crate::util::EmptyStoreManager;
use anyhow::{Context, Result};
use spin_core::{async_trait, wasmtime::component::Resource};
use spin_locked_app::MetadataKey;
use spin_world::v2::key_value;
use std::{collections::HashSet, sync::Arc};
use table::Table;
use tracing::{instrument, Level};

pub const KEY_VALUE_STORES_KEY: MetadataKey<Vec<String>> = MetadataKey::new("key_value_stores");

const DEFAULT_STORE_TABLE_CAPACITY: u32 = 256;

pub use key_value::Error;
Expand Down
4 changes: 3 additions & 1 deletion crates/factor-key-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ use std::{
};

use anyhow::ensure;
use host::KEY_VALUE_STORES_KEY;
use spin_factors::{
ConfigureAppContext, Factor, FactorInstanceBuilder, InitContext, PrepareContext, RuntimeFactors,
};
use spin_locked_app::MetadataKey;
use util::DefaultManagerGetter;

/// Metadata key for key-value stores.
pub const KEY_VALUE_STORES_KEY: MetadataKey<Vec<String>> = MetadataKey::new("key_value_stores");
pub use host::{log_error, Error, KeyValueDispatch, Store, StoreManager};
pub use runtime_config::RuntimeConfig;
pub use util::{CachingStoreManager, DelegatingStoreManager};
Expand Down
1 change: 1 addition & 0 deletions crates/factor-sqlite/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ fn ensure_allowed_databases_are_configured(
Ok(())
}

/// Metadata key for a list of allowed databases for a component.
pub const ALLOWED_DATABASES_KEY: MetadataKey<Vec<String>> = MetadataKey::new("databases");

/// Resolves a label to a default connection creator.
Expand Down

0 comments on commit 8de5926

Please sign in to comment.