admin

package
v0.28.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2022 License: AGPL-3.0 Imports: 18 Imported by: 2 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Intro

Admin tool allows us to dynamically change settings of the running node without a restart. It can be used to change log level, and turn on profiler etc.

Usage

List all commands

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "list-commands"}'

To change log level

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "set-log-level", "data": "debug"}'

To turn on profiler

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "set-profiler-enabled", "data": true}'

To get the latest finalized block

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "read-blocks", "data": { "block": "final" }}'

To get the latest sealed block

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "read-blocks", "data": { "block": "sealed" }}'

To get block by height

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "read-blocks", "data": { "block": 24998900 }}'

To get identity by peer id

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "get-latest-identity", "data": { "peer_id": "QmNqszdfyEZmMCXcnoUdBDWboFvVLF5reyKPuiqFQT77Vw" }}'

To get transactions for ranges (only available to staked access and execution nodes)

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "get-transactions", "data": { "start-height": 340, "end-height": 343 }}'

To set required approvals for sealing

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "set-required-approvals-for-sealing", "data": 1}'

To get required apporvals for sealing

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "get-required-approvals-for-sealing"}'

Set a stop height

curl localhost:9002/admin/run_command -H 'Content-Type: application/json' -d '{"commandName": "stop-at-height", "data": { "height": 1111, "crash": false }}'

Documentation

Index

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 IsInvalidAdminParameterError(err error) bool

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          interface{}
	ValidatorData interface{}
}

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

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 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 (*InvalidAdminParameterError) Field added in v0.28.0

Directories

Path Synopsis
Package admin is a reverse proxy.
Package admin is a reverse proxy.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL