types

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitializeConfig

func InitializeConfig(cmd *cobra.Command, config *BaseConfiguration, obsF Factory) error

Types

type BaseConfiguration

type BaseConfiguration struct {
	// The Alphabill home directory
	HomeDir string
	// Configuration file URL. If it's relative, then it's relative from the HomeDir.
	CfgFile string
	// Logger configuration file URL.
	LogCfgFile string

	Metrics string
	Tracing string

	ConsoleWriter ConsoleWrapper

	Observe Observability
}

func (*BaseConfiguration) AddConfigurationFlags

func (c *BaseConfiguration) AddConfigurationFlags(cmd *cobra.Command)

func (*BaseConfiguration) ConfigFileExists

func (c *BaseConfiguration) ConfigFileExists() bool

func (*BaseConfiguration) InitConfigFileLocation

func (c *BaseConfiguration) InitConfigFileLocation()

func (*BaseConfiguration) InitLogger

func (c *BaseConfiguration) InitLogger(cmd *cobra.Command, loggerBuilder LoggerFactory) (*slog.Logger, error)

InitLogger creates Logger based on configuration flags in "cmd".

func (*BaseConfiguration) InitializeConfig

func (c *BaseConfiguration) InitializeConfig(cmd *cobra.Command) error

InitializeConfig reads in config file and ENV variables if set.

func (*BaseConfiguration) LoggerCfgFilename

func (c *BaseConfiguration) LoggerCfgFilename() string

LoggerCfgFilename always returns non-empty filename - either the value of the flag set by user or default cfg location. The flag will be assigned the default filename (ie without path) if user doesn't specify that flag.

type BillsConfig

type BillsConfig struct {
	WalletConfig  *WalletConfig
	RpcUrl        string
	Key           uint64
	ShowUnswapped bool
	BillID        BytesHex
	SystemID      uint32
}

func (*BillsConfig) GetRpcUrl added in v0.4.0

func (c *BillsConfig) GetRpcUrl() string

type BytesHex

type BytesHex []byte

BytesHex cobra cli hex value flag that accepts any hex string with or without 0x prefix, implements github.com/spf13/pflag/flag.go#Value interface

func (*BytesHex) Set

func (h *BytesHex) Set(v string) error

Set sets the value of this bytesHex string

func (*BytesHex) String

func (h *BytesHex) String() string

String returns string value of given hexVal, used in Printf and help context

func (*BytesHex) Type

func (h *BytesHex) Type() string

Type used to show the type value in the help context

type ConsoleWrapper

type ConsoleWrapper interface {
	Println(a ...any)
	Print(a ...any)
}

func NewStdoutWriter

func NewStdoutWriter() ConsoleWrapper

type EvmConfig

type EvmConfig struct {
	WalletConfig *WalletConfig
	NodeURL      string
}

type Factory

type Factory interface {
	Logger(cfg *logger.LogConfiguration) (*slog.Logger, error)
	Observability(metrics, traces string) (observability.MeterAndTracer, error)
}

type LoggerFactory

type LoggerFactory func(cfg *logger.LogConfiguration) (*slog.Logger, error)

type Observability

type Observability interface {
	Tracer(name string, options ...trace.TracerOption) trace.Tracer
	TracerProvider() trace.TracerProvider
	Meter(name string, opts ...metric.MeterOption) metric.Meter
	PrometheusRegisterer() prometheus.Registerer
	Shutdown() error
	Logger() *slog.Logger
}

type PartitionType

type PartitionType string

PartitionType "partition" cli flag, implements github.com/spf13/pflag/flag.go#Value interface

const (
	MoneyType  PartitionType = "money"
	TokensType PartitionType = "tokens"
	EvmType    PartitionType = "evm"
)

func (*PartitionType) Set

func (e *PartitionType) Set(v string) error

Set sets the value of this partitionType string

func (*PartitionType) String

func (e *PartitionType) String() string

String returns string value of given partitionType, used in Printf and help context

func (*PartitionType) Type

func (e *PartitionType) Type() string

Type used to show the type value in the help context

type StdoutWrapper

type StdoutWrapper struct {
}

func (*StdoutWrapper) Print

func (w *StdoutWrapper) Print(a ...any)

func (*StdoutWrapper) Println

func (w *StdoutWrapper) Println(a ...any)

type WalletConfig

type WalletConfig struct {
	Base            *BaseConfiguration
	WalletHomeDir   string
	PasswordFromArg string
	PromptPassword  bool
}

func (*WalletConfig) Tracer

func (wc *WalletConfig) Tracer() trace.Tracer

Jump to

Keyboard shortcuts

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