Backwards compatibility with Ubuntu 18.04.

Signed-off-by: Tao He <sighingnow@gmail.com>
This commit is contained in:
Tao He 2021-11-09 00:19:56 +08:00
parent a23e156886
commit 83d1fd2174
1 changed files with 49 additions and 19 deletions

View File

@ -20,17 +20,15 @@ namespace etcdv3 {
} }
} }
namespace grpc {
class ChannelArguments;
}
#if defined(WITH_GRPC_CHANNEL_CLASS) #if defined(WITH_GRPC_CHANNEL_CLASS)
namespace grpc { namespace grpc {
class Channel; class Channel;
class ChannelArguments;
} }
#else #else
namespace grpc_impl { namespace grpc_impl {
class Channel; class Channel;
class ChannelArguments;
} }
#endif #endif
@ -68,7 +66,12 @@ namespace etcd
* @param arguments user provided grpc channel arguments. * @param arguments user provided grpc channel arguments.
*/ */
Client(std::string const & etcd_url, Client(std::string const & etcd_url,
grpc::ChannelArguments const & arguments); #if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments
#else
grpc_impl::ChannelArguments const & arguments
#endif
);
/** /**
* Constructs an etcd client object. * Constructs an etcd client object.
@ -88,7 +91,12 @@ namespace etcd
* @param arguments user provided grpc channel arguments. * @param arguments user provided grpc channel arguments.
*/ */
static etcd::Client *WithUrl(std::string const & etcd_url, static etcd::Client *WithUrl(std::string const & etcd_url,
grpc::ChannelArguments const & arguments); #if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments
#else
grpc_impl::ChannelArguments const & arguments
#endif
);
/** /**
* Constructs an etcd client object. * Constructs an etcd client object.
@ -116,7 +124,13 @@ namespace etcd
Client(std::string const & etcd_url, Client(std::string const & etcd_url,
std::string const & username, std::string const & username,
std::string const & password, std::string const & password,
grpc::ChannelArguments const & arguments); #if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments
#else
grpc_impl::ChannelArguments const & arguments
#endif
);
/** /**
* Constructs an etcd client object. * Constructs an etcd client object.
@ -144,7 +158,13 @@ namespace etcd
static etcd::Client *WithUser(std::string const & etcd_url, static etcd::Client *WithUser(std::string const & etcd_url,
std::string const & username, std::string const & username,
std::string const & password, std::string const & password,
grpc::ChannelArguments const & arguments); #if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments
#else
grpc_impl::ChannelArguments const & arguments
#endif
);
/** /**
* Constructs an etcd client object. * Constructs an etcd client object.
@ -178,7 +198,13 @@ namespace etcd
std::string const & cert, std::string const & cert,
std::string const & key, std::string const & key,
std::string const & target_name_override, std::string const & target_name_override,
grpc::ChannelArguments const & arguments); #if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments
#else
grpc_impl::ChannelArguments const & arguments
#endif
);
/** /**
* Constructs an etcd client object. * Constructs an etcd client object.
@ -214,7 +240,11 @@ namespace etcd
* @param arguments user provided grpc channel arguments. * @param arguments user provided grpc channel arguments.
*/ */
static etcd::Client *WithSSL(std::string const & etcd_url, static etcd::Client *WithSSL(std::string const & etcd_url,
#if defined(WITH_GRPC_CHANNEL_CLASS)
grpc::ChannelArguments const & arguments, grpc::ChannelArguments const & arguments,
#else
grpc_impl::ChannelArguments const & arguments,
#endif
std::string const & ca, std::string const & ca,
std::string const & cert = "", std::string const & cert = "",
std::string const & key = "", std::string const & key = "",