on master help sign in
add "-d <dbdir>" to switch on fs incremental persistence
b2943c6AgentM
ProjectM36/Base.hs+1
@@ -261,6 +261,7 @@ data AttributeNames = AttributeNames (S.Set AttributeName) |
261
261
262instance Binary AttributeNames
262instance Binary AttributeNames
263
263
264+--used for global dbms configuration- per-transaction flag is elsewhere
264data PersistenceStrategy = NoPersistence | --no filesystem persistence/memory-only database
265data PersistenceStrategy = NoPersistence | --no filesystem persistence/memory-only database
265 MinimalPersistence FilePath --fsync off
266 MinimalPersistence FilePath --fsync off
266 --CrashSafePersistence FilePath --full fsync- not yet implemented
267 --CrashSafePersistence FilePath --full fsync- not yet implemented
TutorialD/tutd.hs+12−10
@@ -7,7 +7,6 @@ import ProjectM36.Transaction
7import ProjectM36.Base
7import ProjectM36.Base
8import System.IO
8import System.IO
9import Options.Applicative
9import Options.Applicative
10−import Text.Read (readEither)
11import Data.UUID.V4 (nextRandom)
10import Data.UUID.V4 (nextRandom)
12import qualified Data.Text as T
11import qualified Data.Text as T
13import System.Exit
12import System.Exit
@@ -16,20 +15,23 @@ import System.Exit
16invocation:
15invocation:
17tutd
16tutd
18-no arguments indicates to run without persistence
17-no arguments indicates to run without persistence
19−tutd -d /database-directory -p MinimalPersistence
18+tutd -d /database-directory
20-persist to the database directory
19-persist to the database directory
21-}
20-}
22parseArgs :: Parser InterpreterConfig
21parseArgs :: Parser InterpreterConfig
23parseArgs = InterpreterConfig <$> parsePersistenceStrategy
22parseArgs = InterpreterConfig <$> parsePersistenceStrategy
24
23
25parsePersistenceStrategy :: Parser PersistenceStrategy
24parsePersistenceStrategy :: Parser PersistenceStrategy
26−parsePersistenceStrategy = option (eitherReader readEither)
25+parsePersistenceStrategy = do
27− (short 'p' <>
26+ MinimalPersistence <$> strOption (short 'd' <>
28− long "persistence-strategy" <>
27+ long "database-directory" <>
29− metavar "strategy" <>
28+ metavar "DIRECTORY" <>
30− value NoPersistence <>
31− showDefaultWith show
29+ showDefaultWith show
32− )
30+ )
31+ <|> pure NoPersistence
32+
33+
34+
33
35
34configSetup :: InterpreterConfig -> IO (TransactionGraph)
36configSetup :: InterpreterConfig -> IO (TransactionGraph)
35configSetup config = do
37configSetup config = do
@@ -40,7 +42,7 @@ configSetup config = do
40 let bootstrapGraph = bootstrapTransactionGraph firstGraphUUID dateExamples
42 let bootstrapGraph = bootstrapTransactionGraph firstGraphUUID dateExamples
41 case persistenceStrategy config of
43 case persistenceStrategy config of
42 --create date examples graph for now- probably should be empty context in the future
44 --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}
44 MinimalPersistence dbdir -> do
46 MinimalPersistence dbdir -> do
45 err <- setupDatabaseDir dbdir bootstrapGraph
47 err <- setupDatabaseDir dbdir bootstrapGraph
46 case err of
48 case err of