hindsight-postgresql-store
Copyright(c) 2024
LicenseBSD3
Maintainermaintainer@example.com
Stabilityexperimental
Safe HaskellNone
LanguageGHC2021

Hindsight.Store.PostgreSQL.Projections.Sync

Description

This module provides a complete synchronous projection system for PostgreSQL, including registry management, event processing, catch-up functionality, and transaction-based execution. It merges functionality from the original SyncProjection, SyncProjectionCatchUp, and Projection.Sync modules.

Synopsis

Registry Management

data SyncProjectionRegistry Source #

Registry of synchronous projections

Event Processing

executeSyncProjectionForEvent :: forall (event :: Symbol). Event event => SyncProjectionRegistry -> Proxy event -> EventEnvelope event SQLStore -> Transaction () Source #

Execute all registered synchronous projections for a single event

Catch-up Functionality

catchUpSyncProjections :: Pool -> SyncProjectionRegistry -> IO (Either CatchUpError ()) Source #

Catch up all sync projections to the latest events

PostgreSQL-Specific Projection Functions

matchEventHandlers :: forall (event :: Symbol) (ts :: [Symbol]) backend. Event event => ProjectionHandlers ts backend -> Proxy event -> [ProjectionHandler event backend] Source #

Type-safe handler matching using unified logic

Uses the common handler matching logic from Hindsight.Projection.Matching

executeHandlerChain :: forall (event :: Symbol) backend. Event event => [ProjectionHandler event backend] -> EventEnvelope event backend -> Transaction [ProjectionResult] Source #

Execute a chain of handlers for an event (PostgreSQL Transaction context)

This processes handlers in sequence, collecting results. Unlike the generic version, this is specialized for PostgreSQL transactions.

handleProjectionError :: ProjectionError -> Transaction ProjectionResult Source #

Handle projection errors in PostgreSQL Transaction context