示例#1
0
        public Journal(JournalConfiguration journalConfiguration, IJournalFileWriter journalFileWriter, JournalOffsetManager journalOffsetManager, IList <ITransformJournalEntry> entryTransformers)
        {
            _journalConfiguration = journalConfiguration;
            _journalFileWriter    = journalFileWriter;
            _journalOffsetManager = journalOffsetManager;
            _entryTransformers    = entryTransformers;

            _journalFileWriter.SetJournal(_journalOffsetManager.CurrentJournalIndex, _journalOffsetManager.NextJournalEntryOffset);
        }
示例#2
0
        public IWriteDataBlocks CreateJournaler(JournalConfiguration configuration)
        {
            var fileWriter = configuration.IoType == IoType.Buffered
                ? (IJournalFileWriter) new BufferedJournalFileWriter(configuration)
                : new UnbufferedJournalFileWriter(configuration);

            var offsetManager = new JournalOffsetManager(configuration);

            var transformers = new List <ITransformJournalEntry>
            {
                new AddJournalMetadata()
            };

            if (configuration.IoType == IoType.Unbuffered)
            {
                transformers.Add(new PadToAlignToSector(configuration));
            }

            return(new Journal(configuration, fileWriter, offsetManager, transformers));
        }