{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Cardano.Tools.DBAnalyser.HasAnalysis (
HasAnalysis (..)
, HasProtocolInfo (..)
, SizeInBytes
, WithLedgerState (..)
) where
import Data.Map.Strict (Map)
import Ouroboros.Consensus.Block
import Ouroboros.Consensus.HeaderValidation (HasAnnTip (..))
import Ouroboros.Consensus.Ledger.Abstract
import Ouroboros.Consensus.Node.ProtocolInfo
import Ouroboros.Consensus.Storage.Serialisation (SizeInBytes)
import Ouroboros.Consensus.Util.Condense (Condense)
import Text.Builder (Builder)
data WithLedgerState blk = WithLedgerState
{ forall blk. WithLedgerState blk -> blk
wlsBlk :: blk
, forall blk. WithLedgerState blk -> LedgerState blk
wlsStateBefore :: LedgerState blk
, forall blk. WithLedgerState blk -> LedgerState blk
wlsStateAfter :: LedgerState blk
}
class (HasAnnTip blk, GetPrevHash blk, Condense (HeaderHash blk)) => HasAnalysis blk where
countTxOutputs :: blk -> Int
blockTxSizes :: blk -> [SizeInBytes]
knownEBBs :: proxy blk -> Map (HeaderHash blk) (ChainHash blk)
emitTraces :: WithLedgerState blk -> [String]
blockStats :: blk -> [Builder]
blockApplicationMetrics :: [(Builder, WithLedgerState blk -> IO Builder)]
class HasProtocolInfo blk where
data Args blk
mkProtocolInfo :: Args blk -> IO (ProtocolInfo blk)