chore: clean up example (backport #24709) (#24710)

Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
This commit is contained in:
mergify[bot] 2025-05-06 14:38:02 -04:00 committed by GitHub
parent dcec726d24
commit 1228f82ce1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 2 additions and 55 deletions

2
.gitignore vendored
View File

@ -52,6 +52,8 @@ vagrant
.dir-locals.el
.vscode
.venv
# Depinject & Graphviz
dependency-graph.png
debug_container.dot

View File

@ -169,12 +169,6 @@ just trying the examples, you can skip ahead to the [Testing](#testing) section.
make proto-gen
```
* stdout plugin; from inside the `store/` dir, run:
```shell
go build -o streaming/abci/examples/stdout/stdout streaming/abci/examples/stdout/stdout.go
```
* file plugin (writes to `~/`); from inside the `store/` dir, run:
```shell
@ -185,12 +179,6 @@ go build -o streaming/abci/examples/file/file streaming/abci/examples/file/file.
Export a plugin from one of the Go or Python examples.
* stdout plugin
```shell
export COSMOS_SDK_ABCI="{path to}/cosmos-sdk/store/streaming/abci/examples/stdout/stdout"
```
* file plugin (writes to ~/)
```shell

View File

@ -1,43 +0,0 @@
package main
import (
"context"
"fmt"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/hashicorp/go-plugin"
streamingabci "cosmossdk.io/store/streaming/abci"
store "cosmossdk.io/store/types"
)
// StdoutPlugin is the implementation of the ABCIListener interface
// For Go plugins this is all that is required to process data sent over gRPC.
type StdoutPlugin struct {
BlockHeight int64
}
func (a *StdoutPlugin) ListenFinalizeBlock(ctx context.Context, req abci.RequestFinalizeBlock, res abci.ResponseFinalizeBlock) error {
a.BlockHeight = req.Height
// process tx messages (i.e: sent to external system)
fmt.Printf("listen-finalize-block: block-height=%d req=%v res=%v", a.BlockHeight, req, res)
return nil
}
func (a *StdoutPlugin) ListenCommit(ctx context.Context, res abci.ResponseCommit, changeSet []*store.StoreKVPair) error {
// process block commit messages (i.e: sent to external system)
fmt.Printf("listen-commit: block_height=%d res=%v data=%v", a.BlockHeight, res, changeSet)
return nil
}
func main() {
plugin.Serve(&plugin.ServeConfig{
HandshakeConfig: streamingabci.Handshake,
Plugins: map[string]plugin.Plugin{
"abci": &streamingabci.ListenerGRPCPlugin{Impl: &StdoutPlugin{}},
},
// A non-nil value here enables gRPC serving for this streaming...
GRPCServer: plugin.DefaultGRPCServer,
})
}