admin

package
v1.22.35 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2025 License: BSD-3-Clause Imports: 21 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(config Config) (http.Handler, error)

NewService returns a new admin API service. All of the fields in [config] must be set.

Types

type Admin

type Admin struct {
	Config
	// contains filtered or unexported fields
}

Admin is the API service for node admin management

func (*Admin) Alias

func (a *Admin) Alias(_ *http.Request, args *AliasArgs, _ *api.EmptyReply) error

Alias attempts to alias an HTTP endpoint to a new name

func (*Admin) AliasChain

func (a *Admin) AliasChain(_ *http.Request, args *AliasChainArgs, _ *api.EmptyReply) error

AliasChain attempts to alias a chain to a new name

func (*Admin) DbGet added in v0.1.1

func (a *Admin) DbGet(_ *http.Request, args *DBGetArgs, reply *DBGetReply) error

func (*Admin) GetChainAliases

func (a *Admin) GetChainAliases(_ *http.Request, args *GetChainAliasesArgs, reply *GetChainAliasesReply) error

GetChainAliases returns the aliases of the chain

func (*Admin) GetConfig added in v0.1.1

func (a *Admin) GetConfig(_ *http.Request, _ *struct{}, reply *interface{}) error

GetConfig returns the config that the node was started with.

func (*Admin) GetLoggerLevel added in v0.1.1

func (a *Admin) GetLoggerLevel(_ *http.Request, args *GetLoggerLevelArgs, reply *LoggerLevelReply) error

GetLoggerLevel returns the log level and display level of all loggers.

func (*Admin) LoadVMs added in v0.1.1

func (a *Admin) LoadVMs(r *http.Request, _ *struct{}, reply *LoadVMsReply) error

LoadVMs loads any new VMs available to the node and returns the added VMs. After loading new VMs, it retries creating any chains that were waiting for those VMs (hot-loading support).

func (*Admin) LockProfile

func (a *Admin) LockProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error

LockProfile runs a mutex profile writing to the specified file

func (*Admin) MemoryProfile

