Skip to content

Commit

Permalink
distance-computation-catchup-mechanism (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayvank authored Jan 9, 2024
1 parent a85b1a1 commit 88c8122
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ The type of a worker (slightly simplified) is the following:
, workerState :: MVar (indexer event)
-- ^ the indexer controlled by this worker
, transformInput :: Preprocessor (ExceptT IndexerError m) point input event
-- ^ adapt the input event givent by the coordinator to the worker type
-- ^ adapt the input event given by the coordinator to the worker type
, hoistError :: forall a. n a -> ExceptT IndexerError IO a
-- ^ adapt the monadic stack of the indexer to the one of the worker
}
Expand All @@ -92,7 +92,7 @@ Here are the important bits:
Any concrete indexer type will work as long as it implements the ``IsIndex`` typeclass.
- The indexer is put in an ``MVar`` to allow access to it from other threads.
We'll come back to it later.
- We provide a preprocessor, which can be seen as a functon that transforms the input send by the coordinator into events.
- We provide a preprocessor, which can be seen as a function that transforms the input send by the coordinator into events.
- ``hoistError`` ensures that we know how to translate the base monad of the indexer into ``ExceptT IndexerError IO`` which is the base monad of a worker.

Once we have a list of workers, we can use it to create a coordinator using the ``mkCoordinator`` function.
Expand Down Expand Up @@ -174,7 +174,7 @@ Queryable
---------

The whole point of an indexer is to expose information about the event they index.
In Marconi, it's done through the ``Queryable`` typeclass, which has the following deifinition:
In Marconi, it's done through the ``Queryable`` typeclass, which has the following definition:

.. code-block:: haskell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import Cardano.Api qualified as C
import Data.Word (Word64)
import Marconi.Core qualified as Core

-- | Attach the distance (in blocks) to the tip to an event
-- | A type to store the distance, in blocks, to the tip of the chain
data WithDistance event = WithDistance Word64 event
deriving (Show, Functor, Foldable, Traversable)

Expand All @@ -22,7 +22,7 @@ getEvent (WithDistance _ event) = event

type instance Core.Point (WithDistance event) = C.ChainPoint

-- | Extract the timed information from a block
-- | Attach the distance (in blocks) to the tip to an event
attachDistance
:: C.BlockNo
-> C.ChainTip
Expand Down
2 changes: 1 addition & 1 deletion marconi-core/src/Marconi/Core/Worker.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ data WorkerM m input point = forall indexer event n.
, workerState :: MVar (indexer event)
-- ^ the indexer controlled by this worker
, transformInput :: Preprocessor (ExceptT IndexerError m) point input event
-- ^ adapt the input event givent by the coordinator to the worker type
-- ^ adapt the input event given by the coordinator to the worker type
, hoistError :: forall a. n a -> ExceptT IndexerError m a
-- ^ adapt the monadic stack of the indexer to the one of the worker
}
Expand Down

0 comments on commit 88c8122

Please sign in to comment.