Skip to content
Snippets Groups Projects
Commit f70d9ac7 authored by Jake Taylor's avatar Jake Taylor
Browse files

clean up comments

parent 3f751400
No related branches found
No related tags found
3 merge requests!510Release,!267Make BuildReceptionIdentity public, and make backup restore function return a...,!263Hotfix/refactor cmd
...@@ -32,13 +32,11 @@ import ( ...@@ -32,13 +32,11 @@ import (
"gitlab.com/xx_network/primitives/ndf" "gitlab.com/xx_network/primitives/ndf"
) )
// Number of rounds to store in the CheckedRound buffer
const CheckRoundsMaxSize = 1000000 / 64
const currentSessionVersion = 0 const currentSessionVersion = 0
const cmixGroupKey = "cmixGroup" const cmixGroupKey = "cmixGroup"
const e2eGroupKey = "e2eGroup" const e2eGroupKey = "e2eGroup"
// Session object, backed by encrypted filestore // Session object, backed by encrypted versioned.KVc
type Session interface { type Session interface {
GetClientVersion() version.Version GetClientVersion() version.Version
Get(key string) (*versioned.Object, error) Get(key string) (*versioned.Object, error)
...@@ -88,7 +86,7 @@ type session struct { ...@@ -88,7 +86,7 @@ type session struct {
clientVersion *clientVersion.Store clientVersion *clientVersion.Store
} }
// Initialize a new Session object // initStore initializes a new Session object
func initStore(baseDir, password string) (*session, error) { func initStore(baseDir, password string) (*session, error) {
fs, err := ekv.NewFilestore(baseDir, password) fs, err := ekv.NewFilestore(baseDir, password)
var s *session var s *session
...@@ -104,7 +102,7 @@ func initStore(baseDir, password string) (*session, error) { ...@@ -104,7 +102,7 @@ func initStore(baseDir, password string) (*session, error) {
return s, nil return s, nil
} }
// Creates new UserData in the session // New UserData in the session
func New(baseDir, password string, u user.Info, func New(baseDir, password string, u user.Info,
currentVersion version.Version, currentVersion version.Version,
cmixGrp, e2eGrp *cyclic.Group) (Session, error) { cmixGrp, e2eGrp *cyclic.Group) (Session, error) {
...@@ -141,7 +139,7 @@ func New(baseDir, password string, u user.Info, ...@@ -141,7 +139,7 @@ func New(baseDir, password string, u user.Info,
return s, nil return s, nil
} }
// Loads existing user data into the session // Load existing user data into the session
func Load(baseDir, password string, currentVersion version.Version) (Session, error) { func Load(baseDir, password string, currentVersion version.Version) (Session, error) {
s, err := initStore(baseDir, password) s, err := initStore(baseDir, password)
...@@ -198,7 +196,7 @@ func (s *session) Set(key string, object *versioned.Object) error { ...@@ -198,7 +196,7 @@ func (s *session) Set(key string, object *versioned.Object) error {
return s.kv.Set(key, currentSessionVersion, object) return s.kv.Set(key, currentSessionVersion, object)
} }
// delete a value in the session // Delete a value in the session
func (s *session) Delete(key string) error { func (s *session) Delete(key string) error {
return s.kv.Delete(key, currentSessionVersion) return s.kv.Delete(key, currentSessionVersion)
} }
...@@ -208,17 +206,17 @@ func (s *session) GetKV() *versioned.KV { ...@@ -208,17 +206,17 @@ func (s *session) GetKV() *versioned.KV {
return s.kv return s.kv
} }
// GetCmixGrouo returns cMix Group // GetCmixGroup returns cMix Group
func (s *session) GetCmixGroup() *cyclic.Group { func (s *session) GetCmixGroup() *cyclic.Group {
return s.cmixGroup return s.cmixGroup
} }
// GetE2EGrouo returns cMix Group // GetE2EGroup returns cMix Group
func (s *session) GetE2EGroup() *cyclic.Group { func (s *session) GetE2EGroup() *cyclic.Group {
return s.e2eGroup return s.e2eGroup
} }
// Initializes a Session object wrapped around a MemStore object. // InitTestingSession object wrapped around a MemStore object.
// FOR TESTING ONLY // FOR TESTING ONLY
func InitTestingSession(i interface{}) Session { func InitTestingSession(i interface{}) Session {
switch i.(type) { switch i.(type) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment