chore(docs): fix comments that do not start with the name of the exported element. (#20906)
This commit is contained in:
parent
61c36798d0
commit
b5319483ed
@ -896,7 +896,7 @@ func (d *LegacyDec) UnmarshalAmino(bz []byte) error { return d.Unmarshal(bz) }
|
||||
|
||||
// helpers
|
||||
|
||||
// test if two decimal arrays are equal
|
||||
// LegacyDecsEqual return true if two decimal arrays are equal.
|
||||
func LegacyDecsEqual(d1s, d2s []LegacyDec) bool {
|
||||
if len(d1s) != len(d2s) {
|
||||
return false
|
||||
|
||||
@ -521,7 +521,7 @@ func (i *Int) Size() int {
|
||||
func (i Int) MarshalAmino() ([]byte, error) { return i.Marshal() }
|
||||
func (i *Int) UnmarshalAmino(bz []byte) error { return i.Unmarshal(bz) }
|
||||
|
||||
// intended to be used with require/assert: require.True(IntEq(...))
|
||||
// IntEq intended to be used with require/assert: require.True(IntEq(...))
|
||||
func IntEq(t *testing.T, exp, got Int) (*testing.T, bool, string, string, string) {
|
||||
t.Helper()
|
||||
return t, exp.Equal(got), "expected:\t%v\ngot:\t\t%v", exp.String(), got.String()
|
||||
|
||||
@ -14,7 +14,7 @@ func (ts TestStore) Get(bz []byte) ([]byte, error) {
|
||||
return ts.Db.Get(bz)
|
||||
}
|
||||
|
||||
// // Has checks if a key exists.
|
||||
// Has checks if a key exists.
|
||||
func (ts TestStore) Has(key []byte) (bool, error) {
|
||||
return ts.Db.Has(key)
|
||||
}
|
||||
@ -23,18 +23,18 @@ func (ts TestStore) Set(k, v []byte) error {
|
||||
return ts.Db.Set(k, v)
|
||||
}
|
||||
|
||||
// // SetSync sets the value for the given key, and flushes it to storage before returning.
|
||||
// SetSync sets the value for the given key, and flushes it to storage before returning.
|
||||
func (ts TestStore) SetSync(k, v []byte) error {
|
||||
return ts.Db.SetSync(k, v)
|
||||
}
|
||||
|
||||
// // Delete deletes the key, or does nothing if the key does not exist.
|
||||
// // CONTRACT: key readonly []byte
|
||||
// Delete deletes the key, or does nothing if the key does not exist.
|
||||
// CONTRACT: key readonly []byte
|
||||
func (ts TestStore) Delete(bz []byte) error {
|
||||
return ts.Db.Delete(bz)
|
||||
}
|
||||
|
||||
// // DeleteSync deletes the key, and flushes the delete to storage before returning.
|
||||
// DeleteSync deletes the key, and flushes the delete to storage before returning.
|
||||
func (ts TestStore) DeleteSync(bz []byte) error {
|
||||
return ts.Db.DeleteSync(bz)
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ func DefaultConfig() *Config {
|
||||
}
|
||||
}
|
||||
|
||||
// GRPCConfig defines configuration for the gRPC server.
|
||||
// Config defines configuration for the gRPC server.
|
||||
type Config struct {
|
||||
// Enable defines if the gRPC server should be enabled.
|
||||
Enable bool `mapstructure:"enable" toml:"enable" comment:"Enable defines if the gRPC server should be enabled."`
|
||||
|
||||
@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Package reflection implements server reflection service.
|
||||
Package gogoreflection implements server reflection service.
|
||||
|
||||
The service implemented is defined in:
|
||||
https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto.
|
||||
|
||||
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
type (
|
||||
// exportGenesis is a function type that represents the export of the genesis state.
|
||||
// ExportGenesis is a function type that represents the export of the genesis state.
|
||||
ExportGenesis func(ctx context.Context, version uint64) ([]byte, error)
|
||||
// InitGenesis is a function type that represents the initialization of the genesis state.
|
||||
InitGenesis func(ctx context.Context, src io.Reader, txHandler func(json.RawMessage) error) error
|
||||
|
||||
@ -41,6 +41,7 @@ type StateTransitionFunction[T transaction.Tx] interface {
|
||||
req transaction.Msg,
|
||||
) (transaction.Msg, error)
|
||||
|
||||
// RunWithCtx executes the provided closure within a context.
|
||||
// TODO: remove
|
||||
RunWithCtx(
|
||||
ctx context.Context,
|
||||
|
||||
@ -506,6 +506,7 @@ func (c *Consensus[T]) Commit(ctx context.Context, _ *abciproto.CommitRequest) (
|
||||
}
|
||||
|
||||
// Vote extensions
|
||||
|
||||
// VerifyVoteExtension implements types.Application.
|
||||
func (c *Consensus[T]) VerifyVoteExtension(
|
||||
ctx context.Context,
|
||||
|
||||
@ -50,7 +50,7 @@ type Config struct {
|
||||
// CmtCfgOption is a function that allows to overwrite the default server configuration.
|
||||
type CmtCfgOption func(*cmtcfg.Config)
|
||||
|
||||
// OverwriteDefaultConfig overwrites the default config with the new config.
|
||||
// OverwriteDefaultCometConfig overwrites the default comet config with the new config.
|
||||
func OverwriteDefaultCometConfig(newCfg *cmtcfg.Config) CmtCfgOption {
|
||||
return func(cfg *cmtcfg.Config) { // nolint:staticcheck // We want to overwrite everything
|
||||
cfg = newCfg // nolint:ineffassign,staticcheck // We want to overwrite everything
|
||||
|
||||
@ -1,14 +1,15 @@
|
||||
// Package serverv2 defines constants for server configuration flags and output formats.
|
||||
package serverv2
|
||||
|
||||
const (
|
||||
// Home flags
|
||||
// FlagHome specifies the home directory flag.
|
||||
FlagHome = "home"
|
||||
|
||||
// Logging flags
|
||||
FlagLogLevel = "log_level"
|
||||
FlagLogFormat = "log_format"
|
||||
FlagLogNoColor = "log_no_color"
|
||||
FlagTrace = "trace"
|
||||
FlagLogLevel = "log_level" // Sets the logging level
|
||||
FlagLogFormat = "log_format" // Specifies the log output format
|
||||
FlagLogNoColor = "log_no_color" // Disables colored log output
|
||||
FlagTrace = "trace" // Enables trace-level logging
|
||||
|
||||
// OutputFormatJSON defines the JSON output format option.
|
||||
OutputFormatJSON = "json"
|
||||
)
|
||||
|
||||
@ -43,7 +43,7 @@ type HasStartFlags interface {
|
||||
|
||||
var _ ServerComponent[AppI[transaction.Tx], transaction.Tx] = (*Server[AppI[transaction.Tx], transaction.Tx])(nil)
|
||||
|
||||
// Configs returns a viper instance of the config file
|
||||
// ReadConfig returns a viper instance of the config file
|
||||
func ReadConfig(configPath string) (*viper.Viper, error) {
|
||||
v := viper.New()
|
||||
v.SetConfigType("toml")
|
||||
@ -168,7 +168,8 @@ func (s *Server[AppT, T]) Configs() map[string]any {
|
||||
return cfgs
|
||||
}
|
||||
|
||||
// Configs returns all configs of all server components.
|
||||
// Init initializes all server components with the provided application, configuration, and logger.
|
||||
// It returns an error if any component fails to initialize.
|
||||
func (s *Server[AppT, T]) Init(appI AppT, v *viper.Viper, logger log.Logger) error {
|
||||
var components []ServerComponent[AppT, T]
|
||||
for _, mod := range s.components {
|
||||
@ -217,7 +218,7 @@ func (s *Server[AppT, T]) WriteConfig(configPath string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Flags returns all flags of all server components.
|
||||
// StartFlags returns all flags of all server components.
|
||||
func (s *Server[AppT, T]) StartFlags() []*pflag.FlagSet {
|
||||
flags := []*pflag.FlagSet{}
|
||||
for _, mod := range s.components {
|
||||
|
||||
@ -14,11 +14,12 @@ type GRPCClient struct {
|
||||
client ListenerServiceClient
|
||||
}
|
||||
|
||||
// ListenEndBlock listens to end block request and responses.
|
||||
// In addition, it retrieves a types.Context from a context.Context instance.
|
||||
// It panics if a types.Context was not properly attached.
|
||||
// When the node is configured to stop on listening errors,
|
||||
// it will terminate immediately and exit with a non-zero code.
|
||||
// ListenDeliverBlock listens for block delivery requests and responses.
|
||||
// It retrieves a types.Context from the provided context.Context.
|
||||
// If the node is configured to stop on listening errors, it will terminate
|
||||
// and exit with a non-zero code upon encountering an error.
|
||||
//
|
||||
// Panics if a types.Context is not properly attached to the provided context.Context.
|
||||
func (m *GRPCClient) ListenDeliverBlock(goCtx context.Context, req ListenDeliverBlockRequest) error {
|
||||
ctx := goCtx.(Context)
|
||||
sm := ctx.StreamingManager()
|
||||
@ -30,11 +31,12 @@ func (m *GRPCClient) ListenDeliverBlock(goCtx context.Context, req ListenDeliver
|
||||
return err
|
||||
}
|
||||
|
||||
// ListenCommit listens to commit responses and state changes for the current block.
|
||||
// In addition, it retrieves a types.Context from a context.Context instance.
|
||||
// It panics if a types.Context was not properly attached.
|
||||
// When the node is configured to stop on listening errors,
|
||||
// it will terminate immediately and exit with a non-zero code.
|
||||
// ListenStateChanges listens for state changes in the current block.
|
||||
// It retrieves a types.Context from the provided context.Context.
|
||||
// If the node is configured to stop on listening errors, it will terminate
|
||||
// and exit with a non-zero code upon encountering an error.
|
||||
//
|
||||
// Panics if a types.Context is not properly attached to the provided context.Context.
|
||||
func (m *GRPCClient) ListenStateChanges(goCtx context.Context, changeSet []*StoreKVPair) error {
|
||||
ctx := goCtx.(Context)
|
||||
sm := ctx.StreamingManager()
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
// Package abci contains shared data between the host and plugins.
|
||||
// Package streaming provides shared data structures and interfaces for communication
|
||||
// between the host application and plugins in a streaming context.
|
||||
package streaming
|
||||
|
||||
import (
|
||||
@ -8,22 +9,20 @@ import (
|
||||
"google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// Listener is the interface that we're exposing as a streaming service.
|
||||
// It hooks 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.
|
||||
// Listener defines the interface for a streaming service that hooks into
|
||||
// the ABCI message processing of the BaseApp. Implementations should handle
|
||||
// errors internally and return nil if they don't want to affect consensus.
|
||||
type Listener interface {
|
||||
// ListenDeliverBlock updates the streaming service with the latest Delivered Block messages
|
||||
// ListenDeliverBlock updates the streaming service with the latest Delivered Block messages.
|
||||
ListenDeliverBlock(context.Context, ListenDeliverBlockRequest) error
|
||||
// ListenCommit updates the steaming service with the latest Commit messages and state changes
|
||||
|
||||
// ListenStateChanges updates the streaming service with the latest Commit messages and state changes.
|
||||
ListenStateChanges(ctx context.Context, changeSet []*StoreKVPair) error
|
||||
}
|
||||
|
||||
// Handshake is a common handshake that is shared by streaming and host.
|
||||
// This prevents users from executing bad plugins or executing a plugin
|
||||
// directory. It is a UX feature, not a security feature.
|
||||
// Handshake defines the handshake configuration shared by the streaming service and host.
|
||||
// It serves as a UX feature to prevent execution of incompatible or unintended plugins.
|
||||
var Handshake = plugin.HandshakeConfig{
|
||||
// This isn't required when using VersionedPlugins
|
||||
ProtocolVersion: 1,
|
||||
MagicCookieKey: "ABCI_LISTENER_PLUGIN",
|
||||
MagicCookieValue: "ef78114d-7bdf-411c-868f-347c99a78345",
|
||||
@ -40,11 +39,13 @@ type ListenerGRPCPlugin struct {
|
||||
Impl Listener
|
||||
}
|
||||
|
||||
// GRPCServer registers the ListenerService server implementation.
|
||||
func (p *ListenerGRPCPlugin) GRPCServer(_ *plugin.GRPCBroker, s *grpc.Server) error {
|
||||
RegisterListenerServiceServer(s, &GRPCServer{Impl: p.Impl})
|
||||
return nil
|
||||
}
|
||||
|
||||
// GRPCClient creates a new ListenerService client.
|
||||
func (p *ListenerGRPCPlugin) GRPCClient(
|
||||
_ context.Context,
|
||||
_ *plugin.GRPCBroker,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user