config

package
v0.8.1-beta Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockValidator = NetworkTypeBlockValidator
	Directory      = NetworkTypeDirectory
)
View Source
const (
	Validator = NodeTypeValidator
	Follower  = NodeTypeFollower
)
View Source
const DevNet = "devnet"

Variables

View Source
var DefaultLogLevels = LogLevel{}.
	SetDefault("error").
	SetModule("snapshot", "info").
	SetModule("executor", "info").
	String()

Functions

func MakeAbsolute added in v0.5.1

func MakeAbsolute(root, path string) string

func OffsetPort

func OffsetPort(addr string, offset int) (*url.URL, error)

func Store

func Store(config *Config) error

Types

type API

type API struct {
	TxMaxWaitTime      time.Duration `toml:"tx-max-wait-time" mapstructure:"tx-max-wait-time"`
	PrometheusServer   string        `toml:"prometheus-server" mapstructure:"prometheus-server"`
	ListenAddress      string        `toml:"listen-address" mapstructure:"listen-address"`
	DebugJSONRPC       bool          `toml:"debug-jsonrpc" mapstructure:"debug-jsonrpc"`
	EnableDebugMethods bool          `toml:"enable-debug-methods" mapstructure:"enable-debug-methods"`
	ConnectionLimit    int           `toml:"connection-limit" mapstructure:"connection-limit"`
}

type Accumulate

type Accumulate struct {
	SentryDSN string `toml:"sentry-dsn" mapstructure:"sentry-dsn"`

	Network   Network   `toml:"network" mapstructure:"network"`
	Snapshots Snapshots `toml:"snapshots" mapstructure:"snapshots"`
	Storage   Storage   `toml:"storage" mapstructure:"storage"`
	API       API       `toml:"api" mapstructure:"api"`
	Website   Website   `toml:"website" mapstructure:"website"`
}

type Config

type Config struct {
	tm.Config
	Accumulate Accumulate
}

func Default

func Default(netName string, net NetworkType, node NodeType, subnetId string) *Config

func Load

func Load(dir string) (*Config, error)

type LogLevel added in v0.5.1

type LogLevel struct {
	Default string
	Modules [][2]string
}

LogLevel defines the default and per-module log level for Accumulate's logging.

func (LogLevel) Parse added in v0.5.1

func (l LogLevel) Parse(s string) LogLevel

Parse parses a string such as "error;accumulate=info" into a LogLevel.

func (LogLevel) SetDefault added in v0.5.1

func (l LogLevel) SetDefault(level string) LogLevel

SetDefault sets the default log level.

func (LogLevel) SetModule added in v0.5.1

func (l LogLevel) SetModule(module, level string) LogLevel

SetModule sets the log level for a module.

func (LogLevel) String added in v0.5.1

func (l LogLevel) String() string

String convers the log level into a string, for example "error;accumulate=debug".

type Network

type Network struct {
	NetworkName   string      `` /* 135-byte string literal not displayed */
	Type          NetworkType `json:"type,omitempty" form:"type" query:"type" validate:"required" toml:"type" mapstructure:"type"`
	LocalSubnetID string      `` /* 141-byte string literal not displayed */
	LocalAddress  string      `` /* 140-byte string literal not displayed */
	Subnets       []Subnet    `json:"subnets,omitempty" form:"subnets" query:"subnets" validate:"required" toml:"subnets" mapstructure:"subnets"`
	// contains filtered or unexported fields
}

func (*Network) AnchorPool added in v0.5.1

func (n *Network) AnchorPool() *url.URL

AnchorPool returns the URL of the subnet's anchor pool.

func (*Network) Copy added in v1.0.0

func (v *Network) Copy() *Network

func (*Network) CopyAsInterface added in v1.0.0

func (v *Network) CopyAsInterface() interface{}

func (*Network) DefaultOperatorPage

func (n *Network) DefaultOperatorPage() *url.URL

