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
50dc3175
Commit
50dc3175
authored
2 years ago
by
Valentin Syrovatskiy
Browse files
Options
Downloads
Patches
Plain Diff
refactor: call Topology in start_boot
parent
85226ea0
No related branches found
No related tags found
1 merge request
!147
refactor Topology using in start_boot
Pipeline
#7038
passed
2 years ago
Stage: build
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/main.rs
+6
-10
6 additions, 10 deletions
src/main.rs
src/traft/mod.rs
+1
-1
1 addition, 1 deletion
src/traft/mod.rs
src/traft/topology.rs
+19
-0
19 additions, 0 deletions
src/traft/topology.rs
with
26 additions
and
11 deletions
src/main.rs
+
6
−
10
View file @
50dc3175
...
...
@@ -409,16 +409,12 @@ fn start_discover(args: &args::Run, to_supervisor: ipc::Sender<IpcMessage>) {
fn
start_boot
(
args
:
&
args
::
Run
)
{
tlog!
(
Info
,
">>>>> start_boot()"
);
let
mut
topology
=
traft
::
Topology
::
from_peers
(
vec!
[]);
let
req
=
traft
::
JoinRequest
{
cluster_id
:
args
.cluster_id
.clone
(),
instance_id
:
args
.instance_id
.clone
(),
replicaset_id
:
args
.replicaset_id
.clone
(),
advertise_address
:
args
.advertise_address
(),
voter
:
true
,
};
topology
.process
(
&
req
)
.unwrap
();
let
peer
=
topology
.diff
()
.pop
()
.unwrap
();
let
peer
=
traft
::
topology
::
initial_peer
(
args
.cluster_id
.clone
(),
args
.instance_id
.clone
(),
args
.replicaset_id
.clone
(),
args
.advertise_address
(),
);
let
raft_id
=
peer
.raft_id
;
picolib_setup
(
args
);
...
...
This diff is collapsed.
Click to expand it.
src/traft/mod.rs
+
1
−
1
View file @
50dc3175
...
...
@@ -4,7 +4,7 @@ mod error;
mod
network
;
pub
mod
node
;
mod
storage
;
mod
topology
;
pub
mod
topology
;
use
::
raft
::
prelude
as
raft
;
use
::
tarantool
::
tuple
::
AsTuple
;
...
...
This diff is collapsed.
Click to expand it.
src/traft/topology.rs
+
19
−
0
View file @
50dc3175
...
...
@@ -146,6 +146,25 @@ impl Topology {
}
}
// Create first peer in the cluster
pub
fn
initial_peer
(
cluster_id
:
String
,
instance_id
:
String
,
replicaset_id
:
Option
<
String
>
,
advertise_address
:
String
,
)
->
Peer
{
let
mut
topology
=
Topology
::
from_peers
(
vec!
[]);
let
req
=
JoinRequest
{
cluster_id
,
instance_id
,
replicaset_id
,
advertise_address
,
voter
:
true
,
};
topology
.process
(
&
req
)
.unwrap
();
topology
.diff
()
.pop
()
.unwrap
()
}
#[cfg(test)]
mod
tests
{
use
super
::
Topology
;
...
...
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