Skip to content
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

docs: update server/v2 api contract #22815

Merged
merged 2 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion runtime/v2/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func ProvideModuleConfigMaps(
fetchFlag := flag
// splitting on "." is required to handle nested flags which are defined
// in other modules that are not the current module
// for example: "server.minimum-gas-prices" is defined in the server module
// for example: "server.minimum-gas-prices" is defined in the server component
// but required by x/validate
for _, part := range strings.Split(flag, ".") {
if maybeMap, ok := m[part]; ok {
Expand Down
22 changes: 13 additions & 9 deletions server/v2/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,45 +16,49 @@ import (
"cosmossdk.io/log"
)

// ServerComponent is a server module that can be started and stopped.
// ServerComponent is a server component that can be started and stopped.
type ServerComponent[T transaction.Tx] interface {
// Name returns the name of the server component.
Name() string

// Start starts the server component.
Start(context.Context) error
// Stop stops the server component.
// Once Stop has been called on a server component, it may not be reused.
Stop(context.Context) error
}

// HasStartFlags is a server module that has start flags.
// HasStartFlags is a server component that has start flags.
type HasStartFlags interface {
// StartCmdFlags returns server start flags.
// Those flags should be prefixed with the server name.
// They are then merged with the server config in one viper instance.
StartCmdFlags() *pflag.FlagSet
}

// HasConfig is a server module that has a config.
// HasConfig is a server component that has a config.
type HasConfig interface {
Config() any
}

// ConfigWriter is a server module that can write its config to a file.
// ConfigWriter is a server component that can write its config to a file.
type ConfigWriter interface {
WriteConfig(path string) error
}

// HasCLICommands is a server module that has CLI commands.
// HasCLICommands is a server component that has CLI commands.
type HasCLICommands interface {
CLICommands() CLIConfig
}

// CLIConfig defines the CLI configuration for a module server.
// CLIConfig defines the CLI configuration for a component server.
type CLIConfig struct {
// Commands defines the main command of a module server.
// Commands defines the main command of a server component.
Commands []*cobra.Command
// Queries defines the query commands of a module server.
// Queries defines the query commands of a server component.
// Those commands are meant to be added in the root query command.
Queries []*cobra.Command
// Txs defines the tx commands of a module server.
// Txs defines the tx commands of a server component.
// Those commands are meant to be added in the root tx command.
Txs []*cobra.Command
}
Expand Down
Loading