Skip to content

Conduit: Algod importer implementation #1135

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

Merged
merged 6 commits into from
Aug 1, 2022
Merged

Conversation

algoganesh
Copy link

Summary

Defines interface for importer plugins and a sample implementation of importer interface using algod rest endpoint.

@codecov
Copy link

codecov bot commented Jul 20, 2022

Codecov Report

❗ No coverage uploaded for pull request base (conduit@c0bf99a). Click here to learn what that means.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             conduit    #1135   +/-   ##
==========================================
  Coverage           ?   60.65%           
==========================================
  Files              ?       56           
  Lines              ?     8435           
  Branches           ?        0           
==========================================
  Hits               ?     5116           
  Misses             ?     2857           
  Partials           ?      462           

Help us with your feedback. Take ten seconds to tell us how you rate us.

type Importer interface {
// GetBlock given any round number rnd fetches the block at that round
// It returns an object of type BlockExportData defined in exporters plugin
GetBlock(rnd uint64) (*exporters.BlockExportData, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

does the processor take block of type exporters.BlockExportData too?

Copy link
Contributor

Choose a reason for hiding this comment

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

It should. I think we're still trying to figure out what the best data format is to pass between all of the plugin.
Some discussion happening in #1119 (comment)

@algoganesh algoganesh force-pushed the algod-importer-impl branch from c6b9cb0 to 027ab87 Compare July 21, 2022 16:42
@algoganesh algoganesh force-pushed the algod-importer-impl branch 2 times, most recently from cb0acac to 777f722 Compare July 26, 2022 16:49
Copy link
Contributor

@Eric-Warehime Eric-Warehime left a comment

Choose a reason for hiding this comment

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

LGTM. Left some minor comments.

return err
}
if u.Scheme != "http" && u.Scheme != "https" {
algodImp.cfg.NetAddr = "http://" + algodImp.cfg.NetAddr
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we log this?

Copy link
Author

Choose a reason for hiding this comment

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

I think its a good idea to log it

s = ""
}

func MockAlgodServerReturnsEmptyBlock() *httptest.Server {
Copy link
Contributor

Choose a reason for hiding this comment

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

We have somewhat similar code in https://github.com/algorand/indexer/blob/develop/fetcher/fetcher_test.go#L103

Also, Will mentioned that block-generator might be doing the same. We should look to refactor these into commonly used conventions for mocking Algod in the future.

Copy link
Author

Choose a reason for hiding this comment

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

I agree. Also MockAlgodServerReturnsEmptyBlock() is intentionally exported for other plugins to utilize in testing.

@Eric-Warehime Eric-Warehime merged commit 595d3bf into conduit Aug 1, 2022
@Eric-Warehime Eric-Warehime deleted the algod-importer-impl branch August 1, 2022 17:14
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.

6 participants