internal EventStore(string dbname, long lastcommittedcommandsn) { DatabaseName = dbname; LastExecutedCommandSN = lastcommittedcommandsn; LoadUncommittedEventsFromJournal(); _eventHandlerThread = new Thread(new ThreadStart(ExecuteEventCommands)); _eventHandlerThread.Start(); _journal = new Journaling(Configuration.BasePath, dbname); }
internal EventStore(string dbname, long lastcommittedcommandsn) { DatabaseName = dbname; LastExecutedCommandSN = lastcommittedcommandsn; long jsn = LoadUncommittedEventsFromJournal(); _eventHandlerThread = new Thread(new ThreadStart(ExecuteEventCommands)); _eventHandlerThread.Start(); _journal = new Journaling(Configuration.BasePath, dbname); _operationsLog = new Journaling(Configuration.BasePath, dbname); // The journal can be empty so i have to evaluate the last committed command serial number // and reset Command Serial number in the journal to ensure command execution coherency. _journal.CommandSN = Math.Max(jsn, lastcommittedcommandsn); }