Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
2b949e64
Commit
2b949e64
authored
2 years ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
refactor: Mailbox<NormalRequest> -> Mutex<RawNode>
parent
d49e760c
No related branches found
No related tags found
No related merge requests found
Pipeline
#9110
failed
2 years ago
Stage: build
Changes
4
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/main.rs
+3
-5
3 additions, 5 deletions
src/main.rs
src/traft/event.rs
+1
-0
1 addition, 0 deletions
src/traft/event.rs
src/traft/mod.rs
+1
-1
1 addition, 1 deletion
src/traft/mod.rs
src/traft/node.rs
+201
-292
201 additions, 292 deletions
src/traft/node.rs
with
206 additions
and
298 deletions
src/main.rs
+
3
−
5
View file @
2b949e64
...
...
@@ -585,6 +585,8 @@ fn postjoin(args: &args::Run) {
let
node
=
traft
::
node
::
Node
::
new
(
&
raft_cfg
);
let
node
=
node
.expect
(
"failed initializing raft node"
);
traft
::
node
::
set_global
(
node
);
let
node
=
traft
::
node
::
global
()
.unwrap
();
let
cs
=
traft
::
Storage
::
conf_state
()
.unwrap
();
if
cs
.voters
==
[
raft_cfg
.id
]
{
...
...
@@ -598,12 +600,8 @@ fn postjoin(args: &args::Run) {
node
.tick
(
1
);
// apply configuration, if any
node
.campaign
()
.ok
();
// trigger election immediately
assert_eq!
(
node
.status
()
.raft_state
,
"Leader"
);
}
traft
::
node
::
set_global
(
node
);
let
node
=
traft
::
node
::
global
()
.unwrap
();
box_cfg
.listen
=
Some
(
args
.listen
.clone
());
tarantool
::
set_cfg
(
&
box_cfg
);
...
...
@@ -617,7 +615,7 @@ fn postjoin(args: &args::Run) {
loop
{
let
timeout
=
Duration
::
from_secs
(
1
);
if
let
Err
(
e
)
=
traft
::
node
::
global
()
.unwrap
()
.read_index
(
timeout
)
{
if
let
Err
(
e
)
=
node
.read_index
(
timeout
)
{
tlog!
(
Warning
,
"unable to get a read barrier: {e}"
);
continue
;
}
else
{
...
...
This diff is collapsed.
Click to expand it.
src/traft/event.rs
+
1
−
0
View file @
2b949e64
...
...
@@ -60,6 +60,7 @@ define_events! {
LeaveJointState
,
"raft.leave-joint-state"
;
StatusChanged
,
"raft.status-changed"
;
TopologyChanged
,
"raft.topology-changed"
;
RaftLoopNeeded
,
"raft.loop-needed"
;
}
////////////////////////////////////////////////////////////////////////////////
...
...
This diff is collapsed.
Click to expand it.
src/traft/mod.rs
+
1
−
1
View file @
2b949e64
...
...
@@ -38,7 +38,7 @@ pub type ReplicasetId = String;
/// - `count` is a simple in-memory counter. It's cheap to increment because it's volatile.
/// - `gen` should be persisted upon LogicalClock initialization to ensure the uniqueness.
/// - `id` corresponds to `raft_id` of the instance (that is already unique across nodes).
#[derive(Clone,
Debug,
Default,
Serialize,
Deserialize,
Hash,
PartialEq,
Eq)]
#[derive(
Copy,
Clone,
Debug,
Default,
Serialize,
Deserialize,
Hash,
PartialEq,
Eq)]
pub
struct
LogicalClock
{
id
:
u64
,
gen
:
u64
,
...
...
This diff is collapsed.
Click to expand it.
src/traft/node.rs
+
201
−
292
View file @
2b949e64
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