aboutsummaryrefslogtreecommitdiffstats
path: root/src/document/store.rs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2026-11-07 22:35:09 +0100
committertv <tv@krebsco.de>2026-11-07 22:35:09 +0100
commit13cba9b0be736433d8ac44c0ef046cb001918a07 (patch)
tree09272f50d6d27cab6200a33fcdc7abb9e552e46c /src/document/store.rs
parentec70060ae5fa665953741da921e28031b56bc5e0 (diff)
store: keys_at tells no map from an empty one
registry::exists counted any value at _continuum/users as a registry; keys_at answers None where there is no map, and its users (records, members, forget records, remakes) say what they make of it. Auth plan M1 (fix).
Diffstat (limited to 'src/document/store.rs')
-rw-r--r--src/document/store.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/document/store.rs b/src/document/store.rs
index b343a2e..2e27b44 100644
--- a/src/document/store.rs
+++ b/src/document/store.rs
@@ -650,16 +650,15 @@ fn summary(
Ok(JsonValue::Object(out))
}
-/// Whether `path` holds a map (one, or concurrent ones merged).
-pub(crate) fn is_map(doc: &impl ReadDoc, path: &[String]) -> bool {
- matches!(resolve_through(doc, path), Ok(Some(Resolved::Maps(_))))
-}
-
-/// Keys of the merged map at `path`; empty if it doesn't exist or isn't a map.
-pub(crate) fn keys_at(doc: &impl ReadDoc, path: &[String]) -> Result<Vec<String>, StoreError> {
+/// Keys of the merged map at `path`; None if there is no map there (nothing, or
+/// another value).
+pub(crate) fn keys_at(
+ doc: &impl ReadDoc,
+ path: &[String],
+) -> Result<Option<Vec<String>>, StoreError> {
Ok(match resolve_through(doc, path)? {
- Some(Resolved::Maps(maps)) => merged_keys(doc, &maps).into_iter().collect(),
- _ => Vec::new(),
+ Some(Resolved::Maps(maps)) => Some(merged_keys(doc, &maps).into_iter().collect()),
+ _ => None,
})
}