Skip to content

Commit a2cd69d

Browse files
committed
Rename & Restructure ComponentSelector
- Rename the field names so both are plural - Nest the sub-messages and remove "Component" prefix - Use `Set` suffix - Add examples Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 7c8f726 commit a2cd69d

File tree

1 file changed

+21
-17
lines changed

1 file changed

+21
-17
lines changed

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

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -258,31 +258,35 @@ message DispatchFilter {
258258

259259
// Parameter for controlling which components a dispatch applies to
260260
// either a set of component IDs, or a set of component categories.
261+
// Examples:
262+
// - To dispatch to a set of component IDs:
263+
// selector { component_ids { ids: [1, 2, 3] } }
264+
// - To dispatch to a set of component categories:
265+
// selector { component_categories { categories: [COMPONENT_CATEGORY_BATTERY, COMPONENT_CRYPTO_MINER] } }
261266
message ComponentSelector {
262-
oneof selector {
267+
// Wrapper for controlling dispatches with a set of component IDs
268+
// Required as we can't use `repeated` directly in a `oneof`
269+
message IdSet {
263270
// Set of component IDs
264-
ComponentIDs component_ids = 1;
271+
repeated uint64 ids = 1;
272+
}
265273

266-
// Component categories
267-
ComponentCategories component_category = 2;
274+
// Wrapper for controlling dispatches with a set of component categories
275+
// Required as we can't use `repeated` directly in a `oneof`
276+
message CategorySet {
277+
// Set of component categories
278+
repeated frequenz.api.common.v1.microgrid.components.ComponentCategory categories = 1;
268279
}
269-
}
270280

271-
// Wrapper for controlling dispatches with a set of component IDs
272-
// Required as we can't use `repeated` directly in a `oneof`
273-
message ComponentIDs {
274-
// Set of component IDs
275-
repeated uint64 component_ids = 1;
276-
}
281+
oneof selector {
282+
// Set of component IDs
283+
IdSet component_ids = 1;
277284

278-
// Wrapper for controlling dispatches with a set of component categories
279-
// Required as we can't use `repeated` directly in a `oneof`
280-
message ComponentCategories {
281-
// Set of component categories
282-
repeated frequenz.api.common.v1.microgrid.components.ComponentCategory component_categories = 1;
285+
// Component categories
286+
CategorySet component_categories = 2;
287+
}
283288
}
284289

285-
286290
// Ruleset governing when and how a dispatch should re-occur.
287291
//
288292
// Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC

0 commit comments

Comments
 (0)