ouroboros-network-protocols:testlib
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Network.Protocol.LocalStateQuery.Examples

Synopsis

Documentation

localStateQueryClient :: forall block point query result (m :: Type -> Type). Applicative m => [(Target point, query result)] -> LocalStateQueryClient block point query m [(Target point, Either AcquireFailure result)] Source #

An example LocalStateQueryClient, which, for each point in the given list, acquires the state for that point, and if that succeeds, returns the result for the corresponding query. When the state could not be acquired, the AcquireFailure is returned instead of the query results.

localStateQueryServer :: forall block point query (m :: Type -> Type) state. Applicative m => (Target point -> Either AcquireFailure state) -> (forall result. state -> query result -> result) -> LocalStateQueryServer block point query m () Source #

An example LocalStateQueryServer. The first function is called to acquire a state, after which the second will be used to query the state.