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

Finalize user discovery restructure (production)

parent 0a34c211
No related branches found
No related tags found
4 merge requests!510Release,!207WIP: Client Restructure,!203Symmetric broadcast,!199Xx 3866/user discovery
......@@ -20,11 +20,9 @@ type UserInfo interface {
GetReceptionRegistrationValidationSignature() []byte
}
// FollowerService is an interface for the api.Client's
// NetworkStatus is an interface for the api.Client's
// NetworkFollowerStatus method.
type FollowerService interface {
NetworkFollowerStatus() api.Status
}
type NetworkStatus func() api.Status
// todo: this may not be needed. if so, remove.
type SingleInterface interface {
......
......@@ -27,12 +27,10 @@ type lookupCallback func(contact.Contact, error)
// Lookup returns the public key of the passed ID as known by the user discovery
// system or returns by the timeout.
func Lookup(udContact contact.Contact,
services cmix.Client,
callback lookupCallback,
rng *fastRNG.StreamGenerator,
uid *id.ID, grp *cyclic.Group,
timeout time.Duration) (id.Round,
func Lookup(services cmix.Client,
rng *fastRNG.StreamGenerator, grp *cyclic.Group,
udContact contact.Contact, callback lookupCallback,
uid *id.ID, timeout time.Duration) (id.Round,
receptionID.EphemeralIdentity, error) {
jww.INFO.Printf("ud.Lookup(%s, %s)", uid, timeout)
......@@ -51,7 +49,7 @@ func BatchLookup(udContact contact.Contact,
for _, uid := range uids {
go func(localUid *id.ID) {
rid, ephId, err := lookup(services, rng, localUid, grp,
_, _, err := lookup(services, rng, localUid, grp,
timeout, udContact, callback)
if err != nil {
jww.WARN.Printf("Failed batch lookup on user %s: %v",
......
......@@ -9,7 +9,7 @@ import (
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/storage/versioned"
store "gitlab.com/elixxir/client/ud/store/ud"
store "gitlab.com/elixxir/client/ud/store"
"gitlab.com/elixxir/crypto/contact"
"gitlab.com/elixxir/crypto/fastRNG"
"gitlab.com/elixxir/primitives/fact"
......@@ -56,16 +56,17 @@ type alternateUd struct {
dhPubKey []byte
}
// NewManager builds a new user discovery manager. It requires that an updated
// NewManager builds a new user discovery manager.
// It requires that an updated
// NDF is available and will error if one is not.
// todo: docstring, organize the order of arguments in a meaningful way
func NewManager(services cmix.Client, e2e e2e.Handler, follower FollowerService,
func NewManager(services cmix.Client, e2e e2e.Handler,
follower NetworkStatus,
events *event.Manager, comms Comms, userStore UserInfo,
rng *fastRNG.StreamGenerator, username string,
kv *versioned.KV) (*Manager, error) {
jww.INFO.Println("ud.NewManager()")
if follower.NetworkFollowerStatus() != api.Running {
if follower() != api.Running {
return nil, errors.New(
"cannot start UD Manager when network follower is not running.")
}
......@@ -121,12 +122,12 @@ func NewManager(services cmix.Client, e2e e2e.Handler, follower FollowerService,
// It will construct a manager that is already registered and restore
// already registered facts into store.
func NewManagerFromBackup(services cmix.Client,
follower FollowerService,
e2e e2e.Handler, events *event.Manager, comms Comms,
e2e e2e.Handler, follower NetworkStatus,
events *event.Manager, comms Comms,
userStore UserInfo, rng *fastRNG.StreamGenerator,
email, phone fact.Fact, kv *versioned.KV) (*Manager, error) {
jww.INFO.Println("ud.NewManagerFromBackup()")
if follower.NetworkFollowerStatus() != api.Running {
if follower() != api.Running {
return nil, errors.New(
"cannot start UD Manager when " +
"network follower is not running.")
......
......@@ -33,11 +33,10 @@ type searchCallback func([]contact.Contact, error)
// used to search for multiple users at once; that can have a privacy reduction.
// Instead, it is intended to be used to search for a user where multiple pieces
// of information is known.
func Search(list fact.FactList,
services cmix.Client, events *event.Manager,
callback searchCallback,
rng *fastRNG.StreamGenerator, udContact contact.Contact,
grp *cyclic.Group, timeout time.Duration) (id.Round,
func Search(services cmix.Client, events *event.Manager,
rng *fastRNG.StreamGenerator, grp *cyclic.Group,
udContact contact.Contact, callback searchCallback,
list fact.FactList, timeout time.Duration) (id.Round,
receptionID.EphemeralIdentity, error) {
jww.INFO.Printf("ud.Search(%s, %s)", list.Stringify(), timeout)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment