import type { ValueOf } from '../../type.utils.js'; /** * Enumeration of partition selection strategies. */ export declare const PartitionKind: { /** Server selects partition using round-robin */ readonly Balanced: 1; /** Client specifies exact partition ID */ readonly PartitionId: 2; /** Client provides a key for consistent hashing */ readonly MessageKey: 3; }; /** Type alias for the PartitionKind object */ export type PartitionKind = typeof PartitionKind; /** String literal type of partition kind names */ export type PartitionKindId = keyof PartitionKind; /** Numeric values of partition kinds */ export type PartitionKindValue = ValueOf; /** Balanced partitioning (server selects partition) */ export type Balanced = { kind: PartitionKind['Balanced']; value: null; }; /** Explicit partition ID selection */ export type PartitionId = { kind: PartitionKind['PartitionId']; /** Partition ID (uint32) */ value: number; }; /** Possible types for message key values */ export type MessageKeyValue = string | number | bigint | Buffer; /** Message key-based partitioning for consistent hashing */ export type MessageKey = { kind: PartitionKind['MessageKey']; value: MessageKeyValue; }; /** Union of all partitioning strategies */ export type Partitioning = Balanced | PartitionId | MessageKey; /** * Factory object for creating partitioning strategies. */ export declare const Partitioning: { Balanced: Balanced; PartitionId: (id: number) => PartitionId; MessageKey: (key: MessageKeyValue) => MessageKey; }; /** * Serializes a message key value to a buffer. * * @param v - Message key value * @returns Serialized buffer * @throws Error if the value type is not supported */ export declare const serializeMessageKey: (v: MessageKeyValue) => Buffer; /** * Serializes the value portion of a partitioning strategy. * * @param part - Partitioning strategy * @returns Serialized value buffer */ export declare const serializePartitioningValue: (part: Partitioning) => Buffer; /** Default partitioning strategy (balanced) */ export declare const default_partionning: Balanced; /** * Serializes a partitioning strategy to wire format. * Format: [kind (1 byte)][value_length (1 byte)][value] * * @param p - Optional partitioning strategy (defaults to balanced) * @returns Serialized partitioning buffer */ export declare const serializePartitioning: (p?: Partitioning) => Buffer; //# sourceMappingURL=partitioning.utils.d.ts.map