Skip to content

Commit 0246a54

Browse files
committed
Split Dispatch into metadata and data
refs #166 Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent cd71167 commit 0246a54

File tree

1 file changed

+33
-51
lines changed

1 file changed

+33
-51
lines changed

proto/frequenz/api/dispatch/v1/dispatch.proto

Lines changed: 33 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -70,46 +70,35 @@ service MicrogridDispatchService {
7070
rpc DeleteMicrogridDispatch(DispatchDeleteRequest) returns (google.protobuf.Empty);
7171
}
7272

73-
// Message representing one dispatch.
73+
// Represents a dispatches data, including its type, start time, duration, component selector,
7474
//
7575
// Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC
7676
// to its local timezone.
7777
message Dispatch {
78-
// The dispatch identifier
79-
uint64 id = 1;
80-
81-
// The microgrid identifier
82-
uint64 microgrid_id = 2;
83-
8478
// The dispatch type.
8579
// Contains user-defined information about what "type" of dispatch this is.
8680
// Downstream applications that consume the dispatch API are responsible for
8781
// understanding and processing this field.
88-
string type = 3;
89-
90-
// The creation time in UTC
91-
// This is set when a dispatch is created via the create request message
92-
google.protobuf.Timestamp create_time = 4;
82+
string type = 1;
9383

94-
// The update time in UTC
95-
// This is set when a dispatch is modified via the update request message
96-
google.protobuf.Timestamp update_time = 5;
97-
98-
// The start time in UTC
99-
google.protobuf.Timestamp start_time = 6;
84+
// The dispatch start time in UTC.
85+
// For reoccuring dispatches this is when the first time execution occurs. When
86+
// creating a dispatch, ensure that the starting timestamp is set to the current
87+
// time or any future time. Timestamps earlier than the current time are not allowed.
88+
google.protobuf.Timestamp start_time = 2;
10089

10190
// Duration in seconds
102-
uint32 duration = 7;
91+
optional uint32 duration = 3;
10392

104-
// The component selector
105-
ComponentSelector selector = 8;
93+
// Dispatch microgrid component selector
94+
ComponentSelector selector = 4;
10695

10796
// The "active" status
10897
// An active dispatch is eligible for processing, either immediately or at a scheduled
10998
// time in the future, including recurring dispatches. If a dispatch is set to
11099
// inactive, it won't be processed even if it matches all other conditions, allowing
111100
// for temporary disabling of dispatches without deletion.
112-
bool is_active = 9;
101+
bool is_active = 5;
113102

114103
// The "dry run" status
115104
// A dry run dispatch is executed for logging and monitoring purposes
@@ -118,13 +107,28 @@ message Dispatch {
118107
// actually affecting any component states.
119108
// Notably, a dispatch can be both "dry run" and "active," allowing for
120109
// the system to generate logs and observe behavior without making actual changes.
121-
bool is_dry_run = 10;
110+
bool is_dry_run = 6;
122111

123112
// The dispatch payload
124-
google.protobuf.Struct payload = 11;
113+
google.protobuf.Struct payload = 7;
125114

126115
// The recurrence rule
127-
RecurrenceRule recurrence = 12;
116+
RecurrenceRule recurrence = 8;
117+
}
118+
119+
// Represents a dispatch, including its metadata
120+
message DispatchDetail {
121+
// Unique identifier of the microgrid dispatch.
122+
uint64 dispatch_id = 1;
123+
124+
// The dispatch data
125+
Dispatch dispatch = 2;
126+
127+
// UTC Timestamp when the order was created.
128+
google.protobuf.Timestamp create_time = 3;
129+
130+
// UTC Timestamp of the last update to the order.
131+
google.protobuf.Timestamp modification_time = 4;
128132
}
129133

130134
// Filter parameter for specifying multiple time intervals
@@ -317,40 +321,18 @@ message DispatchFilter {
317321
// A list of dispatches
318322
message DispatchList {
319323
// The dispatches
320-
repeated Dispatch dispatches = 1;
324+
repeated DispatchDetail dispatches = 1;
321325
}
322326

323327
// Message to create a new dispatch with the given attributes
324328
message DispatchCreateRequest {
325329
// The microgrid identifier
326330
uint64 microgrid_id = 1;
327331

328-
// The type of dispatch
329-
string type = 2;
330-
331-
// The start time
332-
// When creating a dispatch, ensure that the starting timestamp is set to
333-
// the current time or any future time.
334-
// Timestamps earlier than the current time are not allowed.
335-
google.protobuf.Timestamp start_time = 3;
336-
337-
// Duration in seconds
338-
uint32 duration = 4;
339-
340-
// The component selector
341-
ComponentSelector selector = 5;
342-
343-
// The "active" status
344-
bool is_active = 6;
345-
346-
// The "dry run" status
347-
bool is_dry_run = 7;
348-
349-
// The dispatch payload
350-
google.protobuf.Struct payload = 8;
332+
// Content of the dispatch to be created
333+
Dispatch dispatch = 2;
334+
}
351335

352-
// The recurrence rule
353-
RecurrenceRule recurrence = 9;
354336
}
355337

356338
// Message to update the dispatch with the given ID, with the given attributes

0 commit comments

Comments
 (0)