Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The type of the local ledger state query protocol.
This is used by local clients (like wallets and CLI tools) to query the ledger state of a local node.
Synopsis
- data LocalStateQuery block point (query ∷ Type → Type) where
- StIdle ∷ LocalStateQuery block point query
- StAcquiring ∷ LocalStateQuery block point query
- StAcquired ∷ LocalStateQuery block point query
- StQuerying ∷ result → LocalStateQuery block point query
- StDone ∷ LocalStateQuery block point query
- data Target point
- = VolatileTip
- | SpecificPoint point
- | ImmutableTip
- data AcquireFailure
- class (∀ result. Show (query result)) ⇒ ShowQuery query where
- showResult ∷ ∀ result. query result → result → String
Documentation
data LocalStateQuery block point (query ∷ Type → Type) where Source #
The kind of the local state query protocol, and the types of the states in the protocol state machine.
It is parametrised over the type of block (for points), the type of queries and query results.
StIdle ∷ LocalStateQuery block point query | The client has agency. It can ask to acquire a state or terminate. There is no timeout in this state. |
StAcquiring ∷ LocalStateQuery block point query | The server has agency. it must acquire the state at the requested point or report a failure. There is a timeout in this state. |
StAcquired ∷ LocalStateQuery block point query | The client has agency. It can request queries against the current state, or it can release the state. |
StQuerying ∷ result → LocalStateQuery block point query | The server has agency. It must respond with the query result. |
StDone ∷ LocalStateQuery block point query | Nobody has agency. The terminal state. |
Instances
VolatileTip | The tip of the volatile chain Cannot fail to be acquired. |
SpecificPoint point | A specified point Fails to be acquired if the point is not between
|
ImmutableTip | The tip of the immutable chain Cannot fail to be acquired. Requires at least |
Instances
Foldable Target Source # | |
Defined in Ouroboros.Network.Protocol.LocalStateQuery.Type fold ∷ Monoid m ⇒ Target m → m # foldMap ∷ Monoid m ⇒ (a → m) → Target a → m # foldMap' ∷ Monoid m ⇒ (a → m) → Target a → m # foldr ∷ (a → b → b) → b → Target a → b # foldr' ∷ (a → b → b) → b → Target a → b # foldl ∷ (b → a → b) → b → Target a → b # foldl' ∷ (b → a → b) → b → Target a → b # foldr1 ∷ (a → a → a) → Target a → a # foldl1 ∷ (a → a → a) → Target a → a # elem ∷ Eq a ⇒ a → Target a → Bool # maximum ∷ Ord a ⇒ Target a → a # | |
Traversable Target Source # | |
Functor Target Source # | |
Generic (Target point) Source # | |
Show point ⇒ Show (Target point) Source # | |
NFData point ⇒ NFData (Target point) Source # | |
Eq point ⇒ Eq (Target point) Source # | |
Ord point ⇒ Ord (Target point) Source # | |
type Rep (Target point) Source # | |
Defined in Ouroboros.Network.Protocol.LocalStateQuery.Type type Rep (Target point) = D1 ('MetaData "Target" "Ouroboros.Network.Protocol.LocalStateQuery.Type" "ouroboros-network-protocols-0.8.1.0-inplace" 'False) (C1 ('MetaCons "VolatileTip" 'PrefixI 'False) (U1 ∷ Type → Type) :+: (C1 ('MetaCons "SpecificPoint" 'PrefixI 'False) (S1 ('MetaSel ('Nothing ∷ Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 point)) :+: C1 ('MetaCons "ImmutableTip" 'PrefixI 'False) (U1 ∷ Type → Type))) |
data AcquireFailure Source #
Instances
class (∀ result. Show (query result)) ⇒ ShowQuery query where Source #
To implement Show
for:
('Message' ('LocalStateQuery' block query) st st')
we need a way to print the query
GADT and its type index, result
. This
class contain the method we need to provide this Show
instance.
We use a type class for this, as this Show
constraint propagates to a lot
of places.
showResult ∷ ∀ result. query result → result → String Source #