Documentation ¶
Overview ¶
Package helpers contains functions to help make the task of deploying a blockchain easier and faster
Index ¶
- func AllNewNodeExecCon(tn *testnet.TestNet, fn func(*ssh.Client, *db.Server, ssh.Node) error) error
- func AllNewNodeExecConSC(ad *testnet.Adjunct, fn func(*ssh.Client, *db.Server, ssh.Node) error) error
- func AllNodeExecCon(tn *testnet.TestNet, fn func(*ssh.Client, *db.Server, ssh.Node) error) error
- func AllNodeExecConSC(ad *testnet.Adjunct, fn func(*ssh.Client, *db.Server, ssh.Node) error) error
- func AllServerExecCon(tn *testnet.TestNet, fn func(*ssh.Client, *db.Server) error) error
- func AllServerExecConSC(ad *testnet.Adjunct, fn func(*ssh.Client, *db.Server) error) error
- func CheckDeployFlag(details *db.DeploymentDetails, flag string) bool
- func CopyAllToServers(tn *testnet.TestNet, srcDst ...string) error
- func CopyBytesToAllNewNodes(tn *testnet.TestNet, dataDst ...string) error
- func CopyBytesToAllNewNodesSC(ad *testnet.Adjunct, dataDst ...string) error
- func CopyBytesToAllNodes(tn *testnet.TestNet, dataDst ...string) error
- func CopyBytesToAllNodesSC(ad *testnet.Adjunct, dataDst ...string) error
- func CopyToAllNewNodes(tn *testnet.TestNet, srcDst ...string) error
- func CopyToAllNewNodesSC(ad *testnet.Adjunct, srcDst ...string) error
- func CopyToAllNodes(tn *testnet.TestNet, srcDst ...string) error
- func CopyToAllNodesSC(ad *testnet.Adjunct, srcDst ...string) error
- func CreateConfigs(tn *testnet.TestNet, dest string, fn func(ssh.Node) ([]byte, error)) error
- func CreateConfigsNewNodes(tn *testnet.TestNet, dest string, fn func(ssh.Node) ([]byte, error)) error
- func CreateConfigsNewNodesSC(ad *testnet.Adjunct, dest string, fn func(ssh.Node) ([]byte, error)) error
- func CreateConfigsSC(ad *testnet.Adjunct, dest string, fn func(ssh.Node) ([]byte, error)) error
- func GetBlockchainConfig(blockchain string, node int, file string, details *db.DeploymentDetails) ([]byte, error)
- func GetDefaults(details *db.DeploymentDetails, term string) (interface{}, bool)
- func GetFileDefault(details *db.DeploymentDetails, file string) (string, bool)
- func GetStaticBlockchainConfig(blockchain string, file string) ([]byte, error)
- func ScpAndDeferRemoval(client *ssh.Client, buildState *state.BuildState, src string, dst string)
- func SingleCp(client *ssh.Client, buildState *state.BuildState, node ssh.Node, data []byte, ...) error
- type KeyMaster
- func (km *KeyMaster) AddGenerator(gen func(client *ssh.Client) (util.KeyPair, error))
- func (km *KeyMaster) GenerateKeyPair(client *ssh.Client) (util.KeyPair, error)
- func (km *KeyMaster) GetKeyPair(client *ssh.Client) (util.KeyPair, error)
- func (km *KeyMaster) GetMappedKeyPairs(args []string, client *ssh.Client) (map[string]util.KeyPair, error)
- func (km *KeyMaster) GetServerKeyPairs(servers []db.Server, clients []*ssh.Client) (map[string]util.KeyPair, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllNewNodeExecCon ¶
AllNewNodeExecCon is AllNodeExecCon but executes only for new nodes
func AllNewNodeExecConSC ¶ added in v1.7.1
func AllNewNodeExecConSC(ad *testnet.Adjunct, fn func(*ssh.Client, *db.Server, ssh.Node) error) error
AllNewNodeExecConSC is AllNewNodeExecCon but executes only for sidecar nodes
func AllNodeExecCon ¶
AllNodeExecCon executes fn for every node concurrently. Will return once all of the calls to fn have been completely. Each call to fn is provided with, in order, the relevant ssh client, the server where the node exists, the local number of that node on the server and the absolute number of the node in the testnet. If any of the calls to fn return a non-nil error value, one of those errors will be returned. Currently there is no guarentee as to which one, however this should be implemented in the future.
func AllNodeExecConSC ¶ added in v1.7.1
AllNodeExecConSC is AllNodeExecCon but executes only for sidecar nodes
func AllServerExecCon ¶
AllServerExecCon executes fn for every server in the testnet. Is sementatically similar to AllNodeExecCon. Every call to fn is provided with the relevant ssh client and server object.
func AllServerExecConSC ¶ added in v1.7.1
AllServerExecConSC is like AllServerExecCon but for side cars
func CheckDeployFlag ¶
func CheckDeployFlag(details *db.DeploymentDetails, flag string) bool
CheckDeployFlag checks for the presence of an extras flag.
func CopyAllToServers ¶
CopyAllToServers copies all of the src files to all of the servers within the given testnet. This can handle multiple pairs in form of ...,source,destination,source2,destination2
func CopyBytesToAllNewNodes ¶
CopyBytesToAllNewNodes is CopyBytesToAllNodes but only operates on newly built nodes
func CopyBytesToAllNewNodesSC ¶ added in v1.7.1
CopyBytesToAllNewNodesSC is CopyBytesToAllNewNodes but only operates on sidecar nodes
func CopyBytesToAllNodes ¶
CopyBytesToAllNodes functions similiarly to CopyToAllNodes, except it operates on data and dst pairs instead of src and dest pairs, so you can just pass data directly to all of the nodes without having to call buildState.Write first.
func CopyBytesToAllNodesSC ¶ added in v1.7.1
CopyBytesToAllNodesSC is CopyBytesToAllNodes but only operates on sidecar nodes
func CopyToAllNewNodes ¶
CopyToAllNewNodes copies files writen with BuildState's write function over to all of the newly built nodes. Can handle multiple files, in pairs of src and dst
func CopyToAllNewNodesSC ¶ added in v1.7.1
CopyToAllNewNodesSC is CopyToAllNewNodes for side cars
func CopyToAllNodes ¶
CopyToAllNodes copies files writen with BuildState's write function over to all of the nodes. Can handle multiple files, in pairs of src and dst
func CopyToAllNodesSC ¶ added in v1.7.1
CopyToAllNodesSC is CopyToAllNodes for side cars
func CreateConfigs ¶
CreateConfigs allows for individual generation of configuration files with error propogation. For each node, fn will be called, with (Server ID, local node number, absolute node number), and it will expect to have the configuration file returned or error.
func CreateConfigsNewNodes ¶
func CreateConfigsNewNodes(tn *testnet.TestNet, dest string, fn func(ssh.Node) ([]byte, error)) error
CreateConfigsNewNodes is CreateConfigs but it only operates on new nodes
func CreateConfigsNewNodesSC ¶ added in v1.7.1
func CreateConfigsNewNodesSC(ad *testnet.Adjunct, dest string, fn func(ssh.Node) ([]byte, error)) error
CreateConfigsNewNodesSC is CreateConfigsNewNodes but it only operates on side cars
func CreateConfigsSC ¶ added in v1.7.1
CreateConfigsSC is CreateConfigs but it only operates on side cars
func GetBlockchainConfig ¶
func GetBlockchainConfig(blockchain string, node int, file string, details *db.DeploymentDetails) ([]byte, error)
GetBlockchainConfig fetches dynamic config template files for the blockchain. Should be used in most cases instead of GetStaticBlockchainConfig as it provides the user the functionality for `-t..` in the build command for the CLI
func GetDefaults ¶
func GetDefaults(details *db.DeploymentDetails, term string) (interface{}, bool)
GetDefaults get any availible default value for a given term. will be nil,false if it is not found
func GetFileDefault ¶
func GetFileDefault(details *db.DeploymentDetails, file string) (string, bool)
GetFileDefault gets the default value for a file if it exists in the extras
func GetStaticBlockchainConfig ¶
GetStaticBlockchainConfig fetches a static file resource for a blockchain, which will never change
func ScpAndDeferRemoval ¶
ScpAndDeferRemoval Copy a file over to a server, and then defer it for removal after the build is completed
Types ¶
type KeyMaster ¶
type KeyMaster struct { //PrivateKeys contains the static pool of private keys PrivateKeys []string //PublicKeys contains the static pool of private keys. PublicKeys []string // contains filtered or unexported fields }
KeyMaster is a static resource key manager Uses keys stored in the blockchains resource directory, so that keys can remain consistent among builds and also to save time on builds where a large number of keys are needed. Note: This is not thread safe and may need external synchronization.
func NewKeyMaster ¶
func NewKeyMaster(details *db.DeploymentDetails, blockchain string) (*KeyMaster, error)
NewKeyMaster creates a new KeyMaster using the provided deployment details and blockchain. Currently details is not used, but in the future, it should be used to allow the user to provide their own static keys to be used in the pool.
func (*KeyMaster) AddGenerator ¶
AddGenerator sets the backup key generator function for km KeyMaster
func (*KeyMaster) GenerateKeyPair ¶
GenerateKeyPair generates a new key pair if a generator function has been provided
func (*KeyMaster) GetKeyPair ¶
GetKeyPair fetches a key pair, will use up keys in the static pool until it runs out, if it runs out, it will use the given generator to create new keys