Skip to content
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

Add indexerLedgerForEval interface #2897

Merged
merged 5 commits into from
Sep 17, 2021

Conversation

tolikzinovyev
Copy link
Contributor

Summary

Add a new ledger interface for Indexer that is significantly simpler and allows implementing batching in a more straight-forward way. As a result, the Indexer code doesn't need to know the specifics of go-algorand and doesn't need to implement its own accounts cache for batching.

ledger/eval.go Outdated
// in the trusting mode are excluded, and the present functions only request data
// at the latest round.
type indexerLedgerForEval interface {
BlockHdr(basics.Round) (bookkeeping.BlockHeader, error)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when do you need different block header rounds ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only need to previous block header. Do you think I should simplify it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes; Naming it LatestBlockHdr() would be a good name... and in indexerLedgerConnector. BlockHdr you should test that round == blockHdr.Round(), or error. ( i.e. verify that the ledger wasn't really referring to a header which isn't the latest )

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

btw - same applied for Totals()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think that we can move the indexer related implementation to its own file ?
maybe indexereval.X ?

@tolikzinovyev
Copy link
Contributor Author

Do you think that we can move the indexer related implementation to its own file ?
maybe indexereval.X ?

Good idea, I moved the indexer code.

@codecov-commenter
Copy link

codecov-commenter commented Sep 15, 2021

Codecov Report

Merging #2897 (73a9bad) into master (b7a5b82) will decrease coverage by 0.00%.
The diff coverage is 39.24%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2897      +/-   ##
==========================================
- Coverage   47.27%   47.27%   -0.01%     
==========================================
  Files         355      356       +1     
  Lines       57199    57257      +58     
==========================================
+ Hits        27040    27067      +27     
- Misses      27101    27125      +24     
- Partials     3058     3065       +7     
Impacted Files Coverage Δ
ledger/eval.go 78.17% <ø> (+2.16%) ⬆️
ledger/evalIndexer.go 39.24% <39.24%> (ø)
ledger/blockqueue.go 81.03% <0.00%> (-1.15%) ⬇️
data/transactions/verify/txn.go 43.42% <0.00%> (-0.88%) ⬇️
ledger/acctupdates.go 62.13% <0.00%> (-0.51%) ⬇️
network/wsPeer.go 74.93% <0.00%> (+0.55%) ⬆️
catchup/service.go 69.35% <0.00%> (+0.77%) ⬆️
catchup/peerSelector.go 100.00% <0.00%> (+1.04%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b7a5b82...73a9bad. Read the comment docs.

tsachiherman
tsachiherman previously approved these changes Sep 16, 2021
@tsachiherman
Copy link
Contributor

Looks good - could you please verify it passes all the auto tests ?

@tsachiherman tsachiherman merged commit 275e1f3 into algorand:master Sep 17, 2021
@tolikzinovyev tolikzinovyev deleted the indexer-ledger-for-eval branch September 20, 2021 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants