Exemplo n.º 1
0
 /// <summary>
 /// Creates a new <see cref="ServerDatabaseSettings"/>
 /// </summary>
 public ServerDatabaseSettings()
 {
     m_databaseName             = string.Empty;
     m_archiveList              = new ArchiveListSettings();
     m_writeProcessor           = new WriteProcessorSettings();
     m_rolloverLog              = new RolloverLogSettings();
     m_keyType                  = Guid.Empty;
     m_valueType                = Guid.Empty;
     m_streamingEncodingMethods = new ImmutableList <EncodingDefinition>(x =>
     {
         if (x is null)
         {
             throw new ArgumentNullException("value");
         }
         return(x);
     });
 }
Exemplo n.º 2
0
        private void ToWriteProcessorSettings(WriteProcessorSettings settings)
        {
            string intermediateFilePendingExtension;
            string intermediateFileFinalExtension;
            string finalFilePendingExtension;
            string finalFileFinalExtension;

            ValidateExtension(IntermediateFileExtension, out intermediateFilePendingExtension, out intermediateFileFinalExtension);
            ValidateExtension(FinalFileExtension, out finalFilePendingExtension, out finalFileFinalExtension);

            if (m_supportsWriting)
            {
                List <string> finalPaths = new List <string>();
                if (FinalWritePaths.Count > 0)
                {
                    finalPaths.AddRange(FinalWritePaths);
                }
                else
                {
                    finalPaths.Add(m_mainPath);
                }

                settings.IsEnabled = true;

                //0.1 seconds
                settings.PrebufferWriter.RolloverInterval   = m_cacheFlushInterval;
                settings.PrebufferWriter.MaximumPointCount  = 25000;
                settings.PrebufferWriter.RolloverPointCount = 25000;

                //10 seconds
                settings.FirstStageWriter.MaximumAllowedMb = 100;                 //about 10 million points
                settings.FirstStageWriter.RolloverSizeMb   = 100;                 //about 10 million points
                settings.FirstStageWriter.RolloverInterval = m_diskFlushInterval; //10 seconds
                settings.FirstStageWriter.EncodingMethod   = ArchiveEncodingMethod;
                settings.FirstStageWriter.FinalSettings.ConfigureOnDisk(new string[] { m_mainPath }, 1024 * 1024 * 1024, ArchiveDirectoryMethod.TopDirectoryOnly, ArchiveEncodingMethod, "stage1", intermediateFilePendingExtension, intermediateFileFinalExtension, FileFlags.Stage1, FileFlags.IntermediateFile);

                for (int stage = 2; stage <= StagingCount; stage++)
                {
                    int remainingStages = StagingCount - stage;

                    var rollover = new CombineFilesSettings();
                    if (remainingStages > 0)
                    {
                        rollover.ArchiveSettings.ConfigureOnDisk(new string[] { m_mainPath }, 1024 * 1024 * 1024,
                                                                 ArchiveDirectoryMethod.TopDirectoryOnly, ArchiveEncodingMethod, "stage" + stage,
                                                                 intermediateFilePendingExtension, intermediateFileFinalExtension, FileFlags.GetStage(stage), FileFlags.IntermediateFile);
                    }
                    else
                    {
                        //Final staging file
                        rollover.ArchiveSettings.ConfigureOnDisk(finalPaths, 5 * 1024L * 1024 * 1024,
                                                                 m_directoryMethod, ArchiveEncodingMethod, m_databaseName.ToNonNullNorEmptyString("stage" + stage).RemoveInvalidFileNameCharacters(),
                                                                 finalFilePendingExtension, finalFileFinalExtension, FileFlags.GetStage(stage));
                    }

                    rollover.LogPath            = m_mainPath;
                    rollover.ExecuteTimer       = 1000;
                    rollover.CombineOnFileCount = 60;
                    rollover.CombineOnFileSize  = m_targetFileSize / (long)Math.Pow(30, remainingStages);
                    rollover.MatchFlag          = FileFlags.GetStage(stage - 1);
                    settings.StagingRollovers.Add(rollover);
                }
            }
        }