old_mixer_repo
old_mixer_repo copied to clipboard
Make the new adapter interface consistent
Today we have these two methods:
// map name->Type
ConfigureFooHandler(map[string]*foo.Type) error
// foo.Instance has a "Name" field
HandleFoo(context.Context, []*foo.Instance) error
We should be consistent, either:
A) foo.Type
needs a Name
field
// foo.Type has a "Name" field
ConfigureFooHandler([]*foo.Type) error
// foo.Instance has a "Name" field
HandleFoo(context.Context, []*foo.Instance) error
B) We pull the Name
field out of foo.Instance
// map name->Type
ConfigureFooHandler(map[string]*foo.Type) error
// map name->Instance
HandleFoo(context.Context, map[string][]*foo.Instance) error
As-is the asymmetry feels inconsistent.
cc @guptasu @geeknoid
The second form would need to be:
HandleFoo(context.Context, map[string][]*foo.Instance)
since there can be multiple instances for a given type.
I disagree that there is an issue here. The data being provided is in the most directly meaningful form for the adapter author.
I do think we should add a Name field to the Type objects such that Type objects can be self-contained.
Can this be closed?
We need to add Name to Type too. I need to fix that.