diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 928d42f..df0bff7 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,9 +1,10 @@ # ProtoBuf Release Notes -## 0.0.1-dev - 2023-10-11 +## 0.0.1-dev - 2023-10-12 ### Features +- Notification message: support Trigger requirements (PR #6 by @chicco785) - Add protocol buffer to describe faults (PR #3 by @chicco785) ### Refactoring diff --git a/docs/task.proto.md b/docs/task.proto.md index 38bf883..ebcf0a2 100644 --- a/docs/task.proto.md +++ b/docs/task.proto.md @@ -42,6 +42,7 @@ | NOTIFICATION_TYPE_DATA_COMPLETE | 1 | | | NOTIFICATION_TYPE_DATA_TIMEOUT_1 | 2 | | | NOTIFICATION_TYPE_DATA_TIMEOUT_2 | 3 | | +| NOTIFICATION_TYPE_TRIGGER | 4 | | @@ -74,6 +75,7 @@ class NotificationType{ NOTIFICATION_TYPE_DATA_COMPLETE NOTIFICATION_TYPE_DATA_TIMEOUT_1 NOTIFICATION_TYPE_DATA_TIMEOUT_2 + NOTIFICATION_TYPE_TRIGGER } ``` ### Task Diagram @@ -100,7 +102,7 @@ Task --> `TaskType` classDiagram direction LR -%% A notification message. +%% A notification message. Headers used in rabbitMQ: `notificationType` `producerId` `timestampID` class Notification { + int64 createdAt @@ -108,6 +110,7 @@ class Notification { + Optional~string~ measurementID + string message + NotificationType notificationType + + Optional~string~ producerID + Optional~int64~ timestampID } Notification --> `NotificationType` @@ -131,16 +134,17 @@ Notification --> `NotificationType` ## Message: Notification
FQN: task.v1.Notification
-
A notification message.
- -| Field | Ordinal | Type | Label | Description | -|------------------|---------|------------------|----------|---------------------------------------------------| -| createdAt | 3 | int64 | | Notification creation time (Unix Nano timestamp) | -| id | 1 | string | | Id of the notification | -| measurementID | 5 | string | Optional | Related measurement id (if any) | -| message | 4 | string | | Notification message | -| notificationType | 2 | NotificationType | | Notification type | -| timestampID | 6 | int64 | Optional | Related measurement timestamp (if any) | +
A notification message. Headers used in rabbitMQ: `notificationType` `producerId` `timestampID`
+ +| Field | Ordinal | Type | Label | Description | +|------------------|---------|------------------|----------|--------------------------------------------------------------------------------------| +| createdAt | 3 | int64 | | Notification creation time (Unix Nano timestamp) | +| id | 1 | string | | Id of the notification | +| measurementID | 5 | string | Optional | Related measurement id (if any) | +| message | 4 | string | | Notification message, it can be a string or a integer (which maps to a enum value). | +| notificationType | 2 | NotificationType | | Notification type | +| producerID | 7 | string | Optional | The id of the producer (e.g. a PMU) linked to the notification | +| timestampID | 6 | int64 | Optional | Related measurement timestamp (if any) | diff --git a/pkg/task/v1/task.pb.go b/pkg/task/v1/task.pb.go index 9f252d6..44d959f 100644 --- a/pkg/task/v1/task.pb.go +++ b/pkg/task/v1/task.pb.go @@ -87,6 +87,7 @@ const ( NotificationType_NOTIFICATION_TYPE_DATA_COMPLETE NotificationType = 1 NotificationType_NOTIFICATION_TYPE_DATA_TIMEOUT_1 NotificationType = 2 NotificationType_NOTIFICATION_TYPE_DATA_TIMEOUT_2 NotificationType = 3 + NotificationType_NOTIFICATION_TYPE_TRIGGER NotificationType = 4 ) // Enum value maps for NotificationType. @@ -96,12 +97,14 @@ var ( 1: "NOTIFICATION_TYPE_DATA_COMPLETE", 2: "NOTIFICATION_TYPE_DATA_TIMEOUT_1", 3: "NOTIFICATION_TYPE_DATA_TIMEOUT_2", + 4: "NOTIFICATION_TYPE_TRIGGER", } NotificationType_value = map[string]int32{ "NOTIFICATION_TYPE_UNSPECIFIED": 0, "NOTIFICATION_TYPE_DATA_COMPLETE": 1, "NOTIFICATION_TYPE_DATA_TIMEOUT_1": 2, "NOTIFICATION_TYPE_DATA_TIMEOUT_2": 3, + "NOTIFICATION_TYPE_TRIGGER": 4, } ) @@ -219,9 +222,10 @@ type Notification struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` //Id of the notification NotificationType NotificationType `protobuf:"varint,2,opt,name=notificationType,proto3,enum=task.v1.NotificationType" json:"notificationType,omitempty"` //Notification type CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` //Notification creation time (Unix Nano timestamp) - Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` //Notification message + Message string `protobuf:"bytes,4,opt,name=message,proto3" json:"message,omitempty"` //Notification message, it can be a string or a integer (which maps to a enum value). MeasurementID *string `protobuf:"bytes,5,opt,name=measurementID,proto3,oneof" json:"measurementID,omitempty"` //Related measurement id (if any) TimestampID *int64 `protobuf:"varint,6,opt,name=timestampID,proto3,oneof" json:"timestampID,omitempty"` //Related measurement timestamp (if any) + ProducerID *string `protobuf:"bytes,7,opt,name=producerID,proto3,oneof" json:"producerID,omitempty"` //The id of the producer (e.g. a PMU) linked to the notification } func (x *Notification) Reset() { @@ -298,6 +302,13 @@ func (x *Notification) GetTimestampID() int64 { return 0 } +func (x *Notification) GetProducerID() string { + if x != nil && x.ProducerID != nil { + return *x.ProducerID + } + return "" +} + var File_proto_task_v1_task_proto protoreflect.FileDescriptor var file_proto_task_v1_task_proto_rawDesc = []byte{ @@ -316,7 +327,7 @@ var file_proto_task_v1_task_proto_rawDesc = []byte{ 0x70, 0x49, 0x44, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x88, 0x01, 0x01, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x42, 0x0e, 0x0a, - 0x0c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x22, 0x91, 0x02, + 0x0c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x22, 0xc5, 0x02, 0x0a, 0x0c, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x45, 0x0a, 0x10, 0x6e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, @@ -331,30 +342,35 @@ var file_proto_task_v1_task_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x48, 0x00, 0x52, 0x0d, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x88, 0x01, 0x01, 0x12, 0x25, 0x0a, 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x48, 0x01, 0x52, - 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x88, 0x01, 0x01, 0x42, - 0x10, 0x0a, 0x0e, 0x5f, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x49, - 0x44, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, - 0x44, 0x2a, 0x81, 0x01, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x19, - 0x0a, 0x15, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, - 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, 0x14, 0x54, 0x41, 0x53, - 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4c, 0x4c, 0x45, 0x43, 0x54, 0x49, 0x4f, - 0x4e, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, - 0x5f, 0x54, 0x4f, 0x50, 0x4f, 0x4c, 0x4f, 0x47, 0x59, 0x10, 0x02, 0x12, 0x13, 0x0a, 0x0f, 0x54, - 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x45, 0x10, 0x03, - 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x46, 0x41, - 0x55, 0x4c, 0x54, 0x10, 0x04, 0x2a, 0xa6, 0x01, 0x0a, 0x10, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, - 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, 0x0a, 0x1d, 0x4e, 0x4f, - 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, - 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x23, 0x0a, - 0x1f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, - 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x43, 0x4f, 0x4d, 0x50, 0x4c, 0x45, 0x54, 0x45, - 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, - 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x54, 0x49, 0x4d, - 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x31, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, 0x4e, 0x4f, 0x54, 0x49, - 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, - 0x54, 0x41, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x32, 0x10, 0x03, 0x42, 0x0b, - 0x5a, 0x09, 0x2e, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x0b, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x88, 0x01, 0x01, 0x12, + 0x23, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x49, 0x44, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x48, 0x02, 0x52, 0x0a, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x65, 0x72, 0x49, + 0x44, 0x88, 0x01, 0x01, 0x42, 0x10, 0x0a, 0x0e, 0x5f, 0x6d, 0x65, 0x61, 0x73, 0x75, 0x72, 0x65, + 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x42, 0x0e, 0x0a, 0x0c, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x73, + 0x74, 0x61, 0x6d, 0x70, 0x49, 0x44, 0x42, 0x0d, 0x0a, 0x0b, 0x5f, 0x70, 0x72, 0x6f, 0x64, 0x75, + 0x63, 0x65, 0x72, 0x49, 0x44, 0x2a, 0x81, 0x01, 0x0a, 0x08, 0x54, 0x61, 0x73, 0x6b, 0x54, 0x79, + 0x70, 0x65, 0x12, 0x19, 0x0a, 0x15, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, + 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x18, 0x0a, + 0x14, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x43, 0x4f, 0x4c, 0x4c, 0x45, + 0x43, 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x16, 0x0a, 0x12, 0x54, 0x41, 0x53, 0x4b, 0x5f, + 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x4f, 0x50, 0x4f, 0x4c, 0x4f, 0x47, 0x59, 0x10, 0x02, 0x12, + 0x13, 0x0a, 0x0f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x54, 0x41, + 0x54, 0x45, 0x10, 0x03, 0x12, 0x13, 0x0a, 0x0f, 0x54, 0x41, 0x53, 0x4b, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x46, 0x41, 0x55, 0x4c, 0x54, 0x10, 0x04, 0x2a, 0xc5, 0x01, 0x0a, 0x10, 0x4e, 0x6f, + 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x21, + 0x0a, 0x1d, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, + 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, + 0x00, 0x12, 0x23, 0x0a, 0x1f, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, + 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x43, 0x4f, 0x4d, 0x50, + 0x4c, 0x45, 0x54, 0x45, 0x10, 0x01, 0x12, 0x24, 0x0a, 0x20, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, + 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, + 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x31, 0x10, 0x02, 0x12, 0x24, 0x0a, 0x20, + 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, + 0x45, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x5f, 0x54, 0x49, 0x4d, 0x45, 0x4f, 0x55, 0x54, 0x5f, 0x32, + 0x10, 0x03, 0x12, 0x1d, 0x0a, 0x19, 0x4e, 0x4f, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x49, + 0x4f, 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x54, 0x52, 0x49, 0x47, 0x47, 0x45, 0x52, 0x10, + 0x04, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x2f, 0x76, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (