common

package
v0.2011.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 19 Imported by: 9

Documentation

Overview

Package common implements common oasis-node command options and utilities.

Index

Constants

View Source
const (
	// CfgDebugAllowTestKeys is the command line flag to enable the debug test
	// keys.
	CfgDebugAllowTestKeys = "debug.allow_test_keys"

	// CfgDebugRlimit is the command flag to set RLIMIT_NOFILE on launch.
	CfgDebugRlimit = "debug.rlimit"

	CfgDataDir = "datadir"
)

Variables

View Source
var (

	// RootFlags has the flags that are common across all commands.
	RootFlags = flag.NewFlagSet("", flag.ContinueOnError)
)

Functions

func DataDir

func DataDir() string

DataDir returns the data directory iff one is set.

func DataDirOrPwd

func DataDirOrPwd() (string, error)

DataDirOrPwd returns the data directory iff one is set, pwd otherwise.

func EarlyLogAndExit

func EarlyLogAndExit(err error)

EarlyLogAndExit logs the error and exits.

Note: This routine should only be used prior to the logging system being initialized.

func ExportEntity

func ExportEntity(signerBackend, entityDir string) error

ExportEntity creates an empty entity from the public key of the signer generated with the specified backend, and writes it to a file in entityDir.

func GetInputReader

func GetInputReader(cmd *cobra.Command, cfg string) (io.ReadCloser, bool, error)

GetInputReader will open a file if the config string is set, and otherwise return os.Stdin.

func GetOutputWriter

func GetOutputWriter(cmd *cobra.Command, cfg string) (io.WriteCloser, bool, error)

GetOutputWriter will create a file if the config string is set, and otherwise return os.Stdout.

func GetUserConfirmation

func GetUserConfirmation(prompt string) bool

GetUserConfirmation displays the prompt, and scans the input for the user's confirmation, until the user either explicitly confirms or rejects the prompt.

Note: If standard input is not a tty, this will omit displaying the prompt, and assume the user entered yes.

func Init

func Init() error

Init initializes the common environment across all commands.

func InitConfig

func InitConfig()

InitConfig initializes the command configuration.

WARNING: This is exposed for the benefit of tests and the interface is not guaranteed to be stable.

func IsNodeCmd

func IsNodeCmd() bool

IsNodeCmd returns true iff the current command is the ekiden node.

func Isatty

func Isatty(fd uintptr) bool

Isatty returns true iff the provided file descriptor is a terminal.

func LoadEntity

func LoadEntity(signerBackend, entityDir string) (*entity.Entity, signature.Signer, error)

LoadEntity loads the entity and it's signer.

func Logger

func Logger() *logging.Logger

Logger returns the command logger.

func SetBasicVersionTemplate added in v0.2010.0

func SetBasicVersionTemplate(cmd *cobra.Command)

SetBasicVersionTemplate sets a basic custom version template for the given cobra command that shows the version of Oasis Core and the Go toolchain.

func SetIsNodeCmd

func SetIsNodeCmd(v bool)

SetIsNodeCmd sets the IsNodeCmd flag.

Types

This section is empty.

Directories

Path Synopsis
Package background implements utilities for managing background services.
Package background implements utilities for managing background services.
Package consensus contains common consensus-related flags.
Package consensus contains common consensus-related flags.
Package flags implements common flags used across multiple commands and backends.
Package flags implements common flags used across multiple commands and backends.
Package genesis implements common genesis document manipulation routines.
Package genesis implements common genesis document manipulation routines.
Package grpc implements common gRPC command-line flags.
Package grpc implements common gRPC command-line flags.
Package metrics implements a prometheus metrics service.
Package metrics implements a prometheus metrics service.
Package pprof implements a pprof profiling service.
Package pprof implements a pprof profiling service.
Package signer implements helpers for configuring the signer.
Package signer implements helpers for configuring the signer.
Package tracing implements a tracing service.
Package tracing implements a tracing service.

Jump to

Keyboard shortcuts

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