commit 2294160193addfdfb64099453ead4bfb7a535221
parent 05d6103a019e529deeb64f6a5b2ff5afa4fb93c6
Author: triesap <tyson@radroots.org>
Date: Sun, 14 Jun 2026 15:50:16 -0700
config: remove fake pocket storage knobs
Diffstat:
14 files changed, 49 insertions(+), 165 deletions(-)
diff --git a/config/tangle.example.json b/config/tangle.example.json
@@ -5,8 +5,6 @@
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1099511627776,
- "reader_slots": 512,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle/tests/version.rs b/crates/tangle/tests/version.rs
@@ -102,8 +102,6 @@ fn tangle_run_starts_server_and_stays_alive_until_shutdown() {
},
"pocket": {
"data_directory": data_dir,
- "map_size_bytes": 10485760,
- "reader_slots": 32,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_bench/src/lib.rs b/crates/tangle_bench/src/lib.rs
@@ -1445,13 +1445,8 @@ fn authenticated(key: FixtureKey) -> Result<BaseAuthState, String> {
fn bench_store_config(run_name: &str) -> Result<PocketStoreConfig, String> {
let root = bench_temp_root(run_name);
let _ = fs::remove_dir_all(&root);
- PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .map_err(|error| error.to_string())
+ PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .map_err(|error| error.to_string())
}
fn bench_temp_root(run_name: &str) -> PathBuf {
diff --git a/crates/tangle_runtime/src/config.rs b/crates/tangle_runtime/src/config.rs
@@ -305,8 +305,6 @@ struct BaseRelayServerConfigDocument {
#[serde(deny_unknown_fields)]
struct BaseRelayPocketConfigDocument {
data_directory: String,
- map_size_bytes: u64,
- reader_slots: u32,
sync_policy: BaseRelayPocketSyncPolicyDocument,
}
@@ -437,8 +435,6 @@ pub fn parse_base_relay_runtime_config_json(
})?;
let pocket = PocketStoreConfig::new(
PathBuf::from(document.pocket.data_directory),
- document.pocket.map_size_bytes,
- document.pocket.reader_slots,
match document.pocket.sync_policy {
BaseRelayPocketSyncPolicyDocument::FlushOnWrite => PocketSyncPolicy::FlushOnWrite,
BaseRelayPocketSyncPolicyDocument::FlushOnShutdown => PocketSyncPolicy::FlushOnShutdown,
@@ -626,8 +622,6 @@ mod tests {
config.pocket_config().data_directory(),
Path::new("runtime/pocket")
);
- assert_eq!(config.pocket_config().map_size_bytes(), 1_099_511_627_776);
- assert_eq!(config.pocket_config().reader_slots(), 512);
assert_eq!(
config.pocket_config().sync_policy(),
PocketSyncPolicy::FlushOnShutdown
@@ -700,8 +694,6 @@ mod tests {
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1073741824,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
@@ -781,8 +773,6 @@ mod tests {
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1073741824,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
@@ -859,8 +849,6 @@ mod tests {
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1073741824,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
@@ -932,6 +920,31 @@ mod tests {
}
#[test]
+ fn base_relay_runtime_config_rejects_removed_pocket_options() {
+ let raw = include_str!("../../../config/tangle.example.json").replace(
+ " \"data_directory\": \"runtime/pocket\",\n",
+ " \"data_directory\": \"runtime/pocket\",\n \"map_size_bytes\": 1073741824,\n",
+ );
+ assert!(
+ parse_base_relay_runtime_config_json(&raw)
+ .expect_err("removed map size")
+ .prefixed_message()
+ .contains("unknown field `map_size_bytes`")
+ );
+
+ let raw = include_str!("../../../config/tangle.example.json").replace(
+ " \"data_directory\": \"runtime/pocket\",\n",
+ " \"data_directory\": \"runtime/pocket\",\n \"reader_slots\": 128,\n",
+ );
+ assert!(
+ parse_base_relay_runtime_config_json(&raw)
+ .expect_err("removed readers")
+ .prefixed_message()
+ .contains("unknown field `reader_slots`")
+ );
+ }
+
+ #[test]
fn base_relay_runtime_config_requires_explicit_query_complexity() {
let raw = include_str!("../../../config/tangle.example.json")
.replace(" \"max_query_complexity\": 2048,\n", "");
diff --git a/crates/tangle_runtime/src/groups.rs b/crates/tangle_runtime/src/groups.rs
@@ -1071,13 +1071,8 @@ mod tests {
std::process::id()
));
let _ = std::fs::remove_dir_all(&root);
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let store = PocketStoreHandle::open(&config).expect("store");
assert!(
@@ -1094,13 +1089,8 @@ mod tests {
std::process::id()
));
let _ = std::fs::remove_dir_all(&root);
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let store = PocketStoreHandle::open(&config).expect("store");
let public =
tangle_v2_event(FixtureKey::Member, 1, 1, Vec::new(), "public").expect("public");
@@ -1254,13 +1244,8 @@ mod tests {
fn test_store(name: &str) -> (std::path::PathBuf, PocketStoreHandle) {
let root = std::env::temp_dir().join(format!("{}-{}", name, std::process::id()));
let _ = std::fs::remove_dir_all(&root);
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let store = PocketStoreHandle::open(&config).expect("store");
(root, store)
}
diff --git a/crates/tangle_runtime/src/nip11.rs b/crates/tangle_runtime/src/nip11.rs
@@ -390,8 +390,6 @@ mod tests {
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": groups,
diff --git a/crates/tangle_runtime/src/relay/core.rs b/crates/tangle_runtime/src/relay/core.rs
@@ -2461,13 +2461,8 @@ mod tests {
fn test_store_config(name: &str) -> PocketStoreConfig {
let root = std::env::temp_dir().join(format!("tangle-{name}-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&root);
- PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config")
+ PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config")
}
fn enabled_groups_for_owner(owner: &PublicKeyHex) -> tangle_groups::GroupRuntimeConfig {
diff --git a/crates/tangle_runtime/src/runtime.rs b/crates/tangle_runtime/src/runtime.rs
@@ -2715,8 +2715,6 @@ mod tests {
},
"pocket": {
"data_directory": root.join("pocket"),
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_runtime/src/server.rs b/crates/tangle_runtime/src/server.rs
@@ -524,8 +524,6 @@ mod tests {
},
"pocket": {
"data_directory": root.join("pocket"),
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_runtime/src/session.rs b/crates/tangle_runtime/src/session.rs
@@ -738,8 +738,6 @@ mod tests {
},
"pocket": {
"data_directory": root.join("pocket"),
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_runtime/tests/base_relay_v2.rs b/crates/tangle_runtime/tests/base_relay_v2.rs
@@ -1789,13 +1789,7 @@ fn final_group_name_for_order(name: &str, edits: [&Event; 2]) -> String {
fn test_store_config(name: &str) -> PocketStoreConfig {
let root = temp_root(name);
let _ = fs::remove_dir_all(&root);
- PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config")
+ PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown).expect("config")
}
fn relay_limits(max_pending_events: usize) -> BaseRelayLimits {
@@ -1987,8 +1981,6 @@ fn runtime_config(groups_enabled: bool) -> BaseRelayRuntimeConfig {
},
"pocket": {
"data_directory": "runtime/pocket",
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": groups,
diff --git a/crates/tangle_runtime/tests/ops_truthfulness.rs b/crates/tangle_runtime/tests/ops_truthfulness.rs
@@ -136,8 +136,6 @@ fn runtime_config(root: &Path) -> BaseRelayRuntimeConfig {
},
"pocket": {
"data_directory": root.join("pocket"),
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_runtime/tests/phase2_acceptance_targets.rs b/crates/tangle_runtime/tests/phase2_acceptance_targets.rs
@@ -1605,8 +1605,6 @@ fn runtime_config_value(root: &Path, listen_addr: SocketAddr) -> Value {
},
"pocket": {
"data_directory": root.join("pocket"),
- "map_size_bytes": 1073741824_u64,
- "reader_slots": 128,
"sync_policy": "flush_on_shutdown"
},
"groups": {
diff --git a/crates/tangle_store_pocket/src/lib.rs b/crates/tangle_store_pocket/src/lib.rs
@@ -344,22 +344,16 @@ pub enum PocketSyncPolicy {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct PocketStoreConfig {
data_directory: PathBuf,
- map_size_bytes: u64,
- reader_slots: u32,
sync_policy: PocketSyncPolicy,
}
impl PocketStoreConfig {
pub fn new(
data_directory: impl Into<PathBuf>,
- map_size_bytes: u64,
- reader_slots: u32,
sync_policy: PocketSyncPolicy,
) -> Result<Self, PocketConfigError> {
let config = Self {
data_directory: data_directory.into(),
- map_size_bytes,
- reader_slots,
sync_policy,
};
config.validate()?;
@@ -372,16 +366,6 @@ impl PocketStoreConfig {
"pocket.data_directory must not be empty",
));
}
- if self.map_size_bytes == 0 {
- return Err(PocketConfigError::invalid(
- "pocket.map_size_bytes must be greater than zero",
- ));
- }
- if self.reader_slots == 0 {
- return Err(PocketConfigError::invalid(
- "pocket.reader_slots must be greater than zero",
- ));
- }
Ok(())
}
@@ -389,14 +373,6 @@ impl PocketStoreConfig {
&self.data_directory
}
- pub fn map_size_bytes(&self) -> u64 {
- self.map_size_bytes
- }
-
- pub fn reader_slots(&self) -> u32 {
- self.reader_slots
- }
-
pub fn sync_policy(&self) -> PocketSyncPolicy {
self.sync_policy
}
@@ -547,13 +523,8 @@ mod tests {
#[test]
fn pocket_store_handle_opens_syncs_and_exposes_tangle_tables() {
let root = std::env::temp_dir().join(format!("tangle-pocket-store-{}", std::process::id()));
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
@@ -571,13 +542,8 @@ mod tests {
fn pocket_store_handle_stores_queries_and_counts_events() {
let root = std::env::temp_dir().join(format!("tangle-pocket-query-{}", std::process::id()));
let _ = std::fs::remove_dir_all(&root);
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
let event = parse_pocket_event_json(event_json().as_bytes()).expect("event");
let filter = parse_pocket_filter_json(filter_json().as_bytes()).expect("filter");
@@ -602,13 +568,8 @@ mod tests {
#[test]
fn pocket_store_handle_scans_canonical_events_with_offsets() {
let root = temp_root("tangle-pocket-scan");
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
let first =
parse_pocket_event_json(event_json_with("a", "1", "first").as_bytes()).expect("first");
@@ -637,13 +598,8 @@ mod tests {
#[test]
fn pocket_store_handle_screens_events_before_materialization() {
let root = temp_root("tangle-pocket-screen");
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
let visible = parse_pocket_event_json(event_json_with("a", "1", "visible").as_bytes())
.expect("visible");
@@ -674,13 +630,8 @@ mod tests {
#[test]
fn pocket_store_handle_persists_extra_table_records() {
let root = temp_root("tangle-pocket-extra");
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
handle
@@ -744,13 +695,8 @@ mod tests {
#[test]
fn pocket_store_handle_syncs_written_events_and_extra_records() {
let root = temp_root("tangle-pocket-sync");
- let config = PocketStoreConfig::new(
- root.join("pocket"),
- 1024 * 1024 * 1024,
- 128,
- PocketSyncPolicy::FlushOnShutdown,
- )
- .expect("config");
+ let config = PocketStoreConfig::new(root.join("pocket"), PocketSyncPolicy::FlushOnShutdown)
+ .expect("config");
let handle = PocketStoreHandle::open(&config).expect("open");
let event =
parse_pocket_event_json(event_json_with("d", "4", "synced").as_bytes()).expect("event");
@@ -790,8 +736,6 @@ mod tests {
fn pocket_store_config_preserves_explicit_storage_boundary() {
let config = PocketStoreConfig::new(
"runtime/radroots/tangle/pocket",
- 1024 * 1024 * 1024,
- 128,
PocketSyncPolicy::FlushOnShutdown,
)
.expect("config");
@@ -800,41 +744,17 @@ mod tests {
config.data_directory().to_string_lossy(),
"runtime/radroots/tangle/pocket"
);
- assert_eq!(config.map_size_bytes(), 1024 * 1024 * 1024);
- assert_eq!(config.reader_slots(), 128);
assert_eq!(config.sync_policy(), PocketSyncPolicy::FlushOnShutdown);
}
#[test]
fn pocket_store_config_rejects_implicit_storage_values() {
assert_eq!(
- PocketStoreConfig::new("", 1, 1, PocketSyncPolicy::FlushOnWrite)
+ PocketStoreConfig::new("", PocketSyncPolicy::FlushOnWrite)
.expect_err("error")
.message(),
"pocket.data_directory must not be empty"
);
- assert_eq!(
- PocketStoreConfig::new(
- "runtime/radroots/tangle/pocket",
- 0,
- 1,
- PocketSyncPolicy::FlushOnWrite
- )
- .expect_err("error")
- .message(),
- "pocket.map_size_bytes must be greater than zero"
- );
- assert_eq!(
- PocketStoreConfig::new(
- "runtime/radroots/tangle/pocket",
- 1,
- 0,
- PocketSyncPolicy::FlushOnWrite
- )
- .expect_err("error")
- .message(),
- "pocket.reader_slots must be greater than zero"
- );
}
fn event_json() -> String {