{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}

-- | This module contains the definition of a state in the Genesis State Machine
-- (GSM). The GSM itself is defined in 'ouroboros-consensus-diffusion', but the
-- ChainSync client relies on its state.
module Ouroboros.Consensus.Node.GsmState (GsmState (..)) where

import           GHC.Generics (Generic)
import           NoThunks.Class (NoThunks)

-- | Current state of the Genesis State Machine
data GsmState =
    PreSyncing
    -- ^ We are syncing, and the Honest Availability Assumption is not
    -- satisfied.
  |
    Syncing
    -- ^ We are syncing, and the Honest Availability Assumption is satisfied.
  |
    CaughtUp
    -- ^ We are caught-up.
  deriving (GsmState -> GsmState -> Bool
(GsmState -> GsmState -> Bool)
-> (GsmState -> GsmState -> Bool) -> Eq GsmState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: GsmState -> GsmState -> Bool
== :: GsmState -> GsmState -> Bool
$c/= :: GsmState -> GsmState -> Bool
/= :: GsmState -> GsmState -> Bool
Eq, Int -> GsmState -> ShowS
[GsmState] -> ShowS
GsmState -> String
(Int -> GsmState -> ShowS)
-> (GsmState -> String) -> ([GsmState] -> ShowS) -> Show GsmState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> GsmState -> ShowS
showsPrec :: Int -> GsmState -> ShowS
$cshow :: GsmState -> String
show :: GsmState -> String
$cshowList :: [GsmState] -> ShowS
showList :: [GsmState] -> ShowS
Show, ReadPrec [GsmState]
ReadPrec GsmState
Int -> ReadS GsmState
ReadS [GsmState]
(Int -> ReadS GsmState)
-> ReadS [GsmState]
-> ReadPrec GsmState
-> ReadPrec [GsmState]
-> Read GsmState
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS GsmState
readsPrec :: Int -> ReadS GsmState
$creadList :: ReadS [GsmState]
readList :: ReadS [GsmState]
$creadPrec :: ReadPrec GsmState
readPrec :: ReadPrec GsmState
$creadListPrec :: ReadPrec [GsmState]
readListPrec :: ReadPrec [GsmState]
Read, (forall x. GsmState -> Rep GsmState x)
-> (forall x. Rep GsmState x -> GsmState) -> Generic GsmState
forall x. Rep GsmState x -> GsmState
forall x. GsmState -> Rep GsmState x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. GsmState -> Rep GsmState x
from :: forall x. GsmState -> Rep GsmState x
$cto :: forall x. Rep GsmState x -> GsmState
to :: forall x. Rep GsmState x -> GsmState
Generic, Context -> GsmState -> IO (Maybe ThunkInfo)
Proxy GsmState -> String
(Context -> GsmState -> IO (Maybe ThunkInfo))
-> (Context -> GsmState -> IO (Maybe ThunkInfo))
-> (Proxy GsmState -> String)
-> NoThunks GsmState
forall a.
(Context -> a -> IO (Maybe ThunkInfo))
-> (Context -> a -> IO (Maybe ThunkInfo))
-> (Proxy a -> String)
-> NoThunks a
$cnoThunks :: Context -> GsmState -> IO (Maybe ThunkInfo)
noThunks :: Context -> GsmState -> IO (Maybe ThunkInfo)
$cwNoThunks :: Context -> GsmState -> IO (Maybe ThunkInfo)
wNoThunks :: Context -> GsmState -> IO (Maybe ThunkInfo)
$cshowTypeOf :: Proxy GsmState -> String
showTypeOf :: Proxy GsmState -> String
NoThunks)