/// <summary>
        ///     Initializes a new instance of the <see cref="ContentStoreConfiguration"/> class.
        /// </summary>
        public ContentStoreConfiguration
        (
            MaxSizeQuota?maxSizeQuota = null,
            DiskFreePercentQuota?diskFreePercentQuota = null,
            DenyWriteAttributesOnContentSetting denyWriteAttributesOnContent = DenyWriteAttributesOnContentSetting.Disable,
            int singleInstanceTimeoutSeconds = DefaultSingleInstanceTimeoutSeconds,
            bool enableElasticity            = false,
            MaxSizeQuota?initialElasticSize  = null,
            int?historyBufferSize            = default(int?),
            int?historyWindowSize            = default(int?)
        )
        {
            Contract.Requires(singleInstanceTimeoutSeconds > 0);

            MaxSizeQuota                 = maxSizeQuota;
            DiskFreePercentQuota         = diskFreePercentQuota;
            DenyWriteAttributesOnContent = denyWriteAttributesOnContent;
            SingleInstanceTimeoutSeconds = singleInstanceTimeoutSeconds;
            EnableElasticity             = enableElasticity;
            InitialElasticSize           = initialElasticSize;
            HistoryBufferSize            = historyBufferSize;
            HistoryWindowSize            = historyWindowSize;

            Initialize();
        }
Ejemplo n.º 2
0
        public void DenyWriteAttributesOnContentSettingFromJsonSucceeds(DenyWriteAttributesOnContentSetting value)
        {
            var json = @"{""DenyWriteAttributesOnContent"":""" + value + @"""}";

            using (var stream = json.ToUTF8Stream())
            {
                var config = stream.DeserializeFromJSON <ContentStoreConfiguration>();
                config.DenyWriteAttributesOnContent.Should().Be(value);
            }
        }
Ejemplo n.º 3
0
        public void DenyWriteAttributesOnContentSettingRoundtrip(DenyWriteAttributesOnContentSetting value)
        {
            var configuration1 = new ContentStoreConfiguration(denyWriteAttributesOnContent: value);

            using (var ms = new MemoryStream())
            {
                configuration1.SerializeToJSON(ms);
                ms.Position = 0;
                var configuration2 = ms.DeserializeFromJSON <ContentStoreConfiguration>();
                configuration2.DenyWriteAttributesOnContent.Should().Be(value);
            }
        }
        /// <summary>
        ///     Initializes a new instance of the <see cref="ContentStoreConfiguration"/> class.
        /// </summary>
        public ContentStoreConfiguration
        (
            string maxSizeExpression,
            string diskFreePercentExpression,
            DenyWriteAttributesOnContentSetting denyWriteAttributesOnContent = DenyWriteAttributesOnContentSetting.Disable,
            int singleInstanceTimeoutSeconds    = DefaultSingleInstanceTimeoutSeconds,
            bool enableElasticity               = false,
            string?initialElasticSizeExpression = null,
            int?historyBufferSize               = default(int?),
            int?historyWindowSize               = default(int?)
        )
        {
            Contract.Requires(singleInstanceTimeoutSeconds > 0);

            MaxSizeQuota = !string.IsNullOrEmpty(maxSizeExpression)
                ? new MaxSizeQuota(maxSizeExpression)
                : null;

            DiskFreePercentQuota = !string.IsNullOrEmpty(diskFreePercentExpression)
                ? new DiskFreePercentQuota(diskFreePercentExpression)
                : null;

            DenyWriteAttributesOnContent = denyWriteAttributesOnContent;
            SingleInstanceTimeoutSeconds = singleInstanceTimeoutSeconds;

            EnableElasticity = enableElasticity;

            InitialElasticSize = !string.IsNullOrEmpty(initialElasticSizeExpression)
                ? new MaxSizeQuota(initialElasticSizeExpression !)
                : null;

            HistoryBufferSize = historyBufferSize;
            HistoryWindowSize = historyWindowSize;

            Initialize();
        }