Documentation ¶
Overview ¶
Package db manages persistent state and keeps track of previous and current builds.
Index ¶
- Constants
- func Check() error
- func CheckAndUpdate()
- func DeleteMeta(key string) error
- func DeleteNode(id string) error
- func DeleteNodesByServer(id string) error
- func DeleteNodesByTestNet(id string) error
- func DeleteServer(id int) error
- func DivideNodesByAbsMatch(nodes []Node, nodeNums []int) ([]Node, []Node, error)
- func GetAllServers() (map[string]Server, error)
- func GetHostIPsByTestNet(id int) ([]string, error)
- func GetMeta(key string) (interface{}, error)
- func GetMetaP(key string, v interface{}) error
- func GetUniqueServerIds(nodes []Node) []int
- func InsertBuild(dd DeploymentDetails, testnetID string) error
- func InsertLocalServers(db *sql.DB)
- func InsertNode(node Node) (int, error)
- func InsertServer(name string, server Server) (int, error)
- func InsertTestNet(testnet TestNet) error
- func SetMeta(key string, value interface{}) error
- func SetVersion(version string) error
- func UpdateServer(id int, server Server) error
- func UpdateServerNodes(id int, nodes int) error
- func UpdateTestNet(id int, testnet TestNet) error
- func UpdateTestNetNodes(id int, nodes int) error
- type DeploymentDetails
- type Node
- func GetAllNodes() ([]Node, error)
- func GetAllNodesByServer(serverId int) ([]Node, error)
- func GetAllNodesByTestNet(testId string) ([]Node, error)
- func GetNode(id string) (Node, error)
- func GetNodeByAbsNum(nodes []Node, absNum int) (Node, error)
- func GetNodeByLocalId(nodes []Node, localID int) (Node, error)
- func GetNodeByTestNetAndId(testnet string, id string) (Node, error)
- type Server
- type TestNet
Constants ¶
const BuildsTable string = "builds"
BuildsTable contains name of the builds table
const NodesTable string = "nodes"
NodesTable contains name of the nodes table
const ServerTable string = "servers"
ServerTable contains name of the server table
const TestTable string = "testnets"
TestTable contains name of the testnet table
const Version = "2.2.3"
Variables ¶
This section is empty.
Functions ¶
func CheckAndUpdate ¶
func CheckAndUpdate()
func DeleteMeta ¶
func DeleteNode ¶
DeleteNode removes a node from the database (Deprecated)
func DeleteNodesByServer ¶
DeleteNodesByServer delete all nodes which have ever been on a given server.
func DeleteNodesByTestNet ¶
DeleteNodesByTestNet removes all nodes in a testnet from the database. (Deprecated)
func DivideNodesByAbsMatch ¶
func GetAllServers ¶
Get all of the servers, indexed by name
func GetHostIPsByTestNet ¶
Get the ips of the hosts for a testnet
func GetUniqueServerIds ¶
func InsertBuild ¶
func InsertBuild(dd DeploymentDetails, testnetID string) error
InsertBuild inserts a build
func InsertLocalServers ¶
InsertLocalServers adds the default server(s) to the servers database, allowing immediate use of the application without having to register a server
func InsertNode ¶
InsertNode inserts a node into the database
func InsertServer ¶
Insert a new server into the database
func SetVersion ¶
func UpdateServerNodes ¶
Update the number of nodes a server has
func UpdateTestNetNodes ¶
Update the number of nodes in a testnet
Types ¶
type DeploymentDetails ¶
type DeploymentDetails struct { /* Servers: The ids of the servers to build on */ Servers []int `json:"servers"` /* Blockchain: The blockchain to build. */ Blockchain string `json:"blockchain"` /* Nodes: The number of nodes to build */ Nodes int `json:"nodes"` /* Image: The docker image to build off of */ Images []string `json:"images"` /* Params: The blockchain specific parameters */ Params map[string]interface{} `json:"params"` /* Resources: The resources per node */ Resources []util.Resources `json:"resources"` Environments []map[string]string `json:"environments"` Files []map[string]string `json:"files"` Logs []map[string]string `json:"logs"` Extras map[string]interface{} `json:"extras"` // contains filtered or unexported fields }
DeploymentDetails represents the data for the construction of a testnet.
func GetAllBuilds ¶
func GetAllBuilds() ([]DeploymentDetails, error)
GetAllBuilds gets all of the builds done by a user
func GetBuildByTestnet ¶
func GetBuildByTestnet(id string) (DeploymentDetails, error)
GetBuildByTestnet gets the build paramters based off testnet id
func GetLastBuildByKid ¶
func GetLastBuildByKid(kid string) (DeploymentDetails, error)
GetBuildByTestnet gets the build paramters based off testnet id
func QueryBuilds ¶
func QueryBuilds(query string) ([]DeploymentDetails, error)
func (DeploymentDetails) GetJwt ¶
func (this DeploymentDetails) GetJwt() string
func (DeploymentDetails) GetKid ¶
func (this DeploymentDetails) GetKid() string
func (*DeploymentDetails) SetJwt ¶
func (this *DeploymentDetails) SetJwt(jwt string) error
type Node ¶
type Node struct { ID string `json:"id"` AbsoluteNum int `json:"absNum"` /* TestNetId is the id of the testnet to which the node belongs to */ TestNetID string `json:"testNetId"` /* Server is the id of the server on which the node resides */ Server int `json:"server"` /* LocalId is the number of the node in the testnet */ LocalID int `json:"localId"` /* Ip is the ip address of the node */ Ip string `json:"ip"` /* Label is the string given to the node by the build process */ Label string `json:"label"` }
Node represents a node within the network
func GetAllNodes ¶
GetAllNodes gets every node that has ever existed.
func GetAllNodesByServer ¶
GetAllNodesByServer gets all nodes that have ever existed on a server
func GetAllNodesByTestNet ¶
GetAllNodesByTestNet gets all the nodes which are in the given testnet