@@ -152,15 +152,10 @@ module type RO = sig
152152 The result is [Error (`Dictionary_expected k)] if [k] refers to a
153153 value in [t]. *)
154154
155- val last_modified : t -> key -> (int * int64 , error ) result Lwt .t
155+ val last_modified : t -> key -> (Ptime .t , error ) result Lwt .t
156156 (* * [last_modified t k] is the last time the value bound to [k] in
157157 [t] has been modified.
158158
159- The modification time [(d, ps)] is a span for the signed POSIX
160- picosecond span [d] * 86_400e12 + [ps]. [d] is a signed number of
161- POSIX days and [ps] a number of picoseconds in the range
162- \[[0];[86_399_999_999_999_999L]\].
163-
164159 When the value bound to [k] is a dictionary, the modification
165160 time is the latest modification of all entries in that
166161 dictionary. This behaviour is only one level deep and not recursive. *)
@@ -182,6 +177,7 @@ type write_error = [
182177 | error
183178 | `No_space (* * No space left on the device. *)
184179 | `Rename_source_prefix of key * key (* * The source is a prefix of destination in rename. *)
180+ | `Already_present of key (* * The key is already present. *)
185181]
186182
187183val pp_write_error : write_error Fmt .t
@@ -203,6 +199,15 @@ module type RW = sig
203199 val pp_write_error : write_error Fmt .t
204200 (* * The pretty-printer for [pp_write_error]. *)
205201
202+ val allocate : t -> key -> ?last_modified : Ptime .t -> Optint.Int63 .t ->
203+ (unit , write_error ) result Lwt .t
204+ (* * [allocate t key ~last_modified size] allocates space for [key] in [t] with
205+ the provided [size] and [last_modified]. This is useful for e.g.
206+ append-only backends that could still use {!set_partial}. The data will
207+ be filled with 0. If [key] already exists, [Error (`Already_present key)]
208+ is returned. If there's not enough space, [Error `No_space] is returned.
209+ *)
210+
206211 val set : t -> key -> string -> (unit , write_error ) result Lwt .t
207212 (* * [set t k v] replaces the binding [k -> v] in [t].
208213
0 commit comments