-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(core): collect runs batched checks #180
Conversation
This comment has been minimized.
This comment has been minimized.
Pull Request Test Coverage Report for Build 6673349985
💛 - Coveralls |
The checks are specifically made to check the receipts that are to be aggregated only in their own context. Helps for uniqueness checks for example, where we avoid calling the storage backend and only check that the collected receipts are unique. Signed-off-by: Alexis Asseman <[email protected]>
26242a2
to
e608b44
Compare
Signed-off-by: Alexis Asseman <[email protected]>
This comment has been minimized.
This comment has been minimized.
What do you think about proxying the batch call through received receipts class? That way, we can ensure the state remains owned by received receipt. I am worried that we will get difficult bugs popping up as soon as we start requiring the state to be managed outside the state owner. impl ReceivedReceipt {
...
pub async fn perform_batch_checks<CA: EscrowAdapter, RCA: ReceiptChecksAdapter>(
batch: &mut [Self],
check: &ReceiptCheck,
receipt_auditor: &ReceiptAuditor<CA, RCA>,
) -> crate::Result<()> {
receipt_auditor
.check_batch(check, batch)
.await?;
for receipt in batch {
receipt.update_state();
}
Ok(())
}
...
} Additionally, we could return the list of results and have ReceivedReceipt do the updating as well, mainly to keep the approach consistent. pub async fn perform_batch_checks<CA: EscrowAdapter, RCA: ReceiptChecksAdapter>(
batch: &mut [Self],
check: &ReceiptCheck,
receipt_auditor: &ReceiptAuditor<CA, RCA>,
) -> crate::Result<()> {
results = receipt_auditor
.check_batch(check, batch)
.await?;
for (receipt,result) in batch.iter_mut().zip(results) {
receipt.update_check(check, result);
receipt.update_state();
}
ok(())
} Assuming the returned list of results are in the same order as the receipts provided. (edited) |
This reverts commit 882ca39. Signed-off-by: Alexis Asseman <[email protected]>
Signed-off-by: Alexis Asseman <[email protected]>
9bf9064
to
1ed4355
Compare
I reverted a commit that shouldn't be in this PR, and applied your suggestion. |
This comment has been minimized.
This comment has been minimized.
1 similar comment
🤖 Cargo Audit Report 🤖 (Empty means OK! 👍) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checks are specifically made to check the receipts that are to be aggregated only in their own context. Helps for uniqueness checks for example, where we avoid calling the storage backend and only check that the collected receipts are unique.
In terms of the public API, this should be a cleaner solution than #179 . The implementation itself is not super clean though. A deeper refactor of tap_core may help make this a bit less hacky.