Skip to main content

Module partition

Module partition 

Source
Expand description

Partition families, keys, and routing helpers.

§Opaque wire keys (issue #91)

Public wire surfaces carry PartitionKey — an opaque #[serde(transparent)] newtype over the hash-tag literal ("{fp:7}") — rather than the internal Partition struct. The PartitionFamily enum (including its Execution / Flow alias) remains a public ff-core type — in-tree consumers that construct a Partition directly still name it — but it is no longer part of the HTTP / SDK wire DTOs, so external consumers never deserialize it off the wire.

§Migration note (0.2 → 0.3)

The HTTP response body for POST /v1/workers/{id}/claim changed from

{
  "execution_id": "{fp:7}:...",
  "partition_family": "flow",
  "partition_index": 7,
  "grant_key": "...",
  "expires_at_ms": 0
}

to

{
  "execution_id": "{fp:7}:...",
  "partition_key": "{fp:7}",
  "grant_key": "...",
  "expires_at_ms": 0
}

Consumers that need the parsed family/index call PartitionKey::parse (or crate::contracts::ClaimGrant::partition / crate::contracts::ReclaimGrant::partition) — these return a typed Partition so routing code stays unchanged.

The Execution family label collapses to Flow on round-trip (both produce {fp:N} under RFC-011 §11 co-location). Consumers that read grant.partition()?.family for LOGGING will see Flow where Execution previously appeared — cosmetically visible, routing-equivalent. See PartitionKey rustdoc for the full contract.

Structs§

Crc16SoloPartitioner
Default SoloPartitioner: crc16_ccitt(lane_utf8) % num_flow_partitions.
Partition
A resolved partition within a family.
PartitionConfig
Partition counts for each family. Fixed at deployment time.
PartitionKey
Opaque routing handle for a partition, as exchanged on public wire surfaces.

Enums§

PartitionFamily
The partition families in FlowFabric.
PartitionKeyParseError
Errors produced when parsing a PartitionKey back into a Partition.

Traits§

SoloPartitioner
Strategy for picking a solo execution’s partition from its lane id.

Functions§

budget_partition
Compute the partition for a budget ID.
execution_partition
Compute the partition for an execution ID.
flow_partition
Compute the partition for a flow ID.
quota_partition
Compute the partition for a quota policy (by scope ID).
solo_partition
Compute the partition for a solo (flow-less) execution’s lane shard.
solo_partition_with
Compute the partition for a solo execution using a custom SoloPartitioner strategy.