Documentation ¶
Index ¶
- Constants
- Variables
- func IsInvalidAdminParameterError(err error) bool
- func NewAdminServer(cr *CommandRunner) *adminServer
- type CommandHandler
- type CommandRequest
- type CommandRunner
- type CommandRunnerBootstrapper
- func (r *CommandRunnerBootstrapper) Bootstrap(logger zerolog.Logger, bindAddress string, opts ...CommandRunnerOption) *CommandRunner
- func (r *CommandRunnerBootstrapper) RegisterHandler(command string, handler CommandHandler) bool
- func (r *CommandRunnerBootstrapper) RegisterValidator(command string, validator CommandValidator) bool
- type CommandRunnerOption
- type CommandValidator
- type InvalidAdminParameterError
Constants ¶
View Source
const CommandRunnerShutdownTimeout = 5 * time.Second
Variables ¶
View Source
var ErrValidatorReqDataFormat error = errors.New("wrong input format: expected JSON")
Functions ¶
func IsInvalidAdminParameterError ¶ added in v0.28.0
func NewAdminServer ¶
func NewAdminServer(cr *CommandRunner) *adminServer
Types ¶
type CommandHandler ¶
type CommandHandler func(ctx context.Context, request *CommandRequest) (interface{}, error)
type CommandRequest ¶
type CommandRequest struct { // Data is the payload of the request, generated by the request initiator. // This is populated by the admin command framework and is available to both // Validator and Handler functions. Data interface{} // ValidatorData may be optionally set by the Validator function, and will // then be available for use in the Handler function. ValidatorData interface{} }
CommandRequest is the structure of an admin command request.
type CommandRunner ¶
type CommandRunner struct {
// contains filtered or unexported fields
}
func (*CommandRunner) Done ¶
func (r *CommandRunner) Done() <-chan struct{}
func (*CommandRunner) Ready ¶
func (r *CommandRunner) Ready() <-chan struct{}
func (*CommandRunner) Start ¶
func (r *CommandRunner) Start(ctx irrecoverable.SignalerContext)
type CommandRunnerBootstrapper ¶
type CommandRunnerBootstrapper struct {
// contains filtered or unexported fields
}
func NewCommandRunnerBootstrapper ¶
func NewCommandRunnerBootstrapper() *CommandRunnerBootstrapper
func (*CommandRunnerBootstrapper) Bootstrap ¶
func (r *CommandRunnerBootstrapper) Bootstrap(logger zerolog.Logger, bindAddress string, opts ...CommandRunnerOption) *CommandRunner
func (*CommandRunnerBootstrapper) RegisterHandler ¶
func (r *CommandRunnerBootstrapper) RegisterHandler(command string, handler CommandHandler) bool
func (*CommandRunnerBootstrapper) RegisterValidator ¶
func (r *CommandRunnerBootstrapper) RegisterValidator(command string, validator CommandValidator) bool
type CommandRunnerOption ¶
type CommandRunnerOption func(*CommandRunner)
func WithGRPCAddress ¶
func WithGRPCAddress(address string) CommandRunnerOption
func WithMaxMsgSize ¶ added in v0.28.16
func WithMaxMsgSize(size int) CommandRunnerOption
func WithTLS ¶
func WithTLS(config *tls.Config) CommandRunnerOption
type CommandValidator ¶
type CommandValidator func(request *CommandRequest) error
type InvalidAdminParameterError ¶ added in v0.28.0
type InvalidAdminParameterError struct {
// contains filtered or unexported fields
}
func NewInvalidAdminParameterError ¶ added in v0.28.0
func NewInvalidAdminParameterError(field string, msg string, actualVal any) *InvalidAdminParameterError
func (*InvalidAdminParameterError) ActualVal ¶ added in v0.28.0
func (i *InvalidAdminParameterError) ActualVal() any
func (*InvalidAdminParameterError) Error ¶ added in v0.28.0
func (i *InvalidAdminParameterError) Error() string
func (*InvalidAdminParameterError) Field ¶ added in v0.28.0
func (i *InvalidAdminParameterError) Field() string
Click to show internal directories.
Click to hide internal directories.