Skip to content

Commit

Permalink
revert parts unnecessary change and minor update
Browse files Browse the repository at this point in the history
Signed-off-by: wbpcode <[email protected]>
  • Loading branch information
wbpcode committed Aug 15, 2024
1 parent c94a4d9 commit fc2a928
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
35 changes: 16 additions & 19 deletions cpp2sky/internal/async_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ namespace cpp2sky {
* Template base class for gRPC async client.
*/
template <class RequestType, class ResponseType>
class AsyncClientBase {
class AsyncClient {
public:
virtual ~AsyncClientBase() = default;
virtual ~AsyncClient() = default;

/**
* Send the specified protobuf message.
Expand All @@ -45,17 +45,16 @@ class AsyncClientBase {
};

template <class RequestType, class ResponseType>
using AsyncClientBasePtr =
std::unique_ptr<AsyncClientBase<RequestType, ResponseType>>;
using AsyncClientPtr = std::unique_ptr<AsyncClient<RequestType, ResponseType>>;

/**
* Template base class for gRPC async stream. The stream is used to represent
* a single gRPC stream/request.
*/
template <class RequestType, class ResponseType>
class AsyncStreamBase {
class AsyncStream {
public:
virtual ~AsyncStreamBase() = default;
virtual ~AsyncStream() = default;

/**
* Send the specified protobuf message.
Expand All @@ -64,8 +63,7 @@ class AsyncStreamBase {
};

template <class RequestType, class ResponseType>
using AsyncStreamBasePtr =
std::unique_ptr<AsyncStreamBase<RequestType, ResponseType>>;
using AsyncStreamPtr = std::unique_ptr<AsyncStream<RequestType, ResponseType>>;

/**
* Tag for async operation. The callback should be called when the operation is
Expand All @@ -83,11 +81,11 @@ using GrpcCompletionQueue = grpc::CompletionQueue;
* Factory for creating async stream.
*/
template <class RequestType, class ResponseType>
class AsyncStreamFactoryBase {
class AsyncStreamFactory {
public:
virtual ~AsyncStreamFactoryBase() = default;
virtual ~AsyncStreamFactory() = default;

using AsyncStreamPtr = AsyncStreamBasePtr<RequestType, ResponseType>;
using AsyncStreamPtr = AsyncStreamPtr<RequestType, ResponseType>;
using GrpcStub = grpc::TemplatedGenericStub<RequestType, ResponseType>;

virtual AsyncStreamPtr createStream(GrpcClientContextPtr client_ctx,
Expand All @@ -97,22 +95,21 @@ class AsyncStreamFactoryBase {
};

template <class RequestType, class ResponseType>
using AsyncStreamFactoryBasePtr =
std::unique_ptr<AsyncStreamFactoryBase<RequestType, ResponseType>>;
using AsyncStreamFactoryPtr =
std::unique_ptr<AsyncStreamFactory<RequestType, ResponseType>>;

using TraceRequestType = skywalking::v3::SegmentObject;
using TraceResponseType = skywalking::v3::Commands;

using TraceAsyncStream = AsyncStreamBase<TraceRequestType, TraceResponseType>;
using TraceAsyncStreamPtr =
AsyncStreamBasePtr<TraceRequestType, TraceResponseType>;
using TraceAsyncStream = AsyncStream<TraceRequestType, TraceResponseType>;
using TraceAsyncStreamPtr = AsyncStreamPtr<TraceRequestType, TraceResponseType>;

using TraceAsyncStreamFactory =
AsyncStreamFactoryBase<TraceRequestType, TraceResponseType>;
AsyncStreamFactory<TraceRequestType, TraceResponseType>;
using TraceAsyncStreamFactoryPtr =
AsyncStreamFactoryBasePtr<TraceRequestType, TraceResponseType>;
AsyncStreamFactoryPtr<TraceRequestType, TraceResponseType>;

using TraceAsyncClient = AsyncClientBase<TraceRequestType, TraceResponseType>;
using TraceAsyncClient = AsyncClient<TraceRequestType, TraceResponseType>;
using TraceAsyncClientPtr = std::unique_ptr<TraceAsyncClient>;

} // namespace cpp2sky
5 changes: 4 additions & 1 deletion test/e2e/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ def validate(expected_file_name):
res = requests.get('http://0.0.0.0:12800/receiveData')
actual_data = yaml.dump(yaml.load(res.content, Loader=Loader))

print('actual data: ')
print(actual_data)

differ = Differ()
diff_list = list(differ.compare(
actual_data.splitlines(keepends=True),
Expand All @@ -42,7 +45,7 @@ def validate(expected_file_name):
parser.add_argument('--expected_file', help='File name which includes expected reported value')
parser.add_argument('--max_retry_times', help='Max retry times', type=int)
parser.add_argument('--target_path', help='Specify target path')

args = parser.parse_args()

retry_times = 0
Expand Down

0 comments on commit fc2a928

Please sign in to comment.