-- | What the node's LeiosFetch server traces.
module Ouroboros.Consensus.MiniProtocol.LeiosFetch.Trace (TraceLeiosFetchServerEvent (..)) where

import Ouroboros.Consensus.Leios.Types (LeiosPoint)
import Ouroboros.Consensus.MiniProtocol.LeiosFetch.Server (ExnLeiosInvalidRequest)
import Ouroboros.Consensus.MiniProtocol.LeiosFetch.Type (TxBitmaps)
import Ouroboros.Consensus.Storage.LeiosDB.Exception (LeiosDbException)

data TraceLeiosFetchServerEvent
  = -- | The client requested an endorser block.
    TraceLeiosFetchServerBlockRequested !LeiosPoint
  | -- | The server sent it, which references this many transactions.
    TraceLeiosFetchServerBlockServed !LeiosPoint !Int
  | -- | The client requested this many of an endorser block's transactions.
    TraceLeiosFetchServerTxsRequested !LeiosPoint !Int
  | -- | The server sent them.
    TraceLeiosFetchServerTxsServed
      !LeiosPoint
      -- | the number of transactions
      !Int
      -- | their total size in bytes
      !Int
  | -- | The client requested what the server does not hold, so the server
    -- disconnects it.
    TraceLeiosFetchServerInvalidRequest !ExnLeiosInvalidRequest
  | -- | Reading the LeiosDB for the client's request for this endorser block
    -- failed, so the server disconnects the client.
    TraceLeiosFetchServerBlockDbFailure !LeiosPoint !LeiosDbException
  | -- | Reading the LeiosDB for the client's request for these transactions of
    -- this endorser block failed, so the server disconnects the client.
    TraceLeiosFetchServerTxsDbFailure !LeiosPoint !TxBitmaps !LeiosDbException
  | -- | Opening the server's LeiosDB reader failed, so the server disconnects
    -- the client.
    TraceLeiosFetchServerOpenReaderDbFailure !LeiosDbException
  deriving Int -> TraceLeiosFetchServerEvent -> ShowS
[TraceLeiosFetchServerEvent] -> ShowS
TraceLeiosFetchServerEvent -> String
(Int -> TraceLeiosFetchServerEvent -> ShowS)
-> (TraceLeiosFetchServerEvent -> String)
-> ([TraceLeiosFetchServerEvent] -> ShowS)
-> Show TraceLeiosFetchServerEvent
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TraceLeiosFetchServerEvent -> ShowS
showsPrec :: Int -> TraceLeiosFetchServerEvent -> ShowS
$cshow :: TraceLeiosFetchServerEvent -> String
show :: TraceLeiosFetchServerEvent -> String
$cshowList :: [TraceLeiosFetchServerEvent] -> ShowS
showList :: [TraceLeiosFetchServerEvent] -> ShowS
Show