func (a *Admin) MemoryProfile(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error

MemoryProfile runs a memory profile writing to the specified file

func (*Admin) SetLoggerLevel added in v0.1.1

func (a *Admin) SetLoggerLevel(_ *http.Request, args *SetLoggerLevelArgs, reply *LoggerLevelReply) error

SetLoggerLevel sets the log level and/or display level for loggers. If len([args.LoggerName]) == 0, sets the log/display level of all loggers. Otherwise, sets the log/display level of the loggers named in that argument. Sets the log level of these loggers to args.LogLevel. If args.LogLevel == nil, doesn't set the log level of these loggers. If args.LogLevel != nil, must be a valid string representation of a log level. Sets the display level of these loggers to args.LogLevel. If args.DisplayLevel == nil, doesn't set the display level of these loggers. If args.DisplayLevel != nil, must be a valid string representation of a log level.

func (*Admin) Stacktrace added in v0.1.1

func (a *Admin) Stacktrace(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error

Stacktrace returns the current global stacktrace

func (*Admin) StartCPUProfiler

func (a *Admin) StartCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error

StartCPUProfiler starts a cpu profile writing to the specified file

func (*Admin) StopCPUProfiler

func (a *Admin) StopCPUProfiler(_ *http.Request, _ *struct{}, _ *api.EmptyReply) error

StopCPUProfiler stops the cpu profile

type AliasArgs

type AliasArgs struct {
	Endpoint string `json:"endpoint"`
	Alias    string `json:"alias"`
}

AliasArgs are the arguments for calling Alias

type AliasChainArgs

type AliasChainArgs struct {
	Chain string `json:"chain"`
	Alias string `json:"alias"`
}

AliasChainArgs are the arguments for calling AliasChain

type Client added in v0.1.1

type Client struct {
	Requester rpc.EndpointRequester
}

func NewClient added in v0.1.1

func NewClient(uri string) *Client

func (*Client) Alias added in v0.1.1

func (c *Client) Alias(ctx context.Context, endpoint, alias string, options ...rpc.Option) error

func (*Client) AliasChain added in v0.1.1

func (c *Client) AliasChain(ctx context.Context, chain, alias string, options ...rpc.Option) error

func (*Client) DBGet added in v0.1.1

func (c *Client) DBGet(ctx context.Context, key []byte, options ...rpc.Option) ([]byte, error)

func (*Client) GetChainAliases added in v0.1.1

func (c *Client) GetChainAliases(ctx context.Context, chain string, options ...rpc.Option) ([]string, error)

func (*Client) GetConfig added in v0.1.1

func (c *Client) GetConfig(ctx context.Context, options ...rpc.Option) (interface{}, error)

func (*Client) GetLoggerLevel added in v0.1.1

func (c *Client) GetLoggerLevel(
	ctx context.Context,
	loggerName string,
	options ...rpc.Option,
) (map[string]LogAndDisplayLevels, error)

func (*Client) LoadVMs added in v0.1.1

func (c *Client) LoadVMs(ctx context.Context, options ...rpc.Option) (map[ids.ID][]string, map[ids.ID]string, error)

func (*Client) LockProfile added in v0.1.1

func (c *Client) LockProfile(ctx context.Context, options ...rpc.Option) error

func (*Client) MemoryProfile added in v0.1.1

func (c *Client) MemoryProfile(ctx context.Context, options ...rpc.Option) error

func (*Client) SetLoggerLevel added in v0.1.1

func (c *Client) SetLoggerLevel(
	ctx context.Context,
	loggerName,
	logLevel,
	displayLevel string,
	options ...rpc.Option,
) (map[string]LogAndDisplayLevels, error)

func (*Client) Stacktrace added in v0.1.1

func (c *Client) Stacktrace(ctx context.Context, options ...rpc.Option) error

func (*Client) StartCPUProfiler added in v0.1.1

func (c *Client) StartCPUProfiler(ctx context.Context, options ...rpc.Option) error

func (*Client) StopCPUProfiler added in v0.1.1

func (c *Client) StopCPUProfiler(ctx context.Context, options ...rpc.Option) error

type Config added in v0.1.1

type Config struct {
	Log          log.Logger
	ProfileDir   string
	LogFactory   log.Factory
	NodeConfig   interface{}
	DB           database.Database
	ChainManager chains.Manager
	HTTPServer   server.PathAdderWithReadLock
	VMRegistry   registry.VMRegistry
	VMManager    vms.Manager
}

type DBGetArgs added in v0.1.1

type DBGetArgs struct {
	Key string `json:"key"`
}

type DBGetReply added in v0.1.1

type DBGetReply struct {
	Value string `json:"value"`
}

type GetChainAliasesArgs

type GetChainAliasesArgs struct {
	Chain string `json:"chain"`
}

GetChainAliasesArgs are the arguments for calling GetChainAliases

type GetChainAliasesReply

type GetChainAliasesReply struct {
	Aliases []string `json:"aliases"`
}

GetChainAliasesReply are the aliases of the given chain

type GetLoggerLevelArgs added in v0.1.1

type GetLoggerLevelArgs struct {
	LoggerName string `json:"loggerName"`
}

type KeyValueReader added in v0.1.1

type KeyValueReader struct {
	// contains filtered or unexported fields
}

func NewKeyValueReader added in v0.1.1

func NewKeyValueReader(client *Client) *KeyValueReader

func (*KeyValueReader) Get added in v0.1.1

func (r *KeyValueReader) Get(key []byte) ([]byte, error)

func (*KeyValueReader) Has added in v0.1.1

func (r *KeyValueReader) Has(key []byte) (bool, error)

type LoadVMsReply added in v0.1.1

type LoadVMsReply struct {
	// VMs and their aliases which were successfully loaded
	NewVMs map[ids.ID][]string `json:"newVMs"`
	// VMs that failed to be loaded and the error message
	FailedVMs map[ids.ID]string `json:"failedVMs,omitempty"`
	// ChainsRetried is the number of chains that were re-queued for creation
	// after VMs were hot-loaded
	ChainsRetried int `json:"chainsRetried,omitempty"`
}

LoadVMsReply contains the response metadata for LoadVMs

type LogAndDisplayLevels added in v0.1.1

type LogAndDisplayLevels struct {
	LogLevel     log.Level `json:"logLevel"`
	DisplayLevel log.Level `json:"displayLevel"`
}

type LoggerLevelReply added in v0.1.1

type LoggerLevelReply struct {
	LoggerLevels map[string]LogAndDisplayLevels `json:"loggerLevels"`
}

type SetLoggerLevelArgs added in v0.1.1

type SetLoggerLevelArgs struct {
	LoggerName   string     `json:"loggerName"`
	LogLevel     *log.Level `json:"logLevel"`
	DisplayLevel *log.Level `json:"displayLevel"`
}

Jump to

Keyboard shortcuts

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