Esempio n. 1
0
        private Task <CalibrateResult> CalibrateAsync(Context context, IQuotaRule rule)
        {
            var operationContext = new OperationContext(context, _token);

            return(operationContext.PerformOperationAsync(
                       Tracer,
                       async() =>
            {
                if (!rule.CanBeCalibrated)
                {
                    return CalibrateResult.CannotCalibrate;
                }

                if (ShouldAbortOperation(context, "Calibrate", out var reason))
                {
                    return new CalibrateResult(reason);
                }

                return await rule.CalibrateAsync();
            }));
Esempio n. 2
0
        private Task CalibrateAsync(Context context, IQuotaRule rule)
        {
            var operationContext = new OperationContext(context, _token);

            return(CalibrateCall.RunAsync(_tracer, operationContext, async() =>
            {
                if (!rule.CanBeCalibrated)
                {
                    return CalibrateResult.CannotCalibrate;
                }

                if (_token.IsCancellationRequested)
                {
                    var reason = "Calibrate exiting due to shutdown.";
                    _tracer.Debug(context, reason);
                    return new CalibrateResult(reason);
                }

                var result = await rule.CalibrateAsync();
                _tracer.Debug(context, !result.Succeeded ? result.ErrorMessage : $"New hard limit=[{result.Size}]");

                return result;
            }));
        }
Esempio n. 3
0
 /// <inheritdoc />
 internal override bool StopPurging(out string stopReason, out IQuotaRule activeRule)
 {
     throw new NotSupportedException();
 }
Esempio n. 4
0
 /// <summary>
 /// Returns true if the purge process should be stopped.
 /// </summary>
 internal abstract bool StopPurging(out string stopReason, out IQuotaRule activeRule);
Esempio n. 5
0
 public ForwardingQuotaRule(Func <IQuotaRule> ruleFactory, DisposableDirectory root)
 {
     Rule   = ruleFactory();
     Root   = root;
     _freed = false;
 }
Esempio n. 6
0
 /// <nodoc />
 public static bool GetOnlyUnlinked(this IQuotaRule /*Can Be Null*/ rule)
 {
     return(rule?.OnlyUnlinked ?? false);
 }
Esempio n. 7
0
 private bool StopPurging(out string stopReason, out IQuotaRule rule) => _quotaKeeper.StopPurging(out stopReason, out rule);