Documentation ¶
Index ¶
- Constants
- func CreateEmptyDir(path string) error
- func EditIPFSConfig(path, ip string)
- func EditIPFSField(path, field, value string)
- func GetClusterVariables(path, ip, secret, peername string, replmin, replmax int, ports ClusterInstance) string
- func GetEnvVar(field, value string) string
- func GetNextAvailablePorts(pmin, pmax, n int) (*[]int, error)
- func MakeJSONArray(elements []string) string
- func MakeJSONElem(elem string) string
- func Protocol(configPath, nodeID, ip string, replmin, replmax int) error
- func ReadConfig(file string) (string, error)
- func SaveInstances(instances []ClusterInstance, filename string)
- func SetClusterLeaderConfig(path, ip, peername string, replmin, replmax int, ports ClusterInstance) (string, string, error)
- func WriteConfig(path string, config string) error
- type ClusterInstance
Constants ¶
const ( //DefaultIPFSAPIPort DefaultIPFSAPIPort DefaultIPFSAPIPort = 5001 // DefaultIPFSGatewayPort DefaultIPFSGatewayPort DefaultIPFSGatewayPort = 8080 // DefaultIPFSSwarmPort DefaultIPFSSwarmPort DefaultIPFSSwarmPort = 4001 // IPVersion default ip version IPVersion string = "/ip4/" // TransportProtocol default transport protocol TransportProtocol string = "/tcp/" )
Variables ¶
This section is empty.
Functions ¶
func CreateEmptyDir ¶
CreateEmptyDir create an empty directory at the given path
func EditIPFSConfig ¶
func EditIPFSConfig(path, ip string)
EditIPFSConfig edit the ipfs configuration file (mainly the ip)
func EditIPFSField ¶
func EditIPFSField(path, field, value string)
EditIPFSField with the native IPFS config command
func GetClusterVariables ¶
func GetClusterVariables(path, ip, secret, peername string, replmin, replmax int, ports ClusterInstance) string
GetClusterVariables get the cluster variables
func GetNextAvailablePorts ¶
GetNextAvailablePorts return n available ports between pmin and pmax crash if error
func MakeJSONArray ¶
MakeJSONArray make a json array from the given elements
func ReadConfig ¶
ReadConfig read a config file given as parameter and returns a string
func SaveInstances ¶
func SaveInstances(instances []ClusterInstance, filename string)
SaveInstances save ipfs and ipfs-cluster instances ip and ports on disk
func SetClusterLeaderConfig ¶
func SetClusterLeaderConfig(path, ip, peername string, replmin, replmax int, ports ClusterInstance) ( string, string, error)
SetClusterLeaderConfig set the configs for the leader of a cluster
func WriteConfig ¶
WriteConfig write string to a file
Types ¶
type ClusterInstance ¶
type ClusterInstance struct { IP string IPFSAPIPort int RestAPIPort int IPFSProxyPort int ClusterPort int }
ClusterInstance details of a cluster
func LoadInstances ¶
func LoadInstances(filename string) []ClusterInstance
LoadInstances load saved ipfs and ipfs-cluster instances from disk
func SetupClusterLeader ¶
func SetupClusterLeader(configPath, nodeID, ip string, replmin, replmax int) (string, *ClusterInstance, error)
SetupClusterLeader setup a cluster instance for the ARA leader
func SetupClusterSlave ¶
func SetupClusterSlave(configPath, nodeID, ip, bootstrap, secret string, replmin, replmax int) (*ClusterInstance, error)
SetupClusterSlave setup a cluster slave instance