You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement graceful switch balancer other LB-related changes.
General:
- Add Debug to many traits and derive/impl in structs.
- Pass LB config to LB policies via `Option<LbConfig>` instead of
`Option<&LbConfig>`. It should be rare that policies want to store
a config except for the leaf policy.
Child manager:
The original assumption was that all children would be the same
type/configuration, but several policies (including gracefulswitch)
will not have that property. So, several changes are made:
- Children are considered unique by both their identifier and their
LbPolicyBuilder's name().
- Make it so the sharder also can shard LbConfig and provide it via
the ChildUpdate.child_update field in addition to the
ResolverUpdate.
- Make ResolverUpdateSharder a generic instead of Box<dyn>.
- Add booleans so users of child manager can easily easily tell
whether any child policies updated themselves, and which ones did.
- Pass &mut self for sharder so that it can maintain and update its
state if needed.
- Change the sharder's output ChildUpdate.child_update field to an
Option; if None then the child will not be called during the
resolver update, but will remain in the child manager.
- Change child_states into children and provide the whole Child
struct, exposing the fields it contains.
- Provide mutable access to the sharder.
- Change the LB config to be a flat JSON array to facilitate use
within another LB policy that should not need a struct to contain on
the children.
- Minor test cleanups
Graceful switch:
The previous implementation in hyperium#2399 contained a lot of logic to
manage child policy delegation. It was intended that only
ChildManager should need to have this kind of logic.
- Create a new implementation of this policy that delegates to
ChildManager.
- Uses a Sharder that simply emits the active policy with no update
alongside any new policy in the new LbConfig.
- maybe_swap is called after every call into the ChildManager to
determine if child updates necessitate a swap.
- This logic is simple: if the active policy is not Ready, or if there
is a new policy and it is not Connecting, then set the new policy as
the active policy and call resolver_update on the ChildManager. The
sharder will see that no LbConfig is provided and just emit the
active policy with no config, causing the ChildManager to drop the
previously active policy. If no swap is needed, update the picker
of the active policy if it had an update.
- Minor test cleanups/fixes vs. hyperium#2399.
0 commit comments