Table of Contents

Class LicenseCaps

Namespace
Hi.Licenses
Assembly
HiDisp.dll

Internal Use Only. The two licence caps the native locker holds, independent of the licence source, both 0 = no cap. The resolution cap ratio N: the finest cube width a cube tree may be subdivided to is its reference size – the longest side of the bounding box of the geometry it was built from – over N, taken to the powers-of-two width ladder at its finest rung not finer than it (the coarser of the two rungs around the quotient, an exact rung kept: 65 mm at 1/128 is 1 mm, at 1/512 0.25 mm). The clamp points are the native build from a shape, which takes the licensed width when a finer one is asked, and the subtraction and addition ratchets of the cuts, which refine the tree no further than it; a .wct is read whatever its resolution, and a stock finer than the licence runs its cuts no finer than its own width. The step cap: the number of machining steps granted since the last runner reset; at the cap ConsumeStep(int) refuses and the run stops (MachiningParallelProc.RunStep, MachiningSession.RunNcLines); an expired cloud lease refuses the same way, before the cap logic (StepGrant). Beside the caps the locker holds the cloud lease's step grant: the steps the licence server reserved for the installed lease (its sgrant claim, drawn on the account's weekly quota or one-time trial), set by every install, counted down by every granted step and lowered by the cloud lease client to what the chain has left (TightenLeaseSteps(long)); at 0 ConsumeStep(int) refuses after the cap logic (LeaseStepsExhausted), and a runner reset does not refill it – the next install does. The Sentinel source never sets either cap nor a grant, so with both caps at 0 and the grant at -1 every result is what it was before the caps existed; the cloud lease provider sets them from the lease (native, internal); the tests tighten them through TightenForTest(int, int) and TightenLeaseStepsForTest(long), which can never loosen what the source set. The effective cap is the tightest of the source's and the test's values. The state is process-global, and every read here is a relaxed atomic load on the native side.

public static class LicenseCaps
Inheritance
LicenseCaps
Inherited Members

Properties

HasResolutionCap

Whether a resolution cap is in force (ResolutionCapRatio above 0).

public static bool HasResolutionCap { get; }

Property Value

bool

HasStepCap

Whether a step cap is in force (StepCap above 0).

public static bool HasStepCap { get; }

Property Value

bool

LeaseStepsLeft

Internal Use Only. The machining steps the installed cloud lease may still grant: its token's sgrant claim as the last install set it, counted down by every granted step and lowered by TightenLeaseSteps(long); -1 when there is no grant limit – Sentinel mode, a lease without the claim (a paid plan), or a core without the export – and never below 0 otherwise. At 0 ConsumeStep(int) answers LeaseStepsExhausted until an install brings a grant; ResetStepCount(int) does not touch it.

public static long LeaseStepsLeft { get; }

Property Value

long

ResolutionCapRatio

The effective resolution cap ratio N: the cube width of a tree may not go under its reference size / N, taken to the width ladder at its finest rung not finer than it. 0 = no cap.

public static int ResolutionCapRatio { get; }

Property Value

int

StepCap

The effective step cap: the machining steps a run may take since the last reset. 0 = no cap.

public static int StepCap { get; }

Property Value

int

StepsTaken

The machining steps granted since the last ResetStepCount(int), counted with or without a cap.

public static int StepsTaken { get; }

Property Value

int

Methods

ConsumeStep(int)

Asks for one machining step: Granted when it is granted (StepsTaken is one more), CapReached when the count stands at the cap, where it stays, LeaseExpired when the cloud lease of this process is expired (lease mode, Expired), answered before the cap logic and without touching the count, and LeaseStepsExhausted when the installed lease's step grant is used up (LeaseStepsLeft is 0), answered after the cap logic – a fresh lease's grant equals its cap, so both hit on the same step, and the cap is the one a reset lifts – and without touching the count. A granted step counts the grant down by one. The count is defined over the steps on record – the strip's length, residentSteps – and is raised to it first, so a count zeroed without the strip cleared (a ResetStepCount(int) by a caller that cleared nothing) is undone by the next step; a caller without a strip passes 0. The native side logs [StepCapReached] once per reset on the first cap refusal, [LeaseExpired] once per expiry and [LeaseStepsExhausted] once per grant used up (re-armed by an install that brings a grant); the caller says each on the message channel (MachiningStep–LicenseCapReached, MachiningStep–LeaseExpired, MachiningStep–LeaseEnded, MachiningStep–LeaseStepsExhausted and the quota wordings). Only Granted – the native 1 – grants: a test of “not 0” would read the lease refusals, -1 and -2, as granted.

