Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
9b73acab
Commit
9b73acab
authored
4 years ago
by
Éloïs
Browse files
Options
Downloads
Patches
Plain Diff
[ref] dbs: open_dbs must return a result
parent
baf49d59
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
rust-bins/duniter-dbex/src/migrate.rs
+1
-1
1 addition, 1 deletion
rust-bins/duniter-dbex/src/migrate.rs
rust-libs/duniter-dbs/src/open_dbs.rs
+5
-8
5 additions, 8 deletions
rust-libs/duniter-dbs/src/open_dbs.rs
rust-libs/duniter-server/src/lib.rs
+1
-1
1 addition, 1 deletion
rust-libs/duniter-server/src/lib.rs
with
7 additions
and
10 deletions
rust-bins/duniter-dbex/src/migrate.rs
+
1
−
1
View file @
9b73acab
...
@@ -26,7 +26,7 @@ const CHUNK_SIZE: usize = 250;
...
@@ -26,7 +26,7 @@ const CHUNK_SIZE: usize = 250;
pub
(
crate
)
fn
migrate
(
profile_path
:
PathBuf
)
->
anyhow
::
Result
<
()
>
{
pub
(
crate
)
fn
migrate
(
profile_path
:
PathBuf
)
->
anyhow
::
Result
<
()
>
{
let
start_time
=
Instant
::
now
();
let
start_time
=
Instant
::
now
();
let
(
bc_db
,
shared_dbs
)
=
duniter_dbs
::
open_dbs
(
Some
(
profile_path
.as_path
()));
let
(
bc_db
,
shared_dbs
)
=
duniter_dbs
::
open_dbs
(
Some
(
profile_path
.as_path
()))
?
;
let
gva_db
=
duniter_gva_db_writer
::
get_gva_db_rw
(
Some
(
profile_path
.as_path
()));
let
gva_db
=
duniter_gva_db_writer
::
get_gva_db_rw
(
Some
(
profile_path
.as_path
()));
// Clear bc_db and gva_db
// Clear bc_db and gva_db
...
...
This diff is collapsed.
Click to expand it.
rust-libs/duniter-dbs/src/open_dbs.rs
+
5
−
8
View file @
9b73acab
...
@@ -21,12 +21,11 @@ use crate::*;
...
@@ -21,12 +21,11 @@ use crate::*;
pub
fn
open_dbs
<
B
:
BackendConf
>
(
pub
fn
open_dbs
<
B
:
BackendConf
>
(
profile_path_opt
:
Option
<&
Path
>
,
profile_path_opt
:
Option
<&
Path
>
,
)
->
(
crate
::
databases
::
bc_v2
::
BcV2Db
<
B
>
,
SharedDbs
<
B
>
)
{
)
->
KvResult
<
(
crate
::
databases
::
bc_v2
::
BcV2Db
<
B
>
,
SharedDbs
<
B
>
)
>
{
let
bc_db
=
crate
::
databases
::
bc_v2
::
BcV2Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
let
bc_db
=
crate
::
databases
::
bc_v2
::
BcV2Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
crate
::
databases
::
bc_v2
::
BcV2Db
::
<
B
>
::
NAME
,
crate
::
databases
::
bc_v2
::
BcV2Db
::
<
B
>
::
NAME
,
profile_path_opt
,
profile_path_opt
,
))
))
?
;
.expect
(
"fail to open BcV2 DB"
);
let
dbs
=
SharedDbs
{
let
dbs
=
SharedDbs
{
bc_db_ro
:
bc_db
.get_ro_handler
(),
bc_db_ro
:
bc_db
.get_ro_handler
(),
cm_db
:
crate
::
databases
::
cm_v1
::
CmV1Db
::
<
Mem
>
::
open
(
MemConf
::
default
())
cm_db
:
crate
::
databases
::
cm_v1
::
CmV1Db
::
<
Mem
>
::
open
(
MemConf
::
default
())
...
@@ -34,15 +33,13 @@ pub fn open_dbs<B: BackendConf>(
...
@@ -34,15 +33,13 @@ pub fn open_dbs<B: BackendConf>(
dunp_db
:
crate
::
databases
::
dunp_v1
::
DunpV1Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
dunp_db
:
crate
::
databases
::
dunp_v1
::
DunpV1Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
"dunp_v1"
,
"dunp_v1"
,
profile_path_opt
,
profile_path_opt
,
))
))
?
,
.expect
(
"fail to open Dunp DB"
),
txs_mp_db
:
crate
::
databases
::
txs_mp_v2
::
TxsMpV2Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
txs_mp_db
:
crate
::
databases
::
txs_mp_v2
::
TxsMpV2Db
::
<
B
>
::
open
(
B
::
gen_backend_conf
(
crate
::
databases
::
txs_mp_v2
::
TxsMpV2Db
::
<
B
>
::
NAME
,
crate
::
databases
::
txs_mp_v2
::
TxsMpV2Db
::
<
B
>
::
NAME
,
profile_path_opt
,
profile_path_opt
,
))
))
?
,
.expect
(
"fail to open TxsMp DB"
),
};
};
(
bc_db
,
dbs
)
Ok
(
(
bc_db
,
dbs
)
)
}
}
pub
trait
BackendConf
:
Backend
{
pub
trait
BackendConf
:
Backend
{
...
...
This diff is collapsed.
Click to expand it.
rust-libs/duniter-server/src/lib.rs
+
1
−
1
View file @
9b73acab
...
@@ -115,7 +115,7 @@ impl DuniterServer {
...
@@ -115,7 +115,7 @@ impl DuniterServer {
let
txs_mempool
=
TxsMempool
::
new
(
conf
.txs_mempool_size
);
let
txs_mempool
=
TxsMempool
::
new
(
conf
.txs_mempool_size
);
log
::
info!
(
"open duniter databases..."
);
log
::
info!
(
"open duniter databases..."
);
let
(
bc_db
,
dbs
)
=
duniter_dbs
::
open_dbs
(
profile_path_opt
);
let
(
bc_db
,
dbs
)
=
duniter_dbs
::
open_dbs
(
profile_path_opt
)
?
;
dbs
.dunp_db
.heads_old_write
()
.clear
()
?
;
// Clear WS2Pv1 HEADs
dbs
.dunp_db
.heads_old_write
()
.clear
()
?
;
// Clear WS2Pv1 HEADs
log
::
info!
(
"Databases successfully opened."
);
log
::
info!
(
"Databases successfully opened."
);
let
current
=
duniter_dbs_read_ops
::
get_current_block_meta
(
&
dbs
.bc_db_ro
)
let
current
=
duniter_dbs_read_ops
::
get_current_block_meta
(
&
dbs
.bc_db_ro
)
...
...
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