marconi-core-1.2.0.0: Modular indexing for rewindable ledger
Safe HaskellSafe-Inferred
LanguageHaskell2010

Marconi.Core.Type

Description

Base types to index events.

See Marconi.Core for documentation.

Synopsis

Types and type families

type family Point event #

A point in time, the concrete type of a point is now derived from an indexer event, instead of an event. The reason is that you may not want to always carry around a point when you manipulate an event.

data ProcessedInput point event #

The different types of input event that should be handled by an indexer used to map the chain incoming events to something that an indexer should be able to digest.

Constructors

Rollback point

A rollback happen and indexers need to go back to the given point in time

Index (Timed point (Maybe event))

A new event has to be indexed

IndexAllDescending (NonEmpty (Timed point (Maybe event)))

A new event has to be indexed

StableAt point

Inform the indexer of the latest stable point reached

Stop

Processing stops

Instances

Instances details
Foldable (ProcessedInput point) # 
Instance details

Defined in Marconi.Core.Type

Methods

fold :: Monoid m => ProcessedInput point m -> m Source #

foldMap :: Monoid m => (a -> m) -> ProcessedInput point a -> m Source #

foldMap' :: Monoid m => (a -> m) -> ProcessedInput point a -> m Source #

foldr :: (a -> b -> b) -> b -> ProcessedInput point a -> b Source #

foldr' :: (a -> b -> b) -> b -> ProcessedInput point a -> b Source #

foldl :: (b -> a -> b) -> b -> ProcessedInput point a -> b Source #

foldl' :: (b -> a -> b) -> b -> ProcessedInput point a -> b Source #

foldr1 :: (a -> a -> a) -> ProcessedInput point a -> a Source #

foldl1 :: (a -> a -> a) -> ProcessedInput point a -> a Source #

toList :: ProcessedInput point a -> [a] Source #

null :: ProcessedInput point a -> Bool Source #

length :: ProcessedInput point a -> Int Source #

elem :: Eq a => a -> ProcessedInput point a -> Bool Source #

maximum :: Ord a => ProcessedInput point a -> a Source #

minimum :: Ord a => ProcessedInput point a -> a Source #

sum :: Num a => ProcessedInput point a -> a Source #

product :: Num a => ProcessedInput point a -> a Source #

Traversable (ProcessedInput point) # 
Instance details

Defined in Marconi.Core.Type

Methods

traverse :: Applicative f => (a -> f b) -> ProcessedInput point a -> f (ProcessedInput point b) Source #

sequenceA :: Applicative f => ProcessedInput point (f a) -> f (ProcessedInput point a) Source #

mapM :: Monad m => (a -> m b) -> ProcessedInput point a -> m (ProcessedInput point b) Source #

sequence :: Monad m => ProcessedInput point (m a) -> m (ProcessedInput point a) Source #

Functor (ProcessedInput point) # 
Instance details

Defined in Marconi.Core.Type

Methods

fmap :: (a -> b) -> ProcessedInput point a -> ProcessedInput point b Source #

(<$) :: a -> ProcessedInput point b -> ProcessedInput point a Source #

Generic (ProcessedInput point event) # 
Instance details

Defined in Marconi.Core.Type

Associated Types

type Rep (ProcessedInput point event) :: Type -> Type Source #

Methods

from :: ProcessedInput point event -> Rep (ProcessedInput point event) x Source #

to :: Rep (ProcessedInput point event) x -> ProcessedInput point event Source #

