Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        internal FisqStore(string basePath, bool dropEvents)
        {
            Directory.CreateDirectory(basePath);

            GlobalSequenceIndex = new GlobalSequenceIndex(basePath, dropEvents);
            DataStore           = new DataStore(basePath, dropEvents);
            CommitLog           = new CommitLog(basePath, dropEvents);
        }
Ejemplo n.º 3
0
        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);
            }
        }
Ejemplo n.º 4
0
 public void Dispose()
 {
     GlobalSequenceIndex.Dispose();
     CommitLog.Dispose();
 }