accumulated

package
v1.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2023 License: MIT Imports: 80 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildGenesisDocs

func BuildGenesisDocs(network *NetworkInit, globals *core.GlobalValues, time time.Time, logger log.Logger, factomAddresses func() (io.Reader, error), snapshots []func() (ioutil2.SectionReader, error)) (map[string]*tmtypes.GenesisDoc, error)

func BuildNodesConfig

func BuildNodesConfig(network *NetworkInit, mkcfg MakeConfigFunc) [][][2]*config.Config

func ConfigureNodePorts

func ConfigureNodePorts(node *NodeInit, cfg *config.Config, part protocol.PartitionType)

func LoadOrGenerateTmPrivKey

func LoadOrGenerateTmPrivKey(privFileName string) (tmed25519.PrivKey, error)

func WriteNodeFiles

func WriteNodeFiles(cfg *config.Config, privValKey, nodeKey []byte, genDoc *tmtypes.GenesisDoc) (err error)

Types

type AddressBuilder

type AddressBuilder struct {
	// contains filtered or unexported fields
}

AddressBuilder builds an address.

func (AddressBuilder) AccumulateAPI

func (b AddressBuilder) AccumulateAPI() AddressBuilder

AccumulateAPI sets the service to config.PortOffsetAccumulateApi.

func (AddressBuilder) AccumulateP2P

func (b AddressBuilder) AccumulateP2P() AddressBuilder

AccumulateP2P sets the service to config.PortOffsetAccumulateP2P.

func (AddressBuilder) BlockValidator

func (b AddressBuilder) BlockValidator() AddressBuilder

BlockValidator sets the partition type to protocol.PartitionTypeBlockValidator.

func (AddressBuilder) Directory

func (b AddressBuilder) Directory() AddressBuilder

Directory sets the partition type to protocol.PartitionTypeDirectory.

func (AddressBuilder) Multiaddr

func (b AddressBuilder) Multiaddr() multiaddr.Multiaddr

Multiaddr builds the address as a multiaddr.

func (AddressBuilder) PartitionType

func (b AddressBuilder) PartitionType(typ protocol.PartitionType) AddressBuilder

PartitionType sets the partition type.

func (AddressBuilder) Prometheus

func (b AddressBuilder) Prometheus() AddressBuilder

Prometheus sets the service to config.PortOffsetPrometheus.

func (AddressBuilder) Scheme

func (b AddressBuilder) Scheme(scheme string) AddressBuilder

Scheme sets the address scheme.

func (AddressBuilder) String

func (b AddressBuilder) String() string

String builds the address as a traditional URL address string.

func (AddressBuilder) TendermintP2P

func (b AddressBuilder) TendermintP2P() AddressBuilder

TendermintP2P sets the service to config.PortOffsetTendermintP2P.

func (AddressBuilder) TendermintRPC

func (b AddressBuilder) TendermintRPC() AddressBuilder

TendermintRPC sets the service to config.PortOffsetTendermintRpc.

func (AddressBuilder) WithKey

func (b AddressBuilder) WithKey() AddressBuilder

WithKey includes the node key in the address.

type AddressSliceBuilder

type AddressSliceBuilder []AddressBuilder

AddressSliceBuilder builds a slice of addresses.

func (AddressSliceBuilder) AccumulateAPI

func (b AddressSliceBuilder) AccumulateAPI() AddressSliceBuilder

AccumulateAPI sets the service to config.PortOffsetAccumulateApi.

func (AddressSliceBuilder) AccumulateP2P

func (b AddressSliceBuilder) AccumulateP2P() AddressSliceBuilder

AccumulateP2P sets the service to config.PortOffsetAccumulateP2P.

func (AddressSliceBuilder) BlockValidator

func (b AddressSliceBuilder) BlockValidator() AddressSliceBuilder

protocol.PartitionTypeBlockValidator.

func (AddressSliceBuilder) Directory

Directory sets the partition type to protocol.PartitionTypeDirectory.

func (AddressSliceBuilder) Do

Do returns the Cartesian product of the address list and the given operations. Given N addresses and M operations, Do returns N⨯M addresses.

func (AddressSliceBuilder) Multiaddr

func (b AddressSliceBuilder) Multiaddr() []multiaddr.Multiaddr

Multiaddr builds the address as a multiaddr.

func (AddressSliceBuilder) PartitionType

PartitionType sets the partition type.

func (AddressSliceBuilder) Prometheus

Prometheus sets the service to config.PortOffsetPrometheus.

func (AddressSliceBuilder) Scheme

Scheme sets the address scheme.

func (AddressSliceBuilder) String

func (b AddressSliceBuilder) String() []string

String builds the address as a traditional URL address string.

func (AddressSliceBuilder) TendermintP2P

func (b AddressSliceBuilder) TendermintP2P() AddressSliceBuilder

TendermintP2P sets the service to config.PortOffsetTendermintP2P.

func (AddressSliceBuilder) TendermintRPC

func (b AddressSliceBuilder) TendermintRPC() AddressSliceBuilder

