pub trait Strategy: RefUnwindSafe + 'static {
// Required method
fn runtimes(&self) -> Runtimes<'_>;
// Provided methods
fn select(&self, version: &PartialVersion) -> 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 version constraints, what runtime should we use?
This trait models those questions, and provides default implementations for #2 and #3.
A good place to start is default(). It might do what you need.
Required Methods§
Provided Methods§
sourcefn select(&self, version: &PartialVersion) -> Option<Runtime>
fn select(&self, version: &PartialVersion) -> Option<Runtime>
Determine the most appropriate runtime known to this strategy for the given version constraint.
The default implementation narrows the list of runtimes to those that
match the given version constraint, then chooses the one with the
highest version number. It might return None.