+2002-10-19 Jean-Claude Wippler <jcw@equi4.com>
+
+ * library/pkgIndex.tcl:
+ * library/mk4vfs.tcl: merged 1.6 changes, periodic commit/flush
+
2002-10-18 Jeff Hobbs <jeffh@ActiveState.com>
* Makefile.in: add tclIndex to install
* tclconfig/tcl.m4 (new):
* generic/vfs.c: changed BUILD_Vfs to BUILD_vfs
+2002-09-10 Jean-Claude Wippler <jcw@equi4.com>
+ * library/pkgIndex.tcl: adjusted for two new packages,
+ also fixed to use proper file name on unix (as shared lib)
+ * library/starkit.tcl: added, new impl of scripdoc.tcl
+ * library/vfslib.tcl: added back in, need by above
+
2002-07-18 Vince Darley <vincentdarley@sourceforge.net>
* generic/vfs.c: ensure all mount activity is with fully
normalized paths in which the last path element is not a link.
#
# $Id$
#
-# 1.3 jcw 05-04-2002 fixed append mode & close,
-# privatized memchan_handler
-# added zip, crc back in
-# 1.4 jcw 28-04-2002 reorged memchan and pkg dependencies
-# 1.5 jcw 22-06-2002 fixed recursive dir deletion
-
-package provide mk4vfs 1.5
+# 05apr02 jcw 1.3 fixed append mode & close,
+# privatized memchan_handler
+# added zip, crc back in
+# 28apr02 jcw 1.4 reorged memchan and pkg dependencies
+# 22jun02 jcw 1.5 fixed recursive dir deletion
+# 16oct02 jcw 1.6 fixed periodic commit once a change is made
+
+package provide mk4vfs 1.6
package require Mk4tcl
package require vfs
namespace eval mk4vfs {
variable compress 1 ;# HACK - needs to be part of "Super-Block"
variable flush 5000 ;# Auto-Commit frequency
- variable direct 0 ;# read through a memchan, or from Mk4tcl if zero
+ variable direct 0 ;# read through a memchan, or from Mk4tcl if zero
namespace eval v {
variable seq 0
+ variable mode ;# array key is db, value is mode (rw/ro/nc)
+ variable timer ;# array key is db, set to afterid, periodicCommit
array set cache {}
array set fcache {}
+
+ array set mode {exe ro}
}
namespace export mount umount
init $db
- set flush 1
+ set v::mode($db) rw
for {set idx 0} {$idx < [llength $args]} {incr idx} {
switch -- [lindex $args $idx] {
- -readonly -
- -nocommit {set flush 0}
+ -readonly { set v::mode($db) ro }
+ -nocommit { set v::mode($db) nc }
}
}
- if { $flush } {
- _commit $db
+ if {$v::mode($db) == "rw"} {
+ periodicCommit $db
}
return $db
}
- proc _commit {db} {
+ proc periodicCommit {db} {
variable flush
- after $flush [list mk4vfs::_commit $db]
+ set v::timer($db) [after $flush [list mk4vfs::periodicCommit $db]]
mk::file commit $db
}
}
proc _umount {db} {
- after cancel [list mk4vfs::_commit $db]
+ after cancel [list mk4vfs::periodicCommit $db]
+ array unset v::mode $db
+ array unset v::timer $db
array unset v::cache $db,*
array unset v::fcache $db.*
mk::file close $db
} else {
mk::set $cur size [mk::get $cur -size contents]
}
- # added 30-10-2000
- set db [lindex [split $cur .] 0]
- mk::file autocommit $db
+ # 16oct02 new logic to start a periodic commit timer if not yet running
+ setupCommits [lindex [split $cur .] 0]
+ }
+
+ proc setupCommits {db} {
+ if {$v::mode($db) ne "ro" && ![info exists v::timer($db)]} {
+ periodicCommit $db
+ mk::file autocommit $db
+ }
}
proc mkdir {db path} {
set cur [mk::row append $view name $ele parent $parent]
set parent [mk::cursor position cur]
}
+ setupCommits $db
}
proc getdir {db path {pat *}} {
# get rid of file entries to release the space in the datafile
mk::view size $sb(ino).files 0
}
+ setupCommits $db
return ""
}
}