Skip to content

Commit ed77dde

Browse files
Move end_time to RecurrenceRule and add duration field (#78)
Fixes #71
2 parents 532b2db + 10a859c commit ed77dde

File tree

2 files changed

+29
-16
lines changed

2 files changed

+29
-16
lines changed

RELEASE_NOTES.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
## Summary
44

5-
This release is mainly about updating the names of some objects, and improving documentation.
5+
- End time has been moved to the recurrence rule object, replaced by `duration` on the base dispatch object.
66

77
## Upgrading
88

9-
- Service and its methods have been renamed to `MicrogridDispatchService`
10-
- `DispatchComponentSelector` has been renamed to `ComponentSelector`
11-
- `DispatchComponentIDs` has been renamed to `ComponentIDs`
9+
- Queries that compare against a time interval filter should check for the end time inside the recurrence rule.
10+
- `end_time` has been renamed `until` and is mutually exclusive with `count`.
1211

1312
## New Features
1413

15-
- `DispatchFilter` now supports filtering by `is_active` and `is_dry_run`
14+
- Introduced a new field `duration`.
1615

1716
## Bug Fixes
1817

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

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ message Dispatch {
9292
// The start time in UTC
9393
google.protobuf.Timestamp start_time = 6;
9494

95-
// The end time in UTC
96-
google.protobuf.Timestamp end_time = 7;
95+
// Duration in seconds
96+
uint32 duration = 7;
9797

9898
// The component selector
9999
ComponentSelector selector = 8;
@@ -129,10 +129,10 @@ message TimeIntervalFilter {
129129
// Filter by start_time < this timestamp
130130
google.protobuf.Timestamp start_to = 2;
131131

132-
// Filter by end_time >= this timestamp
132+
// Filter by recurrence.end_time >= this timestamp
133133
google.protobuf.Timestamp end_from = 3;
134134

135-
// Filter by end_time < this timestamp
135+
// Filter by recurrence.end_time < this timestamp
136136
google.protobuf.Timestamp end_to = 4;
137137
}
138138

@@ -219,6 +219,19 @@ message RecurrenceRule {
219219
FREQUENCY_MONTHLY = 5;
220220
}
221221

222+
// Controls when a recurring dispatch should end
223+
message EndCriteria {
224+
oneof count_or_until {
225+
// The number of times this dispatch should recur.
226+
// If this field is set, the dispatch will recur the given number of times.
227+
uint32 count = 1;
228+
229+
// The end time of this dispatch in UTC.
230+
// If this field is set, the dispatch will recur until the given timestamp.
231+
google.protobuf.Timestamp until = 2;
232+
}
233+
}
234+
222235
// The frequency specifier of this recurring dispatch
223236
Frequency freq = 1;
224237

@@ -229,9 +242,10 @@ message RecurrenceRule {
229242
// interval = 2
230243
uint32 interval = 2;
231244

232-
// (Optional) limit the number of occurences
233-
// If this field is not set, the dispatch will recur indefinitely
234-
optional uint32 count = 3;
245+
// When this dispatch should end.
246+
// A dispatch can either recur a fixed number of times, or until a given timestamp.
247+
// If this field is not set, the dispatch will recur indefinitely.bool
248+
EndCriteria end_criteria = 3;
235249

236250
// On which minute(s) of the hour does the event occur
237251
repeated uint32 byminutes = 4;
@@ -297,8 +311,8 @@ message DispatchCreateRequest {
297311
// Timestamps earlier than the current time are not allowed.
298312
google.protobuf.Timestamp start_time = 3;
299313

300-
// The end time
301-
google.protobuf.Timestamp end_time = 4;
314+
// Duration in seconds
315+
uint32 duration = 4;
302316

303317
// The component selector
304318
ComponentSelector selector = 5;
@@ -327,8 +341,8 @@ message DispatchUpdateRequest {
327341
// Timestamps earlier than the current time are not allowed.
328342
google.protobuf.Timestamp start_time = 2;
329343

330-
// The end time
331-
google.protobuf.Timestamp end_time = 3;
344+
// Duration in seconds
345+
optional uint32 duration = 3;
332346

333347
// The component selector
334348
ComponentSelector selector = 4;

0 commit comments

Comments
 (0)