Skip to content

Commit

Permalink
move server to service
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubuntu committed May 31, 2023
1 parent 61625f8 commit f3685e8
Show file tree
Hide file tree
Showing 87 changed files with 38 additions and 40 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,33 +50,33 @@ Install dependencies:

Run ResilientDB (Providing a Key-Value Service):

./service/tools/kv_service/service_tools/start_kv_service.sh
./service/tools/kv/server_tools/start_kv_service.sh

- This script will start 4 replica and 1 client. Each replica instantiates a key-value store.

Build Interactive Tools:

bazel build service/tools/kv_service/api_tools/kv_service_tools
bazel build service/tools/kv/api_tools/kv_service_tools

Run tools to set a value by a key (for example, set the value with key "test" and value "test_value"):

bazel-bin/service/tools/kv_service/api_tools/kv_service_tools service/tools/config/interface/service.config set test test_value
bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config set test test_value

You will see the following result if successful:

client set ret = 0

Run tools to get value by a key (for example, get the value with key "test"):

bazel-bin/service/tools/kv_service/api_tools/kv_service_tools service/tools/config/interface/service.config get test test_value
bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config get test test_value

You will see the following result if successful:

client get value = test_value

Run tools to get all values that have been set:

bazel-bin/service/tools/kv_service/api_tools/kv_service_tools service/tools/config/interface/service.config getvalues
bazel-bin/service/tools/kv/api_tools/kv_service_tools service/tools/config/interface/service.config getvalues

You will see the following result if successful:

Expand Down
1 change: 0 additions & 1 deletion platform/networkstrate/service_network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ void ServiceNetwork::InputProcess() {
if (item == nullptr) {
continue;
}
LOG(ERROR) << "get item";
global_stats_->ServerProcess();
Process(std::move(item));
}
Expand Down
1 change: 0 additions & 1 deletion platform/rdbc/acceptor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ void Acceptor::Run() {
item->socket = std::move(client_socket);
item->data = std::move(request_info);
global_stats_->ServerCall();
LOG(ERROR) << "push item";
input_queue_->Push(std::move(item));
}
}));
Expand Down
6 changes: 3 additions & 3 deletions server/contract/BUILD → service/contract/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package(default_visibility = ["//visibility:public"])

cc_binary(
name = "contract_server",
srcs = ["contract_server.cpp"],
name = "contract_service",
srcs = ["contract_service.cpp"],
deps = [
"//executor/contract/executor:contract_executor",
"//platform/config:resdb_config_utils",
"//platform/consensus/ordering/pbft:consensus_manager_pbft",
"//server/utils:server_factory",
"//service/utils:server_factory",
],
)
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include "platform/config/resdb_config_utils.h"
#include "platform/consensus/ordering/pbft/consensus_manager_pbft.h"
#include "platform/statistic/stats.h"
#include "server/utils/server_factory.h"
#include "service/utils/server_factory.h"

using resdb::ConsensusManagerPBFT;
using resdb::CustomGenerateResDBServer;
Expand Down
6 changes: 3 additions & 3 deletions server/kv/BUILD → service/kv/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package(default_visibility = ["//visibility:private"])
load("@bazel_skylib//rules:common_settings.bzl", "bool_flag")

