hydra-node-0.20.0: The Hydra node
Safe HaskellSafe-Inferred
LanguageGHC2021

Hydra.Events

Description

This module defines the types and functions for creating EventSource and EventSink instances and is intended to be used as an extension point.

A single EventSource and zero or more EventSink handles are used by the main HydraNode handle to load and send out events.

See FileBased for an example implementation and FileBasedSpec for the corresponding test suite.

Custom implementations should be located under Hydra.Events to avoid conflicts.

Synopsis

Documentation

class HasEventId a where Source #

Methods

getEventId :: a -> EventId Source #

Instances

Instances details
HasEventId (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

HasEventId (EventId, a) Source # 
Instance details

Defined in Hydra.Events

Methods

getEventId :: (EventId, a) -> EventId Source #

newtype EventSource e m Source #

Constructors

EventSource 

Fields

newtype EventSink e m Source #

Constructors

EventSink 

Fields

putEventsToSinks :: (Monad m, HasEventId e) => [EventSink e m] -> [e] -> m () Source #

Put a list of events to a list of event sinks in a round-robin fashion.

State change events as used by Hydra.Node

data StateEvent tx Source #

A state change event with an event id that is the common entity to be loaded from an EventSource and sent to EventSinks.

Constructors

StateEvent 

Instances

Instances details
(ArbitraryIsTx tx, IsChainState tx) => Arbitrary (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Methods

arbitrary :: Gen (StateEvent tx)

shrink :: StateEvent tx -> [StateEvent tx]

IsChainState tx => FromJSON (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Methods

parseJSON :: Value -> Parser (StateEvent tx)

parseJSONList :: Value -> Parser [StateEvent tx]

omittedField :: Maybe (StateEvent tx)

IsChainState tx => ToJSON (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Methods

toJSON :: StateEvent tx -> Value

toEncoding :: StateEvent tx -> Encoding

toJSONList :: [StateEvent tx] -> Value

toEncodingList :: [StateEvent tx] -> Encoding

omitField :: StateEvent tx -> Bool

Generic (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Associated Types

type Rep (StateEvent tx) :: Type -> Type Source #

Methods

from :: StateEvent tx -> Rep (StateEvent tx) x Source #

to :: Rep (StateEvent tx) x -> StateEvent tx Source #

IsChainState tx => Show (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

IsChainState tx => Eq (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Methods

(==) :: StateEvent tx -> StateEvent tx -> Bool Source #

(/=) :: StateEvent tx -> StateEvent tx -> Bool Source #

HasEventId (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

(ArbitraryIsTx tx, IsChainState tx) => ToADTArbitrary (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

Methods

toADTArbitrarySingleton :: Proxy (StateEvent tx) -> Gen (ADTArbitrarySingleton (StateEvent tx))

toADTArbitrary :: Proxy (StateEvent tx) -> Gen (ADTArbitrary (StateEvent tx))

type Rep (StateEvent tx) Source # 
Instance details

Defined in Hydra.Events

type Rep (StateEvent tx) = D1 ('MetaData "StateEvent" "Hydra.Events" "hydra-node-0.20.0-5pXAEiXeWsXH8K4KfwlMxW" 'False) (C1 ('MetaCons "StateEvent" 'PrefixI 'True) (S1 ('MetaSel ('Just "eventId") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 EventId) :*: S1 ('MetaSel ('Just "stateChanged") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StateChanged tx))))