Use Garmelon/vault

This commit is contained in:
Joscha 2023-02-12 23:09:59 +01:00
parent 35a140e21f
commit 7e9e441c1e
15 changed files with 442 additions and 458 deletions

View file

@ -10,7 +10,7 @@ pub async fn export<W: Write>(vault: &EuphRoomVault, file: &mut W) -> anyhow::Re
let mut total = 0;
let mut offset = 0;
loop {
let messages = vault.chunk_at_offset(CHUNK_SIZE, offset).await;
let messages = vault.chunk_at_offset(CHUNK_SIZE, offset).await?;
offset += messages.len();
if messages.is_empty() {
@ -42,7 +42,7 @@ pub async fn export_stream<W: Write>(vault: &EuphRoomVault, file: &mut W) -> any
let mut total = 0;
let mut offset = 0;
loop {
let messages = vault.chunk_at_offset(CHUNK_SIZE, offset).await;
let messages = vault.chunk_at_offset(CHUNK_SIZE, offset).await?;
offset += messages.len();
if messages.is_empty() {

View file

@ -16,11 +16,11 @@ const TIME_EMPTY: &str = " ";
pub async fn export<W: Write>(vault: &EuphRoomVault, out: &mut W) -> anyhow::Result<()> {
let mut exported_trees = 0;
let mut exported_msgs = 0;
let mut root_id = vault.first_root_id().await;
let mut root_id = vault.first_root_id().await?;
while let Some(some_root_id) = root_id {
let tree = vault.tree(some_root_id).await;
let tree = vault.tree(some_root_id).await?;
write_tree(out, &tree, some_root_id, 0)?;
root_id = vault.next_root_id(some_root_id).await;
root_id = vault.next_root_id(some_root_id).await?;
exported_trees += 1;
exported_msgs += tree.len();