Table of Contents

Class GroupSetBuilder

Namespace
Typhon.Engine
Assembly
Typhon.Engine.dll

Declares a group set (claude/design/Subscriptions/14-phase4-design.md § 3): a family of groups, each a key that members carry in a field of one of their components, and the selector that decides which keys a session holds.

public sealed class GroupSetBuilder
Inheritance
GroupSetBuilder
Inherited Members

Remarks

Membership is the engine's own index, never a copy. A member field carries [Index(AllowMultiple = true, Sparse = true)]: 0 means "in no group" and is not indexed, every commit and fence path maintains it, and a crash rebuilds it from the data. The set reads that index to fill a key a session comes to hold, and the projection reads the field on every push, so a change of key is an event like a change of position.

A region set (Region<TRegion>(Action<RegionBuilder>)) holds the keys whose extent the session's observer meets: a region is an entity of the declared archetype carrying the key and the extent, and a profile names the set with Groups(string, double) and the reach it is met at.

An explicit set (Explicit(GroupRequestHandler)) holds the keys a session asked for and the application allowed — a client's SubscribeRequest — and the keys the server chose for it (SetSources(string, params long[])). A shared set (Shared(long)) has one key, held by every session whose profile names it. A profile names either with Groups(string), which takes no reach.

Methods

Explicit(GroupRequestHandler)

Selects this set's keys by request (14 § 4, P13–P14): a session holds a key its client asked for with SubscribeRequest once admit allowed it, and the keys a system chose for it with SetSources(string, params long[]).

public GroupSetBuilder Explicit(GroupRequestHandler admit = null)

Parameters

admit GroupRequestHandler

The application's verdict on each client request: synchronous, given the session, the set and the key, and nothing of the engine's. It runs on the tick's ingress drain, which is chunked over sessions, so it may be called from several threads at once — like an admission check. Null: clients may not ask, and the set's keys are the server's alone.

Returns

GroupSetBuilder

This builder.

Leave(double)

The hysteresis on the extent test: a region held is left only beyond its reach plus this margin.

public GroupSetBuilder Leave(double marginM)

Parameters

marginM double

Metres, at least 0. Defaults to 0.

Returns

GroupSetBuilder

This builder.

Member<TArchetype>(Action<MemberBuilder>)

Adds a member archetype: its entities belong to the group whose key their field holds, none when it holds 0.

public GroupSetBuilder Member<TArchetype>(Action<MemberBuilder> configure) where TArchetype : Archetype<TArchetype>

Parameters

configure Action<MemberBuilder>

Names the key field.

Returns

GroupSetBuilder

This builder.

Type Parameters

TArchetype

The member archetype.

Region<TRegion>(Action<RegionBuilder>)

Selects this set's keys by geometry: the regions of TRegion whose extent a session's observer meets.

public GroupSetBuilder Region<TRegion>(Action<RegionBuilder> configure) where TRegion : Archetype<TRegion>

Parameters

configure Action<RegionBuilder>

Names the region's key and extent fields.

Returns

GroupSetBuilder

This builder.

Type Parameters

TRegion

The region archetype: one entity per group, carrying the key and the extent.

Shared(long)

Makes this a set with one group (14 § 4, P15): every session whose profile names the set holds key from its first frame, filled and completed like a region's.

public GroupSetBuilder Shared(long key)

Parameters

key long

The group's key: what the members' field holds, never 0, which is no group.

Returns

GroupSetBuilder

This builder.