public void DualCounterTest() { string filePath = "c:\\temp\\test"; DocCounter docCounter= new DocCounter(filePath); SequenceCounter sequenceCounter= new SequenceCounter(filePath); docCounter.Reset(); sequenceCounter.Reset(); long docCount = docCounter.Get(); Assert.AreEqual(0, docCount); docCount = docCounter.Next(); Assert.AreEqual(1, docCount); long sequenceCount = sequenceCounter.Get(); Assert.AreEqual(0, sequenceCount); sequenceCount = sequenceCounter.Next(); Assert.AreEqual(1, sequenceCount); docCounter.Close(); docCounter = new DocCounter(filePath); docCount = docCounter.Get(); Assert.AreEqual(1, docCount); }
public void Open(string storeName, string basePath = BASE_PATH, Dictionary <string, string> options = null) { this.storeName = storeName; DBLockManager manager = DBLockManager.Instance; if (!basePath.EndsWith("\\")) { basePath += "\\"; } this.storeBasePath = basePath; // stores the revision history for a given document docStore = manager.GetDB(basePath + storeName + "\\docStore"); // stores the specific revision id and data for a given document sequenceStore = manager.GetDB(basePath + storeName + "\\sequenceStore"); attachStore = manager.GetDB(basePath + storeName + "\\attachStore"); attachBinaryStore = manager.GetDB(basePath + storeName + "\\attachBinaryStore"); docCounter = new DocCounter(basePath + storeName); docCount = docCounter.Get(); sequenceCounter = new SequenceCounter(basePath + storeName); sequenceCount = sequenceCounter.Get(); opened = true; }
public void SequenceCounterTest() { string filePath = "c:\\temp\\test"; SequenceCounter counter = new SequenceCounter(filePath); counter.Reset(); long count = counter.Get(); Assert.AreEqual(0, count); count = counter.Next(); Assert.AreEqual(1, count); count = counter.Next(); Assert.AreEqual(2, count); counter.Close(); counter = null; counter = new SequenceCounter(filePath); count = counter.Get(); Assert.AreEqual(2, count); }
public void Open(string storeName, string basePath = BASE_PATH, Dictionary<string, string> options = null) { this.storeName = storeName; DBLockManager manager = DBLockManager.Instance; if (!basePath.EndsWith("\\")) { basePath += "\\"; } this.storeBasePath = basePath; // stores the revision history for a given document docStore = manager.GetDB(basePath + storeName+"\\docStore"); // stores the specific revision id and data for a given document sequenceStore = manager.GetDB(basePath + storeName + "\\sequenceStore"); attachStore = manager.GetDB(basePath + storeName + "\\attachStore"); attachBinaryStore = manager.GetDB(basePath + storeName + "\\attachBinaryStore"); docCounter = new DocCounter( basePath + storeName); docCount = docCounter.Get(); sequenceCounter = new SequenceCounter(basePath + storeName); sequenceCount= sequenceCounter.Get(); opened = true; }