-
Notifications
You must be signed in to change notification settings - Fork 1
DbLog
laforge49 edited this page Oct 1, 2011
·
21 revisions
Transaction logs are important, no matter how robust a system. Transaction logs are recorded before an update request is processed. They can be used to build a database in the event of a failure, for a major software update, or when the size of the root block needs to be changed.
Logging is done by the TransactionComponentLog, which takes two parameters:
- logDirPathname - This is the pathname of the directory where log files are to be written. (A new log file is created each time the program is run.)
- flushLog - Optional, and when set to "true", the log file is flushed to disk after each transaction request is written. This parameter needs to be set to ensure that all the completed transactions can be recovered.
##LoggingTest
val systemServices = SystemServices(new ServicesRootComponentFactory)
val dbName = "smallLogging.db"
val logDirPathname = "smallLogging"
val file = new java.io.File(dbName)
file.delete
EmptyLogDirectory(logDirPathname)
val properties = new Properties
properties.put("dbPathname", dbName)
properties.put("logDirPathname", logDirPathname)
properties.put("flushLog", "true")
val db = Subsystem(
systemServices,
new SmallComponentFactory,
properties = properties,
actorId = ActorId("db"))
val results = new Results
val chain = new Chain(results)
chain.op(systemServices, Register(db))
chain.op(db, SetRequest(db, "/$", IncDesInt(null)))
Future(systemServices, chain)
systemServices.close