diff options
| author | tv <tv@krebsco.de> | 2026-11-07 22:35:09 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-07 22:35:09 +0100 |
| commit | 13cba9b0be736433d8ac44c0ef046cb001918a07 (patch) | |
| tree | 09272f50d6d27cab6200a33fcdc7abb9e552e46c /src/remake | |
| parent | ec70060ae5fa665953741da921e28031b56bc5e0 (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/remake')
| -rw-r--r-- | src/remake/delta.rs | 4 | ||||
| -rw-r--r-- | src/remake/records.rs | 4 | ||||
| -rw-r--r-- | src/remake/snapshot.rs | 3 |
3 files changed, 8 insertions, 3 deletions
diff --git a/src/remake/delta.rs b/src/remake/delta.rs index 638231c..6864c4d 100644 --- a/src/remake/delta.rs +++ b/src/remake/delta.rs @@ -242,8 +242,8 @@ fn replay_path( // Replacing an ancestor of the protocol metadata as a whole would clobber it; replay // its children one by one instead. if contains_protocol_path(path) { - let mut keys = store::keys_at(src, path).unwrap_or_default(); - keys.extend(store::keys_at(dst, path).unwrap_or_default()); + let mut keys = store::keys_at(src, path).ok().flatten().unwrap_or_default(); + keys.extend(store::keys_at(dst, path).ok().flatten().unwrap_or_default()); keys.sort(); keys.dedup(); for key in keys { diff --git a/src/remake/records.rs b/src/remake/records.rs index 0c4c444..21b383c 100644 --- a/src/remake/records.rs +++ b/src/remake/records.rs @@ -360,6 +360,8 @@ pub(crate) fn load(doc: &impl ReadDoc, id: &str) -> Option<Record> { pub(crate) fn load_all(doc: &impl ReadDoc) -> Vec<(String, Record)> { let register = load_register(doc); store::keys_at(doc, &records_dir()) + .ok() + .flatten() .unwrap_or_default() .into_iter() .filter_map(|id| { @@ -434,6 +436,8 @@ fn register_path(voter: &str) -> Vec<String> { /// The votes register; unreadable entries are skipped with a warning. pub(crate) fn load_register(doc: &impl ReadDoc) -> Register { store::keys_at(doc, &meta::path(&[VOTES])) + .ok() + .flatten() .unwrap_or_default() .into_iter() .filter_map(|voter| { diff --git a/src/remake/snapshot.rs b/src/remake/snapshot.rs index 157a28d..220989e 100644 --- a/src/remake/snapshot.rs +++ b/src/remake/snapshot.rs @@ -231,6 +231,7 @@ pub(crate) fn verify_document(doc: &Document, epoch: Epoch) -> Result<EpochMetad pub(crate) fn epoch_of(doc: &Document) -> Result<Epoch, String> { let generation = store::keys_at(doc, &meta::path(&[EPOCHS])) .map_err(|error| error.to_string())? + .unwrap_or_default() .iter() .filter_map(|key| key.parse::<u64>().ok()) .max(); @@ -295,7 +296,7 @@ pub(crate) fn build( Ok(()) | Err(StoreError::NotFound) => {} Err(error) => return Err(error.into()), } - let mut protocol_keys = store::keys_at(&base, &meta::path(&[]))?; + let mut protocol_keys = store::keys_at(&base, &meta::path(&[]))?.unwrap_or_default(); protocol_keys.sort(); for key in protocol_keys .into_iter() |
