Skip to content

Commit 08fd5c3

Browse files
committed
Add RPC streaming methods
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 92a911e commit 08fd5c3

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

RELEASE_NOTES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ In this release, we have made some changes to the API to improve the user experi
1717
* Create and Update request now returns the new dispatch object.
1818
* Documentation about authentication and encryption was added.
1919
* Enhanced `payload` documentation.
20+
* Add RPC streaming methods.
2021
* Add YEARLY frequency to the recurrence definition.
2122
* Add parameters for pagination and sorting.
2223
* Documentation of valid values for `count` and `interval` fields was added.

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

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ service MicrogridDispatchService {
6767
// Returns a list of all dispatches
6868
rpc ListMicrogridDispatches(ListMicrogridDispatchesRequest) returns (ListMicrogridDispatchesResponse);
6969

70+
// Streaming RPC for receiving dispatch updates for a given microgrid
71+
rpc StreamMicrogridDispatches(StreamMicrogridDispatchesRequest) returns (stream StreamMicrogridDispatchesResponse);
72+
7073
// Create a new dispatch
7174
rpc CreateMicrogridDispatch(CreateMicrogridDispatchRequest) returns (CreateMicrogridDispatchResponse);
7275

@@ -80,6 +83,38 @@ service MicrogridDispatchService {
8083
rpc DeleteMicrogridDispatch(DeleteMicrogridDispatchRequest) returns (DeleteMicrogridDispatchResponse);
8184
}
8285

86+
// Subscribe to a stream of microgrid dispatch requests.
87+
// This method provides real-time updates on newly or updated dispatch requests for edge-based
88+
// realtime decision making.
89+
message StreamMicrogridDispatchesRequest {
90+
// ID of the microgrid to subscribe to
91+
uint64 microgrid_id = 1;
92+
}
93+
94+
// Response to a subscription request for a stream of microgrid dispatches.
95+
// Real-time information on dispatches affecting a certain microgrid are pushed through this response.
96+
message StreamMicrogridDispatchesResponse {
97+
enum Event {
98+
// Default, unspecified event
99+
EVENT_UNSPECIFIED = 0;
100+
101+
// A new dispatch has been created
102+
EVENT_CREATED = 1;
103+
104+
// An existing dispatch has been updated
105+
EVENT_UPDATED = 2;
106+
107+
// An existing dispatch has been deleted
108+
EVENT_DELETED = 3;
109+
}
110+
111+
// Dispatch record returned.
112+
DispatchDetail dispatch_detail = 1;
113+
114+
// Which event this response was triggered by
115+
Event event = 2;
116+
}
117+
83118
// Represents a dispatches data, including its type, start time, duration, component selector,
84119
//
85120
// Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC

0 commit comments

Comments
 (0)