Merge pull request #126 from djmitche/async

Make Storage methods async
This commit is contained in:
Dustin J. Mitchell
2025-07-13 09:25:43 -04:00
committed by GitHub
14 changed files with 594 additions and 422 deletions

View File

@ -49,6 +49,7 @@ pub(crate) async fn service(
server_state
.server
.add_snapshot(client_id, version_id, body.to_vec())
.await
.map_err(server_error_to_actix)?;
Ok(HttpResponse::Ok().body(""))
}
@ -70,10 +71,10 @@ mod test {
// set up the storage contents..
{
let mut txn = storage.txn(client_id).unwrap();
txn.new_client(version_id).unwrap();
txn.add_version(version_id, NIL_VERSION_ID, vec![])?;
txn.commit()?;
let mut txn = storage.txn(client_id).await.unwrap();
txn.new_client(version_id).await.unwrap();
txn.add_version(version_id, NIL_VERSION_ID, vec![]).await?;
txn.commit().await?;
}
let server = WebServer::new(ServerConfig::default(), WebConfig::default(), storage);
@ -114,9 +115,9 @@ mod test {
// set up the storage contents..
{
let mut txn = storage.txn(client_id).unwrap();
txn.new_client(NIL_VERSION_ID).unwrap();
txn.commit().unwrap();
let mut txn = storage.txn(client_id).await.unwrap();
txn.new_client(NIL_VERSION_ID).await.unwrap();
txn.commit().await.unwrap();
}
let server = WebServer::new(ServerConfig::default(), WebConfig::default(), storage);