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
0065e5a7
Commit
0065e5a7
authored
May 03, 2020
by
caoping
Committed by
vipwzw
May 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
raft update InitBlock
parent
8703305a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
5 deletions
+1
-5
block.go
plugin/consensus/raft/block.go
+1
-5
No files found.
plugin/consensus/raft/block.go
View file @
0065e5a7
...
@@ -35,7 +35,6 @@ type Client struct {
...
@@ -35,7 +35,6 @@ type Client struct {
validatorC
<-
chan
bool
validatorC
<-
chan
bool
ctx
context
.
Context
ctx
context
.
Context
cancel
context
.
CancelFunc
cancel
context
.
CancelFunc
once
sync
.
Once
blockInfo
*
BlockInfo
blockInfo
*
BlockInfo
mtx
sync
.
Mutex
mtx
sync
.
Mutex
}
}
...
@@ -98,6 +97,7 @@ func (client *Client) recoverFromSnapshot(snapshot []byte) error {
...
@@ -98,6 +97,7 @@ func (client *Client) recoverFromSnapshot(snapshot []byte) error {
func
(
client
*
Client
)
SetQueueClient
(
c
queue
.
Client
)
{
func
(
client
*
Client
)
SetQueueClient
(
c
queue
.
Client
)
{
rlog
.
Info
(
"Enter SetQueue method of raft consensus"
)
rlog
.
Info
(
"Enter SetQueue method of raft consensus"
)
client
.
InitClient
(
c
,
func
()
{
client
.
InitClient
(
c
,
func
()
{
client
.
InitBlock
()
})
})
go
client
.
EventLoop
()
go
client
.
EventLoop
()
go
client
.
readCommits
(
client
.
commitC
,
client
.
errorC
)
go
client
.
readCommits
(
client
.
commitC
,
client
.
errorC
)
...
@@ -244,10 +244,6 @@ func (client *Client) pollingTask() {
...
@@ -244,10 +244,6 @@ func (client *Client) pollingTask() {
case
<-
client
.
ctx
.
Done
()
:
case
<-
client
.
ctx
.
Done
()
:
return
return
case
value
,
ok
:=
<-
client
.
validatorC
:
case
value
,
ok
:=
<-
client
.
validatorC
:
//各个节点Block只初始化一次
client
.
once
.
Do
(
func
()
{
client
.
InitBlock
()
})
if
ok
&&
!
value
{
if
ok
&&
!
value
{
rlog
.
Debug
(
"================I'm not the validator node============="
)
rlog
.
Debug
(
"================I'm not the validator node============="
)
leader
:=
mux
.
Load
()
.
(
bool
)
leader
:=
mux
.
Load
()
.
(
bool
)
...
...
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