From: Florian Forster Date: Fri, 29 Jul 2016 09:27:08 +0000 (+0200) Subject: grpc plugin: Unify field names. X-Git-Tag: collectd-5.6.0~54^2~10 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=6754150119aaced4f7d39c2641c61d47aa84a436;p=collectd.git grpc plugin: Unify field names. Fields holding a ValueList are now called "value_list", fields holding a Value are now called "value". Repeated fields use the plural form. --- diff --git a/proto/collectd.proto b/proto/collectd.proto index 5134dbfd..4bc35013 100644 --- a/proto/collectd.proto +++ b/proto/collectd.proto @@ -38,7 +38,7 @@ service Collectd { // The arguments to DispatchValues. message DispatchValuesRequest { - collectd.types.ValueList values = 1; + collectd.types.ValueList value_list = 1; } // The response from DispatchValues. @@ -55,5 +55,5 @@ message QueryValuesRequest { // The response from QueryValues. message QueryValuesReply { - repeated collectd.types.ValueList values = 1; + repeated collectd.types.ValueList value_lists = 1; } diff --git a/proto/types.proto b/proto/types.proto index 4a852e42..5d82a5b9 100644 --- a/proto/types.proto +++ b/proto/types.proto @@ -47,7 +47,7 @@ message Value { } message ValueList { - repeated Value value = 1; + repeated Value values = 1; google.protobuf.Timestamp time = 2; google.protobuf.Duration interval = 3; diff --git a/src/grpc.cc b/src/grpc.cc index ae3dab25..905e403b 100644 --- a/src/grpc.cc +++ b/src/grpc.cc @@ -172,7 +172,7 @@ static grpc::Status marshal_value_list(const value_list_t *vl, collectd::types:: msg->set_allocated_interval(new google::protobuf::Duration(d)); for (size_t i = 0; i < vl->values_len; ++i) { - auto v = msg->add_value(); + auto v = msg->add_values(); switch (ds->ds[i].type) { case DS_TYPE_COUNTER: v->set_counter(vl->values[i].counter); @@ -208,7 +208,7 @@ static grpc::Status unmarshal_value_list(const collectd::types::ValueList &msg, size_t values_len = 0; status = grpc::Status::OK; - for (auto v : msg.value()) { + for (auto v : msg.values()) { value_t *val = (value_t *)realloc(values, (values_len + 1) * sizeof(*values)); if (!val) { status = grpc::Status(grpc::StatusCode::RESOURCE_EXHAUSTED, @@ -261,7 +261,7 @@ static grpc::Status Process(grpc::ServerContext *ctx, DispatchValuesRequest request, DispatchValuesReply *reply) { value_list_t vl = VALUE_LIST_INIT; - auto status = unmarshal_value_list(request.values(), &vl); + auto status = unmarshal_value_list(request.value_list(), &vl); if (!status.ok()) return status; @@ -315,7 +315,7 @@ static grpc::Status Process(grpc::ServerContext *ctx, break; } - auto vl = reply->add_values(); + auto vl = reply->add_value_lists(); status = marshal_value_list(&res, vl); free(res.values); if (!status.ok())