< Summary

Information
Class: IceRpc.DeadlinePipelineExtensions
Assembly: IceRpc.Deadline
File(s): /home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Deadline/DeadlinePipelineExtensions.cs
Tag: 275_13775359185
Line coverage
0%
Covered lines: 0
Uncovered lines: 2
Coverable lines: 2
Total lines: 39
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage
0%
Covered methods: 0
Total methods: 2
Method coverage: 0%

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
UseDeadline(...)100%210%
UseDeadline(...)100%210%

File(s)

/home/runner/work/icerpc-csharp/icerpc-csharp/src/IceRpc.Deadline/DeadlinePipelineExtensions.cs

#LineLine coverage
 1// Copyright (c) ZeroC, Inc.
 2
 3using IceRpc.Deadline;
 4
 5namespace IceRpc;
 6
 7/// <summary>Provides extension methods for <see cref="Pipeline" /> to add the deadline interceptor.</summary>
 8public static class DeadlinePipelineExtensions
 9{
 10    /// <summary>Adds a <see cref="DeadlineInterceptor" /> with an infinite default timeout to this pipeline.
 11    /// This interceptor enforces the deadlines it receives and does not create new deadlines.</summary>
 12    /// <param name="pipeline">The pipeline being configured.</param>
 13    /// <returns>The pipeline being configured.</returns>
 14    /// <example>
 15    /// The following code adds the deadline interceptor to the invocation pipeline.
 16    /// <code source="../../docfx/examples/IceRpc.Deadline.Examples/DeadlineInterceptorExamples.cs" region="UseDeadline"
 17    /// </example>
 018    public static Pipeline UseDeadline(this Pipeline pipeline) => pipeline.UseDeadline(Timeout.InfiniteTimeSpan);
 19
 20    /// <summary>Adds a <see cref="DeadlineInterceptor" /> to this pipeline.</summary>
 21    /// <param name="pipeline">The pipeline being configured.</param>
 22    /// <param name="defaultTimeout">The default timeout. When not infinite, the interceptor adds a deadline to requests
 23    /// without a deadline.</param>
 24    /// <param name="alwaysEnforceDeadline">When <see langword="true" /> and the request carries a deadline, the
 25    /// interceptor always creates a cancellation token source to enforce this deadline. When <see langword="false" />
 26    /// and the request carries a deadline, the interceptor creates a cancellation token source to enforce this deadline
 27    /// only when the invocation's cancellation token cannot be canceled. The default value is <see langword="false" />.
 28    /// </param>
 29    /// <returns>The pipeline being configured.</returns>
 30    /// <example>
 31    /// The following code adds the deadline interceptor to the invocation pipeline.
 32    /// <code source="../../docfx/examples/IceRpc.Deadline.Examples/DeadlineInterceptorExamples.cs" region="UseDeadlineW
 33    /// </example>
 34    public static Pipeline UseDeadline(
 35        this Pipeline pipeline,
 36        TimeSpan defaultTimeout,
 37        bool alwaysEnforceDeadline = false) =>
 038        pipeline.Use(next => new DeadlineInterceptor(next, defaultTimeout, alwaysEnforceDeadline));
 39}