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