My agentic slop goes here. Not intended for anyone else!
1(** Cache entry flags management
2
3 This module provides a type-safe interface for managing cache entry flags.
4 Flags control entry behavior such as pinning (preventing eviction),
5 marking entries as stale (needing revalidation), or temporary.
6
7 Flags are encoded in the filesystem using Maildir++-style conventions,
8 making them persistent across program restarts and visible to external tools. *)
9
10(** Abstract type representing a set of flags *)
11type t
12
13(** Individual flag types *)
14type flag = [
15 | `Pinned (** Entry is pinned and won't be automatically evicted during cleanup *)
16 | `Stale (** Entry needs revalidation before use *)
17 | `Temporary (** Entry is temporary and will be removed on cache clear *)
18 | `Chunk (** Entry is a partial chunk of a larger file (used for resume support) *)
19]
20
21(** {1 Construction} *)
22
23(** Empty set of flags *)
24val empty : t
25
26(** Create a flag set from a list *)
27val of_list : flag list -> t
28
29(** Convert a flag set to a list *)
30val to_list : t -> flag list
31
32(** Create a flag set with a single flag *)
33val singleton : flag -> t
34
35(** {1 Operations} *)
36
37(** Add a flag to the set *)
38val add : flag -> t -> t
39
40(** Remove a flag from the set *)
41val remove : flag -> t -> t
42
43(** Check if a flag is present *)
44val mem : flag -> t -> bool
45
46(** Union of two flag sets *)
47val union : t -> t -> t
48
49(** Intersection of two flag sets *)
50val inter : t -> t -> t
51
52(** Difference of two flag sets *)
53val diff : t -> t -> t
54
55(** Check if flag set is empty *)
56val is_empty : t -> bool
57
58(** {1 Predicates} *)
59
60(** Check if pinned flag is set *)
61val is_pinned : t -> bool
62
63(** Check if stale flag is set *)
64val is_stale : t -> bool
65
66(** Check if temporary flag is set *)
67val is_temporary : t -> bool
68
69(** Check if chunk flag is set *)
70val is_chunk : t -> bool
71
72(** Check if this represents a complete file (not a chunk) *)
73val is_complete : t -> bool
74
75(** {1 Encoding} *)
76
77(** Convert flags to a string representation (for filenames) *)
78val to_string : t -> string
79
80(** Parse flags from a string representation *)
81val of_string : string -> t
82
83(** {1 Comparison} *)
84
85(** Equality of flag sets *)
86val equal : t -> t -> bool
87
88(** Comparison for ordering *)
89val compare : t -> t -> int
90
91(** {1 Pretty Printing} *)
92
93(** Pretty printer for a single flag *)
94val pp_flag : Format.formatter -> flag -> unit
95
96(** Pretty printer for flag sets *)
97val pp : Format.formatter -> t -> unit
98
99(** {1 JSON Support} *)
100
101(** Jsont codec for flags *)
102val jsont : t Jsont.t