Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Hydra.Node
Description
Top-level module to run a single Hydra node.
Checkout Hydra
Documentation
for some details about the overall architecture of the Node
.
Synopsis
- initEnvironment :: RunOptions -> IO Environment
- newtype ParameterMismatch = ParameterMismatch [ParamMismatch]
- data ParamMismatch
- checkHeadState :: MonadThrow m => Tracer m (HydraNodeLog tx) -> Environment -> HeadState tx -> m ()
- data HydraNode tx m = HydraNode {
- eq :: EventQueue m (Event tx)
- hn :: Network m (Message tx)
- nodeState :: NodeState tx m
- oc :: Chain tx m
- server :: Server tx m
- ledger :: Ledger tx
- env :: Environment
- persistence :: PersistenceIncremental (StateChanged tx) m
- data HydraNodeLog tx
- = BeginEvent { }
- | EndEvent { }
- | BeginEffect { }
- | EndEffect { }
- | LogicOutcome { }
- | LoadedState { }
- | Misconfiguration { }
- runHydraNode :: (MonadCatch m, MonadAsync m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> HydraNode tx m -> m ()
- stepHydraNode :: (MonadCatch m, MonadAsync m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> HydraNode tx m -> m ()
- waitDelay :: DiffTime
- processNextEvent :: IsChainState tx => HydraNode tx m -> Event tx -> STM m (Outcome tx)
- processEffects :: (MonadAsync m, MonadCatch m, IsChainState tx) => HydraNode tx m -> Tracer m (HydraNodeLog tx) -> Word64 -> Outcome tx -> m ()
- data NodeState tx m = NodeState {
- modifyHeadState :: forall a. (HeadState tx -> (a, HeadState tx)) -> STM m a
- queryHeadState :: STM m (HeadState tx)
- createNodeState :: MonadLabelledSTM m => HeadState tx -> m (NodeState tx m)
- loadState :: (MonadThrow m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> PersistenceIncremental (StateChanged tx) m -> ChainStateType tx -> m (HeadState tx)
Environment Handling
initEnvironment :: RunOptions -> IO Environment Source #
Intialize the Environment
from command line options.
newtype ParameterMismatch Source #
Exception used to indicate command line options not matching the persisted state.
Constructors
ParameterMismatch [ParamMismatch] |
Instances
Exception ParameterMismatch Source # | |
Defined in Hydra.Node Methods toException :: ParameterMismatch -> SomeException Source # fromException :: SomeException -> Maybe ParameterMismatch Source # | |
Show ParameterMismatch Source # | |
Defined in Hydra.Node | |
Eq ParameterMismatch Source # | |
Defined in Hydra.Node Methods (==) :: ParameterMismatch -> ParameterMismatch -> Bool Source # (/=) :: ParameterMismatch -> ParameterMismatch -> Bool Source # |
data ParamMismatch Source #
Constructors
ContestationPeriodMismatch | |
Fields | |
PartiesMismatch | |
Fields
|
Instances
checkHeadState :: MonadThrow m => Tracer m (HydraNodeLog tx) -> Environment -> HeadState tx -> m () Source #
Checks that command line options match a given HeadState
. This funciton
takes Environment
because it is derived from RunOptions
via
initEnvironment
.
Throws: ParameterMismatch
when state not matching the environment.
Create and run a hydra node
Main handle of a hydra node where all layers are tied together.
Constructors
HydraNode | |
Fields
|
data HydraNodeLog tx Source #
Constructors
BeginEvent | |
EndEvent | |
BeginEffect | |
EndEffect | |
LogicOutcome | |
LoadedState | |
Fields | |
Misconfiguration | |
Fields |
Instances
runHydraNode :: (MonadCatch m, MonadAsync m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> HydraNode tx m -> m () Source #
stepHydraNode :: (MonadCatch m, MonadAsync m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> HydraNode tx m -> m () Source #
processNextEvent :: IsChainState tx => HydraNode tx m -> Event tx -> STM m (Outcome tx) Source #
Monadic interface around update
.
processEffects :: (MonadAsync m, MonadCatch m, IsChainState tx) => HydraNode tx m -> Tracer m (HydraNodeLog tx) -> Word64 -> Outcome tx -> m () Source #
Manage state
Handle to access and modify the state in the Hydra Node.
Constructors
NodeState | |
Fields
|
createNodeState :: MonadLabelledSTM m => HeadState tx -> m (NodeState tx m) Source #
Initialize a new NodeState
.
loadState :: (MonadThrow m, IsChainState tx) => Tracer m (HydraNodeLog tx) -> PersistenceIncremental (StateChanged tx) m -> ChainStateType tx -> m (HeadState tx) Source #
Load a HeadState
from persistence.