Skip to content

Commit fe75205

Browse files
Modify update request to use field mask
Fixes #74 Signed-off-by: Stefan Brus <[email protected]>
1 parent ed77dde commit fe75205

File tree

2 files changed

+62
-19
lines changed

2 files changed

+62
-19
lines changed

RELEASE_NOTES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
## Summary
44

55
- End time has been moved to the recurrence rule object, replaced by `duration` on the base dispatch object.
6+
- Update requests now use a `FieldMask` to indicate which fields should be updated.
67

78
## Upgrading
89

910
- Queries that compare against a time interval filter should check for the end time inside the recurrence rule.
1011
- `end_time` has been renamed `until` and is mutually exclusive with `count`.
12+
- Update request handlers should check the field mask for which attributes to update.
1113

1214
## New Features
1315

1416
- Introduced a new field `duration`.
17+
- Introduced `FieldMask` to the update request.
1518

1619
## Bug Fixes
1720

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

Lines changed: 59 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ syntax = "proto3";
4141
package frequenz.api.dispatch.v1;
4242

4343
import "google/protobuf/empty.proto";
44+
import "google/protobuf/field_mask.proto";
4445
import "google/protobuf/struct.proto";
4546
import "google/protobuf/timestamp.proto";
4647

@@ -332,32 +333,71 @@ message DispatchCreateRequest {
332333

333334
// Message to update the dispatch with the given ID, with the given attributes
334335
message DispatchUpdateRequest {
335-
// The dispatch identifier
336-
uint64 id = 1;
336+
// Message containing the updated dispatch attributes
337+
message DispatchUpdate {
338+
// Message containing the updated recurrence rule attributes
339+
message RecurrenceRuleUpdate {
340+
// The frequency specifier of this recurring dispatch
341+
optional RecurrenceRule.Frequency freq = 1;
337342

338-
// The start time
339-
// When updating a dispatch, ensure that the starting timestamp is set to
340-
// the current time or any future time.
341-
// Timestamps earlier than the current time are not allowed.
342-
google.protobuf.Timestamp start_time = 2;
343+
// How often this dispatch should recur, based on the frequency
344+
optional uint32 interval = 2;
343345

344-
// Duration in seconds
345-
optional uint32 duration = 3;
346+
// When this dispatch should end.
347+
RecurrenceRule.EndCriteria end_criteria = 3;
346348

347-
// The component selector
348-
ComponentSelector selector = 4;
349+
// On which minute(s) of the hour does the event occur
350+
repeated uint32 byminutes = 4;
349351

350-
// The "active" status
351-
optional bool is_active = 5;
352+
// On which hour(s) of the day does the event occur
353+
repeated uint32 byhours = 5;
352354

353-
// The "dry run" status
354-
optional bool is_dry_run = 6;
355+
// On which day(s) of the week does the event occur
356+
repeated RecurrenceRule.Weekday byweekdays = 6;
355357

356-
// The dispatch payload
357-
google.protobuf.Struct payload = 7;
358+
// On which day(s) of the month does the event occur
359+
repeated uint32 bymonthdays = 7;
358360

359-
// The recurrence rule
360-
RecurrenceRule recurrence = 8;
361+
// On which month(s) of the year does the event occur
362+
repeated uint32 bymonths = 8;
363+
}
364+
365+
// The type of dispatch
366+
optional string type = 1;
367+
368+
// The start time
369+
// When updating a dispatch, ensure that the starting timestamp is set to
370+
// the current time or any future time.
371+
// Timestamps earlier than the current time are not allowed.
372+
google.protobuf.Timestamp start_time = 2;
373+
374+
// Duration in seconds
375+
optional uint32 duration = 3;
376+
377+
// The component selector
378+
ComponentSelector selector = 4;
379+
380+
// The "active" status
381+
optional bool is_active = 5;
382+
383+
// The "dry run" status
384+
optional bool is_dry_run = 6;
385+
386+
// The dispatch payload
387+
google.protobuf.Struct payload = 7;
388+
389+
// The recurrence rule
390+
RecurrenceRuleUpdate recurrence = 8;
391+
}
392+
393+
// The dispatch identifier
394+
uint64 id = 1;
395+
396+
// Field mask specifying which fields should be updated
397+
google.protobuf.FieldMask update_mask = 2;
398+
399+
// The updated dispatch attributes
400+
DispatchUpdate update = 3;
361401
}
362402

363403
// Message to get a single dispatch by its ID

0 commit comments

Comments
 (0)