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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
153c3859
Commit
153c3859
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Remove restoring backed up facts from bindings NewUdManagerFromBackup call
parent
046d5d0c
No related branches found
No related tags found
2 merge requests
!510
Release
,
!396
Remove restoring backed up facts from bindings NewUdManagerFromBackup call
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bindings/ud.go
+8
-15
8 additions, 15 deletions
bindings/ud.go
ud/manager.go
+3
-14
3 additions, 14 deletions
ud/manager.go
with
11 additions
and
29 deletions
bindings/ud.go
+
8
−
15
View file @
153c3859
...
...
@@ -203,27 +203,22 @@ func NewOrLoadUd(e2eID int, follower UdNetworkStatus, username string,
}
// NewUdManagerFromBackup builds a new user discover manager from a backup. It
// will construct a manager that is already registered
and restore already
// re
gi
st
e
red
facts into store
.
// will construct a manager that is already registered
. Confirmed facts have
//
already been
rest
o
red
via the call NewCmixFromBackup
.
//
// Parameters:
// - e2eID - e2e object ID in the tracker
// - follower - network follower func wrapped in UdNetworkStatus
// - username - The username this user registered with initially. This should
// not be nullable, and be JSON marshalled as retrieved from
// UserDiscovery.GetFacts().
// - emailFactJson - nullable JSON marshalled email [fact.Fact]
// - phoneFactJson - nullable JSON marshalled phone [fact.Fact]
// - cert - the TLS certificate for the UD server this call will connect with.
// You may use the UD server run by the xx network team by using
// E2e.GetUdCertFromNdf.
// - contactFile - the data within a marshalled contact.Contact. This
//
[
E2e.GetUdCertFromNdf
]
.
// - contactFile - the data within a marshalled
[
contact.Contact
]
. This
// represents the contact file of the server this call will connect with. You
// may use the UD server run by the xx network team by using
// E2e.GetUdContactFromNdf.
//
[
E2e.GetUdContactFromNdf
]
.
// - address - the IP address of the UD server this call will connect with. You
// may use the UD server run by the xx network team by using
// E2e.GetUdAddressFromNdf.
//
[
E2e.GetUdAddressFromNdf
]
.
func
NewUdManagerFromBackup
(
e2eID
int
,
follower
UdNetworkStatus
,
usernameJson
,
emailFactJson
,
phoneFactJson
,
cert
,
contactFile
[]
byte
,
address
string
)
(
*
UserDiscovery
,
error
)
{
...
...
@@ -262,10 +257,8 @@ func NewUdManagerFromBackup(e2eID int, follower UdNetworkStatus,
return
xxdk
.
Status
(
follower
.
UdNetworkStatus
())
}
u
,
err
:=
ud
.
NewManagerFromBackup
(
user
.
api
,
user
.
api
.
GetComms
(),
UdNetworkStatusFn
,
username
,
email
,
phone
,
cert
,
contactFile
,
address
)
u
,
err
:=
ud
.
NewManagerFromBackup
(
user
.
api
,
user
.
api
.
GetComms
(),
UdNetworkStatusFn
,
cert
,
contactFile
,
address
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
ud/manager.go
+
3
−
14
View file @
153c3859
...
...
@@ -125,12 +125,8 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
// - user is an interface that adheres to the xxdk.E2e object.
// - comms is an interface that adheres to client.Comms object.
// - follower is a method off of xxdk.Cmix which returns the network follower's status.
// - username is the name of the user as it is registered with UD. This will be what the end user
// provides if through the bindings.
// - 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).
// - email is a fact.Fact (type Email) which has been registered with UD already.
// - phone is a fact.Fact (type Phone) which has been registered with UD already.
// - cert is the TLS certificate for the UD server this call will connect with.
// - contactFile is the data within a marshalled contact.Contact. This represents the
// contact file of the server this call will connect with.
...
...
@@ -138,9 +134,9 @@ func NewOrLoad(user udE2e, comms Comms, follower udNetworkStatus,
//
// Returns
// - A Manager object which is registered to the specified UD service.
func
NewManagerFromBackup
(
user
udE2e
,
comms
Comms
,
follower
udNetworkStatus
,
username
,
email
,
phone
fact
.
Fact
,
cert
,
contactFile
[]
byte
,
address
string
)
(
*
Manager
,
error
)
{
func
NewManagerFromBackup
(
user
udE2e
,
comms
Comms
,
follower
udNetworkStatus
,
cert
,
contactFile
[]
byte
,
address
string
)
(
*
Manager
,
error
)
{
jww
.
INFO
.
Println
(
"ud.NewManagerFromBackup()"
)
if
follower
()
!=
xxdk
.
Running
{
return
nil
,
errors
.
New
(
...
...
@@ -161,13 +157,6 @@ func NewManagerFromBackup(user udE2e, comms Comms, follower udNetworkStatus,
return
nil
,
err
}
// Put any passed in missing facts into store
err
=
m
.
store
.
BackUpMissingFacts
(
username
,
email
,
phone
)
if
err
!=
nil
{
return
nil
,
errors
.
WithMessage
(
err
,
"Failed to restore UD store "
+
"from backup"
)
}
// Set as registered. Since it's from a backup,
// the user is already registered
if
err
=
setRegistered
(
m
.
getKv
());
err
!=
nil
{
...
...
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