Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

Commit

Permalink
*: remove *.types.h files (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Tao authored Sep 28, 2018
1 parent 737dd9b commit ca2b88e
Show file tree
Hide file tree
Showing 31 changed files with 33 additions and 235 deletions.
1 change: 1 addition & 0 deletions include/dsn/cpp/message_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <dsn/cpp/rpc_stream.h>
#include <dsn/cpp/serialization.h>
#include <dsn/tool-api/rpc_message.h>
#include <dsn/cpp/serialization_helper/dsn.layer2_types.h>

namespace dsn {

Expand Down
57 changes: 16 additions & 41 deletions include/dsn/cpp/serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,61 +50,36 @@ std::string no_registered_function_error_notice(const T &t, dsn_msg_serialize_fo

} // namespace serialization

#define THRIFT_MARSHALLER \
case DSF_THRIFT_BINARY: \
marshall_thrift_binary(writer, value); \
break; \
case DSF_THRIFT_JSON: \
marshall_thrift_json(writer, value); \
break;

#define THRIFT_UNMARSHALLER \
case DSF_THRIFT_BINARY: \
unmarshall_thrift_binary(reader, value); \
break; \
case DSF_THRIFT_JSON: \
unmarshall_thrift_json(reader, value); \
break;

// the following 2 functions is for thrift basic type serialization
template <typename T>
inline void marshall(binary_writer &writer, const T &value, dsn_msg_serialize_format fmt)
template <typename ThriftType>
inline void marshall(binary_writer &writer, const ThriftType &value, dsn_msg_serialize_format fmt)
{
switch (fmt) {
THRIFT_MARSHALLER
case DSF_THRIFT_BINARY:
marshall_thrift_binary(writer, value);
break;
case DSF_THRIFT_JSON:
marshall_thrift_json(writer, value);
break;
default:
dassert(false, serialization::no_registered_function_error_notice(value, fmt).c_str());
}
}

template <typename T>
inline void unmarshall(binary_reader &reader, T &value, dsn_msg_serialize_format fmt)
template <typename ThriftType>
inline void unmarshall(binary_reader &reader, ThriftType &value, dsn_msg_serialize_format fmt)
{
switch (fmt) {
THRIFT_UNMARSHALLER
case DSF_THRIFT_BINARY:
unmarshall_thrift_binary(reader, value);
break;
case DSF_THRIFT_JSON:
unmarshall_thrift_json(reader, value);
break;
default:
dassert(false, serialization::no_registered_function_error_notice(value, fmt).c_str());
}
}

#define GENERATED_TYPE_SERIALIZATION(GType, SerializationType) \
inline void marshall(binary_writer &writer, const GType &value, dsn_msg_serialize_format fmt) \
{ \
switch (fmt) { \
SerializationType##_MARSHALLER default \
: dassert(false, \
serialization::no_registered_function_error_notice(value, fmt).c_str()); \
} \
} \
inline void unmarshall(binary_reader &reader, GType &value, dsn_msg_serialize_format fmt) \
{ \
switch (fmt) { \
SerializationType##_UNMARSHALLER default \
: dassert(false, \
serialization::no_registered_function_error_notice(value, fmt).c_str()); \
} \
}

template <typename T>
inline void marshall(dsn::message_ex *msg, const T &val)
{
Expand Down
15 changes: 0 additions & 15 deletions include/dsn/cpp/serialization_helper/dsn.layer2.types.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/dsn/dist/cli/cli.client.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include <dsn/tool-api/task_tracker.h>
#include <dsn/tool-api/async_calls.h>
#include <dsn/dist/cli/cli.code.definition.h>
#include <dsn/dist/cli/cli.types.h>
#include <dsn/dist/cli/cli_types.h>
#include <iostream>

namespace dsn {
Expand Down
2 changes: 1 addition & 1 deletion include/dsn/dist/cli/cli.server.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <iostream>
#include <dsn/cpp/serverlet.h>
#include <dsn/dist/cli/cli.code.definition.h>
#include <dsn/dist/cli/cli.types.h>
#include <dsn/dist/cli/cli_types.h>

namespace dsn {
class cli_service : public ::dsn::serverlet<cli_service>
Expand Down
12 changes: 0 additions & 12 deletions include/dsn/dist/cli/cli.types.h

This file was deleted.

4 changes: 3 additions & 1 deletion include/dsn/dist/failure_detector/fd.code.definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@
*/

#pragma once
#include <dsn/dist/failure_detector/fd.types.h>

#include <dsn/tool-api/task_code.h>
#include <dsn/dist/failure_detector/fd_types.h>

namespace dsn {
namespace fd {
Expand Down
14 changes: 0 additions & 14 deletions include/dsn/dist/failure_detector/fd.types.h

This file was deleted.

1 change: 0 additions & 1 deletion include/dsn/dist/replication.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,5 @@
#pragma once

#include <dsn/service_api_cpp.h>
#include <dsn/dist/replication/replication.types.h>
#include <dsn/dist/replication/replication_other_types.h>
#include <dsn/dist/replication/replication.codes.h>
1 change: 0 additions & 1 deletion include/dsn/dist/replication/duplication_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

#pragma once

#include <dsn/dist/replication/replication.types.h>
#include <dsn/dist/fmt_logging.h>
#include <dsn/cpp/rpc_holder.h>
#include <dsn/cpp/json_helper.h>
Expand Down
90 changes: 0 additions & 90 deletions include/dsn/dist/replication/replication.types.h

This file was deleted.

2 changes: 1 addition & 1 deletion include/dsn/dist/replication/replication_app_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

#include <dsn/cpp/serverlet.h>
#include <dsn/cpp/json_helper.h>
#include <dsn/dist/replication/replication.types.h>
#include <dsn/dist/replication/replication_types.h>
#include <dsn/dist/replication/replication_other_types.h>
#include <dsn/dist/replication/replication.codes.h>
#include <dsn/dist/replication/replica_base.h>
Expand Down
2 changes: 1 addition & 1 deletion include/dsn/dist/replication/replication_other_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#define replication_OTHER_TYPES_H

#include <sstream>
#include <dsn/dist/replication/replication.types.h>
#include <dsn/dist/replication/replication_types.h>
#include <dsn/dist/replication/replication_enums.h>

namespace dsn {
Expand Down
1 change: 0 additions & 1 deletion include/dsn/service_api_cpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
#include <dsn/service_api_c.h>
#include <dsn/tool-api/auto_codes.h>
#include <dsn/cpp/serialization.h>
#include <dsn/cpp/serialization_helper/dsn.layer2.types.h>
#include <dsn/cpp/rpc_stream.h>
#include <dsn/cpp/zlocks.h>
#include <dsn/cpp/serverlet.h>
Expand Down
1 change: 0 additions & 1 deletion src/apps/echo/echo.code.definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
*/
#pragma once
#include <dsn/service_api_cpp.h>
#include "echo.types.h"

namespace dsn {
namespace example {
Expand Down
11 changes: 0 additions & 11 deletions src/apps/echo/echo.types.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/apps/skv/simple_kv.client.2.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once
#include "simple_kv.code.definition.h"
#include "simple_kv.types.h"
#include "simple_kv_types.h"
#include <iostream>
#include <dsn/utility/optional.h>
#include <dsn/tool-api/async_calls.h>
Expand Down
4 changes: 2 additions & 2 deletions src/apps/skv/simple_kv.server.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <dsn/dist/replication/storage_serverlet.h>

#include "simple_kv.code.definition.h"
#include "simple_kv.types.h"
#include "simple_kv_types.h"

namespace dsn {
namespace replication {
Expand All @@ -51,7 +51,7 @@ class simple_kv_service : public replication_app_base, public storage_serverlet<
simple_kv_service(replica *r) : replication_app_base(r) {}
virtual ~simple_kv_service() {}

virtual int on_request(dsn::message_ex* request) override { return handle_request(request); }
virtual int on_request(dsn::message_ex *request) override { return handle_request(request); }
protected:
// all service handlers to be implemented further
// RPC_SIMPLE_KV_SIMPLE_KV_READ
Expand Down
12 changes: 0 additions & 12 deletions src/apps/skv/simple_kv.types.h

This file was deleted.

2 changes: 0 additions & 2 deletions src/core/core/common_providers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
#include "partition_resolver_simple.h"
#include <dsn/utility/factory_store.h>

#include <dsn/dist/replication/replication.types.h>

namespace dsn {
namespace dist {
static bool register_component_provider(const char *name,
Expand Down
2 changes: 1 addition & 1 deletion src/core/core/partition_resolver_simple.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include <dsn/tool-api/task_tracker.h>
#include <dsn/service_api_c.h>
#include <dsn/cpp/zlocks.h>
#include <dsn/cpp/serialization_helper/dsn.layer2.types.h>
#include <dsn/cpp/serialization_helper/dsn.layer2_types.h>

namespace dsn {
namespace dist {
Expand Down
14 changes: 0 additions & 14 deletions src/dist/nfs/nfs.types.h

This file was deleted.

2 changes: 1 addition & 1 deletion src/dist/nfs/nfs_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
#include <dsn/utility/optional.h>
#include <dsn/tool-api/async_calls.h>

#include "nfs.types.h"
#include "nfs_types.h"
#include "nfs_code_definition.h"

namespace dsn {
Expand Down
Loading

0 comments on commit ca2b88e

Please sign in to comment.