[elephant-devel] standard routine or idiom to clear BDB from within Lisp?

Ben midfield at gmail.com
Thu Jan 19 23:58:06 UTC 2006


i would recommend using whatever backend functions there are for
dropping btrees (or for SQL, tables, presumably.)  i seem to remember
adding a hook for such a thing for the BDB back end, it's somewhere in
the sleepycat code.  should be relatively trivial to access it from
within elephant.

B

On 1/18/06, Andrew Philpot <philpot at isi.edu> wrote:
>
> The following tends to hang.
>
> (defun clear-from-root (&key (store-path *dbpath*)
>                              (verbose t))
>   (let ((remcount 0)
>         (errcount 0))
>     (with-open-store (store-path)
>       (let ((btree (controller-root *store-controller*)))
>         (with-btree-cursor (cursor btree)
>           (loop (multiple-value-bind (more k v)
>                     (ignore-errors (cursor-next cursor))
>                   (declare (ignorable v))
>                   (if (typep k 'error)
>                       (progn
>                         (incf errcount)
>                         (when verbose
>                           (warn "Error was ~A" k)))
>                     (progn
>                       (unless more (return nil))
>                       (when verbose
>                         (format *debug-io* "~%Dropped ~S -> ~S" k v))
>                       (remove-kv k btree)
>                       (incf remcount))))))))
>     (values remcount
>             errcount)))
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
>



More information about the elephant-devel mailing list