Exemplo n.º 1
0
        public MemoryFile(string fileName, int bitHint, EFileAccess access, EFileFlags fileFlags)
        {
            if (fileName == null)
            {
                throw new ArgumentNullException("fileName");
            }

            Filename   = fileName;
            _bitHint   = bitHint;
            _access    = access;
            _fileFlags = fileFlags;
            _fullName  = Path.GetFullPath(fileName);
        }
Exemplo n.º 2
0
 public CompositeFileFactory(EFileFlags fileFlags = EFileFlags.None)
 {
     _fileFlags = fileFlags;
 }
Exemplo n.º 3
0
 public JournalBuilder WithFileFlags(EFileFlags fileFlags)
 {
     _config.FileFlags = fileFlags;
     return(this);
 }
Exemplo n.º 4
0
        public static PartitionData <T> CreatePartition <T>(int?recordHint = null, EFileAccess access = EFileAccess.Read, EFileFlags fileFlags = EFileFlags.None)
        {
            var mmFactory = new CompositeFileFactory(fileFlags);

            using (var dbXml = typeof(Quote).Assembly.GetManifestResourceStream(
                       "Apaf.NFSdb.TestShared.Resources.nfsdb.xml"))
            {
                var dbElement = ConfigurationSerializer.ReadConfiguration(dbXml);
                var jconf     = dbElement.Journals.Single(j => j.Class.EndsWith("." + typeof(T).Name));
                if (recordHint.HasValue)
                {
                    jconf.RecordHint = recordHint.Value;
                }
                var journalPath = Path.Combine(FindJournalsPath(), jconf.DefaultPath);
                jconf.DefaultPath = journalPath;

                var metadata       = JournalBuilder.CreateNewJournalMetadata(jconf);
                var startDate      = new DateTime(2013, 10, 1);
                var journalStorage = new ColumnStorage(metadata, jconf.DefaultPath,
                                                       access, 0, mmFactory);

                var part = new Partition(
                    metadata, new CompositeFileFactory(fileFlags),
                    access, new PartitionDate(startDate, 0, metadata.Settings.PartitionType), 0,
                    Path.Combine(jconf.DefaultPath, "2013-10"), new AsyncJournalServer(TimeSpan.FromSeconds(1)));

                return(new PartitionData <T>(part, metadata, journalStorage, journalPath));
            }
        }