Skip to content
This repository has been archived by the owner on Apr 17, 2019. It is now read-only.

Split scheme to server and client ones #1550

Merged
merged 9 commits into from
Jul 11, 2018
Merged

Split scheme to server and client ones #1550

merged 9 commits into from
Jul 11, 2018

Conversation

l4l
Copy link
Contributor

@l4l l4l commented Jul 9, 2018

Description of the Change

  • Fixed build of standalone shared_model build with tests
  • schema is now for the client and the daemon
  • Split block.proto to block.proto and transaction.proto

Benefits

Weaker coupling of shared model component

Possible Drawbacks

Building grpc protobuf services now isn't straightforward and require SCHEMA_PATH variable to be set

l4l added 3 commits July 9, 2018 23:38
Signed-off-by: Kitsu <mail@kitsu.me>
Signed-off-by: Kitsu <mail@kitsu.me>
Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l added the needs-review pr awaits review from maintainers label Jul 9, 2018
@l4l l4l requested review from vdrobnyi and nickaleks July 9, 2018 20:43
Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l changed the title Fix/move proto Split scheme to server and client ones Jul 9, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
# SPDX-License-Identifier: Apache-2.0

set(SCHEMA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../shared_model/schema/)
compile_proto_only_grpc_to_cpp(endpoint.proto "-I${CMAKE_CURRENT_SOURCE_DIR}/../shared_model/schema/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-I${SCHEMA_PATH} ?

@@ -1,4 +1,4 @@
#!/bin/bash
rm ../schema/*.{cc,h}
rm schema/*.pb.{cc,h}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that all generated files are inside build directory do we still need this?

@@ -1,4 +1,4 @@
#!/bin/bash
rm ../schema/*.{cc,h}
rm schema/*.pb.{cc,h}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that all generated files are inside build directory do we still need this?

target_link_libraries(schema
protobuf
)
set_target_properties(schema PROPERTIES
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe use target_include_directories? It is cleaner and more idiomatic.

Also, I think we need PUBLIC for include directories, since they are used by generated files themselves (e. g. block includes transaction)

shared_model_stateless_validation
shared_model_cryptography
)
if (IROHA_ROOT_PROJECT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the reason for this conditional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed build of standalone shared_model build with tests

Just try to build shared_model without any fixes

Signed-off-by: Kitsu <mail@kitsu.me>
compile_proto_to_grpc_cpp(mst.proto "-I${SM_SCHEMA_PATH}")

add_library(endpoint
# ${SCHEMA_OUT_DIR}/endpoint.pb.cc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove comment?


set(SM_SCHEMA_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../shared_model/schema/)
set(SCHEMA_PATH ${SM_SCHEMA_PATH})
compile_proto_only_grpc_to_cpp(endpoint.proto "-I${SM_SCHEMA_PATH}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Logically it should be SCHEMA_PATH?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, the model proto should be included for the building grpc services

@@ -1,5 +1,5 @@
#!/usr/bin/env bash
CURDIR="$(cd "$(dirname "$0")"; pwd)"
IROHA_HOME="$(dirname $(dirname "${CURDIR}"))"
cmake -H$IROHA_HOME -Bbuild -DSWIG_JAVA=ON -DSWIG_JAVA_PKG="jp.co.soramitsu.iroha";
cmake -H$IROHA_HOME -Bbuild -DSWIG_JAVA=ON -DSWIG_JAVA_PKG="jp.co.soramitsu.iroha" -GNinja
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that every script user has Ninja installed, so it seems better to leave the default value.

compile_proto_to_cpp(proposal.proto)
compile_proto_to_cpp(qry_responses.proto)
compile_proto_to_cpp(queries.proto)
compile_proto_to_cpp(endpoint.proto "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"" looks reduntant, please remove.

l4l added 3 commits July 10, 2018 16:45
Signed-off-by: Kitsu <mail@kitsu.me>
Signed-off-by: Kitsu <mail@kitsu.me>
Signed-off-by: Kitsu <mail@kitsu.me>
@sorabot
Copy link

sorabot commented Jul 10, 2018

SonarQube analysis reported 5 issues

  1. MAJOR query_response_template.hpp#L204: syntax error rule
  2. MINOR pb_common.cpp#L75: The function 'serializeAsset' is never used. rule
  3. MINOR pb_common.cpp#L93: The function 'serializeDomain' is never used. rule
  4. MINOR pb_query_response_factory.hpp#L54: Function parameter 'pb_response' should be passed by reference. rule
  5. MINOR transport_builder_test.cpp#L155: The function 'createInvalidProposal' is never used. rule

Copy link
Contributor

@vdrobnyi vdrobnyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was the reason to rename responses to qry_responses?

@l4l
Copy link
Contributor Author

l4l commented Jul 11, 2018

There's none actually. The first impl considered splitting endpoint to torii_responses, so qry_responses looks more accurate and meaningful naming

@l4l l4l merged commit 4a83590 into develop Jul 11, 2018
@l4l l4l deleted the fix/move_proto branch July 11, 2018 22:26
l4l added a commit that referenced this pull request Jul 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
l4l added a commit that referenced this pull request Jul 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
l4l added a commit that referenced this pull request Jul 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
l4l added a commit that referenced this pull request Jul 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
l4l added a commit that referenced this pull request Jul 25, 2018
Signed-off-by: Kitsu <mail@kitsu.me>
@l4l l4l added shared model and removed needs-review pr awaits review from maintainers labels Jan 16, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

5 participants