cleanup removing temporary classes AyncDelResponse AsyncModifyResponse
and V3BaseResponse
This commit is contained in:
parent
87dc87abdb
commit
01bf49bf2d
|
|
@ -1,4 +1,4 @@
|
|||
add_library(etcd-cpp-api SHARED ../proto/kv.pb.cc ../proto/auth.pb.cc ../proto/rpc.pb.cc ../proto/rpc.grpc.pb.cc ../v3/src/Utils.cpp ../v3/src/grpcClient.cpp ../v3/src/AsyncTxnResponse.cpp ../v3/src/AsyncRangeResponse.cpp ../v3/src/AsyncPutResponse.cpp ../v3/src/V3BaseResponse.cpp ../v3/src/AsyncDelResponse.cpp ../v3/src/AsyncModifyResponse.cpp Client.cpp Response.cpp Value.cpp json_constants.cpp)
|
||||
add_library(etcd-cpp-api SHARED ../proto/kv.pb.cc ../proto/auth.pb.cc ../proto/rpc.pb.cc ../proto/rpc.grpc.pb.cc ../v3/src/Utils.cpp ../v3/src/grpcClient.cpp ../v3/src/AsyncTxnResponse.cpp ../v3/src/AsyncRangeResponse.cpp ../v3/src/AsyncPutResponse.cpp Client.cpp Response.cpp Value.cpp json_constants.cpp)
|
||||
set_property(TARGET etcd-cpp-api PROPERTY CXX_STANDARD 11)
|
||||
|
||||
target_link_libraries(etcd-cpp-api ${CPPREST_LIB} boost_system ssl crypto protobuf grpc++)
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
#include "etcd/Client.hpp"
|
||||
#include "v3/include/AsyncTxnResponse.hpp"
|
||||
#include "v3/include/AsyncRangeResponse.hpp"
|
||||
#include "v3/include/AsyncDelResponse.hpp"
|
||||
#include "v3/include/AsyncModifyResponse.hpp"
|
||||
#include "v3/include/Utils.hpp"
|
||||
#include <iostream>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* AsyncDelResponse.h
|
||||
*
|
||||
* Created on: Jun 8, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#ifndef V3_SRC_ASYNCDELRESPONSE_HPP_
|
||||
#define V3_SRC_ASYNCDELRESPONSE_HPP_
|
||||
|
||||
#include "v3/include/V3Response.hpp"
|
||||
#include "v3/include/V3BaseResponse.hpp"
|
||||
#include "v3/include/grpcClient.hpp"
|
||||
|
||||
namespace etcdv3 {
|
||||
|
||||
class AsyncDelResponse : public etcdv3::V3Response, public etcdv3::V3BaseResponse {
|
||||
public:
|
||||
AsyncDelResponse(){action="delete";};
|
||||
AsyncDelResponse(std::string const &);
|
||||
AsyncDelResponse(const AsyncDelResponse&);
|
||||
AsyncDelResponse& operator=(const AsyncDelResponse&);
|
||||
virtual ~AsyncDelResponse();
|
||||
|
||||
etcdserverpb::DeleteRangeResponse deleteResponse;
|
||||
std::unique_ptr<grpc::ClientAsyncResponseReader<etcdserverpb::DeleteRangeResponse>> rpcInstance;
|
||||
AsyncDelResponse& ParseResponse();
|
||||
etcdv3::grpcClient* client;
|
||||
std::string key;
|
||||
};
|
||||
} /* namespace etcdv3 */
|
||||
|
||||
#endif /* V3_SRC_ASYNCDELRESPONSE_HPP_ */
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* AsyncModifyResponse.h
|
||||
*
|
||||
* Created on: Jun 9, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#ifndef V3_SRC_ASYNCMODIFYRESPONSE_HPP_
|
||||
#define V3_SRC_ASYNCMODIFYRESPONSE_HPP_
|
||||
|
||||
#include "v3/include/V3Response.hpp"
|
||||
#include "v3/include/V3BaseResponse.hpp"
|
||||
#include "v3/include/grpcClient.hpp"
|
||||
|
||||
namespace etcdv3 {
|
||||
|
||||
class AsyncModifyResponse : public etcdv3::V3Response, public etcdv3::V3BaseResponse {
|
||||
public:
|
||||
AsyncModifyResponse(){action="compareAndSwap";};
|
||||
AsyncModifyResponse(std::string const &);
|
||||
AsyncModifyResponse(const AsyncModifyResponse&);
|
||||
AsyncModifyResponse& operator=(const AsyncModifyResponse&);
|
||||
virtual ~AsyncModifyResponse();
|
||||
|
||||
etcdserverpb::PutResponse putResponse;
|
||||
std::unique_ptr<grpc::ClientAsyncResponseReader<etcdserverpb::PutResponse>> rpcInstance;
|
||||
AsyncModifyResponse& ParseResponse();
|
||||
etcdv3::grpcClient* client;
|
||||
std::string key;
|
||||
};
|
||||
} /* namespace etcdv3 */
|
||||
|
||||
#endif /* V3_SRC_ASYNCMODIFYRESPONSE_HPP_ */
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
/*
|
||||
* V3BaseResponse.h
|
||||
*
|
||||
* Created on: Jun 8, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#ifndef V3_SRC_V3BASERESPONSE_H_
|
||||
#define V3_SRC_V3BASERESPONSE_H_
|
||||
|
||||
#include <grpc++/grpc++.h>
|
||||
#include "proto/rpc.grpc.pb.h"
|
||||
#include "proto/kv.pb.h"
|
||||
|
||||
//TODO: make into abstract class
|
||||
namespace etcdv3 {
|
||||
class V3BaseResponse {
|
||||
public:
|
||||
V3BaseResponse();
|
||||
virtual ~V3BaseResponse();
|
||||
|
||||
grpc::Status status;
|
||||
grpc::ClientContext context;
|
||||
grpc::CompletionQueue cq_;
|
||||
// type& parseResponse()=0; //a possible candidate to make this abstract
|
||||
};
|
||||
} /* namespace etcdv3 */
|
||||
|
||||
#endif /* V3_SRC_V3BASERESPONSE_H_ */
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/*
|
||||
* AsyncDelResponse.cpp
|
||||
*
|
||||
* Created on: Jun 8, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#include "v3/include/AsyncDelResponse.hpp"
|
||||
#include "v3/include/Utils.hpp"
|
||||
|
||||
etcdv3::AsyncDelResponse::AsyncDelResponse(std::string const &inputAction) {
|
||||
action = inputAction;
|
||||
}
|
||||
|
||||
etcdv3::AsyncDelResponse::AsyncDelResponse(const etcdv3::AsyncDelResponse& other)
|
||||
{
|
||||
error_code = other.error_code;
|
||||
error_message = other.error_message;
|
||||
index = other.index;
|
||||
action = other.action;
|
||||
values = other.values;
|
||||
}
|
||||
|
||||
etcdv3::AsyncDelResponse& etcdv3::AsyncDelResponse::operator=(const etcdv3::AsyncDelResponse& other){
|
||||
error_code = other.error_code;
|
||||
error_message = other.error_message;
|
||||
index = other.index;
|
||||
action = other.action;
|
||||
values = other.values;
|
||||
return *this;
|
||||
}
|
||||
|
||||
etcdv3::AsyncDelResponse::~AsyncDelResponse(){
|
||||
}
|
||||
|
||||
|
||||
//TODO: unused
|
||||
etcdv3::AsyncDelResponse& etcdv3::AsyncDelResponse::ParseResponse(){
|
||||
action = "delete";
|
||||
|
||||
// etcdv3::AsyncRangeResponse* resp = etcdv3::Utils::getKey(key, *client);
|
||||
// if(resp->reply.kvs_size())
|
||||
// {
|
||||
// values.push_back(resp->reply.kvs(0));
|
||||
// }
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
/*
|
||||
* AsyncModifyResponse.cpp
|
||||
*
|
||||
* Created on: Jun 9, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#include "v3/include/AsyncModifyResponse.hpp"
|
||||
#include "v3/include/Utils.hpp"
|
||||
|
||||
namespace etcdv3 {
|
||||
|
||||
etcdv3::AsyncModifyResponse::AsyncModifyResponse(const etcdv3::AsyncModifyResponse& other) {
|
||||
error_code = other.error_code;
|
||||
error_message = other.error_message;
|
||||
index = other.index;
|
||||
action = other.action;
|
||||
values = other.values;
|
||||
prev_values= other.prev_values;
|
||||
}
|
||||
|
||||
etcdv3::AsyncModifyResponse::AsyncModifyResponse(const std::string &input) {
|
||||
action = input;
|
||||
}
|
||||
|
||||
etcdv3::AsyncModifyResponse& etcdv3::AsyncModifyResponse::operator=(const etcdv3::AsyncModifyResponse& other) {
|
||||
error_code = other.error_code;
|
||||
error_message = other.error_message;
|
||||
index = other.index;
|
||||
action = other.action;
|
||||
values = other.values;
|
||||
prev_values= other.prev_values;
|
||||
return *this;
|
||||
}
|
||||
|
||||
AsyncModifyResponse::~AsyncModifyResponse() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
etcdv3::AsyncModifyResponse& etcdv3::AsyncModifyResponse::ParseResponse() {
|
||||
etcdv3::AsyncRangeResponse* response = etcdv3::Utils::getKey(key, *client);
|
||||
if(response->reply.kvs_size())
|
||||
{
|
||||
values.push_back(response->reply.kvs(0));
|
||||
index = response->reply.kvs(0).mod_revision();
|
||||
}
|
||||
else{
|
||||
index = response->reply.header().revision();
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
} /* namespace etcdv3 */
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* V3BaseResponse.cpp
|
||||
*
|
||||
* Created on: Jun 8, 2016
|
||||
* Author: ubuntu
|
||||
*/
|
||||
|
||||
#include "v3/include/V3BaseResponse.hpp"
|
||||
|
||||
namespace etcdv3 {
|
||||
|
||||
V3BaseResponse::V3BaseResponse() {
|
||||
// TODO Auto-generated constructor stub
|
||||
|
||||
}
|
||||
|
||||
V3BaseResponse::~V3BaseResponse() {
|
||||
// TODO Auto-generated destructor stub
|
||||
}
|
||||
|
||||
} /* namespace etcdv3 */
|
||||
Loading…
Reference in New Issue