Skip to content

Commit

Permalink
fix(iroh-sync): ensure the authors table exists (#1807)
Browse files Browse the repository at this point in the history
Closes #1806
  • Loading branch information
dignifiedquire committed Nov 14, 2023
1 parent 018772c commit 39ed64e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 37 deletions.
68 changes: 31 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions iroh-sync/src/store/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ impl Store {
let _table = write_tx.open_table(NAMESPACES_TABLE)?;
let _table = write_tx.open_table(LATEST_PER_AUTHOR_TABLE)?;
let _table = write_tx.open_multimap_table(NAMESPACE_PEERS_TABLE)?;
let _table = write_tx.open_table(AUTHORS_TABLE)?;
}
write_tx.commit()?;

Expand Down Expand Up @@ -778,6 +779,9 @@ mod tests {
let dbfile = tempfile::NamedTempFile::new()?;
let store = Store::new(dbfile.path())?;

let authors: Vec<_> = store.list_authors()?.collect::<Result<_>>()?;
assert!(authors.is_empty());

let author = store.new_author(&mut rand::thread_rng())?;
let namespace = NamespaceSecret::new(&mut rand::thread_rng());
let replica = store.new_replica(namespace.clone())?;
Expand Down

0 comments on commit 39ed64e

Please sign in to comment.