My agentic slop goes here. Not intended for anyone else!
1(** Chunk file management for partial downloads and resumable transfers
2
3 This module manages partial cache entries (chunks) that can be combined
4 to form complete files. Chunks enable resumable downloads and efficient
5 caching of large files by storing byte ranges independently.
6
7 Each chunk is stored as a separate file with range information encoded
8 in its filename, allowing the cache to resume interrupted downloads
9 and serve partial content requests efficiently. *)
10
11(** Information about a chunk file *)
12type t
13
14(** Get the key *)
15val key : t -> string
16
17(** Get the hash *)
18val hash : t -> string
19
20(** Get the range *)
21val range : t -> Range.t
22
23(** Get the path *)
24val path : t -> Eio.Fs.dir_ty Eio.Path.t
25
26(** Get the flags *)
27val flags : t -> Flags.t
28
29(** Get the TTL *)
30val ttl : t -> float option
31
32(** Parse a chunk from a filename and path *)
33val parse : path:Eio.Fs.dir_ty Eio.Path.t -> filename:string -> t option
34
35(** Generate a chunk filename *)
36val make_filename : hash:string -> range:Range.t ->
37 ?ttl:float -> ?flags:Flags.t -> unit -> string
38
39(** Find all chunks for a key in a directory structure *)
40val find_chunks : base_dir:Eio.Fs.dir_ty Eio.Path.t ->
41 key:string -> t list
42
43(** Check if chunks form a complete sequence *)
44val is_complete_sequence : t list -> total_size:int64 -> bool
45
46(** Get missing ranges from a list of chunks *)
47val missing_ranges : t list -> total_size:int64 -> Range.t list
48
49(** Sort chunks by range start position *)
50val sort_by_range : t list -> t list
51
52(** Pretty printer *)
53val pp : Format.formatter -> t -> unit