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
Branches
Tags
1 merge request!23Release
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
package storage package storage
import ( import (
"gitlab.com/elixxir/client/storage/rounds"
"sync" "sync"
"testing" "testing"
...@@ -62,6 +63,7 @@ type Session struct { ...@@ -62,6 +63,7 @@ type Session struct {
garbledMessages *utility.MeteredCmixMessageBuffer garbledMessages *utility.MeteredCmixMessageBuffer
reception *reception.Store reception *reception.Store
clientVersion *clientVersion.Store clientVersion *clientVersion.Store
uncheckedRounds *rounds.UncheckedRoundStore
} }
// Initialize a new Session object // Initialize a new Session object
...@@ -141,6 +143,10 @@ func New(baseDir, password string, u userInterface.User, currentVersion version. ...@@ -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.") 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 return s, nil
} }
...@@ -212,6 +218,11 @@ func Load(baseDir, password string, currentVersion version.Version, ...@@ -212,6 +218,11 @@ func Load(baseDir, password string, currentVersion version.Version,
s.reception = reception.LoadStore(s.kv) 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 return s, nil
} }
...@@ -282,6 +293,12 @@ func (s *Session) Partition() *partition.Store { ...@@ -282,6 +293,12 @@ func (s *Session) Partition() *partition.Store {
return s.partition 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 // Get an object from the session
func (s *Session) Get(key string) (*versioned.Object, error) { func (s *Session) Get(key string) (*versioned.Object, error) {
return s.kv.Get(key, currentSessionVersion) 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