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

Integration UncheckedRoundStore with session object

parent 0a1e1fa3
No related branches found
No related tags found
1 merge request!23Release
......@@ -10,6 +10,7 @@
package storage
import (
"gitlab.com/elixxir/client/storage/rounds"
"sync"
"testing"
......@@ -62,6 +63,7 @@ type Session struct {
garbledMessages *utility.MeteredCmixMessageBuffer
reception *reception.Store
clientVersion *clientVersion.Store
uncheckedRounds *rounds.UncheckedRoundStore
}
// Initialize a new Session object
......@@ -141,6 +143,10 @@ func New(baseDir, password string, u userInterface.User, currentVersion version.
return nil, errors.WithMessage(err, "Failed to create client version store.")
}
s.uncheckedRounds, err = rounds.NewUncheckedStore(s.kv)
if err != nil {
return nil, errors.WithMessage(err, "Failed to create unchecked round store")
}
return s, nil
}
......@@ -212,6 +218,11 @@ func Load(baseDir, password string, currentVersion version.Version,
s.reception = reception.LoadStore(s.kv)
s.uncheckedRounds, err = rounds.LoadUncheckedStore(s.kv)
if err != nil {
return nil, errors.WithMessage(err, "Failed to load unchecked round store")
}
return s, nil
}
......@@ -282,6 +293,12 @@ func (s *Session) Partition() *partition.Store {
return s.partition
}
func (s *Session) UncheckedRounds() *rounds.UncheckedRoundStore {
s.mux.RLock()
defer s.mux.RUnlock()
return s.uncheckedRounds
}
// Get an object from the session
func (s *Session) Get(key string) (*versioned.Object, error) {
return s.kv.Get(key, currentSessionVersion)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment