public IEnumerable <byte[]> Stream(long globalSequenceNumber = 0) { var lastCommitId = CommitLog.Read(); return(from record in GlobalSequenceIndex.Read(lastCommitId, offset: globalSequenceNumber) select DataStore.Read(record.AggregateRootId, record.LocalSequenceNumber)); }
internal FisqStore(string basePath, bool dropEvents) { Directory.CreateDirectory(basePath); GlobalSequenceIndex = new GlobalSequenceIndex(basePath, dropEvents); DataStore = new DataStore(basePath, dropEvents); CommitLog = new CommitLog(basePath, dropEvents); }
public void Enqueue(string streamId, long seq, byte[] data) { lock (_lock) { var commitId = CommitLog.Read(out var isCorrupted); if (isCorrupted) { CommitLog.Recover(); } GlobalSequenceIndex.DetectCorruptionAndRecover(DataStore, commitId); var nextCommitId = commitId + 1; var @event = new EventData(streamId, seq, data); GlobalSequenceIndex.Write(nextCommitId, @event); DataStore.Write(@event); CommitLog.Write(nextCommitId); } }
public void Dispose() { GlobalSequenceIndex.Dispose(); CommitLog.Dispose(); }