config

package
v1.0.0-rc3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockValidator            = protocol.PartitionTypeBlockValidator
	Directory                 = protocol.PartitionTypeDirectory
	NetworkTypeBlockValidator = protocol.PartitionTypeBlockValidator
	NetworkTypeDirectory      = protocol.PartitionTypeDirectory
)
View Source
const (
	Validator = NodeTypeValidator
	Follower  = NodeTypeFollower
)
View Source
const DevNet = "devnet"
View Source
const PortOffsetBlockValidator = 100
View Source
const PortOffsetDirectory = 0

Variables

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

Functions

func MakeAbsolute added in v0.5.1

func MakeAbsolute(root, path string) string

func OffsetPort

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

func Store

func Store(config *Config) error

func StringToEnumHookFunc added in v1.0.0

func StringToEnumHookFunc() mapstructure.DecodeHookFuncType

StringToEnumHookFunc is a decode hook for mapstructure that will convert enums to strings

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"`
	ReadHeaderTimeout  time.Duration `toml:"read-header-timeout" mapstructure:"read-header-timeout"`
}

type Accumulate

type Accumulate struct {
	// SentryDSN string `toml:"sentry-dsn" mapstructure:"sentry-dsn"`
	Describe `toml:"describe" mapstructure:"describe"`
	// TODO: move network config to its own file since it will be constantly changing over time.
	//	NetworkConfig string      `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"`
	AnalysisLog AnalysisLog `toml:"analysis" mapstructure:"analysis"`
}

type AnalysisLog added in v1.0.0

type AnalysisLog struct {
	Directory string `toml:"directory" mapstructure:"directory"`
	Enabled   bool   `toml:"enabled" mapstructure:"enabled"`
	// contains filtered or unexported fields
}

func (*AnalysisLog) Flush added in v1.0.0

func (a *AnalysisLog) Flush()

func (*AnalysisLog) GetDataSet added in v1.0.0

func (a *AnalysisLog) GetDataSet(dataSetName string) *logging.DataSet

func (*AnalysisLog) Init added in v1.0.0

func (a *AnalysisLog) Init(workingDir string, partitionId string)

func (*AnalysisLog) InitDataSet added in v1.0.0

func (a *AnalysisLog) InitDataSet(dataSetName string, opts logging.Options)

type Config

type Config struct {
	tm.Config
	Accumulate Accumulate
}

func Default

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

func Load

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

type Describe added in v1.0.0

type Describe struct {
	NetworkType  NetworkType `json:"networkType,omitempty" form:"networkType" query:"networkType" validate:"required" toml:"type" mapstructure:"type"`
	PartitionId  string      `` /* 135-byte string literal not displayed */
	LocalAddress string      `` /* 140-byte string literal not displayed */
	Network      Network     `json:"network,omitempty" form:"network" query:"network" validate:"required" toml:"network" mapstructure:"network"`
	// contains filtered or unexported fields
}

func (*Describe) AnchorPool added in v1.0.0

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

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

func (*Describe) BlockLedger added in v1.0.0

func (n *Describe) BlockLedger(i uint64) *url.URL

BlockLedger returns the URL of a partition's ledger for a block.

func (*Describe) Copy added in v1.0.0

func (v *Describe) Copy() *Describe

func (*Describe) CopyAsInterface added in v1.0.0

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

func (*Describe) Equal added in v1.0.0

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

func (*Describe) IsValid added in v1.0.0

func (v *Describe) IsValid() error

func (*Describe) Ledger added in v1.0.0

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

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

func (*Describe) MarshalBinary added in v1.0.0

func (v *Describe) MarshalBinary() ([]byte, error)

func (*Describe) MarshalJSON added in v1.0.0

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

func (*Describe) NodeUrl added in v1.0.0

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

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

func (*Describe) Operators added in v1.0.0

func (n *Describe) Operators() *url.URL

Operators returns the URL of the partition's operator key book.

func (*Describe) OperatorsPage added in v1.0.0

func (n *Describe) OperatorsPage() *url.URL

OperatorsPage returns the URL of the default page of the partition's operator key book.

func (*Describe) PartitionUrl added in v1.0.0

func (n *Describe) PartitionUrl() NetworkUrl

PartitionUrl returns a NetworkUrl for the local partition.

func (*Describe) Synthetic added in v1.0.0

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

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

func (*Describe) UnmarshalBinary added in v1.0.0

func (v *Describe) UnmarshalBinary(data []byte) error

func (*Describe) UnmarshalBinaryFrom added in v1.0.0

func (v *Describe) UnmarshalBinaryFrom(rd io.Reader) error

func (*Describe) UnmarshalJSON added in v1.0.0

func (v *Describe) UnmarshalJSON(data []byte) 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 {
	Id         string      `json:"id,omitempty" form:"id" query:"id" validate:"required" toml:"id" mapstructure:"id"`
	Partitions []Partition `` /* 128-byte string literal not displayed */
	// contains filtered or unexported fields
}

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) Equal added in v1.0.0

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

func (*Network) GetBvnNames

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

func (*Network) GetPartitionByID added in v1.0.0

func (n *Network) GetPartitionByID(partitionID string) *Partition

func (*Network) IsValid added in v1.0.0

func (v *Network) IsValid() error

func (*Network) MarshalBinary added in v1.0.0

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

func (*Network) MarshalJSON added in v1.0.0

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

func (*Network) UnmarshalBinary added in v1.0.0

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

func (*Network) UnmarshalBinaryFrom added in v1.0.0

func (v *Network) UnmarshalBinaryFrom(rd io.Reader) error

func (*Network) UnmarshalJSON added in v1.0.0

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

type NetworkType

type NetworkType = protocol.PartitionType

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 partition's anchor pool.

func (NetworkUrl) BlockLedger added in v1.0.0

func (u NetworkUrl) BlockLedger(i uint64) *url.URL

BlockLedger returns the URL of a partition's ledger for a block.

func (NetworkUrl) Identity added in v1.0.0

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

Ledger returns the URL of the partition's identity.

func (NetworkUrl) Ledger added in v0.5.1

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

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

func (NetworkUrl) Operators added in v1.0.0

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

Operators returns the URL of the partition's operator key book.

func (NetworkUrl) OperatorsPage added in v1.0.0

func (n NetworkUrl) OperatorsPage() *url.URL

OperatorsPage returns the URL of the default page of the partition's operator key book.

func (NetworkUrl) Synthetic added in v1.0.0

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

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

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

func (*Node) IsValid added in v1.0.0

func (v *Node) IsValid() error

func (*Node) MarshalBinary added in v1.0.0

func (v *Node) MarshalBinary() ([]byte, error)

func (*Node) UnmarshalBinary added in v1.0.0

func (v *Node) UnmarshalBinary(data []byte) error

func (*Node) UnmarshalBinaryFrom added in v1.0.0

func (v *Node) UnmarshalBinaryFrom(rd io.Reader) error

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) MarshalTOML added in v1.0.0

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

MarshalTOML marshals the Node Type to Toml 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 Partition added in v1.0.0

type Partition 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"`
	BasePort int64       `json:"basePort,omitempty" form:"basePort" query:"basePort" validate:"required" toml:"port" mapstructure:"port"`
	Nodes    []Node      `json:"nodes,omitempty" form:"nodes" query:"nodes" validate:"required" toml:"nodes" mapstructure:"nodes"`
	// contains filtered or unexported fields
}

func (*Partition) Copy added in v1.0.0

func (v *Partition) Copy() *Partition

func (*Partition) CopyAsInterface added in v1.0.0

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

func (*Partition) Equal added in v1.0.0

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

func (*Partition) IsValid added in v1.0.0

func (v *Partition) IsValid() error

func (*Partition) MarshalBinary added in v1.0.0

func (v *Partition) MarshalBinary() ([]byte, error)

func (*Partition) MarshalJSON added in v1.0.0

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

func (*Partition) UnmarshalBinary added in v1.0.0

func (v *Partition) UnmarshalBinary(data []byte) error

func (*Partition) UnmarshalBinaryFrom added in v1.0.0

func (v *Partition) UnmarshalBinaryFrom(rd io.Reader) error

func (*Partition) UnmarshalJSON added in v1.0.0

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

type PortOffset added in v1.0.0

type PortOffset uint64
const PortOffsetAccumulateApi PortOffset = 4

PortOffsetAccumulateApi .

const PortOffsetPrometheus PortOffset = 3

PortOffsetPrometheus .

const PortOffsetTendermintP2P PortOffset = 0

PortOffsetTendermintP2P .

const PortOffsetTendermintRpc PortOffset = 1

PortOffsetTendermintRpc .

const PortOffsetWebsite PortOffset = 2

PortOffsetWebsite .

func PortOffsetByName added in v1.0.0

func PortOffsetByName(name string) (PortOffset, bool)

PortOffsetByName returns the named Port Offset.

func (PortOffset) GetEnumValue added in v1.0.0

func (v PortOffset) GetEnumValue() uint64

GetEnumValue returns the value of the Port Offset

func (PortOffset) MarshalJSON added in v1.0.0

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

MarshalJSON marshals the Port Offset to JSON as a string.

func (*PortOffset) SetEnumValue added in v1.0.0

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

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

func (PortOffset) String added in v1.0.0

func (v PortOffset) String() string

String returns the name of the Port Offset.

func (*PortOffset) UnmarshalJSON added in v1.0.0

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

UnmarshalJSON unmarshals the Port Offset 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"`

	// Schedule is the schedule for capturing snapshots.
	Schedule string `toml:"schedule" mapstructure:"schedule"`
}

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 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