pub trait StrategyLike:
Debug
+ RefUnwindSafe
+ 'static {
// Required method
fn runtimes(&self) -> Runtimes<'_>;
// Provided methods
fn select(&self, constraint: &Constraint) -> Option<Runtime> { ... }
fn fallback(&self) -> Option<Runtime> { ... }
}
Expand description
A strategy for finding PostgreSQL runtimes.
There are a few questions we want to answer:
- What runtimes are available?
- Which of those runtimes is best suited to running a given cluster?
- When there are no constraints, what runtime should we use?
This trait models those questions, and provides default implementations for #2 and #3.
However, a good place to start is the Default
implementation of
Strategy
. It might do what you need.
Required Methods§
Provided Methods§
Sourcefn select(&self, constraint: &Constraint) -> Option<Runtime>
fn select(&self, constraint: &Constraint) -> Option<Runtime>
Determine the most appropriate runtime known to this strategy for the given constraint.
The default implementation narrows the list of runtimes to those that
match the given constraint, then chooses the one with the highest
version number. It might return None
.