← All compilation units

Flyology.Execution_Groups.Topology

Description

Names execution groups as stable application ownership shards.

Example:

Target := Shard_For_Hash (Request_Id);
Cross_To_Shard (Target);

Cross_To_Shard

procedure Cross_To_Shard (Target : Shard_Id)

Cross an application ownership boundary at an explicit cooperative safe point. This is Migrate restricted to the configured shared pool. The caller returns on Target's loop pthread with unchanged Ada task identity and locals. Native tasks cannot cross because their stacks remain owned by their GNARL pthreads. Like Migrate, this is a potentially blocking operation and must not be called inside a protected action.

Parameters
Target

Configured ownership shard to enter

Raised exceptions
Group_Error

The runtime reports an invalid pool size

Migration_Error

Target is outside the configured pool, or the caller is native, pinned, or otherwise cannot migrate

Program_Error

Lightweight caller is inside a protected action

Shard_For_Hash

function Shard_For_Hash (Hash : Interfaces.Unsigned_64) return Shard_Id

Map Hash deterministically across the process's configured shared groups. Launching with a different FLYOLOGY_LOOP_POOL_SIZE or calling Grow_Configured_Pool may remap a hash within one process; persist an independent partition count when storage compatibility requires it.

Parameters
Hash

Application key or hash to partition

Return value

Group in 0 .. Configured_Pool_Size - 1

Raised exceptions
Group_Error

The runtime reports an invalid pool size

Shard_For_Hash

function Shard_For_Hash (Hash : Interfaces.Unsigned_64; Shard_Count : Loop_Pool_Size) return Shard_Id

Map Hash across an explicit fixed number of shards without consulting or starting the runtime. Use this overload when a stored partitioning scheme must remain independent of the startup loop-pool size.

Parameters
Hash

Application key or hash to partition

Shard_Count

Number of zero-based shards in the mapping

Return value

Group in 0 .. Shard_Count - 1

Shard_Id

subtype Shard_Id is Shared_Group_Id;

Shared execution-group identifier eligible for application sharding. A value belongs to the configured pool only when In_Configured_Pool is true.