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.
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
Shard_For_Hash
function Shard_For_Hash
(Hash : Interfaces.Unsigned_64) return Shard_Id
Map Hash deterministically across the prepared runtime's configured shared groups. The compiled pool size is immutable for the process lifetime, so a given hash remains on the same shard within one prepared runtime. Changing FLYOLOGY_LOOP_POOL_SIZE and preparing another runtime may remap keys; 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 prepared 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 prepared pool only when In_Configured_Pool is true.