Skip to content
Snippets Groups Projects
Commit 7ecf83aa authored by Jonah Husson's avatar Jonah Husson
Browse files

Trigger backup on UD register, confirm fact, delete fact

parent 1aecd3a8
No related branches found
No related tags found
2 merge requests!510Release,!436Trigger backup on UD register, confirm fact, delete fact
...@@ -73,7 +73,7 @@ func NewOrLoadReceived(kv *versioned.KV) (*Received, []*ReceivedTransfer, error) ...@@ -73,7 +73,7 @@ func NewOrLoadReceived(kv *versioned.KV) (*Received, []*ReceivedTransfer, error)
tid := tidList[i] tid := tidList[i]
s.transfers[tid], err = loadReceivedTransfer(&tid, s.kv) s.transfers[tid], err = loadReceivedTransfer(&tid, s.kv)
if err != nil { if err != nil {
jww.WARN.Print(warnLoadReceivedTransfer, i, len(tidList), tid, err) jww.WARN.Printf(warnLoadReceivedTransfer, i, len(tidList), tid, err)
errCount++ errCount++
} }
......
...@@ -41,6 +41,7 @@ func (m *Manager) confirmFact(confirmationID, code string, comm confirmFactComm) ...@@ -41,6 +41,7 @@ func (m *Manager) confirmFact(confirmationID, code string, comm confirmFactComm)
"Failed to confirm fact in storage with confirmation ID: %q", "Failed to confirm fact in storage with confirmation ID: %q",
confirmationID) confirmationID)
} }
m.user.GetBackupContainer().TriggerBackup("Fact confirmed")
return nil return nil
} }
...@@ -39,6 +39,7 @@ type udE2e interface { ...@@ -39,6 +39,7 @@ type udE2e interface {
GetRng() *fastRNG.StreamGenerator GetRng() *fastRNG.StreamGenerator
GetStorage() storage.Session GetStorage() storage.Session
GetTransmissionIdentity() xxdk.TransmissionIdentity GetTransmissionIdentity() xxdk.TransmissionIdentity
GetBackupContainer() *xxdk.Container
} }
// udNetworkStatus is an interface for the xxdk.Cmix's // udNetworkStatus is an interface for the xxdk.Cmix's
......
...@@ -46,6 +46,10 @@ type mockE2e struct { ...@@ -46,6 +46,10 @@ type mockE2e struct {
key *rsa.PrivateKey key *rsa.PrivateKey
} }
func (m mockE2e) GetBackupContainer() *xxdk.Container {
return &xxdk.Container{}
}
func (m mockE2e) GetE2E() e2e.Handler { func (m mockE2e) GetE2E() e2e.Handler {
return mockE2eHandler{} return mockE2eHandler{}
} }
......
...@@ -95,6 +95,7 @@ func (m *Manager) register(username string, networkSignature []byte, ...@@ -95,6 +95,7 @@ func (m *Manager) register(username string, networkSignature []byte,
m.getEventReporter().Report(1, "UserDiscovery", "Registration", m.getEventReporter().Report(1, "UserDiscovery", "Registration",
fmt.Sprintf("User Registered with UD: %+v", fmt.Sprintf("User Registered with UD: %+v",
username)) username))
m.user.GetBackupContainer().TriggerBackup("User registered with UD")
} }
return err return err
......
...@@ -26,8 +26,13 @@ import ( ...@@ -26,8 +26,13 @@ import (
func (m *Manager) RemoveFact(f fact.Fact) error { func (m *Manager) RemoveFact(f fact.Fact) error {
jww.INFO.Printf("ud.RemoveFact(%s)", f.Stringify()) jww.INFO.Printf("ud.RemoveFact(%s)", f.Stringify())
m.factMux.Lock() m.factMux.Lock()
defer m.factMux.Unlock() err := m.removeFact(f, m.comms)
return m.removeFact(f, m.comms) m.factMux.Unlock()
if err != nil {
return err
}
m.user.GetBackupContainer().TriggerBackup("Removed fact")
return nil
} }
// removeFact is a helper function which contacts the UD service // removeFact is a helper function which contacts the UD service
......
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