Skip to content

Commit

Permalink
refactor(sut): rename modules for journaling dumblog
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Feb 18, 2022
1 parent 8906236 commit e75fa02
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 54 deletions.
1 change: 0 additions & 1 deletion src/journal/test/JournalTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,6 @@ interleavings (History ops) =
filter1 p (x : xs) | p x = x : filter1 p xs
| otherwise = xs


-- If any one of the single-threaded executions respects the state machine
-- model, then the concurrent execution is correct.
linearisable :: Forest (Command, Response) -> Bool
Expand Down
18 changes: 9 additions & 9 deletions src/sut/dumblog/app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import qualified Journal.Types.AtomicCounter as AtomicCounter
import qualified Journal.Internal.Metrics as Metrics
import Journal.Internal.Logger as Logger

import Blocker (emptyBlocker)
import Codec (Envelope(..), decode)
import FrontEnd (runFrontEnd, FrontEndInfo(..))
import Metrics (dumblogSchema)
import Snapshot (Snapshot)
import qualified Snapshot
import StateMachine(InMemoryDumblog, initState, runCommand)
import Types (Command)
import Worker (worker, WorkerInfo(..))
import Dumblog.Journal.Blocker (emptyBlocker)
import Dumblog.Journal.Codec (Envelope(..), decode)
import Dumblog.Journal.FrontEnd (runFrontEnd, FrontEndInfo(..))
import Dumblog.Journal.Metrics (dumblogSchema)
import Dumblog.Journal.Snapshot (Snapshot)
import qualified Dumblog.Journal.Snapshot as Snapshot
import Dumblog.Journal.StateMachine(InMemoryDumblog, initState, runCommand)
import Dumblog.Journal.Types (Command)
import Dumblog.Journal.Worker (worker, WorkerInfo(..))

fetchJournal :: Maybe Snapshot -> FilePath -> Journal.Options -> IO Journal
fetchJournal mSnapshot fpj opts = do
Expand Down
50 changes: 25 additions & 25 deletions src/sut/dumblog/dumblog.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,6 @@ extra-source-files:
LICENSE
README.md

executable dumblog
main-is: Main.hs

-- Modules included in this executable, other than Main.
-- other-modules:

-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
, async
, base ^>=4.14.1.0
, directory
, dumblog
, journal
hs-source-dirs: app
default-language: Haskell2010

library
build-depends:
, base ^>=4.14.1.0
Expand All @@ -57,13 +40,30 @@ library
, wai
, warp
exposed-modules:
Blocker
, Codec
, FrontEnd
, Metrics
, Snapshot
, StateMachine
, Types
, Worker
Dumblog.Journal.Blocker
, Dumblog.Journal.Codec
, Dumblog.Journal.FrontEnd
, Dumblog.Journal.Metrics
, Dumblog.Journal.Snapshot
, Dumblog.Journal.StateMachine
, Dumblog.Journal.Types
, Dumblog.Journal.Worker
hs-source-dirs: src
default-language: Haskell2010

executable dumblog
main-is: Main.hs

-- Modules included in this executable, other than Main.
-- other-modules:

-- LANGUAGE extensions used by modules in this package.
-- other-extensions:
build-depends:
, async
, base ^>=4.14.1.0
, directory
, dumblog
, journal
hs-source-dirs: app
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Blocker
module Dumblog.Journal.Blocker
(Blocker, emptyBlocker, blockUntil, wakeUp)
where

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveGeneric, DeriveFunctor#-}
module Codec where
module Dumblog.Journal.Codec where

import Data.Binary (Binary)
import qualified Data.Binary as Binary
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
module FrontEnd where
module Dumblog.Journal.FrontEnd where

import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString.Lazy.Char8 as LBS8
Expand All @@ -17,9 +17,9 @@ import qualified Journal
import Journal.Types.AtomicCounter (AtomicCounter)
import qualified Journal.Types.AtomicCounter as AtomicCounter

import Blocker
import Codec
import Types
import Dumblog.Journal.Blocker
import Dumblog.Journal.Codec
import Dumblog.Journal.Types

data FrontEndInfo = FrontEndInfo
{ sequenceNumber :: AtomicCounter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Metrics where
module Dumblog.Journal.Metrics where

import Journal.Internal.Metrics (MetricsSchema, Metrics) -- should maybe be moved to separate package
import qualified Journal.Internal.Metrics as Metrics
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
module Snapshot where
module Dumblog.Journal.Snapshot where

import Data.Binary (Binary)
import qualified Data.Binary as Binary
Expand All @@ -10,7 +10,7 @@ import qualified System.Directory as Dir
import qualified System.FilePath as FP
import System.IO (hClose, IOMode(ReadMode), openFile, openTempFile)

import StateMachine
import Dumblog.Journal.StateMachine

data Snapshot = Snapshot
{ ssBytesInJournal :: Int
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE DeriveGeneric #-}
module StateMachine where
module Dumblog.Journal.StateMachine where

import Data.Binary (Binary)
import Data.ByteString (ByteString)
import qualified Data.ByteString.Lazy as LBS
import qualified Data.ByteString.Lazy.Char8 as LBS8
import GHC.Generics (Generic)

import Types
import Dumblog.Journal.Types

-- This is the main state of Dumblog, which is the result of applying all commands in the log
data InMemoryDumblog = InMemoryDumblog
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE DeriveGeneric #-}
module Types where
module Dumblog.Journal.Types where

import Data.Binary (Binary)
import Data.ByteString (ByteString)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{-# LANGUAGE OverloadedStrings #-}
module Worker where
module Dumblog.Journal.Worker where

import Control.Concurrent (threadDelay)
import Control.Monad (unless)
Expand All @@ -14,12 +14,12 @@ import qualified Journal
import qualified Journal.Internal.Metrics as Metrics
import qualified Journal.Types.AtomicCounter as AtomicCounter

import Blocker
import Codec
import Metrics
import qualified Snapshot
import StateMachine
import Types
import Dumblog.Journal.Blocker
import Dumblog.Journal.Codec
import Dumblog.Journal.Metrics
import qualified Dumblog.Journal.Snapshot as Snapshot
import Dumblog.Journal.StateMachine
import Dumblog.Journal.Types

data WorkerInfo = WorkerInfo
{ wiBlockers :: Blocker (Either Response Response)
Expand Down

0 comments on commit e75fa02

Please sign in to comment.