github.com/Finschia/finschia-sdk@v0.48.1/baseapp/streaming.go (about)

     1  package baseapp
     2  
     3  import (
     4  	"io"
     5  	"sync"
     6  
     7  	abci "github.com/tendermint/tendermint/abci/types"
     8  
     9  	ocabci "github.com/Finschia/ostracon/abci/types"
    10  
    11  	store "github.com/Finschia/finschia-sdk/store/types"
    12  	"github.com/Finschia/finschia-sdk/types"
    13  )
    14  
    15  // ABCIListener interface used to hook into the ABCI message processing of the BaseApp
    16  type ABCIListener interface {
    17  	// ListenBeginBlock updates the streaming service with the latest BeginBlock messages
    18  	ListenBeginBlock(ctx types.Context, req ocabci.RequestBeginBlock, res abci.ResponseBeginBlock) error
    19  	// ListenEndBlock updates the steaming service with the latest EndBlock messages
    20  	ListenEndBlock(ctx types.Context, req abci.RequestEndBlock, res abci.ResponseEndBlock) error
    21  	// ListenDeliverTx updates the steaming service with the latest DeliverTx messages
    22  	ListenDeliverTx(ctx types.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) error
    23  }
    24  
    25  // StreamingService interface for registering WriteListeners with the BaseApp and updating the service with the ABCI messages using the hooks
    26  type StreamingService interface {
    27  	// Stream is the streaming service loop, awaits kv pairs and writes them to some destination stream or file
    28  	Stream(wg *sync.WaitGroup) error
    29  	// Listeners returns the streaming service's listeners for the BaseApp to register
    30  	Listeners() map[store.StoreKey][]store.WriteListener
    31  	// ABCIListener interface for hooking into the ABCI messages from inside the BaseApp
    32  	ABCIListener
    33  	// Closer interface
    34  	io.Closer
    35  }