* fix: state listener observe writes at wrong time Closes: #13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync * synchronous abci call, and format doc * fix comment * update file streamer readme and fix typos * typo * fix: state listener observe writes at wrong time Closes: #13457 Currently state listener is notified when the cache store write, which happens in commit event only, which breaks the current design. The solution (as discussed in the issue) is to listen state writes on rootmulti store only. It also changes the file streamer to output single data file for the writes in the whole block, since we can't distinguish writes from different stage of abci events. It adds new config items for file streamer: - streamers.file.output-metadata - streamers.file.stop-node-on-error - streamers.file.fsync synchronous abci call, and format doc fix comment update file streamer readme and fix typos typo * improve UX of file streamer, make it immediately usable after enabled - set default value to write_dir. - make write_dir based on home directory by default. - auto-create the directory if not exists. * get homePage from opts Co-authored-by: Marko <marbar3778@yahoo.com>
38 lines
1.7 KiB
Go
38 lines
1.7 KiB
Go
package baseapp
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"sync"
|
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
store "github.com/cosmos/cosmos-sdk/store/types"
|
|
)
|
|
|
|
// ABCIListener interface used to hook into the ABCI message processing of the BaseApp.
|
|
// the error results are propagated to consensus state machine,
|
|
// if you don't want to affect consensus, handle the errors internally and always return `nil` in these APIs.
|
|
type ABCIListener interface {
|
|
// ListenBeginBlock updates the streaming service with the latest BeginBlock messages
|
|
ListenBeginBlock(ctx context.Context, req abci.RequestBeginBlock, res abci.ResponseBeginBlock) error
|
|
// ListenEndBlock updates the steaming service with the latest EndBlock messages
|
|
ListenEndBlock(ctx context.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
|
|
// ListenDeliverTx updates the steaming service with the latest DeliverTx messages
|
|
ListenDeliverTx(ctx context.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
|
|
// ListenCommit updates the steaming service with the latest Commit event
|
|
ListenCommit(ctx context.Context, res abci.ResponseCommit) error
|
|
}
|
|
|
|
// StreamingService interface for registering WriteListeners with the BaseApp and updating the service with the ABCI messages using the hooks
|
|
type StreamingService interface {
|
|
// Stream is the streaming service loop, awaits kv pairs and writes them to some destination stream or file
|
|
Stream(wg *sync.WaitGroup) error
|
|
// Listeners returns the streaming service's listeners for the BaseApp to register
|
|
Listeners() map[store.StoreKey][]store.WriteListener
|
|
// ABCIListener interface for hooking into the ABCI messages from inside the BaseApp
|
|
ABCIListener
|
|
// Closer interface
|
|
io.Closer
|
|
}
|