chiark / gitweb /
test-load targets: Use strip to sanitise whitespace in OTHER_DIRS so that the subst...
[chiark-tcl.git] / cdb / cdb.tct
index 05d818be1b803c18d2245edccd780976f1200aa0..889e72aab507769c87334a5cf2aea7ddd8b23906 100644 (file)
@@ -1,10 +1,25 @@
+# cdb, cdb-wr - Tcl bindings for tinycdb and a journalling write extension
+# Copyright 2006-2012 Ian Jackson
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this library; if not, see <http://www.gnu.org/licenses/>.
+
+
 Table *cdbtoplevel TopLevel_Command
        cdb
-               subcmd  enum(Cdb/_SubCommand, "cdb subcommand")
-               ...     obj
+               dispatch(Cdb/_SubCommand, "cdb subcommand")
        cdb-wr
-               subcmd  enum(Cdbwr/_SubCommand, "cdb-wr subcommand")
-               ...     obj
+               dispatch(Cdbwr/_SubCommand, "cdb-wr subcommand")
 
 Table cdb Cdb_SubCommand
        open
@@ -13,11 +28,13 @@ Table cdb Cdb_SubCommand
        lookup
                db      iddata(&cdbtcl_databases)
                key     obj
+               ?def    obj
                =>      obj
        lookup-hb
                db      iddata(&cdbtcl_databases)
                key     hb
-               =>      hb
+               ?def    obj
+               =>      obj
        close
                db      iddata(&cdbtcl_databases)
 
@@ -28,7 +45,7 @@ Table cdbwr Cdbwr_SubCommand
                #       <pathb>.main
                #       <pathb>.lock
                #       <pathb>.cdb
-               #       <pathb>.log
+               #       <pathb>.jrn
                #       <pathb>.tmp (might be new .main or new .cdb)
                # invariants:
                #       .lock is an empty file
@@ -38,40 +55,45 @@ Table cdbwr Cdbwr_SubCommand
                #       .cdb is a cdb database containing data
                #         equivalent to and at least as recent as .main
                #         (maybe not identical, because .cdb may
-               #         have been updated with data from .log but
-               #         .main not yet); if .log does not exist then
+               #         have been updated with data from .jrn but
+               #         .main not yet); if .jrn does not exist then
                #         they are identical)
                #       .cdb may not exist; in which case it is to
                #         be treated as if it existed and was empty
                #         but this is maximally early (so main must
                #         exist and be empty since .main is never
                #         newer than .cdb)
-               #       if .log exists, it is a cdb native
+               #       if .jrn exists, it is a cdb native
                #         text file _without the trailing newline_;
                #         its contents override values from .main or .cdb
                #       if .main.tmp or .cdb.tmp exists it is irrelevant
-               # zero length values mean record is deleted (in .log only;
+               # zero length values mean record is deleted (in .jrn only;
                #  forbidden elsewhere)
                # while db is open:
                #       .lock is locked
-               #       .log and open hash table contain same info
+               #       .jrn and open hash table contain same info
        open 0
                pathb   string
                on_info obj
-               ?maxage int
-               #        >0 means entries start with a 16-hex-digit
-               #         time_t and a single space
-               #         this time_t _is_ part of the value as seen !
+               ?on_lexminval obj
+               # on_lexminval present and not empty list: provides a
+               #  script which returns the current lexminval.  In
+               #  this case, occasionally,
+               #  on_lexminval will be called and then entries whose
+               #  value is lexically strictly less than lexminval
+               #  will be deleted automatically.  The comparison
+               #  is bytewise on the UTF-8 representations.
                =>      iddata(&cdbtcl_rwdatabases)
        open-okjunk RWSCF_OKJUNK
                pathb   string
                on_info obj
-               ?maxage int
+               ?on_lexminval obj
                =>      iddata(&cdbtcl_rwdatabases)
                # on_info <event> <xinfo>...:
                # on_info open-clean <statistics-info-string>
                # on_info open-dirty-start <statistics-info-string>
-               # on_info open-dirty-junk <problem-info-string>
+               # on_info open-dirty-junk <problem-info-string> \
+               #               <problem-error-code-list>
                # on_info open-dirty-done <statistics-info-string>
                # on_info compact-start <statistics-info-string>
                # on_info compact-done <statistics-info-string>
@@ -84,8 +106,8 @@ Table cdbwr Cdbwr_SubCommand
        lookup-hb 0
                db      iddata(&cdbtcl_rwdatabases)
                key     string
-               ?def    hb
-               =>      hb
+               ?def    obj
+               =>      obj
        delete 0
                db      iddata(&cdbtcl_rwdatabases)
                key     string
@@ -101,7 +123,8 @@ Table cdbwr Cdbwr_SubCommand
                db      iddata(&cdbtcl_rwdatabases)
        compact-check 0
                db      iddata(&cdbtcl_rwdatabases)
-       compact-onupdate 0 # this is the default
+       compact-auto 0
+               # this is the default
                db      iddata(&cdbtcl_rwdatabases)
        compact-explicit 0
                db      iddata(&cdbtcl_rwdatabases)