node

package
v0.18.3-mocha Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var APIVersion = GetBuildInfo().SemanticVersion
View Source
var SecretName = keystore.KeyName("jwt-secret.jwt")

Functions

func ConstructModule added in v0.5.0

func ConstructModule(tp Type) fx.Option

func WithMetrics added in v0.7.0

func WithMetrics(lc fx.Lifecycle) error

WithMetrics registers node metrics.

Types

type API added in v0.5.0

type API struct {
	Internal struct {
		Info        func(context.Context) (Info, error)                                `perm:"admin"`
		Ready       func(context.Context) (bool, error)                                `perm:"read"`
		LogLevelSet func(ctx context.Context, name, level string) error                `perm:"admin"`
		AuthVerify  func(ctx context.Context, token string) ([]auth.Permission, error) `perm:"admin"`
		AuthNew     func(ctx context.Context, perms []auth.Permission) (string, error) `perm:"admin"`
	}
}

func (*API) AuthNew added in v0.5.0

func (api *API) AuthNew(ctx context.Context, perms []auth.Permission) (string, error)

func (*API) AuthVerify added in v0.5.0

func (api *API) AuthVerify(ctx context.Context, token string) ([]auth.Permission, error)

func (*API) Info added in v0.5.0

func (api *API) Info(ctx context.Context) (Info, error)

func (*API) LogLevelSet added in v0.5.0

func (api *API) LogLevelSet(ctx context.Context, name, level string) error

func (*API) Ready added in v0.13.0

func (api *API) Ready(ctx context.Context) (bool, error)

type BuildInfo added in v0.9.3

type BuildInfo struct {
	BuildTime       string
	LastCommit      string
	SemanticVersion string
	SystemVersion   string
	GolangVersion   string
}

BuildInfo represents all necessary information about current build.

func GetBuildInfo added in v0.11.0

func GetBuildInfo() *BuildInfo

GetBuildInfo returns information about current build.

func (*BuildInfo) CommitShortSha added in v0.14.0

func (b *BuildInfo) CommitShortSha() string

func (*BuildInfo) GetSemanticVersion added in v0.14.0

func (b *BuildInfo) GetSemanticVersion() string

type Config added in v0.11.0

type Config struct {
	StartupTimeout  time.Duration
	ShutdownTimeout time.Duration
}

func DefaultConfig added in v0.11.0

func DefaultConfig(tp Type) Config

DefaultConfig returns the default node configuration for a given node type.

func (*Config) Validate added in v0.11.0

func (c *Config) Validate() error

type Info added in v0.5.0

type Info struct {
	Type       Type   `json:"type"`
	APIVersion string `json:"api_version"`
}

Info contains information related to the administrative node.

type Module added in v0.5.0

type Module interface {
	// Info returns administrative information about the node.
	Info(context.Context) (Info, error)

	// Ready returns true once the node's RPC is ready to accept requests.
	Ready(context.Context) (bool, error)

	// LogLevelSet sets the given component log level to the given level.
	LogLevelSet(ctx context.Context, name, level string) error

	// AuthVerify returns the permissions assigned to the given token.
	AuthVerify(ctx context.Context, token string) ([]auth.Permission, error)
	// AuthNew signs and returns a new token with the given permissions.
	AuthNew(ctx context.Context, perms []auth.Permission) (string, error)
}

Module defines the API related to interacting with the "administrative" node.

type StorePath added in v0.5.0

type StorePath string

StorePath is an alias used in order to pass the base path of the node store to nodebuilder modules.

type Type

type Type uint8

Type defines the Node type (e.g. `light`, `bridge`) for identity purposes. The zero value for Type is invalid.

const (
	// Bridge is a Celestia Node that bridges the Celestia consensus network and data availability
	// network. It maintains a trusted channel/connection to a Celestia Core node via the core.Client
	// API.
	Bridge Type = iota + 1
	// Light is a stripped-down Celestia Node which aims to be lightweight while preserving the highest
	// possible security guarantees.
	Light
	// Full is a Celestia Node that stores blocks in their entirety.
	Full
)

func GetTypes added in v0.14.0

func GetTypes() []Type

GetTypes returns a list of all known types in order of priority.

func ParseType

func ParseType(str string) Type

ParseType converts string in a type if possible.

func (Type) IsValid

func (t Type) IsValid() bool

IsValid reports whether the Type is valid.

func (Type) String

func (t Type) String() string

String converts Type to its string representation.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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