From: Florian Forster Date: Sun, 28 Aug 2016 19:36:15 +0000 (+0200) Subject: grpc plugin: Rename "DispatchValues" to "PutValues". X-Git-Tag: collectd-5.7.0~114^2 X-Git-Url: https://git.octo.it/?p=collectd.git;a=commitdiff_plain;h=2653da4259ec55e133cb77c46ed0d07829253cfd grpc plugin: Rename "DispatchValues" to "PutValues". This is done to use a naming closer to that of the unixsock and exec plugins. --- diff --git a/proto/collectd.proto b/proto/collectd.proto index 917c5deb..614d1bd0 100644 --- a/proto/collectd.proto +++ b/proto/collectd.proto @@ -30,25 +30,25 @@ option go_package = "collectd.org/rpc/proto"; import "types.proto"; service Collectd { - // DispatchValues reads the value lists from the DispatchValuesRequest stream. + // PutValues reads the value lists from the PutValuesRequest stream. // The gRPC server embedded into collectd will inject them into the system // just like the network plugin. - rpc DispatchValues(stream DispatchValuesRequest) - returns (DispatchValuesResponse); + rpc PutValues(stream PutValuesRequest) + returns (PutValuesResponse); // QueryValues returns a stream of matching value lists from collectd's // internal cache. rpc QueryValues(QueryValuesRequest) returns (stream QueryValuesResponse); } -// The arguments to DispatchValues. -message DispatchValuesRequest { +// The arguments to PutValues. +message PutValuesRequest { // value_list is the metric to be sent to the server. collectd.types.ValueList value_list = 1; } -// The response from DispatchValues. -message DispatchValuesResponse {} +// The response from PutValues. +message PutValuesResponse {} // The arguments to QueryValues. message QueryValuesRequest { diff --git a/src/grpc.cc b/src/grpc.cc index 8b76954d..3b1891fa 100644 --- a/src/grpc.cc +++ b/src/grpc.cc @@ -47,8 +47,8 @@ extern "C" { using collectd::Collectd; -using collectd::DispatchValuesRequest; -using collectd::DispatchValuesResponse; +using collectd::PutValuesRequest; +using collectd::PutValuesResponse; using collectd::QueryValuesRequest; using collectd::QueryValuesResponse; @@ -283,10 +283,10 @@ public: return status; } - grpc::Status DispatchValues(grpc::ServerContext *ctx, - grpc::ServerReader *reader, - DispatchValuesResponse *res) override { - DispatchValuesRequest req; + grpc::Status PutValues(grpc::ServerContext *ctx, + grpc::ServerReader *reader, + PutValuesResponse *res) override { + PutValuesRequest req; while (reader->Read(&req)) { value_list_t vl = VALUE_LIST_INIT; @@ -426,18 +426,18 @@ public: CollectdClient(std::shared_ptr channel) : stub_(Collectd::NewStub(channel)) { } - int DispatchValues(value_list_t const *vl) { + int PutValues(value_list_t const *vl) { grpc::ClientContext ctx; - DispatchValuesRequest req; + PutValuesRequest req; auto status = marshal_value_list(vl, req.mutable_value_list()); if (!status.ok()) { ERROR("grpc: Marshalling value_list_t failed."); return -1; } - DispatchValuesResponse res; - auto stream = stub_->DispatchValues(&ctx, &res); + PutValuesResponse res; + auto stream = stub_->PutValues(&ctx, &res); if (!stream->Write(req)) { NOTICE("grpc: Broken stream."); /* intentionally not returning. */ @@ -451,7 +451,7 @@ public: } return 0; - } /* int DispatchValues */ + } /* int PutValues */ private: std::unique_ptr stub_; @@ -471,7 +471,7 @@ extern "C" { value_list_t const *vl, user_data_t *ud) { CollectdClient *c = (CollectdClient *) ud->data; - return c->DispatchValues(vl); + return c->PutValues(vl); } static int c_grpc_config_listen(oconfig_item_t *ci)