Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
e8220488
Commit
e8220488
authored
Aug 7, 2020
by
Jake Taylor
Browse files
Options
Downloads
Patches
Plain Diff
small refactor
parent
ad22349a
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
storage/session.go
+5
-5
5 additions, 5 deletions
storage/session.go
with
5 additions
and
5 deletions
storage/session.go
+
5
−
5
View file @
e8220488
...
@@ -50,7 +50,7 @@ func (s *Session) Set(key string, object *VersionedObject) error {
...
@@ -50,7 +50,7 @@ func (s *Session) Set(key string, object *VersionedObject) error {
// Obtain the LastMessageID from the Session
// Obtain the LastMessageID from the Session
func
(
s
*
Session
)
GetLastMessageId
()
(
string
,
error
)
{
func
(
s
*
Session
)
GetLastMessageId
()
(
string
,
error
)
{
v
,
err
:=
s
.
kv
.
Get
(
"LastMessageID"
)
v
,
err
:=
s
.
Get
(
"LastMessageID"
)
if
v
==
nil
||
err
!=
nil
{
if
v
==
nil
||
err
!=
nil
{
return
""
,
nil
return
""
,
nil
}
}
...
@@ -67,7 +67,7 @@ func (s *Session) SetLastMessageId(id string) error {
...
@@ -67,7 +67,7 @@ func (s *Session) SetLastMessageId(id string) error {
Timestamp
:
ts
,
Timestamp
:
ts
,
Data
:
[]
byte
(
id
),
Data
:
[]
byte
(
id
),
}
}
return
s
.
kv
.
Set
(
"LastMessageID"
,
vo
)
return
s
.
Set
(
"LastMessageID"
,
vo
)
}
}
// GetNodeKeys returns all keys
// GetNodeKeys returns all keys
...
@@ -76,7 +76,7 @@ func (s *Session) GetNodeKeys() (map[string]user.NodeKeys, error) {
...
@@ -76,7 +76,7 @@ func (s *Session) GetNodeKeys() (map[string]user.NodeKeys, error) {
var
nodeKeys
map
[
string
]
user
.
NodeKeys
var
nodeKeys
map
[
string
]
user
.
NodeKeys
// Attempt to locate the keys map
// Attempt to locate the keys map
v
,
err
:=
s
.
kv
.
Get
(
key
)
v
,
err
:=
s
.
Get
(
key
)
if
err
!=
nil
{
if
err
!=
nil
{
// If the map doesn't exist, initialize it
// If the map doesn't exist, initialize it
ts
,
err
:=
time
.
Now
()
.
MarshalText
()
ts
,
err
:=
time
.
Now
()
.
MarshalText
()
...
@@ -98,7 +98,7 @@ func (s *Session) GetNodeKeys() (map[string]user.NodeKeys, error) {
...
@@ -98,7 +98,7 @@ func (s *Session) GetNodeKeys() (map[string]user.NodeKeys, error) {
Timestamp
:
ts
,
Timestamp
:
ts
,
Data
:
nodeKeysBuffer
.
Bytes
(),
Data
:
nodeKeysBuffer
.
Bytes
(),
}
}
err
=
s
.
kv
.
Set
(
key
,
vo
)
err
=
s
.
Set
(
key
,
vo
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -162,7 +162,7 @@ func (s *Session) PushNodeKey(id *id.ID, key user.NodeKeys) error {
...
@@ -162,7 +162,7 @@ func (s *Session) PushNodeKey(id *id.ID, key user.NodeKeys) error {
Timestamp
:
ts
,
Timestamp
:
ts
,
Data
:
nodeKeysBuffer
.
Bytes
(),
Data
:
nodeKeysBuffer
.
Bytes
(),
}
}
return
s
.
kv
.
Set
(
"NodeKeys"
,
vo
)
return
s
.
Set
(
"NodeKeys"
,
vo
)
}
}
// Initializes a Session object wrapped around a MemStore object.
// Initializes a Session object wrapped around a MemStore object.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment