-
Notifications
You must be signed in to change notification settings - Fork 43
Labels
common-builderMigration to use a common builder struct and interfaceMigration to use a common builder struct and interface
Description
The current implementation of EmbeddableBuilder only supports the minimal methods that every builder must support. Some builders, such as HFCBuilder in pkg/bmh/hfc.go only support these. Some builders which only support these methods do so for good reason, as it makes no sense to have some resources deletable. A similar issue is that force is only a parameter for some Update methods.
We need to figure out a way to embed these methods for only some builders then. Some current ideas to do so:
- worst solution but also easiest is to just define the functions in
pkg/internal/commonthen require builders to create short methods that tail call the common function - maybe we create embeddable builders which compose each other to offer more functions. the more idiomatic version is to have something like
struct { EmbeddableBuilder; EmbeddableDeleter; EmbeddableUpdater }but this would result in fields referencing other fields in the same struct and other weirdness - an alternative to having adjacent builders is a hierarchy of builders. this is just weaponizing composition to create inheritance but seems more viable.
GetGVKandSetGVKmay be a concern - another bad but easy solution is to just implement the methods anyway. it's generally good to prevent users from doing things they shouldn't at compile time and this goes against that. also doesn't handle different signatures very well
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
common-builderMigration to use a common builder struct and interfaceMigration to use a common builder struct and interface