Skip to content

Commit

Permalink
Merge pull request #164 from mrBliss/mrBliss/immutable-db-rewrite
Browse files Browse the repository at this point in the history
Rewrite ImmutableDB
  • Loading branch information
edsko committed Jan 21, 2019
2 parents 8eddc4a + a54476b commit 1a87978
Show file tree
Hide file tree
Showing 17 changed files with 2,940 additions and 990 deletions.
15 changes: 12 additions & 3 deletions ouroboros-consensus/ouroboros-consensus.cabal
Expand Up @@ -66,7 +66,6 @@ library
Ouroboros.Consensus.Util.STM

-- Storing things on disk
Ouroboros.Storage.Immutable.DB
Ouroboros.Storage.FS.Class
Ouroboros.Storage.FS.Class.Example
Ouroboros.Storage.FS.Class.Types
Expand All @@ -75,6 +74,12 @@ library
Ouroboros.Storage.FS.Sim.MockFS
Ouroboros.Storage.FS.Sim.Pure
Ouroboros.Storage.FS.Sim.STM
Ouroboros.Storage.ImmutableDB
Ouroboros.Storage.ImmutableDB.API
Ouroboros.Storage.ImmutableDB.Impl
Ouroboros.Storage.ImmutableDB.Index
Ouroboros.Storage.ImmutableDB.Types
Ouroboros.Storage.ImmutableDB.Util
Ouroboros.Storage.Util
Ouroboros.Storage.IO

Expand Down Expand Up @@ -131,6 +136,7 @@ library
fingertree >=0.1.4.2 && <0.2,
memory >=0.14 && <0.15,
mtl >=2.2 && <2.3,
pipes >=4.3 && <4.4,
serialise >=0.2 && <0.3,
stm,
text >=1.2 && <1.3,
Expand Down Expand Up @@ -246,9 +252,12 @@ test-suite test-storage
default-language: Haskell2010
main-is: Main.hs
other-modules:
Test.Ouroboros.StateMachine
Test.Ouroboros.Storage
Test.Ouroboros.Storage.Immutable.Sim
Test.Ouroboros.Storage.Util
Test.Ouroboros.Storage.FS
Test.Ouroboros.Storage.FS.StateMachine
Test.Ouroboros.Storage.ImmutableDB
Test.Ouroboros.Storage.ImmutableDB.Sim
Test.Util.RefEnv
build-depends: base,
ouroboros-network,
Expand Down
6 changes: 6 additions & 0 deletions ouroboros-consensus/src/Ouroboros/Consensus/Util.hs
Expand Up @@ -18,6 +18,7 @@ module Ouroboros.Consensus.Util (
, checkThat
, pickOne
, markLast
, lastMaybe
) where

import qualified Data.ByteString as Strict
Expand Down Expand Up @@ -92,3 +93,8 @@ markLast :: [a] -> [Either a a]
markLast [] = []
markLast xs = let (y:ys) = reverse xs
in reverse $ Right y : map Left ys

lastMaybe :: [a] -> Maybe a
lastMaybe [] = Nothing
lastMaybe [x] = Just x
lastMaybe (_:xs) = lastMaybe xs

0 comments on commit 1a87978

Please sign in to comment.