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
0408196c
Commit
0408196c
authored
Jul 6, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Revert ud/ Manager constructors to pass in a Comms interface
parent
943f65e8
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!510
Release
,
!260
made ud package use e2e.ReceptionID
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmd/ud.go
+2
-2
2 additions, 2 deletions
cmd/ud.go
ud/interfaces.go
+2
-2
2 additions, 2 deletions
ud/interfaces.go
ud/manager.go
+6
-6
6 additions, 6 deletions
ud/manager.go
ud/mockE2e_test.go
+2
-5
2 additions, 5 deletions
ud/mockE2e_test.go
with
12 additions
and
15 deletions
cmd/ud.go
+
2
−
2
View file @
0408196c
...
...
@@ -82,11 +82,11 @@ var udCmd = &cobra.Command{
// Make user discovery manager
rng
:=
client
.
GetRng
()
userToRegister
:=
viper
.
GetString
(
"register"
)
userDiscoveryMgr
,
err
:=
ud
.
NewManager
(
client
,
userDiscoveryMgr
,
err
:=
ud
.
NewManager
(
client
,
client
.
GetComms
(),
client
.
NetworkFollowerStatus
,
userToRegister
,
nil
)
if
err
!=
nil
{
if
strings
.
Contains
(
err
.
Error
(),
ud
.
IsRegisteredErr
)
{
userDiscoveryMgr
,
err
=
ud
.
LoadManager
(
client
)
userDiscoveryMgr
,
err
=
ud
.
LoadManager
(
client
,
client
.
GetComms
()
)
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to load UD manager: %+v"
,
err
)
}
...
...
This diff is collapsed.
Click to expand it.
ud/interfaces.go
+
2
−
2
View file @
0408196c
package
ud
import
(
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/event"
"gitlab.com/elixxir/client/single"
...
...
@@ -21,10 +22,9 @@ type CMix interface {
// relevant to what is used in this package.
type
E2E
interface
{
GetReceptionIdentity
()
xxdk
.
ReceptionIdentity
GetCmix
()
CMix
GetCmix
()
cmix
.
Client
GetE2E
()
e2e
.
Handler
GetEventReporter
()
event
.
Reporter
GetComms
()
Comms
GetRng
()
*
fastRNG
.
StreamGenerator
GetStorage
()
storage
.
Session
GetTransmissionIdentity
()
xxdk
.
TransmissionIdentity
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
6
−
6
View file @
0408196c
...
...
@@ -74,7 +74,7 @@ type Manager struct {
// It requires that an updated
// NDF is available and will error if one is not.
// registrationValidationSignature may be set to nil
func
NewManager
(
e2e
E2E
,
follower
NetworkStatus
,
func
NewManager
(
e2e
E2E
,
comms
Comms
,
follower
NetworkStatus
,
username
string
,
registrationValidationSignature
[]
byte
)
(
*
Manager
,
error
)
{
jww
.
INFO
.
Println
(
"ud.NewManager()"
)
...
...
@@ -88,7 +88,7 @@ func NewManager(e2e E2E, follower NetworkStatus,
network
:
e2e
.
GetCmix
(),
e2e
:
e2e
,
events
:
e2e
.
GetEventReporter
(),
comms
:
e2e
.
GetC
omms
()
,
comms
:
c
omms
,
kv
:
e2e
.
GetStorage
()
.
GetKV
(),
rng
:
e2e
.
GetRng
(),
registrationValidationSignature
:
registrationValidationSignature
,
...
...
@@ -133,7 +133,7 @@ func NewManager(e2e E2E, follower NetworkStatus,
// NewManagerFromBackup builds a new user discover manager from a backup.
// It will construct a manager that is already registered and restore
// already registered facts into store.
func
NewManagerFromBackup
(
e2e
E2E
,
follower
NetworkStatus
,
func
NewManagerFromBackup
(
e2e
E2E
,
comms
Comms
,
follower
NetworkStatus
,
email
,
phone
fact
.
Fact
)
(
*
Manager
,
error
)
{
jww
.
INFO
.
Println
(
"ud.NewManagerFromBackup()"
)
if
follower
()
!=
xxdk
.
Running
{
...
...
@@ -147,7 +147,7 @@ func NewManagerFromBackup(e2e E2E, follower NetworkStatus,
network
:
e2e
.
GetCmix
(),
e2e
:
e2e
,
events
:
e2e
.
GetEventReporter
(),
comms
:
e2e
.
GetC
omms
()
,
comms
:
c
omms
,
kv
:
e2e
.
GetStorage
()
.
GetKV
(),
rng
:
e2e
.
GetRng
(),
}
...
...
@@ -212,13 +212,13 @@ func InitStoreFromBackup(kv *versioned.KV,
// LoadManager loads the state of the Manager
// from disk. This is meant to be called after any the first
// instantiation of the manager by NewUserDiscovery.
func
LoadManager
(
e2e
E2E
)
(
*
Manager
,
error
)
{
func
LoadManager
(
e2e
E2E
,
comms
Comms
)
(
*
Manager
,
error
)
{
m
:=
&
Manager
{
network
:
e2e
.
GetCmix
(),
e2e
:
e2e
,
events
:
e2e
.
GetEventReporter
(),
comms
:
e2e
.
GetC
omms
()
,
comms
:
c
omms
,
rng
:
e2e
.
GetRng
(),
kv
:
e2e
.
GetStorage
()
.
GetKV
(),
}
...
...
This diff is collapsed.
Click to expand it.
ud/mockE2e_test.go
+
2
−
5
View file @
0408196c
...
...
@@ -3,6 +3,7 @@ package ud
import
(
"github.com/cloudflare/circl/dh/sidh"
"gitlab.com/elixxir/client/catalog"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/message"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/ratchet/partner"
...
...
@@ -78,11 +79,7 @@ func (m mockE2e) GetEventReporter() event.Reporter {
return
mockReporter
{}
}
func
(
m
mockE2e
)
GetComms
()
Comms
{
return
&
mockComms
{}
}
func
(
m
mockE2e
)
GetCmix
()
CMix
{
func
(
m
mockE2e
)
GetCmix
()
cmix
.
Client
{
//TODO implement me
panic
(
"implement me"
)
}
...
...
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