From 5550a70a322c2c241d6984156182a385c37743ac Mon Sep 17 00:00:00 2001 From: Francois BERENGER Date: Mon, 11 Jun 2018 15:17:55 +0900 Subject: [PATCH] added destroy function --- dbm.ml | 4 ++++ dbm.mli | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/dbm.ml b/dbm.ml index 197f8a1..a2855b1 100644 --- a/dbm.ml +++ b/dbm.ml @@ -56,3 +56,7 @@ let iter f t = walk (try Some(nextkey t) with Not_found -> None) in walk (try Some(firstkey t) with Not_found -> None) + +let destroy fn = + Sys.remove (fn ^ ".dir"); + Sys.remove (fn ^ ".pag") diff --git a/dbm.mli b/dbm.mli index ab30f11..6ab88e9 100644 --- a/dbm.mli +++ b/dbm.mli @@ -43,6 +43,10 @@ val opendbm : string -> open_flag list -> int -> t external close : t -> unit = "caml_dbm_close" (** Close the given descriptor. *) +val destroy: string -> unit +(** [destroy fn] removes the underlying dbm files + [fn ^ ".pag"] and [fn ^ ".dir"]. *) + external find : t -> string -> string = "caml_dbm_fetch" (** [find db key] returns the data associated with the given [key] in the database opened for the descriptor [db].