{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
module Cardano.Tools.DBAnalyser.HasAnalysis
( HasAnalysis (..)
, HasProtocolInfo (..)
, LSMConfig (..)
, 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 TextBuilder (TextBuilder)
data WithLedgerState blk = WithLedgerState
{ forall blk. WithLedgerState blk -> blk
wlsBlk :: blk
, forall blk. WithLedgerState blk -> LedgerState blk ValuesMK
wlsStateBefore :: LedgerState blk ValuesMK
, forall blk. WithLedgerState blk -> LedgerState blk ValuesMK
wlsStateAfter :: LedgerState blk ValuesMK
}
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 -> [TextBuilder]
blockApplicationMetrics :: [(TextBuilder, WithLedgerState blk -> IO TextBuilder)]
class HasProtocolInfo blk where
data Args blk
mkProtocolInfo :: Args blk -> IO (ProtocolInfo blk)
mkLSMConfig :: Args blk -> IO LSMConfig
mkLSMConfig Args blk
_ = LSMConfig -> IO LSMConfig
forall a. a -> IO a
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Maybe FilePath -> LSMConfig
LSMConfig Maybe FilePath
forall a. Maybe a
Nothing)
data LSMConfig = LSMConfig
{ LSMConfig -> Maybe FilePath
lsmConfigExportPath :: Maybe FilePath
}