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
9f67782a
Commit
9f67782a
authored
Sep 23, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add some debug prints
parent
9b565afd
Branches
Branches containing commit
Tags
Tags containing commit
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)
...
@@ -93,6 +93,9 @@ type UpdateBackupFn func(encryptedBackup []byte)
func
InitializeBackup
(
backupPassphrase
string
,
updateBackupCb
UpdateBackupFn
,
func
InitializeBackup
(
backupPassphrase
string
,
updateBackupCb
UpdateBackupFn
,
container
*
xxdk
.
Container
,
e2e
E2e
,
session
Session
,
ud
UserDiscovery
,
container
*
xxdk
.
Container
,
e2e
E2e
,
session
Session
,
ud
UserDiscovery
,
kv
*
versioned
.
KV
,
rng
*
fastRNG
.
StreamGenerator
)
(
*
Backup
,
error
)
{
kv
*
versioned
.
KV
,
rng
*
fastRNG
.
StreamGenerator
)
(
*
Backup
,
error
)
{
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (InitializeBackup): ud passed in is %+v"
,
ud
)
b
:=
&
Backup
{
b
:=
&
Backup
{
updateBackupCb
:
updateBackupCb
,
updateBackupCb
:
updateBackupCb
,
container
:
container
,
container
:
container
,
...
@@ -143,6 +146,8 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container,
...
@@ -143,6 +146,8 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container,
return
nil
,
err
return
nil
,
err
}
}
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (resume backup): ud passed in is %+v"
,
ud
)
b
:=
&
Backup
{
b
:=
&
Backup
{
updateBackupCb
:
updateBackupCb
,
updateBackupCb
:
updateBackupCb
,
container
:
container
,
container
:
container
,
...
@@ -303,8 +308,10 @@ func (b *Backup) assembleBackup() backup.Backup {
...
@@ -303,8 +308,10 @@ func (b *Backup) assembleBackup() backup.Backup {
// Get facts
// Get facts
if
b
.
ud
!=
nil
{
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
()
bu
.
UserDiscoveryRegistration
.
FactList
=
b
.
ud
.
GetFacts
()
}
else
{
}
else
{
jww
.
INFO
.
Print
(
"USERNAME BACKUP DEBUG (assembleBackup): ud is nil, putting empty list"
)
bu
.
UserDiscoveryRegistration
.
FactList
=
fact
.
FactList
{}
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,
...
@@ -44,30 +44,6 @@ func Lookup(user udE2e,
return
lookup
(
net
,
rng
,
uid
,
grp
,
udContact
,
callback
,
p
)
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
// 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.
// service. It will construct a contact object off of the returned public key.
// The callback will be called on that contact object.
// 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
...
@@ -10,6 +10,7 @@ package ud
import
(
import
(
"fmt"
"fmt"
"github.com/pkg/errors"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/primitives/fact"
"gitlab.com/elixxir/primitives/fact"
)
)
...
@@ -48,6 +49,7 @@ func (s *Store) RestoreFromBackUp(backupData fact.FactList) error {
...
@@ -48,6 +49,7 @@ func (s *Store) RestoreFromBackUp(backupData fact.FactList) error {
func
(
s
*
Store
)
StoreUsername
(
f
fact
.
Fact
)
error
{
func
(
s
*
Store
)
StoreUsername
(
f
fact
.
Fact
)
error
{
s
.
mux
.
Lock
()
s
.
mux
.
Lock
()
defer
s
.
mux
.
Unlock
()
defer
s
.
mux
.
Unlock
()
jww
.
INFO
.
Printf
(
"USERNAME BACKUP DEBUG (StoreUsername): storing username: %+v"
,
f
)
if
f
.
T
!=
fact
.
Username
{
if
f
.
T
!=
fact
.
Username
{
return
errors
.
Errorf
(
"Fact (%s) is not of type username"
,
f
.
Stringify
())
return
errors
.
Errorf
(
"Fact (%s) is not of type username"
,
f
.
Stringify
())
...
@@ -210,12 +212,15 @@ func (s *Store) GetFacts() []fact.Fact {
...
@@ -210,12 +212,15 @@ func (s *Store) GetFacts() []fact.Fact {
s
.
mux
.
RLock
()
s
.
mux
.
RLock
()
defer
s
.
mux
.
RUnlock
()
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
// Flatten the facts into a slice
facts
:=
make
([]
fact
.
Fact
,
0
,
len
(
s
.
confirmedFacts
))
facts
:=
make
([]
fact
.
Fact
,
0
,
len
(
s
.
confirmedFacts
))
for
f
:=
range
s
.
confirmedFacts
{
for
f
:=
range
s
.
confirmedFacts
{
facts
=
append
(
facts
,
f
)
facts
=
append
(
facts
,
f
)
}
}
jww
.
INFO
.
Printf
(
"USERNAME BACKUP DEBUG (getFacts): returned facts: %+v"
,
facts
)
return
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