Module pgdo::coordinate::resource

source ·
Expand description

Manage a resource that can be started, stopped, and destroyed – i.e. a Subject – and which has different facets depending on whether it is locked exclusively, shared between multiple users, or unlocked/free.

For example, a resource representing a PostgreSQL cluster would allow start, stop, and destroy actions only when it is exclusively locked. The type of an unlocked cluster resource or a shared cluster resource would not even have functions available to start, stop, or destroy the cluster.

The intent is to codify safe behaviours into Rust’s type system so that we make it hard or impossible to mishandle a resource – and conversely, easier to correctly handle a resource.

Structs

Traits

  • A resource is faceted into three types: free, shared, and exclusive. This trait allows us to obtain the three facets of a resource.