attestantio / vouch

Apache License 2.0
112 stars 28 forks source link

[Feature Request] Composite Strategy #139

Closed ThomasDalla closed 8 months ago

ThomasDalla commented 1 year ago

When we have a mix of local/nearby and remote/distant nodes, it would be great if we could use a composite strategy mixing first and best.

For example, let's say we have 3 nodes: 2 "nearby" (A, B) and one "distant" (C). An interesting strategy in this case would be to use the best of (A, B) but also the first between these two and C, so that if A and B are down, C is at the rescue: first( best( A, B ), C ).

mcdee commented 1 year ago

Complex strategies can be overly complex, for example with the strategy above if A returned first and C returned second, this would ignore the result from A in favour of that from C regardless even if the result from A was better for the network.

The best strategies have the concept of a soft timeout, where half way through the full timeout period the strategy checks to see if it has any results, and if so returns the best result to date rather than wait for the entire timeout period for a possibly non-responsive node. This allows you to have "near" and "far" nodes, and not having to wait for the far node if there is useful data with which to work by the soft timeout.

gary-rowe commented 8 months ago

Should we consider closing this issue due to inactivity?