From a5faf82f085c17fce8b4052a8ffaed1df9ba30ac Mon Sep 17 00:00:00 2001 From: Josh Brooks <josh@elixxir.io> Date: Thu, 4 Aug 2022 21:39:49 +0000 Subject: [PATCH] Expose GetNodeRegistrationStatus to the bindings --- bindings/follow.go | 18 +++++++++++++++--- bindings/group.go | 1 + xxdk/cmix.go | 6 +++--- 3 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 bindings/group.go diff --git a/bindings/follow.go b/bindings/follow.go index 8e5826dc9..14dc9e9aa 100644 --- a/bindings/follow.go +++ b/bindings/follow.go @@ -83,13 +83,25 @@ func (c *Cmix) WaitForNetwork(timeoutMS int) bool { // NetworkFollowerStatus gets the state of the network follower. It returns a // status with the following values: -// Stopped - 0 -// Running - 2000 -// Stopping - 3000 +// +// Status: +// - Stopped - 0 +// - Running - 2000 +// - Stopping - 3000 func (c *Cmix) NetworkFollowerStatus() int { return int(c.api.NetworkFollowerStatus()) } +// GetNodeRegistrationStatus returns the current state of node registration. +// +// Returns: +// - The number of nodes with which the user is registered. +// - The number of nodes present in the NDF. +// - An error will most likely occur if the network is unhealthy. +func (c *Cmix) GetNodeRegistrationStatus() (int, int, error) { + return c.api.GetNodeRegistrationStatus() +} + // HasRunningProcessies checks if any background threads are running and returns // true if one or more are. // diff --git a/bindings/group.go b/bindings/group.go new file mode 100644 index 000000000..95f91744f --- /dev/null +++ b/bindings/group.go @@ -0,0 +1 @@ +package bindings diff --git a/xxdk/cmix.go b/xxdk/cmix.go index 6dfe2e540..539c2610d 100644 --- a/xxdk/cmix.go +++ b/xxdk/cmix.go @@ -445,9 +445,9 @@ func (c *Cmix) GetEventReporter() event.Reporter { } // GetNodeRegistrationStatus gets the current state of nodes registration. It -// returns the total number of nodes in the NDF and the number of those that are -// currently registered with. An error is returned if the network is not -// healthy. +// returns the number of nodes that the user is currently registered with and +// the total number of nodes in the NDF. An error is returned if the network +// is not healthy. func (c *Cmix) GetNodeRegistrationStatus() (int, int, error) { // Return an error if the network is not healthy if !c.GetCmix().IsHealthy() { -- GitLab