HostBackends

class HostBackends @InternalWowApi constructor(val type: String?, shared: List<() -> Unit> = emptyList(), val stores: Map<String, Store> = emptyMap(), val layout: StoreLayout? = null, val local: Boolean = type == StoreTypes.MEMORY, open: (context: String, schemas: MutableList<() -> Unit>) -> ContextBackends) : AutoCloseable

The backends of the node: the BackendFactory the me.ahoo.wow.runtime.node.ServiceNode opens each context's stores from, remembering what it opened, so that the state reads find a context's stores and the backend lifecycle (WowLifecycles.BACKENDS_PHASE) creates their schemas before the node starts.

type is the store type the host selected (memory when any log is in memory, else the default log store's), or null for the application's own BackendFactory bean, whose schemas are the application's; local whether a log is on a store no other node shares (Store.durable false), so the node serves alone. shared creates the schemas of the stores the contexts share; open opens a context's stores and adds what creates their schemas. stores are the node's store instances by name, in the order they were opened, and layout where each aggregate's log and snapshots are, when the host opened them.

It owns stores, whatever each was opened for: the host opens them (StoreInstances), and closing it closes each of them once, in reverse order of opening (Closing). Spring closes it with its bean, after every bean that uses it, the node and the queries among them, was destroyed, so after the node and the internal port stopped. The resources the host gave the stores are their owners'. The application's own BackendFactory gives it none: what that factory opened is the application's.

Constructors

Link copied to clipboard
constructor(type: String?, shared: List<() -> Unit> = emptyList(), stores: Map<String, Store> = emptyMap(), layout: StoreLayout? = null, local: Boolean = type == StoreTypes.MEMORY, open: (context: String, schemas: MutableList<() -> Unit>) -> ContextBackends)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

The stores of each context opened so far.

Link copied to clipboard

Opens each context's stores once.

Link copied to clipboard
Link copied to clipboard

Whether a log is on a store no other node shares, so that the node serves alone.

Link copied to clipboard
Link copied to clipboard
val type: String?

Functions

Link copied to clipboard
open override fun close()

Closes stores, each once, in reverse order of opening (Closing.inReverse).

Link copied to clipboard

Creates the schemas of the stores opened so far, where they are missing.

Link copied to clipboard

The store instance type's snapshots are on, when the host opened its stores.