public int PutObject(object obj, int id = 0) { if (id == 0) { id = fileStore.GetKeyForNewObject(obj); } memoryStore.PutObject(obj, id); journal.RecordWrite(obj, id); indexStore.IndexObject(obj, id); return(id); }
public void RecordWriteCreatesJournalEntry() { var journal = new FileJournal("Wrote", null); journal.JournalIntervalSeconds = 10000; var gates = new Creature("Bill Gates", Alignment.Good); string dir = string.Format(@"{0}\Journal", journal.DirectoryPath); try { Assert.AreEqual(0, Directory.GetFiles(dir).Length); journal.RecordWrite(gates); Assert.AreEqual(1, Directory.GetFiles(dir).Length); } finally { journal.DeleteDatabase(); Directory.Delete("Wrote"); } }