diff --git a/include/grpc++/credentials.h b/include/grpc++/credentials.h index 15bfef55ab7..a193bba2c74 100644 --- a/include/grpc++/credentials.h +++ b/include/grpc++/credentials.h @@ -97,20 +97,20 @@ std::unique_ptr ComputeEngineCredentials(); // Builds service account credentials. // json_key is the JSON key string containing the client's private key. // scope is a space-delimited list of the requested permissions. -// token_lifetime is the lifetime of each token acquired through this service -// account credentials. It should be positive and should not exceed -// grpc_max_auth_token_lifetime or will be cropped to this value. +// token_lifetime_seconds is the lifetime in seconds of each token acquired +// through this service account credentials. It should be positive and should +// not exceed grpc_max_auth_token_lifetime or will be cropped to this value. std::unique_ptr ServiceAccountCredentials( const grpc::string& json_key, const grpc::string& scope, - long token_lifetime); + long token_lifetime_seconds); // Builds JWT credentials. // json_key is the JSON key string containing the client's private key. -// token_lifetime is the lifetime of each Json Web Token (JWT) created with -// this credentials. It should not exceed grpc_max_auth_token_lifetime or -// will be cropped to this value. +// token_lifetime_seconds is the lifetime in seconds of each Json Web Token +// (JWT) created with this credentials. It should not exceed +// grpc_max_auth_token_lifetime or will be cropped to this value. std::unique_ptr JWTCredentials( - const grpc::string& json_key, long token_lifetime); + const grpc::string& json_key, long token_lifetime_seconds); // Builds refresh token credentials. // json_refresh_token is the JSON string containing the refresh token along diff --git a/include/grpc++/time.h b/include/grpc++/time.h index 470471ab8b4..995e550f4b9 100644 --- a/include/grpc++/time.h +++ b/include/grpc++/time.h @@ -38,11 +38,33 @@ namespace grpc { +/* If you are trying to use CompletionQueue::AsyncNext with a time class that + isn't either gpr_timespec or std::chrono::system_clock::time_point, you + will most likely be looking at that comment as your compiler will have + fired the static_assert below. In order to fix that issue, you have two + potential solutions: + + 1. Use gpr_timespec or std::chrono::system_clock::time_point instead + 2. Specialize the TimePoint class with whichever time class that you + want to use here. See below for two examples of how to do that. + */ + template class TimePoint { public: - TimePoint(const T& time) : time_(time) { } - gpr_timespec raw_time() const { return time_; } + TimePoint(const T& time) { + static_assert(false, "You need a specialization of TimePoint"); + } + gpr_timespec raw_time() { + static_assert(false, "You need a specialization of TimePoint"); + } +}; + +template<> +class TimePoint { + public: + TimePoint(const gpr_timespec& time) : time_(time) { } + gpr_timespec raw_time() { return time_; } private: gpr_timespec time_; };