Skip to content

Commit

Permalink
Merge pull request fedimint#6445 from elsirion/2024-11-efficient-op-log
Browse files Browse the repository at this point in the history
fix: use linear pagination algorithm for operation log
  • Loading branch information
dpc authored Dec 2, 2024
2 parents 33cc642 + 07a3092 commit c319879
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 58 deletions.
2 changes: 1 addition & 1 deletion fedimint-cli/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ pub async fn handle_command(

let operations = client
.operation_log()
.list_operations(limit, None)
.paginate_operations_rev(limit, None)
.await
.into_iter()
.map(|(k, v)| {
Expand Down
2 changes: 1 addition & 1 deletion fedimint-client/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ impl_db_record!(
);

/// Key used to lookup operation log entries in chronological order
#[derive(Debug, Clone, Copy, Encodable, Decodable, Serialize)]
#[derive(Debug, Clone, Copy, Hash, Eq, PartialEq, Encodable, Decodable, Serialize)]
pub struct ChronologicalOperationLogKey {
pub creation_time: std::time::SystemTime,
pub operation_id: OperationId,
Expand Down
2 changes: 1 addition & 1 deletion fedimint-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ impl Client {
}
"list_operations" => {
// TODO: support pagination
let operations = self.operation_log().list_operations(usize::MAX, None).await;
let operations = self.operation_log().paginate_operations_rev(usize::MAX, None).await;
yield serde_json::to_value(operations)?;
}
"has_pending_recoveries" => {
Expand Down
Loading

0 comments on commit c319879

Please sign in to comment.