コード例 #1
0
        /// <summary>
        /// Sets a bool-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, bool Value)
        {
            await synchObject.BeginWrite();

            try
            {
                BooleanSetting Setting = await Database.FindFirstDeleteRest <BooleanSetting>(new FilterFieldEqualTo("Key", Key));

                if (Setting is null)
                {
                    Setting = new BooleanSetting(Key, Value);
                    await Database.Insert(Setting);

                    return(true);
                }
                else
                {
                    if (Setting.Value != Value)
                    {
                        Setting.Value = Value;
                        await Database.Update(Setting);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            finally
            {
                await synchObject.EndWrite();
            }
        }
コード例 #2
0
        private void UpdateDisplay()
        {
            StringBuilder sb = new StringBuilder();

            var items = SettingsCollection.Where(e => e.IsModified);

            foreach (var item in items)
            {
                sb.Append(item.Label.ToUpper());

                if (item is StringSetting)
                {
                    StringSetting ss = item as StringSetting;
                    sb.Append(": ");
                    sb.Append(ss.TextValue);
                }
                else
                {
                    BooleanSetting bs = item as BooleanSetting;
                    if (bs.IsChecked)
                    {
                        sb.Append(": Checked");
                    }
                    else
                    {
                        sb.Append(": Unchecked");
                    }
                }
                sb.Append(Environment.NewLine);
            }

            Display = sb.ToString();
        }
コード例 #3
0
        /// <summary>
        /// Sets a bool-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, bool Value)
        {
            foreach (BooleanSetting Setting in await Database.Find <BooleanSetting>(new FilterFieldEqualTo("Key", Key)))
            {
                if (Setting.Value != Value)
                {
                    Setting.Value = Value;
                    await Database.Update(Setting);

                    //Log.Informational("Setting updated.", Key, new KeyValuePair<string, object>("Value", Value));
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            BooleanSetting NewSetting = new BooleanSetting(Key, Value);
            await Database.Insert(NewSetting);

            //Log.Informational("Setting created.", Key, new KeyValuePair<string, object>("Value", Value));

            return(true);
        }
コード例 #4
0
        /// <summary>
        /// Sets a bool-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, bool Value)
        {
            using (Semaphore Semaphore = await Semaphores.BeginWrite("setting:" + Key))
            {
                BooleanSetting Setting = await Database.FindFirstDeleteRest <BooleanSetting>(new FilterFieldEqualTo("Key", Key));

                if (Setting is null)
                {
                    Setting = new BooleanSetting(Key, Value);
                    await Database.Insert(Setting);

                    return(true);
                }
                else
                {
                    if (Setting.Value != Value)
                    {
                        Setting.Value = Value;
                        await Database.Update(Setting);

                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Sets a bool-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="Value">New value.</param>
        /// <returns>If the setting was saved (true). If the setting existed, and had the same value, false is returned.</returns>
        public static async Task <bool> SetAsync(string Key, bool Value)
        {
            using (Semaphore Semaphore = await Semaphores.BeginWrite("setting:" + Key))
            {
                BooleanSetting Setting = await Database.FindFirstDeleteRest <BooleanSetting>(new FilterFieldEqualTo("Key", Key));

                return(await SetAsyncLocked(Key, Value, Setting));
            }
        }
コード例 #6
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && (this.setting != null))
     {
         this.setting.ValueChangedT -= new ValueChangedEventHandler <bool>(this.OnSettingValueChanged);
         this.setting = null;
     }
     base.Dispose(disposing);
 }
コード例 #7
0
 public BooleanSplitButton(BooleanSetting setting, string resourceRoot)
 {
     Validate.Begin().IsNotNull <BooleanSetting>(setting, "setting").IsNotNullOrWhiteSpace(resourceRoot, "resourceRoot").Check();
     this.setting                = setting;
     this.resourceRoot           = resourceRoot;
     this.setting.ValueChangedT += new ValueChangedEventHandler <bool>(this.OnSettingValueChanged);
     base.Name         = resourceRoot;
     this.DisplayStyle = ToolStripItemDisplayStyle.Image;
     base.AutoSize     = true;
     base.Available    = false;
 }
コード例 #8
0
 public BooleanSettingDTO(BooleanSetting setting)
     : base(
         setting.SettingId,
         setting.Order,
         setting.IsReadOnly,
         setting.ChangeRequiresDashboardRestart,
         setting.ChangeRequiresBackendRestart,
         setting.ShortText,
         setting.LongText,
         setting.HoverText)
 {
     Value = setting.Value;
 }
コード例 #9
0
        public static string Build(BooleanSetting setting)
        {
            StringBuilder builder = new StringBuilder();

            builder.AppendLine(setting.Key);
            if (setting.Description != null)
            {
                builder.AppendLine();
                builder.AppendLine(setting.Description);
            }
            if (setting.DefaultValue.HasValue)
            {
                builder.AppendLine();
                var realDefaultValue = setting.DefaultValue.Value ? "1" : "0";
                builder.AppendLine($"{Resources.GameSettings_DefaultValue_Text}: {realDefaultValue}");
            }
            return(builder.ToString());
        }
コード例 #10
0
        private static async Task <bool> SetAsyncLocked(string Key, bool Value, BooleanSetting Setting)
        {
            if (Setting is null)
            {
                Setting = new BooleanSetting(Key, Value);
                await Database.Insert(Setting);

                return(true);
            }
            else
            {
                if (Setting.Value != Value)
                {
                    Setting.Value = Value;
                    await Database.Update(Setting);

                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
コード例 #11
0
        private void UpdateSetting(BaseSetting setting, bool wasChanged)
        {
            #region BooleanSettings
            BooleanSetting newValue = setting as BooleanSetting;
            if (newValue != null)
            {
                var oldValue = Settings.FirstOrDefault(set => set.Equals(newValue));
                if (oldValue != null)
                {
                    BooleanSetting oldBoolValue = oldValue as BooleanSetting;
                    if (oldBoolValue != null)
                    {
                        if (wasChanged)
                        {
                            oldBoolValue.ChangeValue(newValue.Value);
                        }
                        else
                        {
                            oldBoolValue.ChangeValue(oldBoolValue.Value);
                        }
                        PublishSettingChangeNotification(setting, wasChanged);
                        return;
                    }
                }
            }
            #endregion

            #region IntegerSettings
            IntegerSetting newIntValue = setting as IntegerSetting;
            if (newIntValue != null)
            {
                var oldValue = Settings.FirstOrDefault(set => set.Equals(newIntValue));
                if (oldValue != null)
                {
                    IntegerSetting oldIntValue = oldValue as IntegerSetting;
                    if (oldIntValue != null)
                    {
                        if (wasChanged)
                        {
                            oldIntValue.ChangeValue(newIntValue.Value);
                        }
                        else
                        {
                            oldIntValue.ChangeValue(oldIntValue.Value);
                        }
                        PublishSettingChangeNotification(setting, wasChanged);
                        return;
                    }
                }
            }
            #endregion

            #region SkinSettings
            SkinSetting newSkinValue = setting as SkinSetting;
            if (newSkinValue != null)
            {
                var oldValue = Settings.FirstOrDefault(set => set.Equals(newSkinValue));
                if (oldValue != null)
                {
                    SkinSetting oldSkinValue = oldValue as SkinSetting;
                    if (oldSkinValue != null)
                    {
                        if (wasChanged)
                        {
                            oldSkinValue.ChangeValue(newSkinValue.Value);
                            Configuration.Skinning.CurrentSkin = newSkinValue.Value;
                        }
                        else
                        {
                            oldSkinValue.ChangeValue(oldSkinValue.Value);
                        }
                        PublishSettingChangeNotification(setting, wasChanged);
                        return;
                    }
                }
            }
            #endregion

            #region LocalizationSettings
            if (setting is LocalizationSetting newLocalizationValue)
            {
                var oldValue = Settings.FirstOrDefault(set => set.Equals(newLocalizationValue));
                if (oldValue != null)
                {
                    if (oldValue is LocalizationSetting oldLocalizationValue)
                    {
                        if (wasChanged)
                        {
                            oldLocalizationValue.ChangeValue(newLocalizationValue.Value);
                            Configuration.Localization.CurrentLanguage = newLocalizationValue.Value;
                        }
                        else
                        {
                            oldLocalizationValue.ChangeValue(oldLocalizationValue.Value);
                        }
                        PublishSettingChangeNotification(setting, wasChanged);
                        return;
                    }
                }
            }
            #endregion
        }
コード例 #12
0
        public ScanSettings()
            : base()
        {
            TurntableScanningSetter = new SettingSetter();

            //Kinect
            KinectProperties = new SettingGroup("Kinect")
            {
                FriendlyName = GreenResources.SettingGroupKinect, Footer = GreenResources.SettingGroupKinectFooter
            };
            SettingGroups.Add(KinectProperties);

            KinectMode = new EnumSetting <KinectManager.Modes>("Mode", KinectManager.Modes.DepthAndColor)
            {
                FriendlyName = GreenResources.SettingKinectMode, FriendlyOptions = GreenResources.EnumKinectManagerModes.Split('|')
            };
            DependentAvailability kinectModeIsDepthAndColor = new DependentAvailability(KinectMode, "DepthAndColor");
            DependentAvailability kinectModeWithDepth       = new DependentAvailability(KinectMode, "Depth|DepthAndColor");

            KinectProperties.Settings.Add(KinectMode);

            NearModeEnabled = new BooleanSetting("NearModeEnabled", true)
            {
                FriendlyName = GreenResources.SettingKinectNearMode, AvailabilityProvider = kinectModeWithDepth
            };
            EmitterEnabled = new BooleanSetting("EmitterEnabled", true)
            {
                FriendlyName = GreenResources.SettingKinectEmitterEnabled, AvailabilityProvider = kinectModeWithDepth
            };
            ElevationAngle = new NumericSetting <int>("ElevationAngle", 0, -27, 27)
            {
                FriendlyName = GreenResources.SettingElevationAngle
            };
            KinectProperties.Settings.Add(NearModeEnabled);
            KinectProperties.Settings.Add(EmitterEnabled);
            KinectProperties.Settings.Add(ElevationAngle);

            TurntableScanningSetter.Settings.AddRange(KinectProperties.Settings);

            //Preprocessing
            PreprocessingProperties = new SettingGroup("Preprocessing")
            {
                FriendlyName = GreenResources.SettingGroupPreprocessing
            };
            SettingGroups.Add(PreprocessingProperties);

            DepthAveraging = new NumericSetting <int>("DepthAveraging", 1, 1, 256)
            {
                FriendlyName = GreenResources.SettingDepthAveraging, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            DepthGaussIterations = new NumericSetting <int>("DepthGaussIterations", 0, 0, 4)
            {
                FriendlyName = GreenResources.SettingDepthGaussIterations, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            DepthGaussSigma = new NumericSetting <float>("DepthGaussSigma", 1, 0.1f, 4f, 2)
            {
                FriendlyName = GreenResources.SettingDepthGaussSigma, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            PreprocessingProperties.Settings.Add(DepthAveraging);
            PreprocessingProperties.Settings.Add(DepthGaussIterations);
            PreprocessingProperties.Settings.Add(DepthGaussSigma);

            //Camera
            CameraProperties = new SettingGroup("Camera")
            {
                FriendlyName = GreenResources.SettingGroupCamera
            };
            SettingGroups.Add(CameraProperties);

            InfraredIntrinsics = new MatrixSetting("InfraredIntrinsics", new float[, ] {
                { 582.0813f, 0f, 309.8195f }, { 0f, 582.865f, 234.2108f }, { 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingInfraredIntrinsics, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            InfraredDistortion = new MatrixSetting("InfraredDistortion", new float[, ] {
                { 0f, 0f }, { 0f, 0f }
            })
            {
                FriendlyName = GreenResources.SettingInfraredDistortion, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            InfraredDistortionCorrectionEnabled = new BooleanSetting("InfraredDistortionCorrectionEnabled", false)
            {
                FriendlyName = GreenResources.SettingInfraredDistortionCorrectionEnabled, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            DepthToIRMapping = new MatrixSetting("DepthToIRMapping", new float[, ] {
                { 1f, 0f, 0f }, { 0f, 1f, 0f }, { 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingDepthToIRMapping, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            DepthCoeffs = new MatrixSetting("DepthCoeffs", new float[, ] {
                { 0.125e-3f, 0f }
            })
            {
                FriendlyName = GreenResources.SettingDepthCoeffs, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorIntrinsics = new MatrixSetting("ColorIntrinsics", new float[, ] {
                { 523.279f, 0f, 303.9468f }, { 0f, 523.1638f, 239.1431f }, { 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingColorIntrinsics, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorRemapping = new MatrixSetting("ColorRemapping", new float[, ] {
                { 1f, 0f, 0f }, { 0f, 1f, 0f }, { 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingColorRemapping, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorExtrinsics = new MatrixSetting("ColorExtrinsics", new float[, ] {
                { 0.999967f, 0.003969562f, 0.00709248f, 0.02473051f }, { -0.003896888f, 0.9999401f, -0.01023114f, -0.000453843f }, { -0.007132668f, 0.01020316f, 0.9999225f, 0.003119022f }, { 0f, 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingColorExtrinsics, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            CameraProperties.Settings.Add(InfraredIntrinsics);
            CameraProperties.Settings.Add(InfraredDistortion);
            CameraProperties.Settings.Add(InfraredDistortionCorrectionEnabled);
            CameraProperties.Settings.Add(DepthToIRMapping);
            CameraProperties.Settings.Add(DepthCoeffs);
            CameraProperties.Settings.Add(ColorIntrinsics);
            CameraProperties.Settings.Add(ColorRemapping);
            CameraProperties.Settings.Add(ColorExtrinsics);

            ColorDispositionX = new NumericSetting <int>("ColorDispositionX", 0, -32, 32)
            {
                FriendlyName = GreenResources.SettingColorDispositionX, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorDispositionY = new NumericSetting <int>("ColorDispositionY", 0, -32, 32)
            {
                FriendlyName = GreenResources.SettingColorDispositionY, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorScaleX = new NumericSetting <float>("ColorScaleX", 1f, 0.8f, 1.2f, 2)
            {
                FriendlyName = GreenResources.SettingColorScaleX, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ColorScaleY = new NumericSetting <float>("ColorScaleY", 1f, 0.8f, 1.2f, 2)
            {
                FriendlyName = GreenResources.SettingColorScaleY, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            CameraProperties.Settings.Add(ColorDispositionX);
            CameraProperties.Settings.Add(ColorDispositionY);
            CameraProperties.Settings.Add(ColorScaleX);
            CameraProperties.Settings.Add(ColorScaleY);

            TurntableScanningSetter.Settings.AddRange(CameraProperties.Settings);

            //View
            ViewProperties = new SettingGroup("View")
            {
                FriendlyName = GreenResources.SettingGroupView
            };
            SettingGroups.Add(ViewProperties);

            TranslationX = new NumericSetting <float>("TranslationX", 0f, -1f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingTranslationX, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            TranslationY = new NumericSetting <float>("TranslationY", 0f, -1f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingTranslationY, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            TranslationZ = new NumericSetting <float>("TranslationZ", 1.5f, 0f, 3f, 2)
            {
                FriendlyName = GreenResources.SettingTranslationZ, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ViewProperties.Settings.Add(TranslationX);
            ViewProperties.Settings.Add(TranslationY);
            ViewProperties.Settings.Add(TranslationZ);

            RotationX = new NumericSetting <float>("RotationX", 0f, -180f, 180f, 2)
            {
                FriendlyName = GreenResources.SettingRotationX, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            RotationY = new NumericSetting <float>("RotationY", 0f, -180f, 180f, 2)
            {
                FriendlyName = GreenResources.SettingRotationY, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            RotationZ = new NumericSetting <float>("RotationZ", 0f, -180f, 180f, 2)
            {
                FriendlyName = GreenResources.SettingRotationZ, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ViewProperties.Settings.Add(RotationX);
            ViewProperties.Settings.Add(RotationY);
            ViewProperties.Settings.Add(RotationZ);

            Scale = new NumericSetting <float>("Scale", 1f, 0f, 8f, 2)
            {
                FriendlyName = GreenResources.SettingScale
            };
            MoveX = new NumericSetting <float>("MoveX", 0f, -1f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingMoveX
            };
            MoveY = new NumericSetting <float>("MoveY", 0f, -1f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingMoveY
            };
            Rotation = new NumericSetting <int>("Rotation", 0, 0, 3)
            {
                FriendlyName = GreenResources.SettingRotation
            };
            ViewProperties.Settings.Add(Scale);
            ViewProperties.Settings.Add(MoveX);
            ViewProperties.Settings.Add(MoveY);
            ViewProperties.Settings.Add(Rotation);

            //Shading
            ShadingProperties = new SettingGroup("Shading")
            {
                FriendlyName = GreenResources.SettingGroupShading
            };
            SettingGroups.Add(ShadingProperties);

            UseModuleShading = new BooleanSetting("ModuleShading", false)
            {
                FriendlyName = GreenResources.SettingUseModuleShading, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ShadingMode = new EnumSetting <GraphicsCanvas.ShadingModes>("ShadingMode", GraphicsCanvas.ShadingModes.Rainbow)
            {
                FriendlyName = GreenResources.SettingShadingMode, AvailabilityProvider = kinectModeIsDepthAndColor, FriendlyOptions = GreenResources.EnumGraphicsCanvasShadingModes.Split('|')
            };
            DependentAvailability periodicShading = new DependentAvailability(ShadingMode, "Zebra|Rainbow|ShadedRainbow");
            DependentAvailability phongShading    = new DependentAvailability(ShadingMode, "ShadedRainbow|ShadedScale|Phong");

            DepthMaximum = new NumericSetting <float>("DepthMaximum", 8f, 0f, 8f, 2)
            {
                FriendlyName = GreenResources.SettingDepthMaximum, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            DepthMinimum = new NumericSetting <float>("DepthMinimum", 0.4f, 0.4f, 8f, 2)
            {
                FriendlyName = GreenResources.SettingDepthMinimum, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ShadingPeriode = new NumericSetting <float>("ShadingPeriode", 1f, 0.01f, 2f, 2)
            {
                FriendlyName = GreenResources.SettingShadingPeriode, AvailabilityProvider = periodicShading
            };
            ShadingPhase = new NumericSetting <float>("ShadingPhase", 0f, 0f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingShadingPhase, AvailabilityProvider = periodicShading
            };
            TriangleRemoveLimit = new NumericSetting <float>("TriangleRemoveLimit", 0.0024f, 0.0001f, 0.004f, 4)
            {
                FriendlyName = GreenResources.SettingTriangleRemoveLimit, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            WireframeShading = new BooleanSetting("WireframeShading", false)
            {
                FriendlyName = GreenResources.SettingWireframeShading, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            ShadingProperties.Settings.Add(UseModuleShading);
            ShadingProperties.Settings.Add(ShadingMode);
            ShadingProperties.Settings.Add(DepthMaximum);
            ShadingProperties.Settings.Add(DepthMinimum);
            ShadingProperties.Settings.Add(ShadingPeriode);
            ShadingProperties.Settings.Add(ShadingPhase);
            ShadingProperties.Settings.Add(TriangleRemoveLimit);
            ShadingProperties.Settings.Add(WireframeShading);

            //Lighting
            LightingProperties = new SettingGroup("Lighting")
            {
                FriendlyName = GreenResources.SettingGroupLighting
            };
            SettingGroups.Add(LightingProperties);

            AmbientLighting = new NumericSetting <float>("AmbientLighting", 0.1f, 0f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingAmbientLighting, AvailabilityProvider = phongShading
            };
            DiffuseLighting = new NumericSetting <float>("DiffuseLighting", 0.8f, 0f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingDiffuseLighting, AvailabilityProvider = phongShading
            };
            SpecularLighting = new NumericSetting <float>("SpecularLighting", 0.4f, 0f, 1f, 2)
            {
                FriendlyName = GreenResources.SettingSpecularLighting, AvailabilityProvider = phongShading
            };
            Shininess = new NumericSetting <float>("Shininess", 20f, 0f, 50f, 1)
            {
                FriendlyName = GreenResources.SettingShininess, AvailabilityProvider = phongShading
            };
            LightingProperties.Settings.Add(AmbientLighting);
            LightingProperties.Settings.Add(DiffuseLighting);
            LightingProperties.Settings.Add(SpecularLighting);
            LightingProperties.Settings.Add(Shininess);

            //Performance
            PerformanceProperties = new SettingGroup("Performance")
            {
                FriendlyName = GreenResources.SettingGroupPerformance
            };
            SettingGroups.Add(PerformanceProperties);

            TriangleGridResolution = new SizeSetting("TriangleGridResolution", 640, 480, 16, 12, 640, 480)
            {
                FriendlyName = GreenResources.SettingTriangleGridResolution, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            PerformanceProperties.Settings.Add(TriangleGridResolution);

            //Save
            SaveProperties = new SettingGroup("Save")
            {
                FriendlyName = GreenResources.SettingGroupSave
            };
            SettingGroups.Add(SaveProperties);

            SaveDirectory = new PathSetting("Directory", "")
            {
                FriendlyName = GreenResources.SettingSaveDirectory
            };
            SaveLabel = new StringSetting("Label", "", Path.GetInvalidFileNameChars())
            {
                FriendlyName = GreenResources.SettingSaveLabel
            };
            SaveNoTimestamp = new BooleanSetting("NoTimestamp", false)
            {
                FriendlyName = GreenResources.SettingSaveNoTimestamp
            };
            SaveModelResolution = new SizeSetting("ModelResolution", 640, 480, 8, 8, 640, 480)
            {
                FriendlyName = GreenResources.SettingSaveModelResolution, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            SaveTextureResolution = new SizeSetting("TextureResolution", 640, 480, 8, 8, 1024, 1024)
            {
                FriendlyName = GreenResources.SettingSaveTextureResolution, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            SaveCalibrationDirectory = new PathSetting("CalibrationDirectory", "")
            {
                FriendlyName = GreenResources.SettingSaveCalibrationDirectory, IsHidden = true
            };
            SaveScalingPower = new NumericSetting <int>("ScalingPower", 0, -3, 6)
            {
                FriendlyName = GreenResources.SettingSaveScalingPower, AvailabilityProvider = kinectModeIsDepthAndColor
            };
            SaveProperties.Settings.Add(SaveDirectory);
            SaveProperties.Settings.Add(SaveLabel);
            SaveProperties.Settings.Add(SaveNoTimestamp);
            SaveProperties.Settings.Add(SaveModelResolution);
            SaveProperties.Settings.Add(SaveTextureResolution);
            SaveProperties.Settings.Add(SaveCalibrationDirectory);
            SaveProperties.Settings.Add(SaveScalingPower);

            SaveContinousShootingInterval = new NumericSetting <int>("SaveContinousShootingInterval", 100, 0, 1000);
            SaveProperties.Settings.Add(SaveContinousShootingInterval);

            //Turntable
            TurntableProperties = new SettingGroup("Turntable")
            {
                FriendlyName = GreenResources.SettingGroupTurntable, IsHidden = true
            };
            SettingGroups.Add(TurntableProperties);

            TurntableMode = new EnumSetting <RotatingScanner.Modes>("Mode", RotatingScanner.Modes.TwoAxis)
            {
                FriendlyName = GreenResources.SettingTurntableMode, FriendlyOptions = GreenResources.EnumRotatingScannerModes.Split('|')
            };
            DependentAvailability turntableModeIsVolumetric = new DependentAvailability(TurntableMode, "Volumetric");
            DependentAvailability turntableModeIsAxial      = new DependentAvailability(TurntableMode, "OneAxis|TwoAxis");

            TurntableProperties.Settings.Add(TurntableMode);
            TurntableTransform = new MatrixSetting("TurntableTransform", new float[, ] {
                { 1f, 0f, 0f, 0f }, { 0f, 1f, 0f, 0f }, { 0f, 0f, 1f, 0f }, { 0f, 0f, 0f, 1f }
            })
            {
                FriendlyName = GreenResources.SettingTurntableTransform, IsHidden = true
            };
            TurntableProperties.Settings.Add(TurntableTransform);
            TurntablePiSteps = new NumericSetting <int>("PiSteps", 10934, 5000, 20000)
            {
                FriendlyName = GreenResources.SettingTurntablePiSteps
            };
            TurntableProperties.Settings.Add(TurntablePiSteps);
            TurntableHasMirror = new BooleanSetting("HasMirror", true)
            {
                FriendlyName = GreenResources.SettingTurntableHasMirror
            };
            TurntableProperties.Settings.Add(TurntableHasMirror);
            TurntableEllipse = new RectangleSetting("SelectionEllipse", new Rect(0d, 0d, 0d, 0d))
            {
                IsHidden = true
            };
            TurntableRectangleA = new RectangleSetting("SelectionRectangleA", new Rect(0d, 0d, 0d, 0d))
            {
                IsHidden = true
            };
            TurntableRectangleB = new RectangleSetting("SelectionRectangleB", new Rect(0d, 0d, 0d, 0d))
            {
                IsHidden = true
            };
            TurntableProperties.Settings.Add(TurntableEllipse);
            TurntableProperties.Settings.Add(TurntableRectangleA);
            TurntableProperties.Settings.Add(TurntableRectangleB);

            TurntableScanningSetter.Settings.AddRange(new Setting[] { TurntableMode, TurntableHasMirror });

            //Turntable - Axial
            TurntableAxialProperties = new SettingGroup("TurntableAxial")
            {
                FriendlyName = GreenResources.SettingGroupTurntableAxial, IsHidden = true
            };
            SettingGroups.Add(TurntableAxialProperties);

            TurntableAxialView = new EnumSetting <RotatingScanner.AxialViews>("AxialView", RotatingScanner.AxialViews.Overlay)
            {
                FriendlyName = GreenResources.SettingTurntableAxialView, AvailabilityProvider = turntableModeIsAxial, FriendlyOptions = GreenResources.EnumRotatingScannerViews.Split('|')
            };
            TurntableAxialProperties.Settings.Add(TurntableAxialView);
            TurntableAxialClippingHeight = new NumericSetting <float>("ClippingHeight", 0.5f, 0f, 2f, 3)
            {
                FriendlyName = GreenResources.SettingTurntableAxialClippingHeight, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialClippingRadius = new NumericSetting <float>("ClippingRadius", 0.3f, 0f, 2f, 3)
            {
                FriendlyName = GreenResources.SettingTurntableAxialClippingRadius, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialProperties.Settings.Add(TurntableAxialClippingHeight);
            TurntableAxialProperties.Settings.Add(TurntableAxialClippingRadius);
            TurntableAxialCoreX = new NumericSetting <float>("CoreX", 0.11f, 0f, 0.5f, 3)
            {
                FriendlyName = GreenResources.SettingTurntableAxialCoreX, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialCoreY = new NumericSetting <float>("CoreY", -0.11f, -0.5f, 0.5f, 3)
            {
                FriendlyName = GreenResources.SettingTurntableAxialCoreY, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialProperties.Settings.Add(TurntableAxialCoreX);
            TurntableAxialProperties.Settings.Add(TurntableAxialCoreY);
            TurntableAxialModelResolution = new SizeSetting("ModelResolution", 640, 480, 64, 64, 1024, 1024)
            {
                FriendlyName = GreenResources.SettingTurntableSaveModelResolution, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialTextureResolution = new SizeSetting("TextureResolution", 640, 480, 64, 64, 1024, 1024)
            {
                FriendlyName = GreenResources.SettingTurntableSaveTextureResolution, AvailabilityProvider = turntableModeIsAxial
            };
            TurntableAxialProperties.Settings.Add(TurntableAxialModelResolution);
            TurntableAxialProperties.Settings.Add(TurntableAxialTextureResolution);

            TurntableScanningSetter.Settings.AddRange(new Setting[] { TurntableAxialClippingHeight, TurntableAxialClippingRadius, TurntableAxialCoreX, TurntableAxialCoreY, TurntableAxialModelResolution, TurntableAxialTextureResolution });

            //Turntable - Volumetric
            TurntableVolumetricProperties = new SettingGroup("TurntableVolumetric")
            {
                FriendlyName = GreenResources.SettingGroupTurntableVolumetric, IsHidden = true
            };
            SettingGroups.Add(TurntableVolumetricProperties);

            TurntableVolumetricCubeSize = new NumericSetting <float>("CubeSize", 30, 10, 50)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricCubeSize, AvailabilityProvider = turntableModeIsVolumetric
            };
            TurntableVolumetricCubeResolution = new NumericSetting <int>("CubeResolution", 128, 16, 512)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricCubeResolution, AvailabilityProvider = turntableModeIsVolumetric
            };
            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricCubeSize);
            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricCubeResolution);
            TurntableVolumetricView = new EnumSetting <RotatingScanner.VolumetricViews>("VolumetricView", RotatingScanner.VolumetricViews.Overlay)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricView, AvailabilityProvider = turntableModeIsVolumetric, FriendlyOptions = GreenResources.EnumRotatingScannerVolumetricViews.Split('|')
            };
            DependentAvailability turntableVolumetricSliceView = new DependentAvailability(new Setting[] { TurntableMode, TurntableVolumetricView }, new string[] { "Volumetric", "Slice" });

            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricView);
            TurntableVolumetricSlice = new NumericSetting <float>("Slice", 0, 0, 1, 2)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricSlice, AvailabilityProvider = turntableVolumetricSliceView
            };
            TurntableVolumetricThreshold = new NumericSetting <float>("Threshold", 0.1f, 0, 1, 2)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricThreshold, AvailabilityProvider = turntableModeIsVolumetric
            };
            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricSlice);
            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricThreshold);
            TurntableVolumetricGradientLimit = new NumericSetting <float>("GradientLimit", 0.05f, 0f, 0.2f, 4)
            {
                FriendlyName = GreenResources.SettingTurntableVolumetricGradientLimit, AvailabilityProvider = turntableModeIsVolumetric
            };
            TurntableVolumetricProperties.Settings.Add(TurntableVolumetricGradientLimit);

            TurntableScanningSetter.Settings.AddRange(new Setting[] { TurntableVolumetricCubeSize, TurntableVolumetricCubeResolution });
        }
コード例 #13
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

			MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

			MemoryLimitForIndexing = new IntegerSetting(settings[Constants.MemoryLimitForIndexing],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75))); 

		    EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting],
		        Constants.DefaultKeySizeToUseInActualEncryptionInBits);
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);
			
			
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
			PreventAutomaticSuggestionCreation =
				new BooleanSetting(settings["Raven/PreventAutomaticSuggestionCreation"], false);
			DisablePerformanceCounters =
				new BooleanSetting(settings["Raven/DisablePerformanceCounters"], false);

			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DisableInMemoryIndexing =
				new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], (string) null);
			UseSsl = 
				new BooleanSetting(settings["Raven/UseSsl"], false);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetchForIndexing =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

			DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatbaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

			MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

			FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);

			MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);
		}
コード例 #14
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);
            MaxIndexingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);

            MaxNumberOfItemsToIndexInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingIndexBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelIndexTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], (string)null);
            UseSsl =
                new BooleanSetting(settings["Raven/UseSsl"], false);
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetchingForIndexing =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetchForIndexing =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
            ServerName  = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);
        }
コード例 #15
0
 public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
 {
     MaxPageSize =
         new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
     MemoryCacheLimitMegabytes =
         new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
     MemoryCacheExpiration =
         new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                             TimeSpanArgumentType.FromSeconds);
     MemoryCacheLimitPercentage =
         new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
     MemoryCacheLimitCheckInterval =
         new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                             TimeSpanArgumentType.FromParse);
     MaxIndexingRunLatency =
         new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                             TimeSpanArgumentType.FromParse);
     MaxNumberOfItemsToIndexInSingleBatch =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                   defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
     AvailableMemoryForRaisingIndexBatchSizeLimit =
         new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                            Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
     MaxNumberOfItemsToReduceInSingleBatch =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                   defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
     NumberOfItemsToExecuteReduceInSingleStep =
         new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
     MaxNumberOfParallelIndexTasks =
         new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);
     TempIndexPromotionMinimumQueryCount =
         new IntegerSetting(settings["Raven/TempIndexPromotionMinimumQueryCount"], 100);
     TempIndexPromotionThreshold =
         new IntegerSetting(settings["Raven/TempIndexPromotionThreshold"], 60000 /* once a minute */);
     TempIndexCleanupPeriod =
         new TimeSpanSetting(settings["Raven/TempIndexCleanupPeriod"], TimeSpan.FromMinutes(10),
                             TimeSpanArgumentType.FromSeconds);
     TempIndexCleanupThreshold =
         new TimeSpanSetting(settings["Raven/TempIndexCleanupThreshold"], TimeSpan.FromMinutes(20),
                             TimeSpanArgumentType.FromSeconds);
     TempIndexInMemoryMaxMb =
         new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/TempIndexInMemoryMaxMB"], 25, 1), 1024 * 1024);
     RunInMemory =
         new BooleanSetting(settings["Raven/RunInMemory"], false);
     CreateTemporaryIndexesForAdHocQueriesIfNeeded =
         new BooleanSetting(settings["Raven/CreateTemporaryIndexesForAdHocQueriesIfNeeded"], true);
     ResetIndexOnUncleanShutdown =
         new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
     DataDir =
         new StringSetting(settings["Raven/DataDir"], @"~\Data");
     IndexStoragePath =
         new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
     HostName =
         new StringSetting(settings["Raven/HostName"], (string)null);
     Port =
         new StringSetting(settings["Raven/Port"], (string)null);
     HttpCompression =
         new BooleanSetting(settings["Raven/HttpCompression"], true);
     AccessControlAllowOrigin =
         new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
     AccessControlMaxAge =
         new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
     AccessControlAllowMethods =
         new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
     AccessControlRequestHeaders =
         new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
     RedirectStudioUrl =
         new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
     DisableDocumentPreFetchingForIndexing =
         new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
     WebDir =
         new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
     PluginsDirectory =
         new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
     TaskScheduler =
         new StringSetting(settings["Raven/TaskScheduler"], (string)null);
     AllowLocalAccessWithoutAuthorization =
         new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
 }
コード例 #16
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);
			TempIndexPromotionMinimumQueryCount =
				new IntegerSetting(settings["Raven/TempIndexPromotionMinimumQueryCount"], 100);
			TempIndexPromotionThreshold =
				new IntegerSetting(settings["Raven/TempIndexPromotionThreshold"], 60000 /* once a minute */);
			TempIndexCleanupPeriod =
				new TimeSpanSetting(settings["Raven/TempIndexCleanupPeriod"], TimeSpan.FromMinutes(10),
				                    TimeSpanArgumentType.FromSeconds);
			TempIndexCleanupThreshold =
				new TimeSpanSetting(settings["Raven/TempIndexCleanupThreshold"], TimeSpan.FromMinutes(20),
				                    TimeSpanArgumentType.FromSeconds);
			TempIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/TempIndexInMemoryMaxMB"], 25, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateTemporaryIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateTemporaryIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/HttpCompression"], (string) null);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
		}
コード例 #17
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            //1024 is Lucene.net default - so if the setting is not set it will be the same as not touching Lucene's settings at all
            MaxClauseCount = new IntegerSetting(settings[Constants.MaxClauseCount], 1024);

            AllowScriptsToAdjustNumberOfSteps = new BooleanSetting(settings[Constants.AllowScriptsToAdjustNumberOfSteps], false);

            IndexAndTransformerReplicationLatencyInSec = new IntegerSetting(settings[Constants.RavenIndexAndTransformerReplicationLatencyInSec], Constants.DefaultRavenIndexAndTransformerReplicationLatencyInSec);

            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentRequestsForDatabaseDuringLoad = new IntegerSetting(settings[Constants.MaxConcurrentRequestsForDatabaseDuringLoad], 50);

            MaxSecondsForTaskToWaitForDatabaseToLoad = new IntegerSetting(settings[Constants.MaxSecondsForTaskToWaitForDatabaseToLoad], 5);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemoryInMb * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);

            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxTime =
                new TimeSpanSetting(settings["Raven/NewIndexInMemoryMaxTime"], TimeSpan.FromMinutes(15), TimeSpanArgumentType.FromParse);
            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings[Constants.RunInMemory], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            WorkingDir =
                new StringSetting(settings["Raven/WorkingDir"], @"~\");
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Databases\System");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            ExposeConfigOverTheWire =
                new StringSetting(settings[Constants.ExposeConfigOverTheWire], "Open");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            AssembliesDirectory =
                new StringSetting(settings["Raven/AssembliesDirectory"], @"~\Assemblies");
            EmbeddedFilesDirectory =
                new StringSetting(settings["Raven/EmbeddedFilesDirectory"], (string)null);
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            RejectClientsModeEnabled =
                new BooleanSetting(settings[Constants.RejectClientsModeEnabled], false);

            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            TurnOffDiscoveryClient = new BooleanSetting(settings["Raven/TurnOffDiscoveryClient"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize = new IntegerSetting(settings[Constants.Voron.MaxBufferPoolSize], 4);
            Voron.InitialFileSize = new NullableIntegerSetting(settings[Constants.Voron.InitialFileSize], (int?)null);
            Voron.MaxScratchBufferSize = new IntegerSetting(settings[Constants.Voron.MaxScratchBufferSize], 6144);

            var maxScratchBufferSize = Voron.MaxScratchBufferSize.Value;
            var scratchBufferSizeNotificationThreshold = -1;
            if (maxScratchBufferSize > 1024)
                scratchBufferSizeNotificationThreshold = 1024;
            else if (maxScratchBufferSize > 512)
                scratchBufferSizeNotificationThreshold = 512;
            Voron.ScratchBufferSizeNotificationThreshold = new IntegerSetting(settings[Constants.Voron.ScratchBufferSizeNotificationThreshold], scratchBufferSizeNotificationThreshold);

            Voron.AllowIncrementalBackups = new BooleanSetting(settings[Constants.Voron.AllowIncrementalBackups], false);
            Voron.AllowOn32Bits = new BooleanSetting(settings[Constants.Voron.AllowOn32Bits], false);
            Voron.TempPath = new StringSetting(settings[Constants.Voron.TempPath], (string)null);

            var txJournalPath = settings[Constants.RavenTxJournalPath];
            var esentLogsPath = settings[Constants.RavenEsentLogsPath];

            Voron.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(txJournalPath) ? esentLogsPath : txJournalPath, (string)null);

            Esent.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(esentLogsPath) ? txJournalPath : esentLogsPath, (string)null);

            var defaultCacheSize = Environment.Is64BitProcess ? Math.Min(1024, (MemoryStatistics.TotalPhysicalMemory / 4)) : 256;
            Esent.CacheSizeMax = new IntegerSetting(settings[Constants.Esent.CacheSizeMax], defaultCacheSize);
            Esent.MaxVerPages = new IntegerSetting(settings[Constants.Esent.MaxVerPages], 512);
            Esent.PreferredVerPages = new IntegerSetting(settings[Constants.Esent.PreferredVerPages], 472);
            Esent.DbExtensionSize = new IntegerSetting(settings[Constants.Esent.DbExtensionSize], 8);
            Esent.LogFileSize = new IntegerSetting(settings[Constants.Esent.LogFileSize], 64);
            Esent.LogBuffers = new IntegerSetting(settings[Constants.Esent.LogBuffers], 8192);
            Esent.MaxCursors = new IntegerSetting(settings[Constants.Esent.MaxCursors], 2048);
            Esent.CircularLog = new BooleanSetting(settings[Constants.Esent.CircularLog], true);

            Replication.FetchingFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);
            Replication.ForceReplicationRequestBuffering = new BooleanSetting(settings["Raven/Replication/ForceReplicationRequestBuffering"], false);
            Replication.MaxNumberOfItemsToReceiveInSingleBatch = new NullableIntegerSettingWithMin(settings["Raven/Replication/MaxNumberOfItemsToReceiveInSingleBatch"], (int?)null, 512);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings[Constants.FileSystem.MaximumSynchronizationInterval], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath = new StringSetting(settings[Constants.FileSystem.IndexStorageDirectory], string.Empty);
            FileSystem.DataDir = new StringSetting(settings[Constants.FileSystem.DataDirectory], @"~\FileSystems");
            FileSystem.DefaultStorageTypeName = new StringSetting(settings[Constants.FileSystem.Storage], string.Empty);
            FileSystem.PreventSchemaUpdate = new BooleanSetting(settings[Constants.FileSystem.PreventSchemaUpdate], false);
            Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            Indexing.MaxNumberOfItemsToProcessInTestIndexes = new IntegerSetting(settings[Constants.MaxNumberOfItemsToProcessInTestIndexes], 512);
            Indexing.DisableIndexingFreeSpaceThreshold = new IntegerSetting(settings[Constants.Indexing.DisableIndexingFreeSpaceThreshold], 2048);
            Indexing.DisableMapReduceInMemoryTracking = new BooleanSetting(settings[Constants.Indexing.DisableMapReduceInMemoryTracking], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], string.Empty);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);

            ImplicitFetchFieldsFromDocumentMode = new EnumSetting<ImplicitFetchFieldsMode>(settings["Raven/ImplicitFetchFieldsFromDocumentMode"], ImplicitFetchFieldsMode.Enabled);

            if (settings["Raven/MaxServicePointIdleTime"] != null)
                ServicePointManager.MaxServicePointIdleTime = Convert.ToInt32(settings["Raven/MaxServicePointIdleTime"]);

            WebSockets.InitialBufferPoolSize = new IntegerSetting(settings["Raven/WebSockets/InitialBufferPoolSize"], 128 * 1024);

            MaxConcurrentResourceLoads = new IntegerSetting(settings[Constants.RavenMaxConcurrentResourceLoads], 8);
            ConcurrentResourceLoadTimeout = new TimeSpanSetting(settings[Constants.ConcurrentResourceLoadTimeout],
                TimeSpan.FromSeconds(15),
                TimeSpanArgumentType.FromParse);

            CacheDocumentsInMemory = new BooleanSetting(settings["Raven/CacheDocumentsInMemory"], true);
        }
コード例 #18
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                                                          // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                          Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb  = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize       = new IntegerSetting(settings["Raven/Voron/MaxBufferPoolSize"], 4);
            Voron.InitialFileSize         = new NullableIntegerSetting(settings["Raven/Voron/InitialFileSize"], (int?)null);
            Voron.MaxScratchBufferSize    = new IntegerSetting(settings["Raven/Voron/MaxScratchBufferSize"], 1024);
            Voron.AllowIncrementalBackups = new BooleanSetting(settings["Raven/Voron/AllowIncrementalBackups"], false);
            Voron.TempPath = new StringSetting(settings["Raven/Voron/TempPath"], (string)null);

            Replication.FetchingFromDiskTimeoutInSeconds        = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings["Raven/FileSystem/MaximumSynchronizationInterval"], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath       = new StringSetting(settings["Raven/FileSystem/IndexStoragePath"], (string)null);
            FileSystem.DataDir                = new StringSetting(settings["Raven/FileSystem/DataDir"], @"~\Data\FileSystem");
            FileSystem.DefaultStorageTypeName = new StringSetting(settings["Raven/FileSystem/Storage"], InMemoryRavenConfiguration.VoronTypeName);

            Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], InMemoryRavenConfiguration.VoronTypeName);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);
            JournalsStoragePath      = new StringSetting(settings["Raven/Esent/LogsPath"] ?? settings[Constants.RavenTxJournalPath], (string)null);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);
        }
コード例 #19
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForIndexing = new IntegerSetting(settings[Constants.MemoryLimitForIndexing],
                                                        // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                        Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75)));

            EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting],
                                                             Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxIndexingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            PreventAutomaticSuggestionCreation =
                new BooleanSetting(settings["Raven/PreventAutomaticSuggestionCreation"], false);
            DisablePerformanceCounters =
                new BooleanSetting(settings["Raven/DisablePerformanceCounters"], false);

            MaxNumberOfItemsToIndexInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingIndexBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelIndexTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings["Raven/RunInMemory"], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Data");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], (string)null);
            UseSsl =
                new BooleanSetting(settings["Raven/UseSsl"], false);
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetchingForIndexing =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetchForIndexing =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatbaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
            ServerName  = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);

            MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);
        }
コード例 #20
0
        public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
        {
            //1024 is Lucene.net default - so if the setting is not set it will be the same as not touching Lucene's settings at all
            MaxClauseCount = new IntegerSetting(settings[Constants.MaxClauseCount], 1024);

            AllowScriptsToAdjustNumberOfSteps = new BooleanSetting(settings[Constants.AllowScriptsToAdjustNumberOfSteps], false);

            IndexAndTransformerReplicationLatencyInSec = new IntegerSetting(settings[Constants.RavenIndexAndTransformerReplicationLatencyInSec], Constants.DefaultRavenIndexAndTransformerReplicationLatencyInSec);

            PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

            MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

            MaxConcurrentRequestsForDatabaseDuringLoad = new IntegerSetting(settings[Constants.MaxConcurrentRequestsForDatabaseDuringLoad], 50);

            MaxSecondsForTaskToWaitForDatabaseToLoad = new IntegerSetting(settings[Constants.MaxSecondsForTaskToWaitForDatabaseToLoad], 5);

            MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

            MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                                                          // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                                                          Math.Min(1024, (int)(MemoryStatistics.AvailableMemoryInMb * 0.75)));

            MaxPageSize =
                new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
            MemoryCacheLimitMegabytes =
                new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
            MemoryCacheExpiration =
                new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
                                    TimeSpanArgumentType.FromSeconds);
            MemoryCacheLimitPercentage =
                new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
            MemoryCacheLimitCheckInterval =
                new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);


            MaxProcessingRunLatency =
                new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxIndexWritesBeforeRecreate =
                new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
            MaxSimpleIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

            MaxMapReduceIndexOutputsPerDocument =
                new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

            MaxNumberOfItemsToProcessInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            AvailableMemoryForRaisingBatchSizeLimit =
                new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
                                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory / 2));
            MaxNumberOfItemsToReduceInSingleBatch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch / 2, 128);
            NumberOfItemsToExecuteReduceInSingleStep =
                new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
            MaxNumberOfParallelProcessingTasks =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

            NewIndexInMemoryMaxTime =
                new TimeSpanSetting(settings["Raven/NewIndexInMemoryMaxTime"], TimeSpan.FromMinutes(15), TimeSpanArgumentType.FromParse);
            NewIndexInMemoryMaxMb =
                new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024 * 1024);
            RunInMemory =
                new BooleanSetting(settings[Constants.RunInMemory], false);
            CreateAutoIndexesForAdHocQueriesIfNeeded =
                new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
            ResetIndexOnUncleanShutdown =
                new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
            DisableInMemoryIndexing =
                new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
            WorkingDir =
                new StringSetting(settings["Raven/WorkingDir"], @"~\");
            DataDir =
                new StringSetting(settings["Raven/DataDir"], @"~\Databases\System");
            IndexStoragePath =
                new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
            CountersDataDir =
                new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");

            HostName =
                new StringSetting(settings["Raven/HostName"], (string)null);
            Port =
                new StringSetting(settings["Raven/Port"], "*");
            ExposeConfigOverTheWire =
                new StringSetting(settings[Constants.ExposeConfigOverTheWire], "Open");
            HttpCompression =
                new BooleanSetting(settings["Raven/HttpCompression"], true);
            AccessControlAllowOrigin =
                new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string)null);
            AccessControlMaxAge =
                new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
            AccessControlAllowMethods =
                new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
            AccessControlRequestHeaders =
                new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string)null);
            RedirectStudioUrl =
                new StringSetting(settings["Raven/RedirectStudioUrl"], (string)null);
            DisableDocumentPreFetching =
                new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
            MaxNumberOfItemsToPreFetch =
                new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"] ?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
                                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
            WebDir =
                new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
            PluginsDirectory =
                new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
            AssembliesDirectory =
                new StringSetting(settings["Raven/AssembliesDirectory"], @"~\Assemblies");
            EmbeddedFilesDirectory =
                new StringSetting(settings["Raven/EmbeddedFilesDirectory"], (string)null);
            CompiledIndexCacheDirectory =
                new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\CompiledIndexCache");
            TaskScheduler =
                new StringSetting(settings["Raven/TaskScheduler"], (string)null);
            AllowLocalAccessWithoutAuthorization =
                new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
            RejectClientsModeEnabled =
                new BooleanSetting(settings[Constants.RejectClientsModeEnabled], false);

            MaxIndexCommitPointStoreTimeInterval =
                new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
                                    TimeSpanArgumentType.FromParse);
            MaxNumberOfStoredCommitPoints =
                new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
            MinIndexingTimeIntervalToStoreCommitPoint =
                new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
                                    TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

            DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

            TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

            DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

            TurnOffDiscoveryClient = new BooleanSetting(settings["Raven/TurnOffDiscoveryClient"], false);

            ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

            MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10 * 1000);
            AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

            MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

            Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
            Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb  = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize    = new IntegerSetting(settings[Constants.Voron.MaxBufferPoolSize], 4);
            Voron.InitialFileSize      = new NullableIntegerSetting(settings[Constants.Voron.InitialFileSize], (int?)null);
            Voron.MaxScratchBufferSize = new IntegerSetting(settings[Constants.Voron.MaxScratchBufferSize], 6144);

            var maxScratchBufferSize = Voron.MaxScratchBufferSize.Value;
            var scratchBufferSizeNotificationThreshold = -1;

            if (maxScratchBufferSize > 1024)
            {
                scratchBufferSizeNotificationThreshold = 1024;
            }
            else if (maxScratchBufferSize > 512)
            {
                scratchBufferSizeNotificationThreshold = 512;
            }
            Voron.ScratchBufferSizeNotificationThreshold = new IntegerSetting(settings[Constants.Voron.ScratchBufferSizeNotificationThreshold], scratchBufferSizeNotificationThreshold);

            Voron.AllowIncrementalBackups = new BooleanSetting(settings[Constants.Voron.AllowIncrementalBackups], false);
            Voron.AllowOn32Bits           = new BooleanSetting(settings[Constants.Voron.AllowOn32Bits], false);
            Voron.TempPath = new StringSetting(settings[Constants.Voron.TempPath], (string)null);

            var txJournalPath = settings[Constants.RavenTxJournalPath];
            var esentLogsPath = settings[Constants.RavenEsentLogsPath];

            Voron.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(txJournalPath) ? esentLogsPath : txJournalPath, (string)null);

            Esent.JournalsStoragePath = new StringSetting(string.IsNullOrEmpty(esentLogsPath) ? txJournalPath : esentLogsPath, (string)null);

            Replication.FetchingFromDiskTimeoutInSeconds        = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
            Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);
            Replication.ForceReplicationRequestBuffering        = new BooleanSetting(settings["Raven/Replication/ForceReplicationRequestBuffering"], false);
            Replication.MaxNumberOfItemsToReceiveInSingleBatch  = new NullableIntegerSettingWithMin(settings["Raven/Replication/MaxNumberOfItemsToReceiveInSingleBatch"], (int?)null, 512);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings[Constants.FileSystem.MaximumSynchronizationInterval], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
            FileSystem.IndexStoragePath            = new StringSetting(settings[Constants.FileSystem.IndexStorageDirectory], string.Empty);
            FileSystem.DataDir                     = new StringSetting(settings[Constants.FileSystem.DataDirectory], @"~\FileSystems");
            FileSystem.DefaultStorageTypeName      = new StringSetting(settings[Constants.FileSystem.Storage], string.Empty);
            FileSystem.PreventSchemaUpdate         = new BooleanSetting(settings[Constants.FileSystem.PreventSchemaUpdate], false);
            Encryption.UseFips                     = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
            Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
            Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

            Indexing.MaxNumberOfItemsToProcessInTestIndexes = new IntegerSetting(settings[Constants.MaxNumberOfItemsToProcessInTestIndexes], 512);
            Indexing.DisableIndexingFreeSpaceThreshold      = new IntegerSetting(settings[Constants.Indexing.DisableIndexingFreeSpaceThreshold], 2048);
            Indexing.DisableMapReduceInMemoryTracking       = new BooleanSetting(settings[Constants.Indexing.DisableMapReduceInMemoryTracking], false);

            DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], string.Empty);

            FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);

            TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);

            ImplicitFetchFieldsFromDocumentMode = new EnumSetting <ImplicitFetchFieldsMode>(settings["Raven/ImplicitFetchFieldsFromDocumentMode"], ImplicitFetchFieldsMode.Enabled);

            if (settings["Raven/MaxServicePointIdleTime"] != null)
            {
                ServicePointManager.MaxServicePointIdleTime = Convert.ToInt32(settings["Raven/MaxServicePointIdleTime"]);
            }

            WebSockets.InitialBufferPoolSize = new IntegerSetting(settings["Raven/WebSockets/InitialBufferPoolSize"], 128 * 1024);

            Http.AuthenticationSchemes = new EnumSetting <AuthenticationSchemes?>(settings["Raven/Http/AuthenticationSchemes"], (AuthenticationSchemes?)null);

            MaxConcurrentResourceLoads    = new IntegerSetting(settings[Constants.RavenMaxConcurrentResourceLoads], 8);
            ConcurrentResourceLoadTimeout = new TimeSpanSetting(settings[Constants.ConcurrentResourceLoadTimeout],
                                                                TimeSpan.FromSeconds(15),
                                                                TimeSpanArgumentType.FromParse);
        }
