Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
8b718ebc
Commit
8b718ebc
authored
Apr 14, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Finalize user discovery restructure (production)
parent
0a34c211
No related branches found
No related tags found
4 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
,
!199
Xx 3866/user discovery
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ud/interfaces.go
+2
-4
2 additions, 4 deletions
ud/interfaces.go
ud/lookup.go
+6
-8
6 additions, 8 deletions
ud/lookup.go
ud/manager.go
+9
-8
9 additions, 8 deletions
ud/manager.go
ud/search.go
+4
-5
4 additions, 5 deletions
ud/search.go
with
21 additions
and
25 deletions
ud/interfaces.go
+
2
−
4
View file @
8b718ebc
...
...
@@ -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
{
...
...
This diff is collapsed.
Click to expand it.
ud/lookup.go
+
6
−
8
View file @
8b718ebc
...
...
@@ -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"
,
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
9
−
8
View file @
8b718ebc
...
...
@@ -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."
)
...
...
This diff is collapsed.
Click to expand it.
ud/search.go
+
4
−
5
View file @
8b718ebc
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment