config

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Validator = NodeTypeValidator
	Follower  = NodeTypeFollower
)
View Source
const DevNet = "devnet"
View Source
const PortOffsetBlockSummary = 200
View Source
const PortOffsetBlockValidator = 100
View Source
const PortOffsetDirectory = 0

Variables

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

Functions

func LoadFilePV

func LoadFilePV(keyFilePath, stateFilePath string) (*privval.FilePV, error)

func MakeAbsolute

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) (err error)

func StoreAcc added in v1.2.5

func StoreAcc(config *Config, dir string) error

func StringToEnumHookFunc

func StringToEnumHookFunc() mapstructure.DecodeHookFuncType

StringToEnumHookFunc is a decode hook for mapstructure that converts enums to strings.

func StringToMultiaddrHookFunc

func StringToMultiaddrHookFunc() mapstructure.DecodeHookFuncType

StringToMultiaddrHookFunc is a decode hook for mapstructure that converts strings to multiaddrs.

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 {
	Describe              `toml:"describe" mapstructure:"describe"`
	BatchReplayLimit      int    `toml:"batch-replay-limit" mapstructure:"batch-replay-limit"`
	SummaryNetwork        string `toml:"summary-network" mapstructure:"summary-network"`
	DisableDirectDispatch bool   `toml:"disable-direct-dispatch" mapstructure:"disable-direct-dispatch"`
	MaxEnvelopesPerBlock  int    `toml:"max-envelopes-per-block" mapstructure:"max-envelopes-per-block"`

	// TODO: move network config to its own file since it will be constantly changing over time.
	//	NetworkConfig string      `toml:"network" mapstructure:"network"`
	Healing     Healing     `toml:"healing" mapstructure:"healing"`
	Snapshots   Snapshots   `toml:"snapshots" mapstructure:"snapshots"`
	Storage     Storage     `toml:"storage" mapstructure:"storage"`
	P2P         P2P         `toml:"p2p" mapstructure:"p2p"`
	API         API         `toml:"api" mapstructure:"api"`
	AnalysisLog AnalysisLog `toml:"analysis" mapstructure:"analysis"`
	Logging     Logging     `toml:"logging" mapstructure:"logging"`
}

func LoadAcc added in v1.2.5

func LoadAcc(dir string) (*Accumulate, error)

type AnalysisLog

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

func (*AnalysisLog) Flush

func (a *AnalysisLog) Flush()

func (*AnalysisLog) GetDataSet

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

func (*AnalysisLog) Init

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

func (*AnalysisLog) InitDataSet

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 protocol.PartitionType, _ NodeType, partitionId string) *Config

func Load

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

type Describe

