Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Dunitrust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
nodes
rust
Dunitrust
Commits
f598bbb1
Commit
f598bbb1
authored
5 years ago
by
jm
Committed by
Éloïs
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[ref] gva: corrections following review
parent
e81ad4c0
Branches
Branches containing commit
No related tags found
1 merge request
!226
Resolve "GVA: create skeleton & implement current Block request"
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lib/modules/gva/src/lib.rs
+12
-10
12 additions, 10 deletions
lib/modules/gva/src/lib.rs
lib/modules/gva/src/schema.rs
+3
-0
3 additions, 0 deletions
lib/modules/gva/src/schema.rs
lib/modules/gva/src/webserver.rs
+4
-3
4 additions, 3 deletions
lib/modules/gva/src/webserver.rs
with
19 additions
and
13 deletions
lib/modules/gva/src/lib.rs
+
12
−
10
View file @
f598bbb1
...
@@ -51,9 +51,14 @@ use dubp_currency_params::CurrencyName;
...
@@ -51,9 +51,14 @@ use dubp_currency_params::CurrencyName;
use
durs_common_tools
::
fatal_error
;
use
durs_common_tools
::
fatal_error
;
use
durs_common_tools
::
traits
::
merge
::
Merge
;
use
durs_common_tools
::
traits
::
merge
::
Merge
;
use
durs_conf
::
DuRsConf
;
use
durs_conf
::
DuRsConf
;
use
durs_message
::
events
::
*
;
use
durs_message
::
events
::{
BlockchainEvent
,
DursEvent
};
use
durs_message
::
*
;
use
durs_message
::
DursMsg
;
use
durs_module
::
*
;
use
durs_module
::{
DursConfTrait
,
DursModule
,
ModuleConfError
,
ModuleEvent
,
ModulePriority
,
ModuleRole
,
ModuleStaticName
,
RequiredKeys
,
RequiredKeysContent
,
RouterThreadMessage
,
SoftwareMetaDatas
,
};
//use durs_module::*;
use
durs_network
::
events
::
NetworkEvent
;
use
durs_network
::
events
::
NetworkEvent
;
use
std
::
ops
::
Deref
;
use
std
::
ops
::
Deref
;
...
@@ -257,13 +262,10 @@ impl DursModule<DuRsConf, DursMsg> for GvaModule {
...
@@ -257,13 +262,10 @@ impl DursModule<DuRsConf, DursMsg> for GvaModule {
let
smd
:
SoftwareMetaDatas
<
DuRsConf
>
=
soft_meta_datas
.clone
();
let
smd
:
SoftwareMetaDatas
<
DuRsConf
>
=
soft_meta_datas
.clone
();
let
router_sender_clone
=
router_sender
.clone
();
let
router_sender_clone
=
router_sender
.clone
();
thread
::
spawn
(
move
||
{
thread
::
spawn
(
move
||
{
match
webserver
::
start_web_server
(
&
smd
)
{
if
let
Err
(
e
)
=
webserver
::
start_web_server
(
&
smd
)
{
Ok
(
_
)
=>
{
info!
(
"GVA http web server stop."
);
}
Err
(
e
)
=>
{
error!
(
"GVA http web server error : {} "
,
e
);
error!
(
"GVA http web server error : {} "
,
e
);
}
}
else
{
info!
(
"GVA http web server stop."
)
}
}
let
_result
=
let
_result
=
router_sender_clone
.send
(
RouterThreadMessage
::
ModuleMessage
(
DursMsg
::
Stop
));
router_sender_clone
.send
(
RouterThreadMessage
::
ModuleMessage
(
DursMsg
::
Stop
));
...
...
This diff is collapsed.
Click to expand it.
lib/modules/gva/src/schema.rs
+
3
−
0
View file @
f598bbb1
...
@@ -12,6 +12,8 @@
...
@@ -12,6 +12,8 @@
//
//
// You should have received a copy of the GNU Affero General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.
//
// model and resolvers implementation
use
crate
::
context
::
Context
;
use
crate
::
context
::
Context
;
use
dubp_block_doc
::
block
::
BlockDocumentTrait
;
use
dubp_block_doc
::
block
::
BlockDocumentTrait
;
...
@@ -21,6 +23,7 @@ use juniper::Executor;
...
@@ -21,6 +23,7 @@ use juniper::Executor;
use
juniper
::
FieldResult
;
use
juniper
::
FieldResult
;
use
juniper_from_schema
::
graphql_schema_from_file
;
use
juniper_from_schema
::
graphql_schema_from_file
;
// generate schema from schema file
graphql_schema_from_file!
(
"resources/schema.gql"
);
graphql_schema_from_file!
(
"resources/schema.gql"
);
pub
struct
Query
;
pub
struct
Query
;
...
...
This diff is collapsed.
Click to expand it.
lib/modules/gva/src/webserver.rs
+
4
−
3
View file @
f598bbb1
...
@@ -12,13 +12,14 @@
...
@@ -12,13 +12,14 @@
//
//
// You should have received a copy of the GNU Affero General Public License
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// along with this program. If not, see <https://www.gnu.org/licenses/>.
// web server implementaion based on actix-web
use
crate
::
context
;
use
crate
::
context
;
use
crate
::
schema
::
*
;
use
crate
::
schema
::
{
create_schema
,
Schema
}
;
use
actix_web
::{
middleware
,
web
,
App
,
Error
,
HttpResponse
,
HttpServer
};
use
actix_web
::{
middleware
,
web
,
App
,
Error
,
HttpResponse
,
HttpServer
};
use
durs_common_tools
::
fatal_error
;
use
durs_common_tools
::
fatal_error
;
use
durs_conf
::
DuRsConf
;
use
durs_conf
::
DuRsConf
;
use
durs_module
::
*
;
use
durs_module
::
SoftwareMetaDatas
;
use
futures
::
future
::
Future
;
use
futures
::
future
::
Future
;
use
juniper
::
http
::
graphiql
::
graphiql_source
;
use
juniper
::
http
::
graphiql
::
graphiql_source
;
use
juniper
::
http
::
GraphQLRequest
;
use
juniper
::
http
::
GraphQLRequest
;
...
@@ -39,7 +40,7 @@ fn graphql(
...
@@ -39,7 +40,7 @@ fn graphql(
let
context
=
crate
::
context
::
get_context
();
let
context
=
crate
::
context
::
get_context
();
web
::
block
(
move
||
{
web
::
block
(
move
||
{
let
result
=
data
.execute
(
&
schema
,
context
);
let
result
=
data
.execute
(
&
schema
,
context
);
Ok
::
<
_
,
serde_json
::
error
::
Error
>
(
serde_json
::
to_string
(
&
result
)
?
)
serde_json
::
to_string
(
&
result
)
})
})
.map_err
(
Error
::
from
)
.map_err
(
Error
::
from
)
.and_then
(|
user
|
{
.and_then
(|
user
|
{
...
...
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