-
Notifications
You must be signed in to change notification settings - Fork 2
/
Dependencies.hs
44 lines (37 loc) · 1.47 KB
/
Dependencies.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE MultiParamTypeClasses #-}
module Dolla.Consensus.Proposing.Staging.Execution.Environment.EventStore.Dependencies (Dependencies (..)) where
import Dolla.Common.NodeId
import Dolla.Common.Dependencies.Core
import Dolla.Common.Logging.Core
import Dolla.Common.Memory.Byte (Byte)
import qualified Dolla.Libraries.LogEngine.Instances.EventStore.Settings as EventStore
import Dolla.Consensus.Proposal.Persistence
import Dolla.Consensus.Proposing.Staging.Execution.Environment.EventStore.Settings
data Dependencies
= Dependencies
{ nodeId :: NodeId
, logger :: Logger
, proposalRootFolder :: ProposalRootFolder
, proposalSizeLimit :: Byte
, eventStoreClient :: EventStore.Dependencies}
instance DependencyDerivable Settings Dependencies where
acquireDependencies
Settings
{ eventStoreClient = eventStoreClientSettings
, logger = loggerSettings
, proposalRootFolder
, proposalSizeLimit
, nodeId
}
executionUnderBracket
= acquireDependencies
loggerSettings
(\logger ->
acquireDependencies
eventStoreClientSettings
(\eventStoreClient -> executionUnderBracket Dependencies {..}))
instance HealthCheckable Dependencies where
checkHealth d @ Dependencies {eventStoreClient}
= (fmap . fmap) (const d) (checkHealth eventStoreClient)