import { ShardConfig, ShardedNode } from './types.js';
export * from './types.js';
export * from './segment_tree.js';
/**
 * Controls the order in which candidate nodes are evaluated by selectNodes.
 *
 * 'min'    – sort by numShard ascending, then shardId ascending (default).
 *            Prefers coarser-grained nodes; typically yields fewer selected
 *            nodes. Good for upload.
 * 'max'    – sort by numShard descending, then shardId ascending.
 *            Prefers finer-grained nodes first.
 * 'random' – shuffle before selection.
 *            Spreads load across replicas. Recommended for download.
 */
export type SelectMethod = 'min' | 'max' | 'random';
/**
 * Select a minimal set of nodes that provides `expectedReplica` complete,
 * non-overlapping sharding sets.
 *
 * A node with (shardId=K, numShard=N) holds segments where
 * globalSegmentIndex % N === K.  expectedReplica=R means R full copies
 * of the file are available in the returned set.
 *
 * The input array is never mutated.
 * Returns [selectedNodes, true] on success, [[], false] when coverage
 * cannot be satisfied.
 */
export declare function selectNodes(nodes: ShardedNode[], expectedReplica: number, method?: SelectMethod): [ShardedNode[], boolean];
/**
 * Given a covering set returned by selectNodes, return the node responsible
 * for the segment at `globalSegIdx`.
 *
 * A node (shardId=K, numShard=N) is responsible when globalSegIdx % N === K.
 * For expectedReplica=1 exactly one node in the selected set satisfies this.
 * For expectedReplica>1 the first matching node is returned (caller may
 * implement its own replica selection on top).
 *
 * globalSegIdx = startSegmentIndex + localSegmentIndex, where
 * startSegmentIndex = Math.floor(tx.startEntryIndex / DEFAULT_SEGMENT_MAX_CHUNKS).
 */
export declare function nodeForSegment(selected: ShardedNode[], globalSegIdx: number): ShardedNode | undefined;
export declare function checkReplica(shardConfigs: ShardConfig[], expectedReplica: number): boolean;
//# sourceMappingURL=index.d.ts.map