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,
container *xxdk.Container, e2e E2e, session Session, ud UserDiscovery,
kv *versioned.KV, rng *fastRNG.StreamGenerator) (*Backup, error) {
jww.INFO.Printf("USERNAME BACKUP DEBUG (InitializeBackup): ud passed in is %+v", ud)
b := &Backup{
updateBackupCb: updateBackupCb,
container: container,
......@@ -146,8 +144,6 @@ func ResumeBackup(updateBackupCb UpdateBackupFn, container *xxdk.Container,
return nil, err
}
jww.INFO.Printf("USERNAME BACKUP DEBUG (resume backup): ud passed in is %+v", ud)
b := &Backup{
updateBackupCb: updateBackupCb,
container: container,
......@@ -308,10 +304,8 @@ func (b *Backup) assembleBackup() backup.Backup {
// Get facts
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()
} else {
jww.INFO.Printf("USERNAME BACKUP DEBUG (assembleBackup): ud is nil, putting empty list")
bu.UserDiscoveryRegistration.FactList = fact.FactList{}
}
......
......@@ -81,8 +81,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
}
udInfo := backUp.UserDiscoveryRegistration
jww.INFO.Printf("USERNAME BACKUP DEBUG (NewCmixFromBackup): fact list %+v", udInfo)
var username, email, phone fact.Fact
for _, f := range udInfo.FactList {
switch f.T {
......@@ -94,10 +92,6 @@ func NewCmixFromBackup(ndfJSON, storageDir, backupPassphrase string,
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)
return backUp.Contacts.Identities, backUp.JSONParams, err
......
......@@ -10,7 +10,6 @@ package ud
import (
"fmt"
"github.com/pkg/errors"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/primitives/fact"
)
......@@ -49,7 +48,6 @@ 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())
......@@ -70,12 +68,8 @@ func (s *Store) GetUsername() (string, error) {
// todo: refactor this in the future so that
// it's an O(1) lookup (place this object in another map
// or have it's own field)
jww.INFO.Printf("USERNAME BACKUP DEBUG (GetUsername): map: %+v", s.confirmedFacts)
for f := range s.confirmedFacts {
if f.T == fact.Username {
jww.INFO.Printf("USERNAME BACKUP DEBUG (GetUsername): found fact: %+v", f)
return f.Fact, nil
}
}
......@@ -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 {
return s.saveConfirmedFacts()
}
......@@ -218,15 +210,12 @@ 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
}
......
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