예제 #1
0
        public JournalOffsetManager(JournalConfiguration journalConfiguration)
        {
            _journalLengthInBytes = journalConfiguration.LengthInBytes;

            CurrentJournalIndex    = 0;
            NextJournalEntryOffset = 0;
        }
예제 #2
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);
        }
예제 #3
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));
        }