Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/factor-key-value/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ impl FactorInstanceBuilder for InstanceBuilder {
Ok(KeyValueDispatch::new_with_capacity_and_semaphore(
allowed_stores,
store_manager,
u32::MAX,
spin_factors::DEFAULT_RESOURCE_TABLE_SIZE,
semaphore,
otel,
))
Expand Down
2 changes: 1 addition & 1 deletion crates/factor-outbound-mqtt/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl InstanceState {
Self {
allowed_hosts: AllowedHostChecker::new(allowed_hosts),
create_client,
connections: spin_resource_table::Table::new(1024),
connections: spin_resource_table::Table::new(spin_factors::DEFAULT_RESOURCE_TABLE_SIZE),
semaphore,
otel,
max_payload_size_bytes,
Expand Down
2 changes: 1 addition & 1 deletion crates/factor-outbound-redis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl Factor for OutboundRedisFactor {
Ok(InstanceState {
allowed_host_checker: AllowedHostChecker::new(outbound_networking.allowed_hosts()),
blocked_networks: outbound_networking.blocked_networks(),
connections: spin_resource_table::Table::new(1024),
connections: spin_resource_table::Table::new(spin_factors::DEFAULT_RESOURCE_TABLE_SIZE),
semaphore: ctx.app_state().semaphore.clone(),
otel,
})
Expand Down
2 changes: 1 addition & 1 deletion crates/factor-sqlite/src/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl InstanceState {
) -> Self {
Self {
allowed_databases,
connections: spin_resource_table::Table::new(256),
connections: spin_resource_table::Table::new(spin_factors::DEFAULT_RESOURCE_TABLE_SIZE),
connection_creators,
otel,
}
Expand Down
8 changes: 8 additions & 0 deletions crates/factors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ pub use crate::{
},
};

/// A typical size for resource tables. Use this if you don't have a
/// reason to use another value (or as the default if your table is
/// configurable).
///
/// This value is aligned with the size chosen in `Table::default`
/// in `table/src/lib.rs`.
pub const DEFAULT_RESOURCE_TABLE_SIZE: u32 = 1024;

/// Result wrapper type defaulting to use [`Error`].
pub type Result<T, E = Error> = std::result::Result<T, E>;

Expand Down
1 change: 1 addition & 0 deletions crates/table/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ pub struct Table<V> {

impl<V> Default for Table<V> {
fn default() -> Self {
// For the value, cf `spin_factors::DEFAULT_RESOURCE_TABLE_SIZE`
Self::new(1024)
}
}
Expand Down
Loading