TendermintRPC sets the service to config.PortOffsetTendermintRpc.

func (AddressSliceBuilder) WithKey

WithKey includes the node key in the address.

type BvnInit

type BvnInit struct {
	Id    string      `json:"id,omitempty" form:"id" query:"id" validate:"required"`
	Nodes []*NodeInit `json:"nodes,omitempty" form:"nodes" query:"nodes" validate:"required"`
}

func (*BvnInit) MarshalJSON

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

func (*BvnInit) Peers

func (b *BvnInit) Peers(node *NodeInit) AddressSliceBuilder

Peers returns an address slice builder for every node in the BVN other than the given one.

func (*BvnInit) UnmarshalJSON

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

type Daemon

type Daemon struct {
	Config *config.Config
	Logger tmlog.Logger

	// knobs for tests
	// IsTest   bool
	UseMemDB bool
	// contains filtered or unexported fields
}

func Load

func Load(dir string, newWriter func(*config.Config) (io.Writer, error)) (*Daemon, error)

func New

func New(cfg *config.Config, newWriter func(*config.Config) (io.Writer, error)) (*Daemon, error)

func (*Daemon) API

func (d *Daemon) API() *nodeapi.Handler

func (*Daemon) ConnectDirectly

func (d *Daemon) ConnectDirectly(e *Daemon) error

func (*Daemon) DB_TESTONLY

func (d *Daemon) DB_TESTONLY() *database.Database

func (*Daemon) Done

func (d *Daemon) Done() <-chan struct{}

func (*Daemon) Key

func (d *Daemon) Key() crypto.PrivKey

func (*Daemon) LoadSnapshot

func (d *Daemon) LoadSnapshot(file ioutil2.SectionReader) error

func (*Daemon) LocalClient

func (d *Daemon) LocalClient() (connections.ABCIClient, error)

func (*Daemon) Node_TESTONLY

func (d *Daemon) Node_TESTONLY() *node.Node

func (*Daemon) P2P_TESTONLY

func (d *Daemon) P2P_TESTONLY() *p2p.Node

func (*Daemon) Start

func (d *Daemon) Start() (err error)

func (*Daemon) Stop

func (d *Daemon) Stop() error

type DevnetOptions

type DevnetOptions struct {
	BvnCount       int
	ValidatorCount int
	FollowerCount  int
	BasePort       int
	GenerateKeys   func() (privVal, dnn, bvnn []byte)
	HostName       func(bvnNum, nodeNum int) (host, listen string)
}

type MakeConfigFunc

type MakeConfigFunc func(networkName string, net config.NetworkType, node config.NodeType, netId string) *config.Config

type NetworkInit

type NetworkInit struct {
	Id   string     `json:"id,omitempty" form:"id" query:"id" validate:"required"`
	Bvns []*BvnInit `json:"bvns,omitempty" form:"bvns" query:"bvns" validate:"required"`
}

func NewDevnet

func NewDevnet(opts DevnetOptions) *NetworkInit

func (*NetworkInit) MarshalJSON

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

func (*NetworkInit) Peers

func (n *NetworkInit) Peers(node *NodeInit) AddressSliceBuilder

Peers returns an address slice builder for every node in the network other than the given one.

func (*NetworkInit) UnmarshalJSON

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

type NodeInit

type NodeInit struct {
	DnnType          config.NodeType `json:"dnnType,omitempty" form:"dnnType" query:"dnnType" validate:"required"`
	BvnnType         config.NodeType `json:"bvnnType,omitempty" form:"bvnnType" query:"bvnnType" validate:"required"`
	BasePort         uint64          `json:"basePort,omitempty" form:"basePort" query:"basePort" validate:"required"`
	AdvertizeAddress string          `json:"advertizeAddress,omitempty" form:"advertizeAddress" query:"advertizeAddress" validate:"required"`
	ListenAddress    string          `json:"listenAddress,omitempty" form:"listenAddress" query:"listenAddress" validate:"required"`
	PeerAddress      string          `json:"peerAddress,omitempty" form:"peerAddress" query:"peerAddress" validate:"required"`
	PrivValKey       []byte          `json:"privValKey,omitempty" form:"privValKey" query:"privValKey" validate:"required"`
	DnNodeKey        []byte          `json:"dnNodeKey,omitempty" form:"dnNodeKey" query:"dnNodeKey" validate:"required"`
	BvnNodeKey       []byte          `json:"bvnNodeKey,omitempty" form:"bvnNodeKey" query:"bvnNodeKey" validate:"required"`
}

func (*NodeInit) Advertize

func (n *NodeInit) Advertize() AddressBuilder

Advertize returns an address builder for the node's advertized address.

func (*NodeInit) Listen

func (n *NodeInit) Listen() AddressBuilder

Listen returns an address builder for the node's listen address.

func (*NodeInit) MarshalJSON

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

func (*NodeInit) Peer

func (n *NodeInit) Peer() AddressBuilder

Peer returns an address builder for the node's peer address.

func (*NodeInit) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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