ProjectionEngine

zio.blocks.projection.ProjectionEngine
See theProjectionEngine companion class

Attributes

Companion
class
Source
ProjectionEngine.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

def boundedHub[E](capacity: Int = ...): UIO[Hub[EventEnvelope[E]]]

Creates a bounded hub for live events. Publishing suspends when the hub is full, so a slow consumer slows the producer down instead of losing events.

Creates a bounded hub for live events. Publishing suspends when the hub is full, so a slow consumer slows the producer down instead of losing events.

Value parameters

capacity

the most events the hub holds

Attributes

Source
ProjectionEngine.scala
def make(specs: Projection[_]*): ZIO[Scope, Throwable, ProjectionEngine]

Creates an engine for the given projections, with the default ProjectionEngineConfig.

Creates an engine for the given projections, with the default ProjectionEngineConfig.

It checks the projection names and folders, creates a TransactorCache that is closed with the enclosing Scope, and a SQLite store for each projection: global/.db for a global projection and /.db otherwise. The engine has no event stores, so it has nothing to read; to give it some, use makeWithStores or makeWithStoresVarargs instead.

Fails if a name or folder is invalid.

Value parameters

specs

the projections to run

Attributes

Source
ProjectionEngine.scala
def makeWithConfig(config: ProjectionEngineConfig, specs: Projection[_]*): ZIO[Scope, Throwable, ProjectionEngine]

Like make, with the settings config.

Like make, with the settings config.

Value parameters

config

the settings

specs

the projections to run

Attributes

Source
ProjectionEngine.scala
def makeWithStores(specs: List[Projection[_]], stores: Map[String, ProjectionStore[_]], eventStores: Map[String, EventStore[_]], cache: TransactorCache, config: ProjectionEngineConfig = ...): UIO[ProjectionEngine]

Creates an engine from stores you made yourself, instead of creating them. This is how an engine is given event stores to read from, and how TestEngine wires its in-memory stores.

Creates an engine from stores you made yourself, instead of creating them. This is how an engine is given event stores to read from, and how TestEngine wires its in-memory stores.

It neither creates nor opens any store, and stores must have an entry for every projection. An invalid projection name or folder is a defect, not a typed error.

Value parameters

cache

the cache that opens the SQLite files; the engine also opens the shards of cross-entity projections with it

config

the settings

eventStores

the event store of each source, keyed by the source name given to from

specs

the projections to run

stores

the primary store of each projection, keyed by projection name

Attributes

Source
ProjectionEngine.scala
def makeWithStoresVarargs(cache: TransactorCache, eventStores: Map[String, EventStore[_]], config: ProjectionEngineConfig = ...)(specs: Projection[_]*): Task[ProjectionEngine]

Like makeWithStores in that it takes event stores, but it creates the primary stores itself, the way make does. The projections are passed in a second parameter list.

Like makeWithStores in that it takes event stores, but it creates the primary stores itself, the way make does. The projections are passed in a second parameter list.

Unlike makeWithStores, an invalid projection name or folder fails the task.

Value parameters

cache

the cache that opens the SQLite files

config

the settings

eventStores

the event store of each source, keyed by the source name given to from

specs

the projections to run

Attributes

Source
ProjectionEngine.scala
def validateBasePath(path: String): Unit

Checks that a folder path cannot escape the storage directory, and throws IllegalArgumentException if it can. It rejects an empty path, backslashes, .., //, and absolute paths.

Checks that a folder path cannot escape the storage directory, and throws IllegalArgumentException if it can. It rejects an empty path, backslashes, .., //, and absolute paths.

Value parameters

path

the folder path to check

Attributes

Source
ProjectionEngine.scala
def validateName(name: String): Unit

Checks that a projection name is safe to use as a file name, and throws IllegalArgumentException if it is not. A name must be non-empty and made of letters, digits, _ and -.

Checks that a projection name is safe to use as a file name, and throws IllegalArgumentException if it is not. A name must be non-empty and made of letters, digits, _ and -.

Value parameters

name

the projection name to check

Attributes

Source
ProjectionEngine.scala