jon.recoil.org

Module Partition_object_files

Partitioning object files into size-limited buckets.

This module partitions a list of files with their sizes into buckets, where each bucket's total size is at most a configurable threshold.

type error =
  1. | File_exceeds_partition_size of {
    1. filename : string;
    2. size : int64;
    3. threshold : int64;
    }

Errors that can occur during file partitioning.

exception Error of Partition_object_files.error

Exception wrapper for partitioning errors.

Pretty-print a partitioning error.

val default_partition_size : int64

Default partition size threshold in bytes (1 GiB).

val bytes_of_gb : float -> int64

Convert gigabytes to bytes.

val partition_files : threshold:int64 -> Measure_object_files.File_size.t list -> Partition.t list

partition_files ~threshold file_sizes partitions files into buckets, starting a new bucket when adding the next file would exceed threshold. The order of files is preserved.

The input should only contain files destined for partitioning (OCaml files, startup object, cached genfns). Passthrough files (C stubs, runtime libs) should be handled separately by the caller.

Raises Error (File_exceeds_partition_size _) if any single file exceeds the threshold.