Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
link33
plugin
Commits
1c0c6d72
Commit
1c0c6d72
authored
Dec 14, 2018
by
陈德海
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix linter
parent
5887e326
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
12 deletions
+16
-12
skip_list.go
plugin/mempool/price/skip_list.go
+8
-6
skip_list.go
plugin/mempool/score/skip_list.go
+8
-6
No files found.
plugin/mempool/price/skip_list.go
View file @
1c0c6d72
...
@@ -35,6 +35,7 @@ type skipListNode struct {
...
@@ -35,6 +35,7 @@ type skipListNode struct {
Value
*
SkipValue
Value
*
SkipValue
}
}
// SkipList 跳跃表
type
SkipList
struct
{
type
SkipList
struct
{
header
,
tail
*
skipListNode
header
,
tail
*
skipListNode
findcount
int
findcount
int
...
@@ -42,6 +43,7 @@ type SkipList struct {
...
@@ -42,6 +43,7 @@ type SkipList struct {
level
int
level
int
}
}
// SkipListIterator 跳跃表迭代器
type
SkipListIterator
struct
{
type
SkipListIterator
struct
{
list
*
SkipList
list
*
SkipList
node
*
skipListNode
node
*
skipListNode
...
@@ -217,10 +219,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
...
@@ -217,10 +219,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
}
}
// Print 测试用的输出函数
// Print 测试用的输出函数
func
(
l
*
SkipList
)
Print
()
{
func
(
s
l
*
SkipList
)
Print
()
{
if
l
.
count
>
0
{
if
s
l
.
count
>
0
{
r
:=
l
.
header
r
:=
s
l
.
header
for
i
:=
l
.
level
-
1
;
i
>=
0
;
i
--
{
for
i
:=
s
l
.
level
-
1
;
i
>=
0
;
i
--
{
e
:=
r
.
next
[
i
]
e
:=
r
.
next
[
i
]
//fmt.Print(i)
//fmt.Print(i)
for
e
!=
nil
{
for
e
!=
nil
{
...
@@ -238,8 +240,8 @@ func (l *SkipList) Print() {
...
@@ -238,8 +240,8 @@ func (l *SkipList) Print() {
}
}
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历
func
(
lm
*
SkipList
)
Walk
(
cb
func
(
value
interface
{})
bool
)
{
func
(
sl
*
SkipList
)
Walk
(
cb
func
(
value
interface
{})
bool
)
{
for
e
:=
lm
.
header
.
Next
();
e
!=
nil
;
e
=
e
.
Next
()
{
for
e
:=
sl
.
header
.
Next
();
e
!=
nil
;
e
=
e
.
Next
()
{
if
cb
==
nil
{
if
cb
==
nil
{
return
return
}
}
...
...
plugin/mempool/score/skip_list.go
View file @
1c0c6d72
...
@@ -32,6 +32,7 @@ type skipListNode struct {
...
@@ -32,6 +32,7 @@ type skipListNode struct {
Value
*
SkipValue
Value
*
SkipValue
}
}
// SkipList 跳跃表
type
SkipList
struct
{
type
SkipList
struct
{
header
,
tail
*
skipListNode
header
,
tail
*
skipListNode
findcount
int
findcount
int
...
@@ -39,6 +40,7 @@ type SkipList struct {
...
@@ -39,6 +40,7 @@ type SkipList struct {
level
int
level
int
}
}
// SkipListIterator 跳跃表迭代器
type
SkipListIterator
struct
{
type
SkipListIterator
struct
{
list
*
SkipList
list
*
SkipList
node
*
skipListNode
node
*
skipListNode
...
@@ -214,10 +216,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
...
@@ -214,10 +216,10 @@ func (sl *SkipList) Delete(value *SkipValue) int {
}
}
// Print 测试用的输出函数
// Print 测试用的输出函数
func
(
l
*
SkipList
)
Print
()
{
func
(
s
l
*
SkipList
)
Print
()
{
if
l
.
count
>
0
{
if
s
l
.
count
>
0
{
r
:=
l
.
header
r
:=
s
l
.
header
for
i
:=
l
.
level
-
1
;
i
>=
0
;
i
--
{
for
i
:=
s
l
.
level
-
1
;
i
>=
0
;
i
--
{
e
:=
r
.
next
[
i
]
e
:=
r
.
next
[
i
]
//fmt.Print(i)
//fmt.Print(i)
for
e
!=
nil
{
for
e
!=
nil
{
...
@@ -235,8 +237,8 @@ func (l *SkipList) Print() {
...
@@ -235,8 +237,8 @@ func (l *SkipList) Print() {
}
}
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历
//Walk 遍历整个结构,如果cb 返回false 那么停止遍历
func
(
lm
*
SkipList
)
Walk
(
cb
func
(
value
interface
{})
bool
)
{
func
(
sl
*
SkipList
)
Walk
(
cb
func
(
value
interface
{})
bool
)
{
for
e
:=
lm
.
header
.
Next
();
e
!=
nil
;
e
=
e
.
Next
()
{
for
e
:=
sl
.
header
.
Next
();
e
!=
nil
;
e
=
e
.
Next
()
{
if
cb
==
nil
{
if
cb
==
nil
{
return
return
}
}
...
...
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