(Show event, Show point) => Show (ProcessedInput point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

showsPrec :: Int -> ProcessedInput point event -> ShowS Source #

show :: ProcessedInput point event -> String Source #

showList :: [ProcessedInput point event] -> ShowS Source #

(Eq event, Eq point) => Eq (ProcessedInput point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

(==) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

(/=) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

(Ord event, Ord point) => Ord (ProcessedInput point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

compare :: ProcessedInput point event -> ProcessedInput point event -> Ordering Source #

(<) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

(<=) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

(>) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

(>=) :: ProcessedInput point event -> ProcessedInput point event -> Bool Source #

max :: ProcessedInput point event -> ProcessedInput point event -> ProcessedInput point event Source #

min :: ProcessedInput point event -> ProcessedInput point event -> ProcessedInput point event Source #

type Rep (ProcessedInput point event) # 
Instance details

Defined in Marconi.Core.Type

type Rep (ProcessedInput point event) = D1 ('MetaData "ProcessedInput" "Marconi.Core.Type" "marconi-core-1.2.0.0-inplace" 'False) ((C1 ('MetaCons "Rollback" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 point)) :+: C1 ('MetaCons "Index" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Timed point (Maybe event))))) :+: (C1 ('MetaCons "IndexAllDescending" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (NonEmpty (Timed point (Maybe event))))) :+: (C1 ('MetaCons "StableAt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 point)) :+: C1 ('MetaCons "Stop" 'PrefixI 'False) (U1 :: Type -> Type))))

type family Result query #

A Result is a data family for query descriptor.

A query is tied to an indexer by a typeclass, this design choice has two main reasons: * we want to be able to define different query for the same indexer (eg. we may want to define two distinct query types for an utxo indexer: one to ge all the utxo for a given address, another one for to get all the utxos emitted at a given slot). * we want to assign a query type to different indexers.

Instances

Instances details
type Result (GetLastQuery a) # 
Instance details

Defined in Marconi.Core.Indexer.LastEventIndexer

type Result (EventAtQuery event) #

The result of EventAtQuery is always an event. The error cases are handled by the query interface.

Instance details

Defined in Marconi.Core.Query

type Result (EventAtQuery event) = Maybe event
type Result (EventsFromQuery event) # 
Instance details

Defined in Marconi.Core.Query

type Result (EventsFromQuery event) = [Timed (Point event) event]
type Result (EventsMatchingQuery event) #

The result of an EventMatchingQuery

Instance details

Defined in Marconi.Core.Query

type Result (EventsMatchingQuery event) = [Timed (Point event) event]
type Result (LatestEventsQuery event) # 
Instance details

Defined in Marconi.Core.Query

type Result (LatestEventsQuery event) = [Timed (Point event) event]
type Result (WithStability (EventsFromQuery event)) # 
Instance details

Defined in Marconi.Core.Query

type Result (WithStability (EventsFromQuery event)) = [Stability (Timed (Point event) event)]
type Result (WithStability (EventsMatchingQuery event)) # 
Instance details

Defined in Marconi.Core.Query

type Result (WithStability (EventsMatchingQuery event)) = [Stability (Timed (Point event) event)]

data Timed point event #

Attach an event to a point in time

Constructors

Timed point event 

Instances

Instances details
Foldable (Timed point) # 
Instance details

Defined in Marconi.Core.Type

Methods

fold :: Monoid m => Timed point m -> m Source #

foldMap :: Monoid m => (a -> m) -> Timed point a -> m Source #

foldMap' :: Monoid m => (a -> m) -> Timed point a -> m Source #

foldr :: (a -> b -> b) -> b -> Timed point a -> b Source #

foldr' :: (a -> b -> b) -> b -> Timed point a -> b Source #

foldl :: (b -> a -> b) -> b -> Timed point a -> b Source #

foldl' :: (b -> a -> b) -> b -> Timed point a -> b Source #

foldr1 :: (a -> a -> a) -> Timed point a -> a Source #

foldl1 :: (a -> a -> a) -> Timed point a -> a Source #

toList :: Timed point a -> [a] Source #

null :: Timed point a -> Bool Source #

length :: Timed point a -> Int Source #

elem :: Eq a => a -> Timed point a -> Bool Source #

maximum :: Ord a => Timed point a -> a Source #

minimum :: Ord a => Timed point a -> a Source #

sum :: Num a => Timed point a -> a Source #

product :: Num a => Timed point a -> a Source #

Traversable (Timed point) # 
Instance details

Defined in Marconi.Core.Type

Methods

traverse :: Applicative f => (a -> f b) -> Timed point a -> f (Timed point b) Source #

sequenceA :: Applicative f => Timed point (f a) -> f (Timed point a) Source #

mapM :: Monad m => (a -> m b) -> Timed point a -> m (Timed point b) Source #

sequence :: Monad m => Timed point (m a) -> m (Timed point a) Source #

Functor (Timed point) # 
Instance details

Defined in Marconi.Core.Type

Methods

fmap :: (a -> b) -> Timed point a -> Timed point b Source #

(<$) :: a -> Timed point b -> Timed point a Source #

(FromJSON event, FromJSON point) => FromJSON (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

parseJSON :: Value -> Parser (Timed point event)

parseJSONList :: Value -> Parser [Timed point event]

(ToJSON event, ToJSON point) => ToJSON (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

toJSON :: Timed point event -> Value

toEncoding :: Timed point event -> Encoding

toJSONList :: [Timed point event] -> Value

toEncodingList :: [Timed point event] -> Encoding

Generic (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Associated Types

type Rep (Timed point event) :: Type -> Type Source #

Methods

from :: Timed point event -> Rep (Timed point event) x Source #

to :: Rep (Timed point event) x -> Timed point event Source #

(Show event, Show point) => Show (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

showsPrec :: Int -> Timed point event -> ShowS Source #

show :: Timed point event -> String Source #

showList :: [Timed point event] -> ShowS Source #

(Eq event, Eq point) => Eq (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

(==) :: Timed point event -> Timed point event -> Bool Source #

(/=) :: Timed point event -> Timed point event -> Bool Source #

(Ord event, Ord point) => Ord (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

Methods

compare :: Timed point event -> Timed point event -> Ordering Source #

(<) :: Timed point event -> Timed point event -> Bool Source #

(<=) :: Timed point event -> Timed point event -> Bool Source #

(>) :: Timed point event -> Timed point event -> Bool Source #

(>=) :: Timed point event -> Timed point event -> Bool Source #

max :: Timed point event -> Timed point event -> Timed point event Source #

min :: Timed point event -> Timed point event -> Timed point event Source #

type Rep (Timed point event) # 
Instance details

Defined in Marconi.Core.Type

type Rep (Timed point event) = D1 ('MetaData "Timed" "Marconi.Core.Type" "marconi-core-1.2.0.0-inplace" 'False) (C1 ('MetaCons "Timed" 'PrefixI 'True) (S1 ('MetaSel ('Just "_point") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 point) :*: S1 ('MetaSel ('Just "_event") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 event)))

point :: Lens' (Timed point event) point #

When was this event created

event :: Lens (Timed point a) (Timed point b) a b #

A lens to get the event without its time information

Error types

data IndexerError #

Error that can occur when you index events

Constructors

RollbackBehindHistory

An indexer don't have access to the history at the point that is asked

IndexerInternalError Text

The indexer did not respond

InvalidIndexer Text

The indexer is in an invalid state and can't recover

StopIndexer (Maybe Text)

Indexer has to stop as requested by the given worker

ResumingFailed Text

The indexer failed at resuming (likely due to a bug)

IndexerCloseTimeoutError

The indexer timed out while attempting to write a file before closing

OtherIndexError Text

Any other cause of failure

_StopIndexer :: Prism' IndexerError (Maybe Text) #

data QueryError query #

Error that can occurs when you query an indexer

Constructors

AheadOfLastSync (Maybe (Result query))

The required point is ahead of the current index. The error may still provide its latest result if it make sense for the given query.

It can be useful for indexer that contains a partial knowledge and that want to pass this knowledge to another indexer to complete the query.

NotStoredAnymore

The requested point is too far in the past and has been pruned

IndexerQueryError Text

The indexer query failed

SlotNoBoundsInvalid Text

Upper or lower SlotNo bounds provided in the query are not consistent. For example, the requested point is too early to answer the query completely.

Instances

Instances details
(Typeable query, Show (Result query)) => Exception (QueryError query) # 
Instance details

Defined in Marconi.Core.Type

Show (Result query) => Show (QueryError query) # 
Instance details

Defined in Marconi.Core.Type

Methods

showsPrec :: Int -> QueryError query -> ShowS Source #

show :: QueryError query -> String Source #

showList :: [QueryError query] -> ShowS Source #

_AheadOfLastSync :: forall query query. Prism (QueryError query) (QueryError query) (Maybe (Result query)) (Maybe (Result query)) #

_NotStoredAnymore :: forall query. Prism' (QueryError query) () #

_IndexerQueryError :: forall query. Prism' (QueryError query) Text #

_SlotNoBoundsInvalid :: forall query. Prism' (QueryError query) Text #