DefaultOperatorPage returns the URL of the default page of the subnet operator key book.

func (*Network) DefaultValidatorPage

func (n *Network) DefaultValidatorPage() *url.URL

DefaultValidatorPage returns the URL of the default page of the subnet operator key book.

func (*Network) Equal added in v1.0.0

func (v *Network) Equal(u *Network) bool

func (*Network) GetBvnNames

func (n *Network) GetBvnNames() []string

func (*Network) GetSubnetByID

func (n *Network) GetSubnetByID(subnetID string) Subnet

func (*Network) Ledger added in v0.5.1

func (n *Network) Ledger() *url.URL

Ledger returns the URL of the subnet's ledger account.

func (*Network) MarshalJSON added in v1.0.0

func (v *Network) MarshalJSON() ([]byte, error)

func (*Network) NodeUrl

func (n *Network) NodeUrl(path ...string) *url.URL

NodeUrl returns the URL of the subnet, optionally with a path appended.

func (*Network) OperatorBook

func (n *Network) OperatorBook() *url.URL

OperatorBook returns the URL of the subnet's operator key book.

func (*Network) OperatorPage

func (n *Network) OperatorPage(index uint64) *url.URL

OperatorPage returns the URL of the page of the subnet's operator key book.

func (*Network) Synthetic

func (n *Network) Synthetic() *url.URL

Synthetic returns the URL of the subnet's ledger account.

func (*Network) UnmarshalJSON added in v1.0.0

func (v *Network) UnmarshalJSON(data []byte) error

func (*Network) ValidatorBook added in v0.5.1

func (n *Network) ValidatorBook() *url.URL

ValidatorBook returns the URL of the subnet's validator key book.

func (*Network) ValidatorPage added in v0.5.1

func (n *Network) ValidatorPage(index uint64) *url.URL

ValidatorPage returns the URL of the page of the subnet's validator key book.

type NetworkType

type NetworkType uint64
const NetworkTypeBlockValidator NetworkType = 2

NetworkTypeBlockValidator .

const NetworkTypeDirectory NetworkType = 1

NetworkTypeDirectory .

func NetworkTypeByName

func NetworkTypeByName(name string) (NetworkType, bool)

NetworkTypeByName returns the named Network Type.

func (NetworkType) GetEnumValue

func (v NetworkType) GetEnumValue() uint64

GetEnumValue returns the value of the Network Type

func (NetworkType) MarshalJSON

