From c05ffdbf841a9ed953e65b1f156bb98197dd15b5 Mon Sep 17 00:00:00 2001 From: Matteo Parmi Date: Mon, 13 Nov 2023 16:45:33 +0100 Subject: [PATCH] Bug: Use int64 for topology's createdAt. (#16) ## Description Use int64 for topology's createdAt. ## Changes Made ## Related Issues ## Checklist - [ ] I have used a PR title that is descriptive enough for a release note. - [ ] I have tested these changes locally. - [ ] I have added appropriate tests or updated existing tests. - [ ] I have tested these changes on a dedicated VM or a customer VM [name of the VM] - [ ] I have added appropriate documentation or updated existing documentation. --------- Co-authored-by: Bot Co-authored-by: tejo --- RELEASE_NOTES.md | 27 ++++----------------------- docs/topology.proto.md | 10 +++++----- pkg/grid/v1/topology.pb.go | 8 ++++---- pkg/grid/v1/topology_test.go | 2 +- proto/grid/v1/topology.proto | 4 ++-- 5 files changed, 16 insertions(+), 35 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 245b447..fda3d8e 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,31 +1,12 @@ # ProtoBuf Release Notes -## 0.0.2-dev - 2023-11-09 - -### Documentation - -- Update documentation to reflect protocol buffer refactoring (PR #15 by - @chicco785) - -## 0.0.1 - 2023-10-27 - -### Features - -- New protocol buffer for topology data (PR #12 by @chicco785) -- Notification message: support Trigger requirements (PR #6 by @chicco785) -- Add protocol buffer to describe faults (PR #3 by @chicco785) +## 0.0.2-dev - 2023-11-13 ### Bug Fixes -- fix typo in `Fault` field `faultCurrent` (PR #7 by @tejo) - -### Continuous Integration +- Bug: Use int64 for topology's createdAt. (PR #16 by @tejo) -- Use new shared workflow for Golang (PR #11 by @chicco785) - -### Refactoring +### Documentation -- Refactor protobuffer to align with architecture discussion (PR #9 by +- Update documentation to reflect protocol buffer refactoring (PR #15 by @chicco785) -- Migrate existing protobuf from - `https://github.com/zaphiro-technologies/rabbitmq-poc` (PR #2 by @chicco785) diff --git a/docs/topology.proto.md b/docs/topology.proto.md index 70093e9..a480a18 100644 --- a/docs/topology.proto.md +++ b/docs/topology.proto.md @@ -34,7 +34,7 @@ direction LR %% class Topology { - + uint64 createdAt + + int64 createdAt + bytes tp } @@ -45,10 +45,10 @@ class Topology {
A topology computed information.
Headers used in rabbitMQ:
* `id`: id of the `Topology`
* `type`: always `Topology`
* `producerId`: the id of the producer (e.g. a PMU) linked to the dataset.
* `timestampId`: related measurement Unix msec timestamp (if any)
* `subnetworkId`: the sub network id for which the topology was computed

-| Field | Ordinal | Type | Label | Description | -|-----------|---------|--------|-------|-------------------------------------------------------------------| -| createdAt | 1 | uint64 | | The time of creation of the topology data (Unix msec timestamp). | -| tp | 2 | bytes | | The TP profile file serialized as bytes. | +| Field | Ordinal | Type | Label | Description | +|-----------|---------|-------|-------|-------------------------------------------------------------------| +| createdAt | 1 | int64 | | The time of creation of the topology data (Unix msec timestamp). | +| tp | 2 | bytes | | The TP profile file serialized as bytes. | diff --git a/pkg/grid/v1/topology.pb.go b/pkg/grid/v1/topology.pb.go index aa7ce3c..78281a9 100644 --- a/pkg/grid/v1/topology.pb.go +++ b/pkg/grid/v1/topology.pb.go @@ -28,8 +28,8 @@ type Topology struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - CreatedAt uint64 `protobuf:"varint,1,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //The time of creation of the topology data (Unix msec timestamp). - Tp []byte `protobuf:"bytes,2,opt,name=tp,proto3" json:"tp,omitempty"` //The TP profile file serialized as bytes. + CreatedAt int64 `protobuf:"varint,1,opt,name=createdAt,proto3" json:"createdAt,omitempty"` // The time of creation of the topology data (Unix msec timestamp). + Tp []byte `protobuf:"bytes,2,opt,name=tp,proto3" json:"tp,omitempty"` // The TP profile file serialized as bytes. } func (x *Topology) Reset() { @@ -64,7 +64,7 @@ func (*Topology) Descriptor() ([]byte, []int) { return file_proto_grid_v1_topology_proto_rawDescGZIP(), []int{0} } -func (x *Topology) GetCreatedAt() uint64 { +func (x *Topology) GetCreatedAt() int64 { if x != nil { return x.CreatedAt } @@ -85,7 +85,7 @@ var file_proto_grid_v1_topology_proto_rawDesc = []byte{ 0x74, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x67, 0x72, 0x69, 0x64, 0x2e, 0x76, 0x31, 0x22, 0x38, 0x0a, 0x08, 0x54, 0x6f, 0x70, 0x6f, 0x6c, 0x6f, 0x67, 0x79, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x02, 0x74, 0x70, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x67, 0x72, 0x69, 0x64, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, diff --git a/pkg/grid/v1/topology_test.go b/pkg/grid/v1/topology_test.go index a6023e0..8afc72b 100644 --- a/pkg/grid/v1/topology_test.go +++ b/pkg/grid/v1/topology_test.go @@ -14,7 +14,7 @@ func generateTopology(timestamp int64) *Topology { tp, _ := os.ReadFile("FullGrid_TP.xml") // read the content of file return &Topology{ - CreatedAt: uint64(timestamp), + CreatedAt: timestamp, Tp: tp, } } diff --git a/proto/grid/v1/topology.proto b/proto/grid/v1/topology.proto index 3d50317..557dfe1 100644 --- a/proto/grid/v1/topology.proto +++ b/proto/grid/v1/topology.proto @@ -17,6 +17,6 @@ Headers used in rabbitMQ: */ message Topology { - uint64 createdAt = 1; //The time of creation of the topology data (Unix msec timestamp). - bytes tp = 2; //The TP profile file serialized as bytes. + int64 createdAt = 1; // The time of creation of the topology data (Unix msec timestamp). + bytes tp = 2; // The TP profile file serialized as bytes. }