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

Improve documentation

parent 7edf36da
Branches
Tags
2 merge requests!510Release,!323Xx 4019/new or load alt ud
...@@ -105,7 +105,10 @@ type UdNetworkStatus interface { ...@@ -105,7 +105,10 @@ type UdNetworkStatus interface {
// Manager functions // // Manager functions //
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// LoadOrNewUserDiscovery creates a bindings-level user discovery manager. // NewOrLoadUdFromNdf loads an existing Manager from storage or creates a
// new one if there is no extant storage information. This will default to connecting with
// the xx network's UD server as found in the NDF. For connecting to a custom server, use
// NewOrLoadUd.
// //
// Parameters: // Parameters:
// - e2eID - e2e object ID in the tracker // - e2eID - e2e object ID in the tracker
...@@ -113,8 +116,9 @@ type UdNetworkStatus interface { ...@@ -113,8 +116,9 @@ type UdNetworkStatus interface {
// - username - the username the user wants to register with UD. // - username - the username the user wants to register with UD.
// If the user is already registered, this field may be blank // If the user is already registered, this field may be blank
// - registrationValidationSignature - the signature provided by the xx network. // - registrationValidationSignature - the signature provided by the xx network.
// This signature is optional for other consumers who deploy their own UD. // This may be nil, however UD may return an error in some cases (e.g. in a production level
func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus, // environment).
func NewOrLoadUdFromNdf(e2eID int, follower UdNetworkStatus,
username string, registrationValidationSignature []byte) ( username string, registrationValidationSignature []byte) (
*UserDiscovery, error) { *UserDiscovery, error) {
...@@ -140,29 +144,29 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus, ...@@ -140,29 +144,29 @@ func LoadOrNewUserDiscovery(e2eID int, follower UdNetworkStatus,
return udTrackerSingleton.make(u), nil return udTrackerSingleton.make(u), nil
} }
// LoadOrNewAlternateUserDiscovery loads an existing Manager from storage or creates a // NewOrLoadUd loads an existing Manager from storage or creates a
// new one if there is no extant storage information. This is different from NewOrLoadFromNdf // new one if there is no extant storage information. This is different from NewOrLoadUdFromNdf
// in that it allows the user to provide alternate User Discovery contact information. // in that it allows the user to provide alternate User Discovery contact information.
// These parameters may be used to contact a separate UD server than the one run by the // These parameters may be used to contact a separate UD server than the one run by the
// xx network team, one the user or a third-party may operate. // xx network team, one the user or a third-party may operate.
// //
// Params // Params
// - user is an interface that adheres to the xxdk.E2e object. // - e2eID - e2e object ID in the tracker
// - comms is an interface that adheres to client.Comms object. // - follower - network follower func wrapped in UdNetworkStatus
// - follower is a method off of xxdk.Cmix which returns the network follower's status. // - username - the username the user wants to register with UD.
// - username is the name of the user as it is registered with UD. This will be what the end user // If the user is already registered, this field may be blank
// provides if through the bindings. // - networkValidationSig is a signature provided by the network (i.e. the client registrar).
// - networkValidationSig is a signature provided by the network (i.e. the client registrar). This may // This may be nil, however UD may return an error in some cases (e.g. in a production level
// be nil, however UD may return an error in some cases (e.g. in a production level environment). // environment).
// - altCert is the TLS certificate for the alternate UD server. // - customCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server. // - customAddress is the IP address of the alternate UD server.
// - marshalledContact is the data within a marshalled contact.Contact. // - customContactFile is the data within a marshalled contact.Contact.
// //
// Returns // Returns
// - A Manager object which is registered to the specified alternate UD service. // - A Manager object which is registered to the specified alternate UD service.
func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus, func NewOrLoadUd(e2eID int, follower UdNetworkStatus,
username string, registrationValidationSignature, username string, registrationValidationSignature,
altCert, altAddress, marshalledContact []byte) ( customCert, customAddress, customContactFile []byte) (
*UserDiscovery, error) { *UserDiscovery, error) {
// Get user from singleton // Get user from singleton
...@@ -179,7 +183,7 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus, ...@@ -179,7 +183,7 @@ func LoadOrNewAlternateUserDiscovery(e2eID int, follower UdNetworkStatus,
// Build manager // Build manager
u, err := ud.NewOrLoad(user.api, user.api.GetComms(), u, err := ud.NewOrLoad(user.api, user.api.GetComms(),
UdNetworkStatusFn, username, registrationValidationSignature, UdNetworkStatusFn, username, registrationValidationSignature,
altCert, altAddress, marshalledContact) customCert, customAddress, customContactFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
...@@ -141,15 +141,15 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus, ...@@ -141,15 +141,15 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus,
// provides if through the bindings. // provides if through the bindings.
// - networkValidationSig is a signature provided by the network (i.e. the client registrar). This may // - networkValidationSig is a signature provided by the network (i.e. the client registrar). This may
// be nil, however UD may return an error in some cases (e.g. in a production level environment). // be nil, however UD may return an error in some cases (e.g. in a production level environment).
// - altCert is the TLS certificate for the alternate UD server. // - customCert is the TLS certificate for the alternate UD server.
// - altAddress is the IP address of the alternate UD server. // - customAddress is the IP address of the alternate UD server.
// - marshalledContact is the data within a marshalled contact.Contact. // - customContactFile is the data within a marshalled contact.Contact.
// //
// Returns // Returns
// - A Manager object which is registered to the specified alternate UD service. // - A Manager object which is registered to the specified alternate UD service.
func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus, func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
username string, networkValidationSig []byte, altCert, altAddress, username string, networkValidationSig []byte,
marshalledContact []byte) (*Manager, error) { customCert, customAddress, customContactFile []byte) (*Manager, error) {
jww.INFO.Println("ud.NewOrLoad()") jww.INFO.Println("ud.NewOrLoad()")
...@@ -160,7 +160,7 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus, ...@@ -160,7 +160,7 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
} }
// Set alternative user discovery // Set alternative user discovery
err = m.setAlternateUserDiscovery(altCert, altAddress, marshalledContact) err = m.setAlternateUserDiscovery(customCert, customAddress, customContactFile)
if err != nil { if err != nil {
return nil, err return nil, err
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment