Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Marconi.Core.Transformer.WithCatchup
Description
The catch-up mechanism buffered events to pass them in batch to an indexer, to reduce the time needed for an indexer to catch-up with the tip.
Once we are close enough to the tip of the chain, WithCatchup
deactivate itself and pass directly
the blocks to the indexer.
When you use several workers and coordinators, you may want to put the catchup on the final indexers and not on the coordinators to improve performances.
Synopsis
- data WithCatchup indexer event
- withCatchup :: (Point event -> event -> Word64) -> CatchupConfig -> indexer event -> WithCatchup indexer event
- data CatchupConfig = CatchupConfig Word64 Word64 (Maybe (CatchupEvent -> IO ()))
- mkCatchupConfig :: Word64 -> Word64 -> CatchupConfig
- configCatchupEventHook :: Lens' CatchupConfig (Maybe (CatchupEvent -> IO ()))
- class HasCatchupConfig indexer where
- catchupBypassDistance :: Lens' (indexer event) Word64
- catchupBatchSize :: Lens' (indexer event) Word64
- catchupEventHook :: Lens' (indexer event) (Maybe (CatchupEvent -> IO ()))
- data CatchupEvent = Synced
Documentation
data WithCatchup indexer event #
Instances
IndexerTrans WithCatchup # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods unwrap :: forall (indexer :: Type -> Type) event. Lens' (WithCatchup indexer event) (indexer event) # | |
Queryable m event query indexer => Queryable m event query (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods query :: Point event -> query -> WithCatchup indexer event -> m (Result query) # queryLatest :: query -> WithCatchup indexer event -> m (Result query) # | |
(MonadIO m, IsIndex m event indexer, Ord (Point event)) => IsIndex m event (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods index :: Timed (Point event) (Maybe event) -> WithCatchup indexer event -> m (WithCatchup indexer event) # indexAll :: (Eq (Point event), Traversable f) => f (Timed (Point event) (Maybe event)) -> WithCatchup indexer event -> m (WithCatchup indexer event) # indexAllDescending :: (Eq (Point event), Traversable f) => f (Timed (Point event) (Maybe event)) -> WithCatchup indexer event -> m (WithCatchup indexer event) # rollback :: Point event -> WithCatchup indexer event -> m (WithCatchup indexer event) # setLastStablePoint :: Point event -> WithCatchup indexer event -> m (WithCatchup indexer event) # | |
IsSync m event indexer => IsSync m event (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods lastStablePoint :: WithCatchup indexer event -> m (Point event) # lastSyncPoint :: WithCatchup indexer event -> m (Point event) # | |
(Applicative m, Resetable m event indexer) => Resetable m event (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods reset :: WithCatchup indexer event -> m (WithCatchup indexer event) # | |
Closeable m indexer => Closeable m (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods close :: WithCatchup indexer event -> m () # | |
HasDatabasePath indexer => HasDatabasePath (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods getDatabasePath :: WithCatchup indexer event -> SQLiteDBLocation # | |
HasCatchupConfig (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods catchupBypassDistance :: Lens' (WithCatchup indexer event) Word64 # catchupBatchSize :: Lens' (WithCatchup indexer event) Word64 # catchupEventHook :: Lens' (WithCatchup indexer event) (Maybe (CatchupEvent -> IO ())) # |
Arguments
:: (Point event -> event -> Word64) | The distance function |
-> CatchupConfig | Configure how many element we put in a batch and until when we use it |
-> indexer event | the underlying indexer |
-> WithCatchup indexer event |
A smart constructor for WithCatchup
data CatchupConfig #
The visible part of the catchup configuration, it allows you to configure the size of the batch and to control when the batch mecanism stops
Constructors
CatchupConfig Word64 Word64 (Maybe (CatchupEvent -> IO ())) |
mkCatchupConfig :: Word64 -> Word64 -> CatchupConfig #
configCatchupEventHook :: Lens' CatchupConfig (Maybe (CatchupEvent -> IO ())) #
class HasCatchupConfig indexer where #
A typeclass that allows an indexer with a WitchCatchup
transformer to configure
the behaviour of this transformer
Methods
catchupBypassDistance :: Lens' (indexer event) Word64 #
catchupBatchSize :: Lens' (indexer event) Word64 #
catchupEventHook :: Lens' (indexer event) (Maybe (CatchupEvent -> IO ())) #
Instances
HasCatchupConfig (WithCatchup indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods catchupBypassDistance :: Lens' (WithCatchup indexer event) Word64 # catchupBatchSize :: Lens' (WithCatchup indexer event) Word64 # catchupEventHook :: Lens' (WithCatchup indexer event) (Maybe (CatchupEvent -> IO ())) # | |
(IndexerTrans t, HasCatchupConfig indexer) => HasCatchupConfig (t indexer) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods catchupBypassDistance :: Lens' (t indexer event) Word64 # catchupBatchSize :: Lens' (t indexer event) Word64 # catchupEventHook :: Lens' (t indexer event) (Maybe (CatchupEvent -> IO ())) # | |
(IndexerMapTrans t, HasCatchupConfig indexer) => HasCatchupConfig (t indexer output) # | |
Defined in Marconi.Core.Transformer.WithCatchup Methods catchupBypassDistance :: Lens' (t indexer output event) Word64 # catchupBatchSize :: Lens' (t indexer output event) Word64 # catchupEventHook :: Lens' (t indexer output event) (Maybe (CatchupEvent -> IO ())) # |
data CatchupEvent #
Constructors
Synced |