StoreProvider

A backend of the node's stores: what opens a store instance of one type, wow.stores.<name>.type, or the one store wow.backend names. The built-in PostgreSQL (postgres) and MongoDB (mongo) backends are providers as a community backend is; the host finds them on the classpath (ServiceLoader, from the backend module's META-INF/services/me.ahoo.wow.spi.store.StoreProvider) and among the application's beans, a bean taking the place of a provider of its type on the classpath.

A provider is stateless: open gives each store instance its own Store, over the resources StoreConfig.resources finds (a DataSource, a driver's client) and the settings StoreConfig.options holds.

Properties

Link copied to clipboard

Every setting a store of this type reads from its StoreConfig.options, each read through its option (StoreConfig.option): the host binds wow.<type>.<key> for each ProviderOption.Scope.TYPE one, and refuses a store's setting no option declares, naming these.

Link copied to clipboard

What a store of this type needs from the application, in the words of a startup failure that says it is missing (a DataSource bean, say).

Link copied to clipboard
abstract val type: String

The type a store's configuration names: lowercase, unique among the providers of a node.

Functions

Link copied to clipboard
open fun available(resources: StoreResources): Boolean

Whether resources are enough to open a durable store of this type with no setting of its own: wow.backend=auto takes the one provider that is available (PostgreSQL with a DataSource, MongoDB with a MongoClient).

Link copied to clipboard
abstract fun open(config: StoreConfig): Store

Opens the store config configures. It opens nothing in the database yet: its ports open on first use.