private JournalMetadata CreateMetadata <T>(JournalElement conf = null, string[] privateFields = null)
        {
            var settings = conf ?? new JournalElement();
            var meta     = JournalBuilder.CreateNewJournalMetadata(settings, typeof(T));

            return(meta);
        }
        private static JournalMetadata CreateMetadata <T>(EPartitionType configValue,
                                                          string workingDir, params string[] symbols)
        {
            var jconf = new JournalElement
            {
                DefaultPath   = workingDir,
                PartitionType = configValue
            };

            if (symbols != null)
            {
                foreach (string sym in symbols)
                {
                    var se = new SymbolElement
                    {
                        AvgSize           = 20,
                        HintDistinctCount = 100,
                        MaxSize           = 120,
                        Name = sym
                    };
                    jconf.Columns.Add(se);
                }
            }
            var meta = JournalBuilder.CreateNewJournalMetadata(jconf, typeof(T));

            return(meta);
        }
Example #3
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));
            }
        }