コード例 #21
0
        /// <summary>
        /// Gets a bool-valued setting.
        /// </summary>
        /// <param name="Key">Key name.</param>
        /// <param name="DefaultValue">Default value, if not found.</param>
        /// <returns>Setting value.</returns>
        public static async Task <bool> GetAsync(string Key, bool DefaultValue)
        {
            BooleanSetting Setting = await GetAsync <BooleanSetting>(Key);

            return(Setting?.Value ?? DefaultValue);
        }
コード例 #22
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{
			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);
			MaxIndexingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);

			MaxNumberOfItemsToIndexInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingIndexBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelIndexTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string) null);
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], (string) null);
			UseSsl = 
				new BooleanSetting(settings["Raven/UseSsl"], false);
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetchingForIndexing =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetchForIndexing =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ClusterName = new StringSetting(settings["Raven/ClusterName"], (string)null);
			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);
		}
コード例 #23
0
ファイル: UISettingsPage.cs プロジェクト: ykafia/Paint.Net4
        protected override ControlInfo OnCreateConfigUI(PropertyCollection properties)
        {
            ControlInfo    info = base.OnCreateConfigUI(properties);
            BooleanSetting enableHardwareAcceleration = base.Section.AppSettings.UI.EnableHardwareAcceleration;

            info.SetPropertyControlValue(enableHardwareAcceleration.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(enableHardwareAcceleration.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.EnableHardwareAcceleration.Description"));
            BooleanSetting enableAnimations = base.Section.AppSettings.UI.EnableAnimations;

            info.SetPropertyControlValue(enableAnimations.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(enableAnimations.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.EnableAnimations.Description"));
            BooleanSetting enableAntialiasedSelectionOutline = base.Section.AppSettings.UI.EnableAntialiasedSelectionOutline;

            info.SetPropertyControlValue(enableAntialiasedSelectionOutline.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(enableAntialiasedSelectionOutline.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.EnableAntialiasedSelectionOutline.Description"));
            BooleanSetting showTaskbarPreviews = base.Section.AppSettings.UI.ShowTaskbarPreviews;

            info.SetPropertyControlValue(showTaskbarPreviews.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(showTaskbarPreviews.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.ShowTaskbarPreviews.Description"));
            BooleanSetting enableOverscroll = base.Section.AppSettings.UI.EnableOverscroll;

            info.SetPropertyControlValue(enableOverscroll.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(enableOverscroll.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.Overscroll.Description"));
            BooleanSetting translucentWindows = base.Section.AppSettings.UI.TranslucentWindows;

            info.SetPropertyControlValue(translucentWindows.Path, ControlInfoPropertyNames.DisplayName, string.Empty);
            info.SetPropertyControlValue(translucentWindows.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.TranslucentWindows.Description"));
            EnumSetting <AeroColorScheme> aeroColorScheme = base.Section.AppSettings.UI.AeroColorScheme;

            info.SetPropertyControlValue(aeroColorScheme.Path, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SettingsDialog.UI.AeroColorScheme.DisplayName"));
            PropertyControlInfo info2 = info.FindControlForPropertyName(aeroColorScheme.Path);

            info2.SetValueDisplayName(AeroColorScheme.Blue, PdnResources.GetString("SettingsDialog.UI.AeroColorScheme.Value.Blue"));
            info2.SetValueDisplayName(AeroColorScheme.Light, PdnResources.GetString("SettingsDialog.UI.AeroColorScheme.Value.Light"));
            if (ThemeConfig.EffectiveTheme == PdnTheme.Classic)
            {
                info.SetPropertyControlValue(aeroColorScheme.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.AeroColorScheme.Description.ClassicDisabled"));
            }
            CultureInfoSetting language = base.Section.AppSettings.UI.Language;

            info.SetPropertyControlValue(language.Path, ControlInfoPropertyNames.DisplayName, PdnResources.GetString("SettingsDialog.UI.Language.DisplayName"));
            info.SetPropertyControlValue(language.Path, ControlInfoPropertyNames.Description, PdnResources.GetString("SettingsDialog.UI.Language.Description"));
            PropertyControlInfo      info3    = info.FindControlForPropertyName(language.Path);
            StaticListChoiceProperty property = (StaticListChoiceProperty)info3.Property;
            CultureInfo info4 = new CultureInfo("en-US");

            foreach (CultureInfo info5 in property.ValueChoices)
            {
                string nativeName;
                if (info5.Equals(info4))
                {
                    nativeName = info5.Parent.NativeName;
                }
                else
                {
                    nativeName = info5.NativeName;
                }
                info3.SetValueDisplayName(info5, nativeName);
            }
            return(info);
        }
コード例 #24
0
		public void Setup(int defaultMaxNumberOfItemsToIndexInSingleBatch, int defaultInitialNumberOfItemsToIndexInSingleBatch)
		{

			PrefetchingDurationLimit = new IntegerSetting(settings[Constants.RavenPrefetchingDurationLimit], Constants.DefaultPrefetchingDurationLimit);

            BulkImportBatchTimeout = new TimeSpanSetting(settings[Constants.BulkImportBatchTimeout], TimeSpan.FromMilliseconds(Constants.BulkImportDefaultTimeoutInMs), TimeSpanArgumentType.FromParse);

			MaxConcurrentServerRequests = new IntegerSetting(settings[Constants.MaxConcurrentServerRequests], 512);

			MaxConcurrentMultiGetRequests = new IntegerSetting(settings[Constants.MaxConcurrentMultiGetRequests], 192);

			MemoryLimitForProcessing = new IntegerSetting(settings[Constants.MemoryLimitForProcessing] ?? settings[Constants.MemoryLimitForProcessing_BackwardCompatibility],
                // we allow 1 GB by default, or up to 75% of available memory on startup, if less than that is available
                Math.Min(1024, (int)(MemoryStatistics.AvailableMemory * 0.75))); 

			MaxPageSize =
				new IntegerSettingWithMin(settings["Raven/MaxPageSize"], 1024, 10);
			MemoryCacheLimitMegabytes =
				new IntegerSetting(settings["Raven/MemoryCacheLimitMegabytes"], GetDefaultMemoryCacheLimitMegabytes);
			MemoryCacheExpiration =
				new TimeSpanSetting(settings["Raven/MemoryCacheExpiration"], TimeSpan.FromMinutes(60),
				                    TimeSpanArgumentType.FromSeconds);
			MemoryCacheLimitPercentage =
				new IntegerSetting(settings["Raven/MemoryCacheLimitPercentage"], 0 /* auto size */);
			MemoryCacheLimitCheckInterval =
				new TimeSpanSetting(settings["Raven/MemoryCacheLimitCheckInterval"], MemoryCache.Default.PollingInterval,
				                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsSyncronousWaitTime =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsSyncronousWaitTime"], TimeSpan.FromSeconds(3),
                                    TimeSpanArgumentType.FromParse);

            PrewarmFacetsOnIndexingMaxAge =
                new TimeSpanSetting(settings["Raven/PrewarmFacetsOnIndexingMaxAge"], TimeSpan.FromMinutes(10),
                                    TimeSpanArgumentType.FromParse);
			
			
			MaxProcessingRunLatency =
				new TimeSpanSetting(settings["Raven/MaxProcessingRunLatency"] ?? settings["Raven/MaxIndexingRunLatency"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxIndexWritesBeforeRecreate =
				new IntegerSetting(settings["Raven/MaxIndexWritesBeforeRecreate"], 256 * 1024);
			MaxSimpleIndexOutputsPerDocument = 
				new IntegerSetting(settings["Raven/MaxSimpleIndexOutputsPerDocument"], 15);

			MaxMapReduceIndexOutputsPerDocument =
				new IntegerSetting(settings["Raven/MaxMapReduceIndexOutputsPerDocument"], 50);

			MaxNumberOfItemsToProcessInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToProcessInSingleBatch"] ?? settings["Raven/MaxNumberOfItemsToIndexInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			AvailableMemoryForRaisingBatchSizeLimit =
				new IntegerSetting(settings["Raven/AvailableMemoryForRaisingBatchSizeLimit"] ?? settings["Raven/AvailableMemoryForRaisingIndexBatchSizeLimit"],
				                   Math.Min(768, MemoryStatistics.TotalPhysicalMemory/2));
			MaxNumberOfItemsToReduceInSingleBatch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToReduceInSingleBatch"],
				                          defaultMaxNumberOfItemsToIndexInSingleBatch/2, 128);
			NumberOfItemsToExecuteReduceInSingleStep =
				new IntegerSetting(settings["Raven/NumberOfItemsToExecuteReduceInSingleStep"], 1024);
			MaxNumberOfParallelProcessingTasks =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfParallelProcessingTasks"] ?? settings["Raven/MaxNumberOfParallelIndexTasks"], Environment.ProcessorCount, 1);

			NewIndexInMemoryMaxMb =
				new MultipliedIntegerSetting(new IntegerSettingWithMin(settings["Raven/NewIndexInMemoryMaxMB"], 64, 1), 1024*1024);
			RunInMemory =
				new BooleanSetting(settings["Raven/RunInMemory"], false);
			CreateAutoIndexesForAdHocQueriesIfNeeded =
				new BooleanSetting(settings["Raven/CreateAutoIndexesForAdHocQueriesIfNeeded"], true);
			ResetIndexOnUncleanShutdown =
				new BooleanSetting(settings["Raven/ResetIndexOnUncleanShutdown"], false);
			DisableInMemoryIndexing =
				new BooleanSetting(settings["Raven/DisableInMemoryIndexing"], false);
			DataDir =
				new StringSetting(settings["Raven/DataDir"], @"~\Data");
			IndexStoragePath =
				new StringSetting(settings["Raven/IndexStoragePath"], (string)null);
			CountersDataDir =
				new StringSetting(settings["Raven/Counters/DataDir"], @"~\Data\Counters");
			
			HostName =
				new StringSetting(settings["Raven/HostName"], (string) null);
			Port =
				new StringSetting(settings["Raven/Port"], "*");
			HttpCompression =
				new BooleanSetting(settings["Raven/HttpCompression"], true);
			AccessControlAllowOrigin =
				new StringSetting(settings["Raven/AccessControlAllowOrigin"], (string) null);
			AccessControlMaxAge =
				new StringSetting(settings["Raven/AccessControlMaxAge"], "1728000" /* 20 days */);
			AccessControlAllowMethods =
				new StringSetting(settings["Raven/AccessControlAllowMethods"], "PUT,PATCH,GET,DELETE,POST");
			AccessControlRequestHeaders =
				new StringSetting(settings["Raven/AccessControlRequestHeaders"], (string) null);
			RedirectStudioUrl =
				new StringSetting(settings["Raven/RedirectStudioUrl"], (string) null);
			DisableDocumentPreFetching =
				new BooleanSetting(settings["Raven/DisableDocumentPreFetching"] ?? settings["Raven/DisableDocumentPreFetchingForIndexing"], false);
			MaxNumberOfItemsToPreFetch =
				new IntegerSettingWithMin(settings["Raven/MaxNumberOfItemsToPreFetch"]?? settings["Raven/MaxNumberOfItemsToPreFetchForIndexing"],
										  defaultMaxNumberOfItemsToIndexInSingleBatch, 128);
			WebDir =
				new StringSetting(settings["Raven/WebDir"], GetDefaultWebDir);
			PluginsDirectory =
				new StringSetting(settings["Raven/PluginsDirectory"], @"~\Plugins");
			CompiledIndexCacheDirectory =
				new StringSetting(settings["Raven/CompiledIndexCacheDirectory"], @"~\Raven\CompiledIndexCache");
			TaskScheduler =
				new StringSetting(settings["Raven/TaskScheduler"], (string) null);
			AllowLocalAccessWithoutAuthorization =
				new BooleanSetting(settings["Raven/AllowLocalAccessWithoutAuthorization"], false);
			MaxIndexCommitPointStoreTimeInterval =
				new TimeSpanSetting(settings["Raven/MaxIndexCommitPointStoreTimeInterval"], TimeSpan.FromMinutes(5),
				                    TimeSpanArgumentType.FromParse);
			MaxNumberOfStoredCommitPoints =
				new IntegerSetting(settings["Raven/MaxNumberOfStoredCommitPoints"], 5);
			MinIndexingTimeIntervalToStoreCommitPoint =
				new TimeSpanSetting(settings["Raven/MinIndexingTimeIntervalToStoreCommitPoint"], TimeSpan.FromMinutes(1),
				                    TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeRunningIdleIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningIdleIndexes"], TimeSpan.FromMinutes(10), TimeSpanArgumentType.FromParse);

			DatbaseOperationTimeout = new TimeSpanSetting(settings["Raven/DatabaseOperationTimeout"], TimeSpan.FromMinutes(5), TimeSpanArgumentType.FromParse);
            
			TimeToWaitBeforeMarkingAutoIndexAsIdle = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingAutoIndexAsIdle"], TimeSpan.FromHours(1), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeMarkingIdleIndexAsAbandoned = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeMarkingIdleIndexAsAbandoned"], TimeSpan.FromHours(72), TimeSpanArgumentType.FromParse);

			TimeToWaitBeforeRunningAbandonedIndexes = new TimeSpanSetting(settings["Raven/TimeToWaitBeforeRunningAbandonedIndexes"], TimeSpan.FromHours(3), TimeSpanArgumentType.FromParse);

			DisableClusterDiscovery = new BooleanSetting(settings["Raven/DisableClusterDiscovery"], false);

			ServerName = new StringSetting(settings["Raven/ServerName"], (string)null);

			MaxStepsForScript = new IntegerSetting(settings["Raven/MaxStepsForScript"], 10*1000);
			AdditionalStepsForScriptBasedOnDocumentSize = new IntegerSetting(settings["Raven/AdditionalStepsForScriptBasedOnDocumentSize"], 5);

			MaxRecentTouchesToRemember = new IntegerSetting(settings["Raven/MaxRecentTouchesToRemember"], 1024);

			Prefetcher.FetchingDocumentsFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Prefetcher/FetchingDocumentsFromDiskTimeout"], 5);
			Prefetcher.MaximumSizeAllowedToFetchFromStorageInMb = new IntegerSetting(settings["Raven/Prefetcher/MaximumSizeAllowedToFetchFromStorage"], 256);

            Voron.MaxBufferPoolSize = new IntegerSetting(settings["Raven/Voron/MaxBufferPoolSize"], 4);
			Voron.InitialFileSize = new NullableIntegerSetting(settings["Raven/Voron/InitialFileSize"], (int?)null);
			Voron.MaxScratchBufferSize = new IntegerSetting(settings["Raven/Voron/MaxScratchBufferSize"], 512);
			Voron.AllowIncrementalBackups = new BooleanSetting(settings["Raven/Voron/AllowIncrementalBackups"], false);
			Voron.TempPath = new StringSetting(settings["Raven/Voron/TempPath"], (string) null);

			Replication.FetchingFromDiskTimeoutInSeconds = new IntegerSetting(settings["Raven/Replication/FetchingFromDiskTimeout"], 30);
			Replication.ReplicationRequestTimeoutInMilliseconds = new IntegerSetting(settings["Raven/Replication/ReplicationRequestTimeout"], 60 * 1000);

            FileSystem.MaximumSynchronizationInterval = new TimeSpanSetting(settings["Raven/FileSystem/MaximumSynchronizationInterval"], TimeSpan.FromSeconds(60), TimeSpanArgumentType.FromParse);
			FileSystem.IndexStoragePath = new StringSetting(settings["Raven/FileSystem/IndexStoragePath"], (string)null);
			FileSystem.DataDir = new StringSetting(settings["Raven/FileSystem/DataDir"], @"~\Data\FileSystem");
			FileSystem.DefaultStorageTypeName = new StringSetting(settings["Raven/FileSystem/Storage"], InMemoryRavenConfiguration.VoronTypeName);

			Encryption.UseFips = new BooleanSetting(settings["Raven/Encryption/FIPS"], false);
			Encryption.EncryptionKeyBitsPreference = new IntegerSetting(settings[Constants.EncryptionKeyBitsPreferenceSetting], Constants.DefaultKeySizeToUseInActualEncryptionInBits);
			Encryption.UseSsl = new BooleanSetting(settings["Raven/UseSsl"], false);

			DefaultStorageTypeName = new StringSetting(settings["Raven/StorageTypeName"] ?? settings["Raven/StorageEngine"], InMemoryRavenConfiguration.VoronTypeName);

			FlushIndexToDiskSizeInMb = new IntegerSetting(settings["Raven/Indexing/FlushIndexToDiskSizeInMb"], 5);
			JournalsStoragePath = new StringSetting(settings["Raven/Esent/LogsPath"] ?? settings[Constants.RavenTxJournalPath], (string)null);

			TombstoneRetentionTime = new TimeSpanSetting(settings["Raven/TombstoneRetentionTime"], TimeSpan.FromDays(14), TimeSpanArgumentType.FromParse);
		}
コード例 #25
0
        public static void WriteCrashLog(Exception crashEx, TextWriter stream)
        {
            string   str;
            string   str2;
            DateTime startupTime = Startup.StartupTime;

            try
            {
                str = PdnResources.GetString("CrashLog.HeaderText.Format");
            }
            catch (Exception exception)
            {
                str = "This text file was created because paint.net crashed.\r\nPlease e-mail this file to {0} so we can diagnose and fix the problem.\r\n, --- Exception while calling PdnResources.GetString(\"CrashLog.HeaderText.Format\"): " + exception.ToString() + Environment.NewLine;
            }
            try
            {
                str2 = string.Format(str, "*****@*****.**");
            }
            catch (Exception)
            {
                str2 = string.Empty;
            }
            stream.WriteLine(str2);
            string fullAppName      = "err";
            string str4             = "err";
            string str5             = "err";
            string str6             = "err";
            string str7             = "err";
            string str8             = "err";
            string str9             = "err";
            string currentDirectory = "err";
            string str11            = "err";
            string revision         = "err";
            string str13            = "err";
            string str14            = "err";
            string str15            = "err";
            string str16            = "err";
            string str17            = "err";
            string cpuName          = "err";
            string str19            = "err";
            string str20            = "err";
            string str21            = "err";
            string str22            = "err";
            string str23            = "err";
            string str24            = "err";
            string str25            = "err";
            string str26            = "err";
            string str27            = "err";
            string str28            = "err";
            string str29            = "err";
            string str30            = "err";
            string str31            = "err";
            string str32            = "err";

            try
            {
                try
                {
                    fullAppName = PdnInfo.FullAppName;
                }
                catch (Exception exception2)
                {
                    fullAppName = Application.ProductVersion + ", --- Exception while calling PdnInfo.GetFullAppName(): " + exception2.ToString() + Environment.NewLine;
                }
                try
                {
                    str4 = DateTime.Now.ToString();
                }
                catch (Exception exception3)
                {
                    str4 = "--- Exception while populating timeOfCrash: " + exception3.ToString() + Environment.NewLine;
                }
                try
                {
                    str5 = ((TimeSpan)(DateTime.Now - startupTime)).ToString();
                }
                catch (Exception exception4)
                {
                    str5 = "--- Exception while populating appUptime: " + exception4.ToString() + Environment.NewLine;
                }
                try
                {
                    bool hasShutdownStarted = Environment.HasShutdownStarted;
                    bool flag2 = AppDomain.CurrentDomain.IsFinalizingForUnload();
                    str6 = Startup.State.ToString() + " " + (hasShutdownStarted ? "Environment.HasShutdownStarted " : string.Empty) + (flag2 ? "AppDomain.IsFinalizingForUnload " : string.Empty).Trim();
                }
                catch (Exception exception5)
                {
                    str6 = "--- Exception while populating applicationState: " + exception5.ToString() + Environment.NewLine;
                }
                try
                {
                    str7 = ((((double)Environment.WorkingSet) / 1024.0)).ToString("N0") + " KiB";
                }
                catch (Exception exception6)
                {
                    str7 = "--- Exception while populating workingSet: " + exception6.ToString() + Environment.NewLine;
                }
                try
                {
                    int     num4;
                    int     num5;
                    Process currentProcess = Process.GetCurrentProcess();
                    int     handleCount    = currentProcess.HandleCount;
                    int     count          = currentProcess.Threads.Count;
                    ProcessStatus.GetCurrentProcessGuiResources(out num4, out num5);
                    str8 = $"{handleCount} handles, {count} threads, {num4} gdi, {num5} user";
                }
                catch (Exception exception7)
                {
                    str8 = "--- Exception while populating threadCount: " + exception7.ToString() + Environment.NewLine;
                }
                try
                {
                    currentDirectory = Environment.CurrentDirectory;
                }
                catch (Exception exception8)
                {
                    currentDirectory = "--- Exception while populating currentDir: " + exception8.ToString() + Environment.NewLine;
                }
                try
                {
                    str9 = RegistrySettings.SystemWide.GetString("TARGETDIR", "n/a");
                }
                catch (Exception exception9)
                {
                    str9 = "--- Exception while populating targetDir: " + exception9.ToString() + Environment.NewLine;
                }
                try
                {
                    str11 = Environment.OSVersion.Version.ToString();
                }
                catch (Exception exception10)
                {
                    str11 = "--- Exception while populating osVersion: " + exception10.ToString() + Environment.NewLine;
                }
                try
                {
                    revision = OS.Revision;
                }
                catch (Exception exception11)
                {
                    revision = "--- Exception while populating osRevision: " + exception11.ToString() + Environment.NewLine;
                }
                try
                {
                    str13 = OS.OSType.ToString();
                }
                catch (Exception exception12)
                {
                    str13 = "--- Exception while populating osType: " + exception12.ToString() + Environment.NewLine;
                }
                try
                {
                    str14 = Processor.NativeArchitecture.ToString().ToLower();
                }
                catch (Exception exception13)
                {
                    str14 = "--- Exception while populating processorNativeArchitecture: " + exception13.ToString() + Environment.NewLine;
                }
                try
                {
                    str15 = Environment.Version.ToString();
                }
                catch (Exception exception14)
                {
                    str15 = "--- Exception while populating clrVersion: " + exception14.ToString() + Environment.NewLine;
                }
                try
                {
                    bool flag3 = OS.VerifyFrameworkVersion(4, 6, 0, OS.FrameworkProfile.Client);
                    bool flag4 = OS.VerifyFrameworkVersion(4, 6, 0, OS.FrameworkProfile.Full);
                    str16 = ((flag3 | flag4) ? "4.6 " : string.Empty).Trim();
                }
                catch (Exception exception15)
                {
                    str16 = "--- Exception while populating fxInventory: " + exception15.ToString() + Environment.NewLine;
                }
                try
                {
                    str17 = Processor.Architecture.ToString().ToLower();
                }
                catch (Exception exception16)
                {
                    str17 = "--- Exception while populating processorArchitecture: " + exception16.ToString() + Environment.NewLine;
                }
                try
                {
                    cpuName = Processor.CpuName;
                }
                catch (Exception exception17)
                {
                    cpuName = "--- Exception while populating cpuName: " + exception17.ToString() + Environment.NewLine;
                }
                try
                {
                    LogicalProcessorInfo logicalProcessorInformation = Processor.GetLogicalProcessorInformation();
                    int num6 = logicalProcessorInformation.Packages.Count;
                    int physicalCoreCount = logicalProcessorInformation.GetPhysicalCoreCount();
                    int logicalCpuCount   = Processor.LogicalCpuCount;
                    if (num6 > 1)
                    {
                        str19 = $"{num6.ToString()}S/{physicalCoreCount.ToString()}C/{logicalCpuCount.ToString()}T";
                    }
                    else
                    {
                        str19 = $"{physicalCoreCount.ToString()}C/{logicalCpuCount.ToString()}T";
                    }
                }
                catch (Exception exception18)
                {
                    str19 = "--- Exception while populating cpuCount: " + exception18.ToString() + Environment.NewLine;
                }
                try
                {
                    str20 = "@ ~" + Processor.ApproximateSpeedMhz.ToString() + "MHz";
                }
                catch (Exception exception19)
                {
                    str20 = "--- Exception while populating cpuSpeed: " + exception19.ToString() + Environment.NewLine;
                }
                try
                {
                    str21 = "(" + str19;
                    foreach (string str33 in Enum.GetNames(typeof(ProcessorFeature)))
                    {
                        ProcessorFeature feature = (ProcessorFeature)Enum.Parse(typeof(ProcessorFeature), str33);
                        if (Processor.IsFeaturePresent(feature))
                        {
                            str21 = str21 + ", ";
                            str21 = str21 + str33;
                        }
                    }
                    if (str21.Length > 0)
                    {
                        str21 = str21 + ")";
                    }
                }
                catch (Exception exception20)
                {
                    str21 = "--- Exception while populating cpuFeatures: " + exception20.ToString() + Environment.NewLine;
                }
                try
                {
                    str22 = ((Memory.TotalPhysicalBytes / ((ulong)0x400L)) / ((ulong)0x400L)) + " MB";
                }
                catch (Exception exception21)
                {
                    str22 = "--- Exception while populating totalPhysicalBytes: " + exception21.ToString() + Environment.NewLine;
                }
                try
                {
                    BooleanSetting enableHardwareAcceleration = AppSettings.Instance.UI.EnableHardwareAcceleration;
                    str23 = enableHardwareAcceleration.Value.ToString() + " (default: " + enableHardwareAcceleration.DefaultValue.ToString() + ")";
                }
                catch (Exception exception22)
                {
                    str23 = "--- Exception while populating hwAcceleration: " + exception22.ToString() + Environment.NewLine;
                }
                try
                {
                    using (IDxgiFactory1 factory = DxgiFactory1.CreateFactory1())
                    {
                        IDxgiAdapter1[] items = factory.EnumerateAdapters1().ToArrayEx <IDxgiAdapter1>();
                        str24 = items.Select <IDxgiAdapter1, AdapterDescription1>(a => a.Description1).Select <AdapterDescription1, string>(d => $"{d.Description} (v:{d.VendorID.ToString("X")}, d:{d.DeviceID.ToString("X")}, r:{d.Revision.ToString()})").Join(", ");
                        DisposableUtil.FreeContents <IDxgiAdapter1>(items);
                    }
                }
                catch (Exception exception23)
                {
                    str24 = "--- Exception while populating videoCardNames: " + exception23.ToString() + Environment.NewLine;
                }
                try
                {
                    str25 = AppSettings.Instance.UI.EnableAnimations.Value.ToString();
                }
                catch (Exception exception24)
                {
                    str25 = "--- Exception while populating animations: " + exception24.ToString() + Environment.NewLine;
                }
                try
                {
                    float xScaleFactor = UIUtil.GetXScaleFactor();
                    str26 = $"{(96f * xScaleFactor).ToString("F2")} dpi ({xScaleFactor.ToString("F2")}x scale)";
                }
                catch (Exception exception25)
                {
                    str26 = "--- Exception while populating dpiInfo: " + exception25.ToString() + Environment.NewLine;
                }
                try
                {
                    VisualStyleClass visualStyleClass        = UIUtil.VisualStyleClass;
                    PdnTheme         effectiveTheme          = ThemeConfig.EffectiveTheme;
                    bool             isDwmCompositionEnabled = UIUtil.IsDwmCompositionEnabled;
                    string           themeFileName           = UIUtil.ThemeFileName;
                    str27 = $"{visualStyleClass.ToString()}/{effectiveTheme.ToString()}{isDwmCompositionEnabled ? " + DWM" : ""} ({themeFileName})";
                }
                catch (Exception exception26)
                {
                    str27 = "--- Exception while populating themeInfo: " + exception26.ToString() + Environment.NewLine;
                }
                try
                {
                    string   str36;
                    string   str37;
                    string   path       = AppSettings.Instance.UI.Language.Path;
                    bool     flag8      = AppSettings.Instance.StorageHandler.TryGet(SettingsHive.CurrentUser, path, out str36);
                    bool     flag9      = AppSettings.Instance.StorageHandler.TryGet(SettingsHive.SystemWide, path, out str37);
                    string[] textArray1 = new string[] { "pdnr.c: ", PdnResources.Culture.Name, ", hklm: ", flag9 ? str37 : "n/a", ", hkcu: ", flag8 ? str36 : "n/a", ", cc: ", CultureInfo.CurrentCulture.Name, ", cuic: ", CultureInfo.CurrentUICulture.Name };
                    str29 = string.Concat(textArray1);
                }
                catch (Exception exception27)
                {
                    str29 = "--- Exception while populating localeName: " + exception27.ToString() + Environment.NewLine;
                }
                try
                {
                    bool flag10 = AppSettings.Instance.Updates.AutoCheck.Value;
                    str28 = $"{flag10}, {AppSettings.Instance.Updates.LastCheckTimeUtc.Value.ToShortDateString()}";
                }
                catch (Exception exception28)
                {
                    str28 = "--- Exception while populating updaterInfo: " + exception28.ToString() + Environment.NewLine;
                }
                try
                {
                    List <string> strings = new List <string>();
                    if (AppSettings.Instance.UI.ErrorFlagsAtStartup.Value != AppSettings.Instance.UI.ErrorFlags.Value)
                    {
                        strings.Add("ErrorFlagsAtStartup=(" + AppSettings.Instance.UI.ErrorFlagsAtStartup.Value.ToString() + ")");
                    }
                    if (AppSettings.Instance.UI.ErrorFlags.Value != AppSettings.Instance.UI.ErrorFlags.DefaultValue)
                    {
                        strings.Add("ErrorFlags=(" + AppSettings.Instance.UI.ErrorFlags.Value.ToString() + ")");
                    }
                    if (AppSettings.Instance.UI.DefaultTextAntialiasMode.Value != AppSettings.Instance.UI.DefaultTextAntialiasMode.DefaultValue)
                    {
                        strings.Add("DefaultTextAntialiasMode=" + AppSettings.Instance.UI.DefaultTextAntialiasMode.Value.ToString());
                    }
                    if (AppSettings.Instance.UI.DefaultTextRenderingMode.Value != AppSettings.Instance.UI.DefaultTextRenderingMode.DefaultValue)
                    {
                        strings.Add("DefaultTextRenderingMode=" + AppSettings.Instance.UI.DefaultTextRenderingMode.Value.ToString());
                    }
                    if (AppSettings.Instance.UI.EnableCanvasHwndRenderTarget.Value != AppSettings.Instance.UI.EnableCanvasHwndRenderTarget.DefaultValue)
                    {
                        strings.Add("EnableCanvasHwndRenderTarget=" + AppSettings.Instance.UI.EnableCanvasHwndRenderTarget.Value.ToString());
                    }
                    if (AppSettings.Instance.UI.EnableHighQualityScaling.Value != AppSettings.Instance.UI.EnableHighQualityScaling.DefaultValue)
                    {
                        strings.Add("EnableHighQualityScaling=" + AppSettings.Instance.UI.EnableHighQualityScaling.Value.ToString());
                    }
                    if (AppSettings.Instance.UI.EnableSmoothMouseInput.Value != AppSettings.Instance.UI.EnableSmoothMouseInput.DefaultValue)
                    {
                        strings.Add("EnableSmoothMouseInput=" + AppSettings.Instance.UI.EnableSmoothMouseInput.Value.ToString());
                    }
                    str30 = strings.Join(", ");
                }
                catch (Exception exception29)
                {
                    str30 = "--- Exception while populating flagsInfo: " + exception29.ToString() + Environment.NewLine;
                }
                try
                {
                    StringBuilder builder    = new StringBuilder();
                    Assembly[]    assemblies = AppDomain.CurrentDomain.GetAssemblies();
                    for (int i = 0; i < assemblies.Length; i++)
                    {
                        Assembly assembly = assemblies[i];
                        string   str38    = () => assembly.FullName.Eval <string>().GetValueOrDefault() ?? "<FullName?>";
                        string   str39    = () => assembly.Location.Eval <string>().GetValueOrDefault() ?? "<Location?>";
                        builder.AppendFormat("{0}    {1} @ {2}", Environment.NewLine, str38, str39);
                    }
                    str31 = builder.ToString();
                }
                catch (Exception exception30)
                {
                    str31 = "--- Exception while populating assembliesInfo: " + exception30.ToString() + Environment.NewLine;
                }
                try
                {
                    StringBuilder builder2 = new StringBuilder();
                    int           num14    = Processor.Architecture.ToBitness();
                    foreach (ProcessStatus.ModuleFileNameAndBitness bitness in ProcessStatus.GetCurrentProcessModuleNames())
                    {
                        string fileVersion;
                        string str40 = string.Empty;
                        if (bitness.Bitness != num14)
                        {
                            str40 = $" ({bitness.Bitness.ToString()}-bit)";
                        }
                        try
                        {
                            fileVersion = FileVersionInfo.GetVersionInfo(bitness.FileName).FileVersion;
                        }
                        catch (Exception exception31)
                        {
                            fileVersion = $"ex: {exception31.GetType().FullName}";
                        }
                        object[] args = new object[] { Environment.NewLine, bitness.FileName, str40, fileVersion };
                        builder2.AppendFormat("{0}    {1}{2}, version={3}", args);
                    }
                    str32 = builder2.ToString();
                }
                catch (Exception exception32)
                {
                    str32 = "--- Exception while populating nativeModulesInfo: " + exception32.ToString() + Environment.NewLine;
                }
            }
            catch (Exception exception33)
            {
                stream.WriteLine("Exception while gathering app and system info: " + exception33.ToString());
            }
            stream.WriteLine("Application version: " + fullAppName);
            stream.WriteLine("Time of crash: " + str4);
            stream.WriteLine("Application uptime: " + str5);
            stream.WriteLine("Application state: " + str6);
            stream.WriteLine("Working set: " + str7);
            stream.WriteLine("Handles and threads: " + str8);
            stream.WriteLine("Install directory: " + str9);
            stream.WriteLine("Current directory: " + currentDirectory);
            stream.WriteLine("OS Version: " + str11 + (string.IsNullOrEmpty(revision) ? "" : (" " + revision)) + " " + str13 + " " + str14);
            stream.WriteLine(".NET version: CLR " + str15 + " " + str17 + ", FX " + str16);
            stream.WriteLine("Processor: \"" + cpuName + "\" " + str20 + " " + str21);
            stream.WriteLine("Physical memory: " + str22);
            stream.WriteLine("Video card: " + str24);
            stream.WriteLine("Hardware acceleration: " + str23);
            stream.WriteLine("UI animations: " + str25);
            stream.WriteLine("UI DPI: " + str26);
            stream.WriteLine("UI theme: " + str27);
            stream.WriteLine("Updates: " + str28);
            stream.WriteLine("Locale: " + str29);
            stream.WriteLine("Flags: " + str30);
            stream.WriteLine();
            stream.WriteLine("Exception details:");
            if (crashEx == null)
            {
                stream.WriteLine("(null)");
            }
            else
            {
                stream.WriteLine(crashEx.ToString());
                Exception[] loaderExceptions = null;
                if (crashEx is ReflectionTypeLoadException)
                {
                    loaderExceptions = ((ReflectionTypeLoadException)crashEx).LoaderExceptions;
                }
                if (loaderExceptions != null)
                {
                    for (int j = 0; j < loaderExceptions.Length; j++)
                    {
                        stream.WriteLine();
                        stream.WriteLine("Secondary exception details:");
                        if (loaderExceptions[j] == null)
                        {
                            stream.WriteLine("(null)");
                        }
                        else
                        {
                            stream.WriteLine(loaderExceptions[j].ToString());
                        }
                    }
                }
            }
            stream.WriteLine();
            stream.WriteLine("Managed assemblies: " + str31);
            stream.WriteLine();
            stream.WriteLine("Native modules: " + str32);
            stream.WriteLine("------------------------------------------------------------------------------");
            stream.Flush();
        }