< Summary

Information
Class: Trailblazer.Navigation.NavigatorGlobalIdAllocatorState
Assembly: Trailblazer
File(s): /home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/NavigatorGlobalIdAllocatorState.cs
Line coverage
100%
Covered lines: 15
Uncovered lines: 0
Coverable lines: 15
Total lines: 34
Line coverage: 100%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Create()100%11100%
Reset()100%11100%

File(s)

/home/runner/work/Trailblazer/Trailblazer/src/Trailblazer/Navigation/Navigator/NavigatorGlobalIdAllocatorState.cs

#LineLine coverage
 1using System;
 2using System.Threading;
 3
 4namespace Trailblazer.Navigation;
 5
 6/// <summary>
 7/// Allocates deterministic navigator ids for one Trailblazer world context.
 8/// </summary>
 9internal sealed class NavigatorGlobalIdAllocatorState
 10{
 11    private long _nextId;
 12
 13    internal Guid Create()
 14    {
 15415        long next = Interlocked.Increment(ref _nextId);
 15416        return new Guid(
 15417            unchecked((int)next),
 15418            unchecked((short)(next >> 32)),
 15419            unchecked((short)(next >> 48)),
 15420            (byte)'T',
 15421            (byte)'R',
 15422            (byte)'A',
 15423            (byte)'I',
 15424            (byte)'L',
 15425            (byte)'B',
 15426            (byte)'L',
 15427            (byte)'Z');
 28    }
 29
 30    internal void Reset()
 31    {
 2532        Interlocked.Exchange(ref _nextId, 0);
 2533    }
 34}

Methods/Properties

Create()
Reset()