public static StepGrant ConsumeStep(int residentSteps)

Parameters

residentSteps int

The steps on record: the strip's position count (ClStrip.StripPosesCount); 0 without a strip.

Returns

StepGrant

The answer as a StepGrant.

Exceptions

InvalidOperationException

The core answered a code this build does not know.

LicensedGridWidth_mm(double)

The cube width the licence allows a tree of referenceSize_mm: the width of the finest ladder rung not finer than reference / N (the coarser of the two rungs around the quotient, an exact rung kept); the finest width of the ladder when no cap is in force.

public static double LicensedGridWidth_mm(double referenceSize_mm)

Parameters

referenceSize_mm double

The tree's reference size: the longest side of the bounding box of the geometry it was built from.

Returns

double

The licensed cube width in mm.

ReleaseTestCaps()

Both test values back to 0, and the step grant TightenLeaseStepsForTest(long) put back to -1 (never a grant an install set); the licence source's values stand.

public static void ReleaseTestCaps()

ResetStepCount(int)

Counts the steps from residentSteps again – 0 after the runner's reset cleared the strip (MachiningActRunner.ResetStateAndClStrip) – and re-arms the native log line. A reset that clears no strip is undone by the next ConsumeStep(int). The cloud lease's step grant (LeaseStepsLeft) is not touched: it counts the lease, not the run.

public static void ResetStepCount(int residentSteps)

Parameters

residentSteps int

The steps on record after the reset: the strip's position count.

StepGrantOf(int)

Internal Use Only. The StepGrant of a native locker__step_consume code, one for one: 1 granted, 0 the cap, -1 the expired cloud lease, -2 the lease's step grant used up. Only Granted grants; the lease refusals are the codes a test of “not 0” would read as granted, which is why the translation is pinned apart from the native call (the Sentinel-licensed test host never gets -1 from the core, and -2 only through TightenLeaseStepsForTest(long)).

public static StepGrant StepGrantOf(int nativeCode)

Parameters

nativeCode int

The code the core answered.

Returns

StepGrant

The grant.

Exceptions

InvalidOperationException

nativeCode is a code this build does not know.

TightenForTest(int, int)

Test-only override. Each argument above 0 is taken when it is tighter than the current test value, or there is none – a smaller N, a smaller step count; 0 leaves that cap as it is; a value that would loosen is ignored. It can never loosen what the licence source set: an export that could set the caps would let any caller lift a lease's cap with one call, and a tightening-only one still lets the tests exercise every enforcement point. Release with ReleaseTestCaps().

public static bool TightenForTest(int resolutionCapRatio, int stepCap)

Parameters

resolutionCapRatio int

The resolution cap ratio N to tighten to; 0 leaves it.

stepCap int

The step cap to tighten to; 0 leaves it.

Returns

bool

True when either value was taken.

TightenLeaseSteps(long)

Internal Use Only. Lowers the installed cloud lease's step grant to left when that is lower than what is left (a negative value counts as 0): the cloud lease client's arithmetic after every flush and install – the lease's grant less the steps the chain booked since the lease was received, which other processes of the same chain may have taken. It never raises the grant, never touches a counter at -1 (no grant limit), and is ignored on a core without the export.

public static void TightenLeaseSteps(long left)

Parameters

left long

The steps the lease has left by the client's arithmetic.

TightenLeaseStepsForTest(long)

Internal Use Only. Test-only override of the cloud lease's step grant: on a process without one – LeaseStepsLeft at -1: Sentinel mode, or a lease without the claim – it puts a grant of steps (a negative value counts as 0), so the facts reach the LeaseStepsExhausted refusal on a Sentinel-licensed host. Where a grant stands – an install's, or this call's own earlier one – it changes nothing and answers false: it can never raise or replace a grant. It is not synchronised with an install, which replaces the counter with its token's claim and the test's grant with it: a fact tightens in a Sentinel process, or before the install. Release with ReleaseTestCaps(), which puts the counter back to -1 when this call set it.

public static bool TightenLeaseStepsForTest(long steps)

Parameters

steps long

The steps to grant before the refusal.

Returns

bool

True when the grant was put; false when a grant stood and nothing changed.