Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lancet
/
kvcache
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7fc9220c
authored
Apr 24, 2020
by
lancet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
node kind is now private
parent
93df9f43
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
vault/data.go
+1
-1
vault/store.go
+2
-2
No files found.
vault/data.go
View file @
7fc9220c
...
@@ -12,7 +12,7 @@ type Message struct {
...
@@ -12,7 +12,7 @@ type Message struct {
// node - узел данных для очереди устаревания
// node - узел данных для очереди устаревания
type
node
struct
{
type
node
struct
{
K
ind
bool
// 0 - таймаут, 1 - данные
k
ind
bool
// 0 - таймаут, 1 - данные
Key
string
// Ключ
Key
string
// Ключ
Value
interface
{}
// Хранимое значение
Value
interface
{}
// Хранимое значение
Prev
*
node
// Ближе к голове, извлекается раньше
Prev
*
node
// Ближе к голове, извлекается раньше
...
...
vault/store.go
View file @
7fc9220c
...
@@ -34,7 +34,7 @@ func (store *Store) addNode(key string, value interface{}, kind bool) error {
...
@@ -34,7 +34,7 @@ func (store *Store) addNode(key string, value interface{}, kind bool) error {
if
store
.
tail
!=
nil
{
if
store
.
tail
!=
nil
{
prev
=
store
.
tail
prev
=
store
.
tail
}
}
store
.
tail
=
&
node
{
Key
:
key
,
Value
:
value
,
Prev
:
prev
,
K
ind
:
kind
}
store
.
tail
=
&
node
{
Key
:
key
,
Value
:
value
,
Prev
:
prev
,
k
ind
:
kind
}
if
store
.
head
==
nil
{
if
store
.
head
==
nil
{
store
.
head
=
store
.
tail
store
.
head
=
store
.
tail
}
}
...
@@ -68,7 +68,7 @@ func (store *Store) popNode() error {
...
@@ -68,7 +68,7 @@ func (store *Store) popNode() error {
if
store
.
head
==
nil
{
if
store
.
head
==
nil
{
return
errors
.
New
(
"No nodes"
)
return
errors
.
New
(
"No nodes"
)
}
}
if
store
.
head
.
K
ind
==
false
{
if
store
.
head
.
k
ind
==
false
{
err
=
errors
.
New
(
"Decay timeout"
)
err
=
errors
.
New
(
"Decay timeout"
)
}
}
if
store
.
head
.
Key
!=
""
{
if
store
.
head
.
Key
!=
""
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment