/
CheckpointToken.cs
37 lines (32 loc) · 1.27 KB
/
CheckpointToken.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Shared.Diagnostics;
namespace Microsoft.Extensions.Diagnostics.Latency;
/// <summary>
/// Represents a registered checkpoint.
/// </summary>
[SuppressMessage("Performance", "CA1815:Override equals and operator equals on value types", Justification = "Comparing instances is not an expected scenario")]
public readonly struct CheckpointToken
{
/// <summary>
/// Gets the name of the checkpoint.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the position of token in the token table.
/// </summary>
public int Position { get; }
/// <summary>
/// Initializes a new instance of the <see cref="CheckpointToken"/> struct.
/// </summary>
/// <param name="name">Name of the checkpoint.</param>
/// <param name="position">Position of the token in the token table.</param>
/// <exception cref="ArgumentNullException"><paramref name="name"/> is <see langword="null"/>.</exception>
public CheckpointToken(string name, int position)
{
Name = Throw.IfNullOrWhitespace(name);
Position = position;
}
}