cc_binary(
name = "kv_server",
srcs = ["kv_server.cpp"],
name = "kv_service",
srcs = ["kv_service.cpp"],
copts = select({
"//executor/kv:enable_leveldb_setting": ["-DENABLE_LEVELDB"],
"//executor/kv:enable_rocksdb_setting": ["-DENABLE_ROCKSDB"],
Expand All @@ -13,7 +13,7 @@ cc_binary(
deps = [
"//platform/config:resdb_config_utils",
"//executor/kv:kv_executor",
"//server/utils:server_factory",
"//service/utils:server_factory",
"//common:comm",
"//storage:in_mem_kv_storage",
"//proto/kv:kv_cc_proto",
Expand Down
2 changes: 1 addition & 1 deletion server/kv/kv_server.cpp → service/kv/kv_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "executor/kv/kv_executor.h"
#include "platform/config/resdb_config_utils.h"
#include "platform/statistic/stats.h"
#include "server/utils/server_factory.h"
#include "service/utils/server_factory.h"
#include "storage/in_mem_kv_storage.h"
#ifdef ENABLE_LEVELDB
#include "storage/res_leveldb.h"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package(default_visibility = ["//visibility:public"])

cc_binary(
name = "kv_client_tools",
srcs = ["kv_client_tools.cpp"],
name = "kv_service_tools",
srcs = ["kv_service_tools.cpp"],
deps = [
"//common/proto:signature_info_cc_proto",
"//interface/kv:kv_client",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
killall -9 kv_server
killall -9 kv_service

SERVER_PATH=./bazel-bin/server/kv/kv_server
SERVER_CONFIG=server/tools/config/server/server.config
SERVER_PATH=./bazel-bin/service/kv/kv_service
SERVER_CONFIG=service/tools/config/server/server.config
WORK_PATH=$PWD
CERT_PATH=${WORK_PATH}/server/tools/data/cert/
CERT_PATH=${WORK_PATH}/service/tools/data/cert/

bazel build //server/kv:kv_server $@
bazel build //service/kv:kv_service $@
nohup $SERVER_PATH $SERVER_CONFIG $CERT_PATH/node1.key.pri $CERT_PATH/cert_1.cert > server0.log &
nohup $SERVER_PATH $SERVER_CONFIG $CERT_PATH/node2.key.pri $CERT_PATH/cert_2.cert > server1.log &
nohup $SERVER_PATH $SERVER_CONFIG $CERT_PATH/node3.key.pri $CERT_PATH/cert_3.cert > server2.log &
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package(default_visibility = ["//server/tools/utxo/wallet_tool/pybind:__subpackages__"])
package(default_visibility = ["//service/tools/utxo/wallet_tool/pybind:__subpackages__"])

cc_library(
name = "addr_utils",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*/

#include "server/tools/utxo/wallet_tool/cpp/addr_utils.h"
#include "service/tools/utxo/wallet_tool/cpp/addr_utils.h"

#include <glog/logging.h>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*/

#include "server/tools/utxo/wallet_tool/cpp/key_utils.h"
#include "service/tools/utxo/wallet_tool/cpp/key_utils.h"

#include "common/crypto/key_generator.h"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ py_binary(
legacy_create_init = False,
python_version = "PY3",
deps = [
"//server/tools/utxo/wallet_tool/pybind:wallet_tools_py_so", # a py_library
"//service/tools/utxo/wallet_tool/pybind:wallet_tools_py_so", # a py_library
],
)

Expand All @@ -16,6 +16,6 @@ py_binary(
legacy_create_init = False,
python_version = "PY3",
deps = [
"//server/tools/utxo/wallet_tool/pybind:wallet_tools_py_so", # a py_library
"//service/tools/utxo/wallet_tool/pybind:wallet_tools_py_so", # a py_library
],
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cc_binary(
linkstatic = 1,
deps = [
"//common:pybind",
"//server/tools/utxo/wallet_tool/cpp:addr_utils",
"//server/tools/utxo/wallet_tool/cpp:key_utils",
"//service/tools/utxo/wallet_tool/cpp:addr_utils",
"//service/tools/utxo/wallet_tool/cpp:key_utils",
],
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

#include <pybind11/pybind11.h>

#include "server/tools/utxo/wallet_tool/cpp/addr_utils.h"
#include "server/tools/utxo/wallet_tool/cpp/key_utils.h"
#include "service/tools/utxo/wallet_tool/cpp/addr_utils.h"
#include "service/tools/utxo/wallet_tool/cpp/key_utils.h"

namespace py = pybind11;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ py_binary(
python_version = "PY3",
deps = [
":key_tester_utils_so",
"//server/tools/utxo/wallet_tool/pybind:wallet_tools_py_so",
"//service/tools/utxo/wallet_tool/pybind:wallet_tools_py_so",
],
)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*
*/

#include "server/utils/server_factory.h"
#include "service/utils/server_factory.h"

namespace resdb {

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions server/utxo/BUILD → service/utxo/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package(default_visibility = ["//visibility:public"])

cc_binary(
name = "utxo_server",
srcs = ["utxo_server.cpp"],
name = "utxo_service",
srcs = ["utxo_service.cpp"],
deps = [
"//executor/utxo/executor:utxo_executor",
"//platform/config:resdb_config_utils",
"//server/utils:server_factory",
"//service/utils:server_factory",
],
)
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
killall -9 utxo_server
killall -9 utxo_service

SERVER_PATH=./bazel-bin/application/utxo/server/utxo_server
SERVER_PATH=./bazel-bin/application/utxo/server/utxo_service
SERVER_CONFIG=application/utxo/server/config/server_config.config
UTXO_CONFIG=application/utxo/server/config/utxo_config.config
WORK_PATH=$PWD

bazel build //application/utxo/server:utxo_server
bazel build //application/utxo/server:utxo_service
nohup $SERVER_PATH $SERVER_CONFIG $WORK_PATH/cert/node1.key.pri $WORK_PATH/cert/cert_1.cert ${UTXO_CONFIG} > server0.log &
nohup $SERVER_PATH $SERVER_CONFIG $WORK_PATH/cert/node2.key.pri $WORK_PATH/cert/cert_2.cert ${UTXO_CONFIG} > server1.log &
nohup $SERVER_PATH $SERVER_CONFIG $WORK_PATH/cert/node3.key.pri $WORK_PATH/cert/cert_3.cert ${UTXO_CONFIG} > server2.log &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "executor/utxo/executor/utxo_executor.h"
#include "platform/config/resdb_config_utils.h"
#include "platform/statistic/stats.h"
#include "server/utils/server_factory.h"
#include "service/utils/server_factory.h"

using google::protobuf::util::JsonParseOptions;
using resdb::ConsensusManagerPBFT;
Expand Down

0 comments on commit f3685e8

Please sign in to comment.