Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Marconi.Core.Type
Description
Base types to index events.
See Marconi.Core for documentation.
Synopsis
- type family Point event
- data ProcessedInput point event
- type family Result query
- data Timed point event = Timed point event
- point :: Lens' (Timed point event) point
- event :: Lens (Timed point a) (Timed point b) a b
- data IndexerError
- = RollbackBehindHistory
- | IndexerInternalError Text
- | InvalidIndexer Text
- | StopIndexer (Maybe Text)
- | ResumingFailed Text
- | IndexerCloseTimeoutError
- | OtherIndexError Text
- _RollbackBehindHistory :: Prism' IndexerError ()
- _IndexerInternalError :: Prism' IndexerError Text
- _InvalidIndexer :: Prism' IndexerError Text
- _StopIndexer :: Prism' IndexerError (Maybe Text)
- _ResumingFailed :: Prism' IndexerError Text
- _IndexerCloseTimeoutError :: Prism' IndexerError ()
- _OtherIndexError :: Prism' IndexerError Text
- data QueryError query
- = AheadOfLastSync (Maybe (Result query))
- | NotStoredAnymore
- | IndexerQueryError Text
- | SlotNoBoundsInvalid Text
- _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
Types and type families
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
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
type Result (GetLastQuery a) # | |
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. |
Defined in Marconi.Core.Query | |
type Result (EventsFromQuery event) # | |
Defined in Marconi.Core.Query | |
type Result (EventsMatchingQuery event) # | The result of an |
Defined in Marconi.Core.Query | |
type Result (LatestEventsQuery event) # | |
Defined in Marconi.Core.Query | |
type Result (WithStability (EventsFromQuery event)) # | |
Defined in Marconi.Core.Query | |
type Result (WithStability (EventsMatchingQuery event)) # | |
Defined in Marconi.Core.Query |
Attach an event to a point in time
Constructors
Timed point event |
Instances
Foldable (Timed point) # | |
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 # | |
Traversable (Timed point) # | |
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) # | |
(FromJSON event, FromJSON point) => FromJSON (Timed point event) # | |
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) # | |
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) # | |
(Show event, Show point) => Show (Timed point event) # | |
(Eq event, Eq point) => Eq (Timed point event) # | |
(Ord event, Ord point) => Ord (Timed point event) # | |
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) # | |
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))) |
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 |
Instances
Exception IndexerError # | |
Defined in Marconi.Core.Type Methods toException :: IndexerError -> SomeException Source # fromException :: SomeException -> Maybe IndexerError Source # | |
Show IndexerError # | |
Defined in Marconi.Core.Type | |
Eq IndexerError # | |
Defined in Marconi.Core.Type Methods (==) :: IndexerError -> IndexerError -> Bool Source # (/=) :: IndexerError -> IndexerError -> Bool Source # |
_RollbackBehindHistory :: Prism' IndexerError () #
_IndexerInternalError :: Prism' IndexerError Text #
_InvalidIndexer :: Prism' IndexerError Text #
_StopIndexer :: Prism' IndexerError (Maybe Text) #
_ResumingFailed :: Prism' IndexerError Text #
_IndexerCloseTimeoutError :: Prism' IndexerError () #
_OtherIndexError :: Prism' IndexerError 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
(Typeable query, Show (Result query)) => Exception (QueryError query) # | |
Defined in Marconi.Core.Type Methods toException :: QueryError query -> SomeException Source # fromException :: SomeException -> Maybe (QueryError query) Source # displayException :: QueryError query -> String Source # | |
Show (Result query) => Show (QueryError query) # | |
Defined in Marconi.Core.Type |
_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 #