-
Notifications
You must be signed in to change notification settings - Fork 11
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 reader-node-firehose #63
base: develop
Are you sure you want to change the base?
add reader-node-firehose #63
Conversation
a.zlogger.Info("launching reader log plugin") | ||
mindreaderLogPlugin, err := mindreader.NewMindReaderPlugin( | ||
a.Config.OneBlocksStoreURL, | ||
a.Config.WorkingDir, | ||
firehoseReader.NoopConsoleReader, | ||
a.Config.StartBlockNum, | ||
a.Config.StopBlockNum, | ||
a.Config.MindReadBlocksChanCapacity, | ||
a.modules.MetricsAndReadinessManager.UpdateHeadBlock, | ||
func(_ error) {}, | ||
a.Config.OneBlockSuffix, | ||
blockStreamServer, | ||
a.zlogger, | ||
a.tracer, | ||
) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
a.zlogger.Debug("configuring shutter") | ||
mindreaderLogPlugin.OnTerminated(a.Shutdown) | ||
a.OnTerminating(mindreaderLogPlugin.Shutdown) |
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.
Ideally, we would avoid completely the mindreader plugin, there is overall little reason to use outside avoiding re-implementing two things:
- Save received one block to one-blocks-store
- Emit block on block stream server
I understand it make the implementation easier. But I have the overall feeling that it will make a much simpler implementation since we will move away from the node-manager.
We should also move to something else than node-manager
as the top-level package.
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.
Sounds good. Should I move it into its own top-level package or is there another package to include it in?
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.
A new top-level reader-node-firehose
seems good, the package <name>
could be shorter if needed.
stream, err := f.firehoseClient.Blocks(context.Background(), &pbfirehose.Request{ | ||
StartBlockNum: int64(startBlock), | ||
Cursor: string(cursor), | ||
StopBlockNum: stopBlock, | ||
FinalBlocksOnly: false, | ||
}, f.callOpts...) | ||
if err != nil { | ||
return fmt.Errorf("failed to request block stream from Firehose: %w", err) | ||
} |
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.
How do we deal with connection errors?
ctx, s.cancelPeriodicLogger = context.WithCancel(ctx) | ||
|
||
go func() { | ||
ticker := time.NewTicker(logEach) |
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.
ticker has a Stop()
let's defer stop it.
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.
blockRate
too has a Stop
method. Could go in StopPeriodicLogToZap()
too.
Fred will continue on this in the new year. |
@matthewdarwin I reviewed the SQL PRs too. If there is something I missed, let me know. |
This adds a new reader-node app that reads blocks from another Firehose endpoint. This allows indexers to bootstrap a Firehose/Substreams stack without having to set up an instrumented blockchain node initially.