Module Gc.Make

Make returns a module that can manage GC processes.

Parameters

module Args : Gc_args.S

Signature

module Args = Args
type t

A running GC process.

val init_and_start : root:string -> lower_root:string option -> output:[ `External of string | `Root ] -> generation:int -> unlink:bool -> dispatcher:Args.Dispatcher.t -> file_manager:Args.File_Manager.t -> contents:Import.read Args.Contents_store.t -> node:Import.read Args.Node_store.t -> commit:Import.read Args.Commit_store.t -> Args.key -> (t, [> `Gc_disallowed of string ]) Stdlib.result

Creates and starts a new GC process.

val finalise : wait:bool -> t -> ([> `Running | `Finalised of Stats.Latest_gc.stats ], Io_errors.t) Stdlib.result

finalise ~wait t returns the state of the GC process.

If wait = true, the call will block until GC finishes.

val on_finalise : t -> ((Stats.Latest_gc.stats, Io_errors.t) Stdlib.result -> unit) -> unit

Attaches a callback to the GC process, which will be called when the GC finalises.

val cancel : t -> bool

Waits for the current gc to finish and returns immediately without swapping the files and doing the other finalisation steps from finalise. Returns the gced status to create a fresh control file for the snapshot.