on master help sign in
add "-d <dbdir>" to switch on fs incremental persistence
commitb2943c699356e9247fad07118791f02434033bb3 authorAgentM <agentm@themactionfaction.com> dateTue 14 Jul 2015, 17:07 (11 years ago) parentd2940fb
2 files changed+13−10
ProjectM36/Base.hs+1 TutorialD/tutd.hs+12−10
ProjectM36/Base.hs+1
@@ -261,6 +261,7 @@ data AttributeNames = AttributeNames (S.Set AttributeName) |
261261
262262instance Binary AttributeNames
263263
264+--used for global dbms configuration- per-transaction flag is elsewhere
264265data PersistenceStrategy = NoPersistence | --no filesystem persistence/memory-only database
265266 MinimalPersistence FilePath --fsync off
266267 --CrashSafePersistence FilePath --full fsync- not yet implemented
TutorialD/tutd.hs+12−10
@@ -7,7 +7,6 @@ import ProjectM36.Transaction
77import ProjectM36.Base
88import System.IO
99import Options.Applicative
10−import Text.Read (readEither)
1110import Data.UUID.V4 (nextRandom)
1211import qualified Data.Text as T
1312import System.Exit
@@ -16,20 +15,23 @@ import System.Exit
1615invocation:
1716tutd
1817-no arguments indicates to run without persistence
19−tutd -d /database-directory -p MinimalPersistence
18+tutd -d /database-directory
2019-persist to the database directory
2120-}
2221parseArgs :: Parser InterpreterConfig
2322parseArgs = InterpreterConfig <$> parsePersistenceStrategy
2423
2524parsePersistenceStrategy :: Parser PersistenceStrategy
26−parsePersistenceStrategy = option (eitherReader readEither)
27− (short 'p' <>
28− long "persistence-strategy" <>
29− metavar "strategy" <>
30− value NoPersistence <>
31− showDefaultWith show
32− )
25+parsePersistenceStrategy = do
26+ MinimalPersistence <$> strOption (short 'd' <>
27+ long "database-directory" <>
28+ metavar "DIRECTORY" <>
29+ showDefaultWith show
30+ )
31+ <|> pure NoPersistence
32+
33+
34+
3335
3436configSetup :: InterpreterConfig -> IO (TransactionGraph)
3537configSetup config = do
@@ -40,7 +42,7 @@ configSetup config = do
4042 let bootstrapGraph = bootstrapTransactionGraph firstGraphUUID dateExamples
4143 case persistenceStrategy config of
4244 --create date examples graph for now- probably should be empty context in the future
43− NoPersistence -> return bootstrapGraph
45+ NoPersistence -> do { putStrLn "Running without filesystem persistence."; return bootstrapGraph}
4446 MinimalPersistence dbdir -> do
4547 err <- setupDatabaseDir dbdir bootstrapGraph
4648 case err of