func (v NetworkType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Network Type to JSON as a string.

func (*NetworkType) SetEnumValue

func (v *NetworkType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (NetworkType) String

func (v NetworkType) String() string

String returns the name of the Network Type

func (*NetworkType) UnmarshalJSON

func (v *NetworkType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Network Type from JSON as a string.

type NetworkUrl added in v0.5.1

type NetworkUrl struct {
	*url.URL
}

func (NetworkUrl) AnchorPool added in v0.5.1

func (u NetworkUrl) AnchorPool() *url.URL

AnchorPool returns the URL of the subnet's anchor pool.

func (NetworkUrl) Ledger added in v0.5.1

func (u NetworkUrl) Ledger() *url.URL

Ledger returns the URL of the subnet's ledger account.

func (NetworkUrl) OperatorBook

func (u NetworkUrl) OperatorBook() *url.URL

OperatorBook returns the URL of the subnet's operator key book.

func (NetworkUrl) OperatorPage

func (u NetworkUrl) OperatorPage(index uint64) *url.URL

OperatorPage returns the URL of the page of the subnet's operator key book.

func (NetworkUrl) Synthetic added in v1.0.0

func (u NetworkUrl) Synthetic() *url.URL

Synthetic returns the URL of the subnet's synthetic transaction ledger account.

func (NetworkUrl) ValidatorBook added in v0.5.1

func (u NetworkUrl) ValidatorBook() *url.URL

ValidatorBook returns the URL of the subnet's validator key book.

func (NetworkUrl) ValidatorPage added in v0.5.1

func (u NetworkUrl) ValidatorPage(index uint64) *url.URL

ValidatorPage returns the URL of the page of the subnet's validator key book.

type Node

type Node struct {
	Address string   `json:"address,omitempty" form:"address" query:"address" validate:"required" toml:"address" mapstructure:"address"`
	Type    NodeType `json:"type,omitempty" form:"type" query:"type" validate:"required" toml:"type" mapstructure:"type"`
	// contains filtered or unexported fields
}

func (*Node) Copy added in v1.0.0

func (v *Node) Copy() *Node

func (*Node) CopyAsInterface added in v1.0.0

func (v *Node) CopyAsInterface() interface{}

func (*Node) Equal added in v1.0.0

func (v *Node) Equal(u *Node) bool

type NodeType

type NodeType uint64
const NodeTypeFollower NodeType = 2

NodeTypeFollower .

const NodeTypeValidator NodeType = 1

NodeTypeValidator .

func NodeTypeByName added in v1.0.0

func NodeTypeByName(name string) (NodeType, bool)

NodeTypeByName returns the named Node Type.

func (NodeType) GetEnumValue added in v1.0.0

func (v NodeType) GetEnumValue() uint64

GetEnumValue returns the value of the Node Type

func (NodeType) MarshalJSON added in v1.0.0

func (v NodeType) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Node Type to JSON as a string.

func (*NodeType) SetEnumValue added in v1.0.0

func (v *NodeType) SetEnumValue(id uint64) bool

SetEnumValue sets the value. SetEnumValue returns false if the value is invalid.

func (NodeType) String added in v1.0.0

func (v NodeType) String() string

String returns the name of the Node Type

func (*NodeType) UnmarshalJSON added in v1.0.0

func (v *NodeType) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshals the Node Type from JSON as a string.

type Snapshots added in v1.0.0

type Snapshots struct {
	// Directory is the directory to store snapshots in
	Directory string `toml:"directory" mapstructure:"directory"`

	// RetainCount is the number of snapshots to retain
	RetainCount int `toml:"retain" mapstructure:"retain"`
}

type Storage added in v0.5.1

type Storage struct {
	Type StorageType  `toml:"type" mapstructure:"type"`
	Path string       `toml:"path" mapstructure:"path"`
	Etcd *etcd.Config `toml:"etcd" mapstructure:"etcd"`
}

type StorageType added in v0.5.1

type StorageType string
const (
	MemoryStorage StorageType = "memory"
	BadgerStorage StorageType = "badger"
	EtcdStorage   StorageType = "etcd"
)

type Subnet

type Subnet struct {
	ID    string      `json:"iD,omitempty" form:"iD" query:"iD" validate:"required" toml:"id" mapstructure:"id"`
	Type  NetworkType `json:"type,omitempty" form:"type" query:"type" validate:"required" toml:"type" mapstructure:"type"`
	Nodes []Node      `json:"nodes,omitempty" form:"nodes" query:"nodes" validate:"required" toml:"nodes" mapstructure:"nodes"`
	// contains filtered or unexported fields
}

func (*Subnet) Copy

func (v *Subnet) Copy() *Subnet

func (*Subnet) CopyAsInterface

func (v *Subnet) CopyAsInterface() interface{}

func (*Subnet) Equal

func (v *Subnet) Equal(u *Subnet) bool

func (*Subnet) MarshalJSON

func (v *Subnet) MarshalJSON() ([]byte, error)

func (*Subnet) UnmarshalJSON

func (v *Subnet) UnmarshalJSON(data []byte) error

type Website

type Website struct {
	Enabled       bool   `toml:"website-enabled" mapstructure:"website-enabled"`
	ListenAddress string `toml:"website-listen-address" mapstructure:"website-listen-address"`
}

Jump to

Keyboard shortcuts

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