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
commit c539e604d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 594 additions and 422 deletions

View file

@ -20,6 +20,7 @@ pub(crate) async fn service(
if let Some((version_id, data)) = server_state
.server
.get_snapshot(client_id)
.await
.map_err(server_error_to_actix)?
{
Ok(HttpResponse::Ok()
@ -48,9 +49,9 @@ mod test {
// set up the storage contents..
{
let mut txn = storage.txn(client_id).unwrap();
txn.new_client(Uuid::new_v4()).unwrap();
txn.commit().unwrap();
let mut txn = storage.txn(client_id).await.unwrap();
txn.new_client(Uuid::new_v4()).await.unwrap();
txn.commit().await.unwrap();
}
let server = WebServer::new(ServerConfig::default(), WebConfig::default(), storage);
@ -75,8 +76,8 @@ mod test {
// set up the storage contents..
{
let mut txn = storage.txn(client_id).unwrap();
txn.new_client(Uuid::new_v4()).unwrap();
let mut txn = storage.txn(client_id).await.unwrap();
txn.new_client(Uuid::new_v4()).await.unwrap();
txn.set_snapshot(
Snapshot {
version_id,
@ -85,8 +86,9 @@ mod test {
},
snapshot_data.clone(),
)
.await
.unwrap();
txn.commit().unwrap();
txn.commit().await.unwrap();
}
let server = WebServer::new(ServerConfig::default(), WebConfig::default(), storage);