Skip to content

Commit 66c21eb

Browse files
authored
Rename & Restructure ComponentSelector (#189)
- Rename the field names so both are plural - Nest the sub-messages and remove "Component" prefix - Use `Set` suffix - Add examples
2 parents 2d6d300 + a2cd69d commit 66c21eb

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
@@ -302,31 +302,35 @@ message DispatchFilter {
302302

303303
// Parameter for controlling which components a dispatch applies to
304304
// either a set of component IDs, or a set of component categories.
305+
// Examples:
306+
// - To dispatch to a set of component IDs:
307+
// selector { component_ids { ids: [1, 2, 3] } }
308+
// - To dispatch to a set of component categories:
309+
// selector { component_categories { categories: [COMPONENT_CATEGORY_BATTERY, COMPONENT_CRYPTO_MINER] } }
305310
message ComponentSelector {
306-
oneof selector {
311+
// Wrapper for controlling dispatches with a set of component IDs
312+
// Required as we can't use `repeated` directly in a `oneof`
313+
message IdSet {
307314
// Set of component IDs
308-
ComponentIDs component_ids = 1;
315+
repeated uint64 ids = 1;
316+
}
309317

310-
// Component categories
311-
ComponentCategories component_category = 2;
318+
// Wrapper for controlling dispatches with a set of component categories
319+
// Required as we can't use `repeated` directly in a `oneof`
320+
message CategorySet {
321+
// Set of component categories
322+
repeated frequenz.api.common.v1.microgrid.components.ComponentCategory categories = 1;
312323
}
313-
}
314324

315-
// Wrapper for controlling dispatches with a set of component IDs
316-
// Required as we can't use `repeated` directly in a `oneof`
317-
message ComponentIDs {
318-
// Set of component IDs
319-
repeated uint64 component_ids = 1;
320-
}
325+
oneof selector {
326+
// Set of component IDs
327+
IdSet component_ids = 1;
321328

322-
// Wrapper for controlling dispatches with a set of component categories
323-
// Required as we can't use `repeated` directly in a `oneof`
324-
message ComponentCategories {
325-
// Set of component categories
326-
repeated frequenz.api.common.v1.microgrid.components.ComponentCategory component_categories = 1;
329+
// Component categories
330+
CategorySet component_categories = 2;
331+
}
327332
}
328333

329-
330334
// Ruleset governing when and how a dispatch should re-occur.
331335
//
332336
// Timezone Note: Timestamps are in UTC. It is the responsibility of each microgrid to translate UTC

0 commit comments

Comments
 (0)