pub trait RuntimeStrategy: 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:

  1. What runtimes are available?
  2. Which of those runtimes is best suited to running a given cluster?
  3. When there are no version constraints, what runtime should we use?

This trait models those questions, and provides default implementations for #2 and #3.

Required Methods§

source

fn runtimes(&self) -> Runtimes<'_>

Find all runtimes that this strategy knows about.

Provided Methods§

source

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.

source

fn fallback(&self) -> Option<Runtime>

The runtime to use when there are no version constraints, e.g. when creating a new cluster.

The default implementation selects the runtime with the highest version number.

Implementors§