cluster

package
v0.0.0-...-d55d242 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPPoVFlags

func AddPPoVFlags(cmd *exec.Cmd, config *node.Config)

func GetUnselectedIndexes

func GetUnselectedIndexes(total int, selected []int) []int

func MakePeers

func MakePeers(keys []*core.PrivateKey, addrs []multiaddr.Multiaddr) []node.Peer

func MakeRandomKeys

func MakeRandomKeys(count int) []*core.PrivateKey

func PickUniqueRandoms

func PickUniqueRandoms(total, count int, isSort bool) []int

func RunCommand

func RunCommand(cmd *exec.Cmd) error

func SetupTemplateDir

func SetupTemplateDir(dir string, keys []*core.PrivateKey, vlds []node.Peer, WorkerProportion, VoterProportion float32) error

func Sleep

func Sleep(d time.Duration)

Sleep print duration and call time.Sleep

func WriteGenesisFile

func WriteGenesisFile(datadir string, genesis *node.Genesis) error

func WriteNodeKey

func WriteNodeKey(datadir string, key *core.PrivateKey) error

func WritePeersFile

func WritePeersFile(datadir string, peers []node.Peer) error

func WriteYamlFile

func WriteYamlFile(clusterDir string, data DockerCompose) error

Types

type Cluster

type Cluster struct {
	CheckRotation  bool
	EmptyChainCode bool
	// contains filtered or unexported fields
}

func (*Cluster) GetNode

func (cls *Cluster) GetNode(idx int) Node

func (*Cluster) NodeConfig

func (cls *Cluster) NodeConfig() node.Config

func (*Cluster) NodeCount

func (cls *Cluster) NodeCount() int

func (*Cluster) RemoveEffects

func (cls *Cluster) RemoveEffects()

func (*Cluster) Start

func (cls *Cluster) Start() error

func (*Cluster) Stop

func (cls *Cluster) Stop()

type ClusterFactory

type ClusterFactory interface {
	SetupCluster(name string) (*Cluster, error)
	TemplateDir() string
}

type DockerCompose

type DockerCompose struct {
	Version  string             `yaml:"version"`
	Services map[string]Service `yaml:"services"`
}

func NewDockerCompose

func NewDockerCompose(cls *Cluster) DockerCompose

type LocalFactory

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

func NewLocalFactory

func NewLocalFactory(params LocalFactoryParams) (*LocalFactory, error)

func (*LocalFactory) SetupCluster

func (ftry *LocalFactory) SetupCluster(name string) (*Cluster, error)

func (*LocalFactory) TemplateDir

func (ftry *LocalFactory) TemplateDir() string

type LocalFactoryParams

type LocalFactoryParams struct {
	BinPath          string
	WorkDir          string
	NodeCount        int
	WorkerProportion float32
	VoterProportion  float32
	SetupDocker      bool

	NodeConfig node.Config
}

type LocalNode

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

func (*LocalNode) EffectDelay

func (node *LocalNode) EffectDelay(d time.Duration) error

func (*LocalNode) EffectLoss

func (node *LocalNode) EffectLoss(percent float32) error

func (*LocalNode) GetEndpoint

func (node *LocalNode) GetEndpoint() string

func (*LocalNode) IsRunning

func (node *LocalNode) IsRunning() bool

func (*LocalNode) NodeConfig

func (node *LocalNode) NodeConfig() node.Config

func (*LocalNode) PrintCmd

func (node *LocalNode) PrintCmd() string

func (*LocalNode) RemoveEffect

func (node *LocalNode) RemoveEffect()

func (*LocalNode) Start

func (node *LocalNode) Start() error

func (*LocalNode) Stop

func (node *LocalNode) Stop()

type Node

type Node interface {
	Start() error
	Stop()
	EffectDelay(d time.Duration) error
	EffectLoss(percent float32) error
	RemoveEffect()
	IsRunning() bool
	GetEndpoint() string
	PrintCmd() string
	NodeConfig() node.Config
}

type RemoteFactory

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

func NewRemoteFactory

func NewRemoteFactory(params RemoteFactoryParams) (*RemoteFactory, error)

func (*RemoteFactory) GetHosts

func (ftry *RemoteFactory) GetHosts() []string

func (*RemoteFactory) GetParams

func (ftry *RemoteFactory) GetParams() RemoteFactoryParams

func (*RemoteFactory) ReadHosts

func (ftry *RemoteFactory) ReadHosts(hostsPath string, nodeCount int) error

func (*RemoteFactory) SetupCluster

func (ftry *RemoteFactory) SetupCluster(name string) (*Cluster, error)

func (*RemoteFactory) TemplateDir

func (ftry *RemoteFactory) TemplateDir() string

type RemoteFactoryParams

type RemoteFactoryParams struct {
	BinPath          string
	WorkDir          string
	NodeCount        int
	WorkerProportion float32
	VoterProportion  float32

	NodeConfig node.Config

	KeySSH    string
	HostsPath string // file path to host ip addresses

	SetupRequired   bool
	InstallRequired bool
}

type RemoteNode

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

func (*RemoteNode) DownloadFile

func (node *RemoteNode) DownloadFile(localPath string, fileName string)

func (*RemoteNode) EffectDelay

func (node *RemoteNode) EffectDelay(d time.Duration) error

func (*RemoteNode) EffectLoss

func (node *RemoteNode) EffectLoss(percent float32) error

func (*RemoteNode) GetEndpoint

func (node *RemoteNode) GetEndpoint() string

func (*RemoteNode) InstallDstat

func (node *RemoteNode) InstallDstat()

func (*RemoteNode) IsRunning

func (node *RemoteNode) IsRunning() bool

func (*RemoteNode) NodeConfig

func (node *RemoteNode) NodeConfig() node.Config

func (*RemoteNode) PrintCmd

func (node *RemoteNode) PrintCmd() string

func (*RemoteNode) RemoveDB

func (node *RemoteNode) RemoveDB()

func (*RemoteNode) RemoveEffect

func (node *RemoteNode) RemoveEffect()

func (*RemoteNode) Start

func (node *RemoteNode) Start() error

func (*RemoteNode) StartDstat

func (node *RemoteNode) StartDstat()

func (*RemoteNode) Stop

func (node *RemoteNode) Stop()

func (*RemoteNode) StopDstat

func (node *RemoteNode) StopDstat()

type Service

type Service struct {
	Image   string   `yaml:"image"`
	Volumes []string `yaml:"volumes"`
	Ports   []string `yaml:"ports"`
	Command string   `yaml:"command"`
}

Jump to

Keyboard shortcuts

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