Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data Effect tx
- = ClientEffect {
- serverOutput :: ServerOutput tx
- | NetworkEffect { }
- | OnChainEffect {
- postChainTx :: PostChainTx tx
- = ClientEffect {
- data StateChanged tx
- = HeadInitialized {
- parameters :: HeadParameters
- chainState :: ChainStateType tx
- headId :: HeadId
- headSeed :: HeadSeed
- | CommittedUTxO {
- party :: Party
- committedUTxO :: UTxOType tx
- chainState :: ChainStateType tx
- | HeadAborted {
- chainState :: ChainStateType tx
- | HeadOpened {
- chainState :: ChainStateType tx
- initialUTxO :: UTxOType tx
- | TransactionReceived {
- tx :: tx
- | TransactionAppliedToLocalUTxO {
- tx :: tx
- newLocalUTxO :: UTxOType tx
- | DecommitRecorded {
- decommitTx :: tx
- newLocalUTxO :: UTxOType tx
- | SnapshotRequestDecided {
- snapshotNumber :: SnapshotNumber
- | SnapshotRequested {
- snapshot :: Snapshot tx
- requestedTxIds :: [TxIdType tx]
- newLocalUTxO :: UTxOType tx
- newLocalTxs :: [tx]
- | DecommitFinalized {
- newVersion :: SnapshotVersion
- | PartySignedSnapshot { }
- | SnapshotConfirmed {
- snapshot :: Snapshot tx
- signatures :: MultiSignature (Snapshot tx)
- | HeadClosed {
- chainState :: ChainStateType tx
- contestationDeadline :: UTCTime
- | HeadContested {
- chainState :: ChainStateType tx
- contestationDeadline :: UTCTime
- | HeadIsReadyToFanout
- | HeadFannedOut {
- chainState :: ChainStateType tx
- | ChainRolledBack {
- chainState :: ChainStateType tx
- | TickObserved {
- chainSlot :: ChainSlot
- = HeadInitialized {
- genStateChanged :: (ArbitraryIsTx tx, IsChainState tx) => Environment -> Gen (StateChanged tx)
- data Outcome tx
- = Continue {
- stateChanges :: [StateChanged tx]
- effects :: [Effect tx]
- | Wait {
- reason :: WaitReason tx
- stateChanges :: [StateChanged tx]
- | Error {
- error :: LogicError tx
- = Continue {
- noop :: Outcome tx
- wait :: WaitReason tx -> Outcome tx
- newState :: StateChanged tx -> Outcome tx
- cause :: Effect tx -> Outcome tx
- causes :: [Effect tx] -> Outcome tx
- data WaitReason tx
- = WaitOnNotApplicableTx { }
- | WaitOnSnapshotNumber {
- waitingForNumber :: SnapshotNumber
- | WaitOnSnapshotVersion {
- waitingForVersion :: SnapshotVersion
- | WaitOnSeenSnapshot
- | WaitOnTxs {
- waitingForTxIds :: [TxIdType tx]
- | WaitOnContestationDeadline
- | WaitOnNotApplicableDecommitTx { }
Documentation
Analogous to inputs, the pure head logic "core" can have effects emited to the "shell" layers and we distinguish the same: effects onto the client, the network and the chain.
ClientEffect | Effect to be handled by the Hydra.API, results in sending this |
| |
NetworkEffect | Effect to be handled by a Hydra.Network, results in a |
OnChainEffect | Effect to be handled by a Hydra.Chain, results in a |
|
Instances
(ArbitraryIsTx tx, IsChainState tx) => Arbitrary (Effect tx) Source # | |
IsChainState tx => FromJSON (Effect tx) Source # | |
Defined in Hydra.HeadLogic.Outcome parseJSON :: Value -> Parser (Effect tx) parseJSONList :: Value -> Parser [Effect tx] omittedField :: Maybe (Effect tx) | |
IsChainState tx => ToJSON (Effect tx) Source # | |
Defined in Hydra.HeadLogic.Outcome toEncoding :: Effect tx -> Encoding toJSONList :: [Effect tx] -> Value toEncodingList :: [Effect tx] -> Encoding | |
Generic (Effect tx) Source # | |
IsChainState tx => Show (Effect tx) Source # | |
IsChainState tx => Eq (Effect tx) Source # | |
type Rep (Effect tx) Source # | |
Defined in Hydra.HeadLogic.Outcome type Rep (Effect tx) = D1 ('MetaData "Effect" "Hydra.HeadLogic.Outcome" "hydra-node-0.19.0-6Z4E5vp1s1XJuLOmmEVMTw" 'False) (C1 ('MetaCons "ClientEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "serverOutput") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (ServerOutput tx))) :+: (C1 ('MetaCons "NetworkEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "message") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Message tx))) :+: C1 ('MetaCons "OnChainEffect" 'PrefixI 'True) (S1 ('MetaSel ('Just "postChainTx") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (PostChainTx tx))))) |
data StateChanged tx Source #
Head state changed event. These events represent all the internal state changes, get persisted and processed in an event sourcing manner.
HeadInitialized | |
| |
CommittedUTxO | |
| |
HeadAborted | |
| |
HeadOpened | |
| |
TransactionReceived | |
| |
TransactionAppliedToLocalUTxO | |
| |
DecommitRecorded | |
| |
SnapshotRequestDecided | |
| |
SnapshotRequested | A snapshot was requested by some party. NOTE: We deliberately already include an updated local ledger state to not need a ledger to interpret this event. |
| |
DecommitFinalized | |
| |
PartySignedSnapshot | |
SnapshotConfirmed | |
| |
HeadClosed | |
| |
HeadContested | |
| |
HeadIsReadyToFanout | |
HeadFannedOut | |
| |
ChainRolledBack | |
| |
TickObserved | |
|
Instances
genStateChanged :: (ArbitraryIsTx tx, IsChainState tx) => Environment -> Gen (StateChanged tx) Source #
Continue | Continue with the given state updates and side effects. |
| |
Wait | Wait for some condition to be met with optional state updates. |
| |
Error | Processing resulted in an error. |
|
Instances
wait :: WaitReason tx -> Outcome tx Source #
newState :: StateChanged tx -> Outcome tx Source #
data WaitReason tx Source #
WaitOnNotApplicableTx | |
WaitOnSnapshotNumber | |
| |
WaitOnSnapshotVersion | |
| |
WaitOnSeenSnapshot | |
WaitOnTxs | |
| |
WaitOnContestationDeadline | |
WaitOnNotApplicableDecommitTx | |