Skip to content
Snippets Groups Projects
Commit 9f67782a authored by Josh Brooks's avatar Josh Brooks
Browse files

Add some debug prints

parent 9b565afd
Branches
Tags
2 merge requests!510Release,!396Remove restoring backed up facts from bindings NewUdManagerFromBackup call
...@@ -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{}
} }
......
...@@ -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.
......
...@@ -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
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment