accumulated

package
v1.2.10-rc.4 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 84 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][]byte, error)

func BuildNodesConfig

func BuildNodesConfig(network *NetworkInit, mkcfg MakeConfigFunc) [][][]*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 []byte) (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) BlockSummary

func (b AddressBuilder) BlockSummary() AddressBuilder

BlockSummary sets the partition type to protocol.PartitionTypeBlockSummary.

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

func (b AddressSliceBuilder) BlockSummary() AddressSliceBuilder

protocol.PartitionTypeBlockSummary.

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) EventBus added in v1.1.1

func (d *Daemon) EventBus() *events.Bus

func (*Daemon) Key

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

func (*Daemon) LoadSnapshot

func (d *Daemon) LoadSnapshot(file ioutil2.SectionReader) 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(others ...*Daemon) (err error)

func (*Daemon) StartP2P added in v1.1.1

func (d *Daemon) StartP2P() error

func (*Daemon) StartSecondary

func (d *Daemon) StartSecondary(e *Daemon, others ...*Daemon) error

StartSecondary starts this daemon as a secondary process of the given daemon (which must already be running).

func (*Daemon) Stop

func (d *Daemon) Stop() error

type DevnetOptions

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

type MakeConfigFunc

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

type NetworkInit

type NetworkInit struct {
	Id        string     `json:"id,omitempty" form:"id" query:"id" validate:"required"`
	Bootstrap *NodeInit  `json:"bootstrap,omitempty" form:"bootstrap" query:"bootstrap" validate:"required"`
	Bvns      []*BvnInit `json:"bvns,omitempty" form:"bvns" query:"bvns" validate:"required"`
	Bsn       *BvnInit   `json:"bsn,omitempty" form:"bsn" query:"bsn" 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"`
	BsnnType         config.NodeType `json:"bsnnType,omitempty" form:"bsnnType" query:"bsnnType" 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"`
	BsnNodeKey       []byte          `json:"bsnNodeKey,omitempty" form:"bsnNodeKey" query:"bsnNodeKey" validate:"required"`
	// contains filtered or unexported fields
}

func (*NodeInit) Advertize

func (n *NodeInit) Advertize() AddressBuilder

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

func (*NodeInit) Copy added in v1.2.0

func (v *NodeInit) Copy() *NodeInit

func (*NodeInit) CopyAsInterface added in v1.2.0

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

func (*NodeInit) Equal added in v1.2.0

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

func (*NodeInit) IsValid added in v1.2.0

func (v *NodeInit) IsValid() error

func (*NodeInit) Listen

func (n *NodeInit) Listen() AddressBuilder

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

func (*NodeInit) MarshalBinary added in v1.2.0

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

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) UnmarshalBinary added in v1.2.0

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

func (*NodeInit) UnmarshalBinaryFrom added in v1.2.0

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

func (*NodeInit) UnmarshalJSON

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

type RateLimitedListener

type RateLimitedListener struct {
	net.Listener
	Pool chan struct{}
}

func (*RateLimitedListener) Accept

func (l *RateLimitedListener) Accept() (net.Conn, error)

Jump to

Keyboard shortcuts

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