Пример #1
0
        private static JournalElement UpdateConfiguration(JournalElement conf)
        {
            string         settingsFile   = Path.Combine(conf.DefaultPath, MetadataConstants.JOURNAL_SETTINGS_FILE_NAME);
            JournalElement existingConfig = null;

            if (File.Exists(settingsFile))
            {
                try
                {
                    using (var dbXml = File.OpenRead(settingsFile))
                    {
                        existingConfig = ConfigurationSerializer.ReadJournalConfiguration(dbXml);
                    }
                }
                catch (IOException)
                {
                }
                catch (InvalidOperationException)
                {
                }

                if (existingConfig != null)
                {
                    existingConfig.OpenPartitionTtl  = conf.OpenPartitionTtl;
                    existingConfig.MaxOpenPartitions = conf.MaxOpenPartitions;
                    existingConfig.LagHours          = conf.LagHours;
                    existingConfig.DefaultPath       = conf.DefaultPath;
                    existingConfig.SerializerName    = conf.SerializerName;
                    existingConfig.FromDisk          = true;
                    return(existingConfig);
                }
            }
            return(conf);
        }
Пример #2
0
        public void SaveTo(Stream stream)
        {
            var existingConfig = GetConfig();

            ConfigurationSerializer.WriteJournalConfiguration(stream, existingConfig);
        }