Skip to content

Commit

Permalink
refactor: move block_service module from src/dist/block_service to sr…
Browse files Browse the repository at this point in the history
…c/block_service (#536)
  • Loading branch information
levy5307 authored Jul 9, 2020
1 parent f14e7e6 commit f8886e4
Show file tree
Hide file tree
Showing 28 changed files with 24 additions and 85 deletions.
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ endif()
add_subdirectory(core)
add_subdirectory(aio)
add_subdirectory(dist)
add_subdirectory(block_service)
add_subdirectory(http)
add_subdirectory(tests)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// can be found in the LICENSE file in the root directory of this source tree.

#include "block_service_manager.h"
#include "fds/fds_service.h"
#include "local/local_service.h"
#include "block_service/fds/fds_service.h"
#include "block_service/local/local_service.h"

#include <dsn/dist/fmt_logging.h>
#include <dsn/utility/factory_store.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.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// can be found in the LICENSE file in the root directory of this source tree.

#include "block_service_mock.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

#include <fstream>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

#pragma once

#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

#include <dsn/dist/block_service.h>
#include <dsn/utility/filesystem.h>
Expand Down
3 changes: 3 additions & 0 deletions src/block_service/test/clear.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

rm -rf log.* *.log data dsn_block_service_test.xml randomfile*
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,9 @@ logging_factory_name = dsn::tools::simple_logger
fast_flush = true
short_header = false
stderr_start_level = LOG_LEVEL_WARNING

[fds_concurrent_test]
total_files = 64
min_size = 100
max_size = 150

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <memory>
#include <fstream>

#include "dist/block_service/fds/fds_service.h"
#include "block_service/fds/fds_service.h"

using namespace dsn;
using namespace dsn::dist::block_service;
Expand Down Expand Up @@ -876,69 +876,3 @@ TEST_F(FDSClientTest, test_concurrent_upload_download)
}
}
}

// TEST_F(FDSClientTest, test_max_file_size)
//{
// char block[1024];
// const char *str = "test_str";
// for (int i = 0; i < 128; ++i) {
// memcpy(block + i * 8, str, 8);
// }
//
// std::shared_ptr<fds_service> _service = std::make_shared<fds_service>();
// std::vector<std::string> init_str = {server_address, access_key, access_secret, bucket_name};
//
// if (server_address == example_server_address) {
// // user don't specify the server-address, we just return true
// return;
// }
// _service->initialize(init_str);
//
// create_file_response cf_resp;
// _service
// ->create_file(create_file_request{"upload_test", true},
// lpc_btest,
// [&cf_resp](const create_file_response &r) { cf_resp = r; },
// nullptr)
// ->wait();
//
// ASSERT_EQ(dsn::ERR_OK, cf_resp.err);
// ASSERT_NE(nullptr, cf_resp.file_handle.get());
//
// unsigned long prev_size = 32 * 1024;
// unsigned long new_size = prev_size * 2;
// unsigned long ceiling = 0;
//
// while (new_size > prev_size) {
// generate_file("test_local_file", new_size, block, 1024);
// upload_response u_resp;
//
// uint64_t start = dsn_now_ms();
// cf_resp.file_handle
// ->upload(upload_request{"test_local_file"},
// lpc_btest,
// [&u_resp](const upload_response &r) { u_resp = r; },
// nullptr)
// ->wait();
// uint64_t end = dsn_now_ms();
//
// if (u_resp.err == dsn::ERR_OK && u_resp.uploaded_size == new_size) {
// printf("upload a file with size %lf MB succeed, time consume %lf sec\n",
// new_size / (1024.0 * 1024.0),
// (end - start) / 1000.0);
// if (ceiling == 0) {
// prev_size = new_size;
// new_size *= 2;
// } else {
// prev_size = new_size;
// new_size = (ceiling + prev_size) / 2;
// }
// } else {
// printf("upload a file with size %lf MB failed, time consume %lf sec\n",
// new_size / (1024.0 * 1024.0),
// (end - start) / 1000.0);
// ceiling = new_size;
// new_size = (ceiling + prev_size) / 2;
// }
// }
//}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ if [ -z "${REPORT_DIR}" ]; then
REPORT_DIR="."
fi

./clear.sh
output_xml="${REPORT_DIR}/dsn_block_service_test.xml"
GTEST_OUTPUT="xml:${output_xml}" ./dsn_block_service_test
1 change: 0 additions & 1 deletion src/dist/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
add_subdirectory(failure_detector)
add_subdirectory(replication)
add_subdirectory(failure_detector_multimaster)
add_subdirectory(block_service)
add_subdirectory(nfs)
add_subdirectory(cmd)
2 changes: 1 addition & 1 deletion src/dist/replication/lib/replica_backup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#include <dsn/dist/fmt_logging.h>
#include <dsn/dist/replication/replication_app_base.h>

#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"
#include "dist/replication/lib/backup/replica_backup_manager.h"

#include "replica.h"
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/lib/replica_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
#include "replica_stub.h"
#include "mutation.h"
#include "mutation_log.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

namespace dsn {
namespace replication {
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/lib/replica_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "replica.h"
#include "mutation_log.h"
#include "replica_stub.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

using namespace dsn::dist::block_service;

Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/lib/replica_stub.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

#include "dist/replication/common/replication_common.h"
#include "dist/replication/common/fs_manager.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"
#include "replica.h"

namespace dsn {
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/meta_server/meta_backup_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "meta_backup_service.h"
#include "dist/replication/meta_server/meta_service.h"
#include "dist/replication/meta_server/server_state.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

namespace dsn {
namespace replication {
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/meta_server/meta_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
#include "dist/replication/meta_server/meta_options.h"
#include "dist/replication/meta_server/meta_backup_service.h"
#include "dist/replication/meta_server/meta_state_service_utils.h"
#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"

namespace dsn {
namespace replication {
Expand Down
2 changes: 1 addition & 1 deletion src/dist/replication/meta_server/server_state_restore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <dsn/dist/block_service.h>
#include <boost/lexical_cast.hpp>

#include "dist/block_service/block_service_manager.h"
#include "block_service/block_service_manager.h"
#include "dist/replication/common/replication_common.h"
#include "dist/replication/meta_server/meta_service.h"
#include "dist/replication/meta_server/server_state.h"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <dsn/dist/block_service.h>
#include "dist/replication/lib/replica_context.h"
#include "dist/replication/test/replica_test/unit_test/replication_service_test_app.h"
#include "dist/block_service/test/block_service_mock.h"
#include "block_service/test/block_service_mock.h"

using namespace ::dsn;
using namespace ::dsn::dist::block_service;
Expand Down
5 changes: 0 additions & 5 deletions src/tests/dsn/config-test.ini
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,3 @@ hosts_list = localhost:12181
timeout_ms = 30000
logfile = zoolog.log

[fds_concurrent_test]
total_files = 64
min_size = 100
max_size = 150

0 comments on commit f8886e4

Please sign in to comment.