Skip to content
Snippets Groups Projects
Commit 30f6bb4b authored by Jake Taylor's avatar Jake Taylor
Browse files

added some bindings

parent 9670bcd9
Branches
Tags
3 merge requests!510Release,!226WIP: Api2.0,!207WIP: Client Restructure
...@@ -15,12 +15,17 @@ var connectionTrackerSingleton = &connectionTracker{ ...@@ -15,12 +15,17 @@ var connectionTrackerSingleton = &connectionTracker{
count: 0, count: 0,
} }
// Connection is the bindings representation of a connect.Connection object that can be tracked // Connection is the bindings representation of a connect.Connection object that can be tracked by id
type Connection struct { type Connection struct {
connection connect.Connection connection connect.Connection
id int id int
} }
// GetId returns the Connection.id
func (c *Connection) GetId() int {
return c.id
}
// Connect performs auth key negotiation with the given recipient, // Connect performs auth key negotiation with the given recipient,
// and returns a Connection object for the newly-created partner.Manager // and returns a Connection object for the newly-created partner.Manager
// This function is to be used sender-side and will block until the // This function is to be used sender-side and will block until the
......
...@@ -48,6 +48,9 @@ func makeRoundsList(rounds []id.Round) RoundsList { ...@@ -48,6 +48,9 @@ func makeRoundsList(rounds []id.Round) RoundsList {
// MessageDeliveryCallback gets called on the determination if all events // MessageDeliveryCallback gets called on the determination if all events
// related to a message send were successful. // related to a message send were successful.
// If delivered == true, timedOut == false && roundResults != nil
// If delivered == false, roundResults == nil
// If timedOut == true, delivered == false && roundResults == nil
type MessageDeliveryCallback interface { type MessageDeliveryCallback interface {
EventCallback(delivered, timedOut bool, roundResults []byte) EventCallback(delivered, timedOut bool, roundResults []byte)
} }
......
package bindings package bindings
import ( import (
"fmt"
"github.com/pkg/errors"
"gitlab.com/xx_network/primitives/netTime" "gitlab.com/xx_network/primitives/netTime"
"time" "time"
) )
...@@ -38,6 +40,19 @@ func (c *Client) StartNetworkFollower(timeoutMS int) error { ...@@ -38,6 +40,19 @@ func (c *Client) StartNetworkFollower(timeoutMS int) error {
return c.api.StartNetworkFollower(timeout) return c.api.StartNetworkFollower(timeout)
} }
// StopNetworkFollower stops the network follower if it is running.
// It returns errors if the Follower is in the wrong status to stop or if it
// fails to stop it.
// if the network follower is running and this fails, the client object will
// most likely be in an unrecoverable state and need to be trashed.
func (c *Client) StopNetworkFollower() error {
if err := c.api.StopNetworkFollower(); err != nil {
return errors.New(fmt.Sprintf("Failed to stop the "+
"network follower: %+v", err))
}
return nil
}
// WaitForNewtwork will block until either the network is healthy or the // WaitForNewtwork will block until either the network is healthy or the
// passed timeout. It will return true if the network is healthy // passed timeout. It will return true if the network is healthy
func (c *Client) WaitForNetwork(timeoutMS int) bool { func (c *Client) WaitForNetwork(timeoutMS int) bool {
......
////////////////////////////////////////////////////////////////////////////////
// Copyright © 2022 Privategrity Corporation /
// /
// All rights reserved. /
////////////////////////////////////////////////////////////////////////////////
package bindings
import "gitlab.com/elixxir/client/api"
// GetVersion returns the api SEMVER
func GetVersion() string {
return api.SEMVER
}
// GetGitVersion rturns the api GITVERSION
func GetGitVersion() string {
return api.GITVERSION
}
// GetDependencies returns the api DEPENDENCIES
func GetDependencies() string {
return api.DEPENDENCIES
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment