-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
reconciler: Move Table from Params to Config
With Hive you cannot currently have more than one private provider for the same type, even when they're in different scopes. Move the Table from Params to Config so that the table can be provided manually and not via Hive for situations where the table cannot be provided via Hive. The exact setup where this problem occurred was: // module 1 var Cell = cell.Module(..., cell.ProvidePrivate(NewRWTableFoo), cell.Provide(NewWriter), ), type Writer struct { table RWTable[Foo] } func NewWriter(t RWTable[Foo]) *Writer func (w *Writer) UnsafeRWTable() RWTable[Foo] { return w.table } // module 2 var Cell = cell.Module(..., cell.ProvidePrivate((*m1.Writer).UnsafeRWTable), cell.Invoke(reconciler.Register[Foo]), ) The above lead to: level=fatal msg="Failed to apply cell" error="cannot provide function \"...UnsafeRWTable: this function introduces a cycle (long error about NewWriter depending on RWTable[Foo] provided by UnsafeRWTable) Hive's (uber/dig's) cycle detection doesn't seem to care about the private providers, and thinks the private provide of "module 2" can be reached by "NewWriter" in module 1. So to fix this and add more flexibility, just make the table a config parameter. Signed-off-by: Jussi Maki <[email protected]>
- Loading branch information
Showing
7 changed files
with
37 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters