Addressing github comments.

pull/1227/head
Nicolas "Pixel" Noble 10 years ago
parent a05b8b7b25
commit b7bbffe9f6
  1. 16
      include/grpc++/credentials.h
  2. 26
      include/grpc++/time.h

@ -97,20 +97,20 @@ std::unique_ptr<Credentials> ComputeEngineCredentials();
// Builds service account credentials. // Builds service account credentials.
// json_key is the JSON key string containing the client's private key. // json_key is the JSON key string containing the client's private key.
// scope is a space-delimited list of the requested permissions. // scope is a space-delimited list of the requested permissions.
// token_lifetime is the lifetime of each token acquired through this service // token_lifetime_seconds is the lifetime in seconds of each token acquired
// account credentials. It should be positive and should not exceed // through this service account credentials. It should be positive and should
// grpc_max_auth_token_lifetime or will be cropped to this value. // not exceed grpc_max_auth_token_lifetime or will be cropped to this value.
std::unique_ptr<Credentials> ServiceAccountCredentials( std::unique_ptr<Credentials> ServiceAccountCredentials(
const grpc::string& json_key, const grpc::string& scope, const grpc::string& json_key, const grpc::string& scope,
long token_lifetime); long token_lifetime_seconds);
// Builds JWT credentials. // Builds JWT credentials.
// json_key is the JSON key string containing the client's private key. // 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 // token_lifetime_seconds is the lifetime in seconds of each Json Web Token
// this credentials. It should not exceed grpc_max_auth_token_lifetime or // (JWT) created with this credentials. It should not exceed
// will be cropped to this value. // grpc_max_auth_token_lifetime or will be cropped to this value.
std::unique_ptr<Credentials> JWTCredentials( std::unique_ptr<Credentials> JWTCredentials(
const grpc::string& json_key, long token_lifetime); const grpc::string& json_key, long token_lifetime_seconds);
// Builds refresh token credentials. // Builds refresh token credentials.
// json_refresh_token is the JSON string containing the refresh token along // json_refresh_token is the JSON string containing the refresh token along

@ -38,11 +38,33 @@
namespace grpc { 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 <typename T> template <typename T>
class TimePoint { class TimePoint {
public: public:
TimePoint(const T& time) : time_(time) { } TimePoint(const T& time) {
gpr_timespec raw_time() const { return 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<gpr_timespec> {
public:
TimePoint(const gpr_timespec& time) : time_(time) { }
gpr_timespec raw_time() { return time_; }
private: private:
gpr_timespec time_; gpr_timespec time_;
}; };

Loading…
Cancel
Save