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
9f67782a
Commit
9f67782a
authored
2 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add some debug prints
parent
9b565afd
No related branches found
No related tags found
2 merge requests
!510
Release
,
!396
Remove restoring backed up facts from bindings NewUdManagerFromBackup call
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
backup/backup.go
+7
-0
7 additions, 0 deletions
backup/backup.go
ud/lookup.go
+0
-24
0 additions, 24 deletions
ud/lookup.go
ud/store/facts.go
+5
-0
5 additions, 0 deletions
ud/store/facts.go
with
12 additions
and
24 deletions
backup/backup.go
+
7
−
0
View file @
9f67782a
...
...
@@ -93,6 +93,9 @@ type UpdateBackupFn func(encryptedBackup []byte)
func
InitializeBackup
(
backupPassphrase
string
,
updateBackupCb
UpdateBackupFn
,
container
*
xxdk
.
Container
,
e2e
E2e
,
session
Session
,
ud
UserDiscovery
,
kv
*
versioned
.
KV
,
rng
*
fastRNG
.
StreamGenerator
)
(
*
Backup
,
error
)
{
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (InitializeBackup): ud passed in is %+v"
,
ud
)
b
:=
&
Backup
{
updateBackupCb
:
updateBackupCb
,
container
:
container
,
...
...
@@ -143,6 +146,8 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container,
return
nil
,
err
}
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (resume backup): ud passed in is %+v"
,
ud
)
b
:=
&
Backup
{
updateBackupCb
:
updateBackupCb
,
container
:
container
,
...
...
@@ -303,8 +308,10 @@ func (b *Backup) assembleBackup() backup.Backup {
// Get facts
if
b
.
ud
!=
nil
{
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (assembleBackup): Getting facts from UD: %v"
,
b
.
ud
.
GetFacts
())
bu
.
UserDiscoveryRegistration
.
FactList
=
b
.
ud
.
GetFacts
()
}
else
{
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (assembleBackup): ud is nil, putting empty list"
)
bu
.
UserDiscoveryRegistration
.
FactList
=
fact
.
FactList
{}
}
...
...
This diff is collapsed.
Click to expand it.
ud/lookup.go
+
0
−
24
View file @
9f67782a
...
...
@@ -44,30 +44,6 @@ func Lookup(user udE2e,
return
lookup
(
net
,
rng
,
uid
,
grp
,
udContact
,
callback
,
p
)
}
// BatchLookup performs a Lookup operation on a list of user IDs.
// The lookup performs a callback on each lookup on the returned contact object
// constructed from the response.
func
BatchLookup
(
udContact
contact
.
Contact
,
net
udCmix
,
callback
lookupCallback
,
rng
csprng
.
Source
,
uids
[]
*
id
.
ID
,
grp
*
cyclic
.
Group
,
p
single
.
RequestParams
)
{
jww
.
INFO
.
Printf
(
"ud.BatchLookup(%s, %s)"
,
uids
,
p
.
Timeout
)
for
_
,
uid
:=
range
uids
{
go
func
(
localUid
*
id
.
ID
)
{
_
,
_
,
err
:=
lookup
(
net
,
rng
,
localUid
,
grp
,
udContact
,
callback
,
p
)
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"Failed batch lookup on user %s: %v"
,
localUid
,
err
)
}
}(
uid
)
}
return
}
// lookup is a helper function which sends a lookup request to the user discovery
// service. It will construct a contact object off of the returned public key.
// The callback will be called on that contact object.
...
...
This diff is collapsed.
Click to expand it.
ud/store/facts.go
+
5
−
0
View file @
9f67782a
...
...
@@ -10,6 +10,7 @@ package ud
import
(
"fmt"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/primitives/fact"
)
...
...
@@ -48,6 +49,7 @@ func (s *Store) RestoreFromBackUp(backupData fact.FactList) error {
func
(
s
*
Store
)
StoreUsername
(
f
fact
.
Fact
)
error
{
s
.
mux
.
Lock
()
defer
s
.
mux
.
Unlock
()
jww
.
INFO
.
Printf
(
"USERNAME BACKUP DEBUG (StoreUsername): storing username: %+v"
,
f
)
if
f
.
T
!=
fact
.
Username
{
return
errors
.
Errorf
(
"Fact (%s) is not of type username"
,
f
.
Stringify
())
...
...
@@ -210,12 +212,15 @@ func (s *Store) GetFacts() []fact.Fact {
s
.
mux
.
RLock
()
defer
s
.
mux
.
RUnlock
()
jww
.
INFO
.
Printf
(
"USERNAME BACKUP DEBUG (getFacts): all the facts in the map: %+v"
,
s
.
confirmedFacts
)
// Flatten the facts into a slice
facts
:=
make
([]
fact
.
Fact
,
0
,
len
(
s
.
confirmedFacts
))
for
f
:=
range
s
.
confirmedFacts
{
facts
=
append
(
facts
,
f
)
}
jww
.
INFO
.
Printf
(
"USERNAME BACKUP DEBUG (getFacts): returned facts: %+v"
,
facts
)
return
facts
}
...
...
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