type Describe struct {
	NetworkType  protocol.PartitionType `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

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

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

func (*Describe) BlockLedger

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

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

func (*Describe) Copy

func (v *Describe) Copy() *Describe

func (*Describe) CopyAsInterface

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

func (*Describe) Equal

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

func (*Describe) IsValid

func (v *Describe) IsValid() error

func (*Describe) Ledger

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

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

func (*Describe) MarshalBinary

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

func (*Describe) MarshalJSON

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

func (*Describe) NodeUrl

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

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

func (*Describe) Operators

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

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

func (*Describe) OperatorsPage

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

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

func (*Describe) PartitionUrl

func (n *Describe) PartitionUrl() NetworkUrl

PartitionUrl returns a NetworkUrl for the local partition.

func (*Describe) Synthetic

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

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

func (*Describe) UnmarshalBinary

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

func (*Describe) UnmarshalBinaryFrom

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

func (*Describe) UnmarshalJSON

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

type Healing added in v1.2.8

type Healing struct {
	// Enable enables healing
	Enable bool `toml:"enable" mapstructure:"enable"`
}

type LogLevel

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

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

func (LogLevel) Parse

func (l LogLevel) Parse(s string) LogLevel

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

func (LogLevel) SetDefault

func (l LogLevel) SetDefault(level string) LogLevel

SetDefault sets the default log level.

func (LogLevel) SetModule

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

SetModule sets the log level for a module.

func (LogLevel) String

func (l LogLevel) String() string

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

type Logging added in v1.3.0

type Logging struct {
	EnableLoki   bool   `toml:"enable-loki" mapstructure:"enable-loki"`
	LokiUrl      string `toml:"loki-url" mapstructure:"loki-url"`
	LokiUsername string `toml:"loki-username" mapstructure:"loki-username"`
	LokiPassword string `toml:"loki-password" mapstructure:"loki-password"`
}

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

func (v *Network) Copy() *Network

func (*Network) CopyAsInterface

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

func (*Network) Equal

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

func (*Network) GetBvnNames

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

func (*Network) GetPartitionByID

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

func (*Network) IsValid

func (v *Network) IsValid() error

func (*Network) MarshalBinary

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

func (*Network) MarshalJSON

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

func (*Network) UnmarshalBinary

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

func (*Network) UnmarshalBinaryFrom

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

func (*Network) UnmarshalJSON

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

type NetworkUrl

type NetworkUrl struct {
	*url.URL
}

func (NetworkUrl) AnchorPool

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

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

func (NetworkUrl) BlockLedger

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

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

func (NetworkUrl) Identity

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

Ledger returns the URL of the partition's identity.

func (NetworkUrl) Ledger

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

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

func (NetworkUrl) Operators

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

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

func (NetworkUrl) OperatorsPage

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

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

func (NetworkUrl) PartitionID added in v1.2.10

func (u NetworkUrl) PartitionID() string

func (NetworkUrl) Synthetic

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

func (v *Node) Copy() *Node

func (*Node) CopyAsInterface

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

func (*Node) Equal

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

func (*Node) IsValid

func (v *Node) IsValid() error

func (*Node) MarshalBinary

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

func (*Node) UnmarshalBinary

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

func (*Node) UnmarshalBinaryFrom

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

func NodeTypeByName(name string) (NodeType, bool)

NodeTypeByName returns the named Node Type.

func (NodeType) GetEnumValue

func (v NodeType) GetEnumValue() uint64

GetEnumValue returns the value of the Node Type

func (NodeType) MarshalJSON

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

MarshalJSON marshals the Node Type to JSON as a string.

func (NodeType) MarshalTOML

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

MarshalTOML marshals the Node Type to Toml as a string.

func (*NodeType) SetEnumValue

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

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

func (NodeType) String

func (v NodeType) String() string

String returns the name of the Node Type.

func (*NodeType) UnmarshalJSON

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

UnmarshalJSON unmarshals the Node Type from JSON as a string.

type P2P

type P2P struct {
	Listen         []p2p.Multiaddr `json:"listen,omitempty" form:"listen" query:"listen" validate:"required" toml:"listen" mapstructure:"listen"`
	BootstrapPeers []p2p.Multiaddr `` /* 150-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*P2P) Copy

func (v *P2P) Copy() *P2P

func (*P2P) CopyAsInterface

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

func (*P2P) Equal

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

func (*P2P) IsValid

func (v *P2P) IsValid() error

func (*P2P) MarshalBinary

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

func (*P2P) MarshalJSON

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

func (*P2P) UnmarshalBinary

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

func (*P2P) UnmarshalBinaryFrom

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

func (*P2P) UnmarshalJSON

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

type Partition

type Partition struct {
	Id       string                 `json:"id,omitempty" form:"id" query:"id" validate:"required" toml:"id" mapstructure:"id"`
	Type     protocol.PartitionType `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

func (v *Partition) Copy() *Partition

func (*Partition) CopyAsInterface

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

func (*Partition) Equal

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

func (*Partition) IsValid

func (v *Partition) IsValid() error

func (*Partition) MarshalBinary

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

func (*Partition) MarshalJSON

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

func (*Partition) UnmarshalBinary

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

func (*Partition) UnmarshalBinaryFrom

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

func (*Partition) UnmarshalJSON

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

type PortOffset

type PortOffset uint64
const PortOffsetAccumulateApi PortOffset = 4

PortOffsetAccumulateApi .

const PortOffsetAccumulateP2P PortOffset = 2

PortOffsetAccumulateP2P .

const PortOffsetPrometheus PortOffset = 3

PortOffsetPrometheus .

const PortOffsetTendermintP2P PortOffset = 0

PortOffsetTendermintP2P .

const PortOffsetTendermintRpc PortOffset = 1

PortOffsetTendermintRpc .

func PortOffsetByName

func PortOffsetByName(name string) (PortOffset, bool)

PortOffsetByName returns the named Port Offset.

func (PortOffset) GetEnumValue

func (v PortOffset) GetEnumValue() uint64

GetEnumValue returns the value of the Port Offset

func (PortOffset) MarshalJSON

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

MarshalJSON marshals the Port Offset to JSON as a string.

func (*PortOffset) SetEnumValue

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

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

func (PortOffset) String

func (v PortOffset) String() string

String returns the name of the Port Offset.

func (*PortOffset) UnmarshalJSON

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

UnmarshalJSON unmarshals the Port Offset from JSON as a string.

type Snapshots

type Snapshots struct {
	// Enable enables snapshots
	Enable bool `toml:"enable" mapstructure:"enable"`

	// EnableIndexing enables indexing of snapshots
	EnableIndexing bool `toml:"enable-indexing" mapstructure:"enable-indexing"`

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

type Storage struct {
	Type StorageType `toml:"type" mapstructure:"type"`
	Path string      `toml:"path" mapstructure:"path"`
}

type StorageType

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

Jump to

Keyboard shortcuts

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