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

Clean up

parent da6a5a01
No related branches found
No related tags found
2 merge requests!510Release,!396Remove restoring backed up facts from bindings NewUdManagerFromBackup call
...@@ -94,8 +94,6 @@ func InitializeBackup(backupPassphrase string, updateBackupCb UpdateBackupFn, ...@@ -94,8 +94,6 @@ 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.Printf("USERNAME BACKUP DEBUG (InitializeBackup): ud passed in is %+v", ud)
b := &Backup{ b := &Backup{
updateBackupCb: updateBackupCb, updateBackupCb: updateBackupCb,
container: container, container: container,
...@@ -146,8 +144,6 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container, ...@@ -146,8 +144,6 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container,
return nil, err return nil, err
} }
jww.INFO.Printf("USERNAME BACKUP DEBUG (resume backup): ud passed in is %+v", ud)
b := &Backup{ b := &Backup{
updateBackupCb: updateBackupCb, updateBackupCb: updateBackupCb,
container: container, container: container,
...@@ -308,10 +304,8 @@ func (b *Backup) assembleBackup() backup.Backup { ...@@ -308,10 +304,8 @@ func (b *Backup) assembleBackup() backup.Backup {
// Get facts // Get facts
if b.ud != nil { if b.ud != nil {
jww.INFO.Printf("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.Printf("USERNAME BACKUP DEBUG (assembleBackup): ud is nil, putting empty list")
bu.UserDiscoveryRegistration.FactList = fact.FactList{} bu.UserDiscoveryRegistration.FactList = fact.FactList{}
} }
......
...@@ -81,8 +81,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string, ...@@ -81,8 +81,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
} }
udInfo := backUp.UserDiscoveryRegistration udInfo := backUp.UserDiscoveryRegistration
jww.INFO.Printf("USERNAME BACKUP DEBUG (NewCmixFromBackup): fact list %+v", udInfo)
var username, email, phone fact.Fact var username, email, phone fact.Fact
for _, f := range udInfo.FactList { for _, f := range udInfo.FactList {
switch f.T { switch f.T {
...@@ -94,10 +92,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string, ...@@ -94,10 +92,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
phone = f phone = f
} }
} }
jww.INFO.Printf("USERNAME BACKUP DEBUG (NewCmixFromBackup) facts found:"+
"\nusername: %v"+
"\nemail %v"+
"\nphone %+v", username, email, phone)
err = ud.InitStoreFromBackup(storageSess.GetKV(), username, email, phone) err = ud.InitStoreFromBackup(storageSess.GetKV(), username, email, phone)
return backUp.Contacts.Identities, backUp.JSONParams, err return backUp.Contacts.Identities, backUp.JSONParams, err
......
...@@ -10,7 +10,6 @@ package ud ...@@ -10,7 +10,6 @@ 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"
) )
...@@ -49,7 +48,6 @@ func (s *Store) RestoreFromBackUp(backupData fact.FactList) error { ...@@ -49,7 +48,6 @@ 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())
...@@ -70,12 +68,8 @@ func (s *Store) GetUsername() (string, error) { ...@@ -70,12 +68,8 @@ func (s *Store) GetUsername() (string, error) {
// todo: refactor this in the future so that // todo: refactor this in the future so that
// it's an O(1) lookup (place this object in another map // it's an O(1) lookup (place this object in another map
// or have it's own field) // or have it's own field)
jww.INFO.Printf("USERNAME BACKUP DEBUG (GetUsername): map: %+v", s.confirmedFacts)
for f := range s.confirmedFacts { for f := range s.confirmedFacts {
if f.T == fact.Username { if f.T == fact.Username {
jww.INFO.Printf("USERNAME BACKUP DEBUG (GetUsername): found fact: %+v", f)
return f.Fact, nil return f.Fact, nil
} }
} }
...@@ -178,8 +172,6 @@ func (s *Store) BackUpMissingFacts(username, email, phone fact.Fact) error { ...@@ -178,8 +172,6 @@ func (s *Store) BackUpMissingFacts(username, email, phone fact.Fact) error {
} }
} }
jww.INFO.Printf("USERNAME BACKUP DEBUG (BackUpMissingFacts): fact map after %+v", s.confirmedFacts)
if modified { if modified {
return s.saveConfirmedFacts() return s.saveConfirmedFacts()
} }
...@@ -218,15 +210,12 @@ func (s *Store) GetFacts() []fact.Fact { ...@@ -218,15 +210,12 @@ 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.
Finish editing this message first!
Please register or to comment