Skip to content
Snippets Groups Projects
Commit e2ab0dfd authored by Josh Brooks's avatar Josh Brooks
Browse files

Fix GetNodeRegistrationStatus return values

parent 310e3973
No related branches found
No related tags found
2 merge requests!510Release,!318Fix GetNodeRegistrationStatus return values
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package bindings package bindings
import ( import (
"encoding/json"
"fmt" "fmt"
"time" "time"
...@@ -92,17 +93,31 @@ func (c *Cmix) NetworkFollowerStatus() int { ...@@ -92,17 +93,31 @@ func (c *Cmix) NetworkFollowerStatus() int {
return int(c.api.NetworkFollowerStatus()) return int(c.api.NetworkFollowerStatus())
} }
// NodeRegistrationReport is the report structure which
// Cmix.GetNodeRegistrationStatus returns JSON marshalled.
type NodeRegistrationReport struct {
NumberOfNodesRegistered int
NumberOfNodes int
Err error
}
// GetNodeRegistrationStatus returns the current state of node registration. // GetNodeRegistrationStatus returns the current state of node registration.
// //
// Returns: // Returns:
// - []int - The 0th element represents the number of nodes with which the user is registered. // - []bye - A marshalled NodeRegistrationReport containing the number of
// The 1st element represents the number of nodes present in the NDF. // nodes the user is registered with, the number of nodes present in the NDF and
// - An error will most likely occur if the network is unhealthy. // a nullable error. If the error is not null, the most likely cause is that the
func (c *Cmix) GetNodeRegistrationStatus() ([]int, error) { // network is unhealthy.
results := make([]int, 2) func (c *Cmix) GetNodeRegistrationStatus() ([]byte, error) {
var err error numNodesRegistered, numNodes, err := c.api.GetNodeRegistrationStatus()
results[0], results[1], err = c.api.GetNodeRegistrationStatus()
return results, err nodeRegReport := NodeRegistrationReport{
NumberOfNodesRegistered: numNodesRegistered,
NumberOfNodes: numNodes,
Err: err,
}
return json.Marshal(nodeRegReport)
} }
// HasRunningProcessies checks if any background threads are running and returns // HasRunningProcessies checks if any background threads are running and returns
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment