Megatest

Check-in [e1254f35a8]
Login
Overview
Comment:yada
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | normalize-db
Files: files | file ages | folders
SHA1: e1254f35a8d5ebd9d71431909d13429bdcc6737b
User & Date: matt on 2013-10-31 02:06:54
Other Links: branch diff | manifest | tags
Context
2013-11-24
18:17
Merged in string db branch check-in: 3eb9a93e77 user: matt tags: inmem-per-run-db
2013-10-31
02:06
yada Closed-Leaf check-in: e1254f35a8 user: matt tags: normalize-db
2013-10-30
00:03
Switched paths to filedb check-in: 37693582eb user: matt tags: normalize-db
Changes

Modified filedb.scm from [a67747bbf8] to [91e90bcdc7].

38
39
40
41
42
43
44



45
46
47
48
49
50
51
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54







+
+
+







                                                   mode      INTEGER DEFAULT -1,
                                                   uid       INTEGER DEFAULT -1,
                                                   gid       INTEGER DEFAULT -1,
                                                   size      INTEGER DEFAULT -1,
                                                   mtime     INTEGER DEFAULT -1);")
	  (sqlite3:execute db "CREATE INDEX path_index ON paths (path,parent_id);")
	  (sqlite3:execute db "CREATE TABLE bases (id INTEGER PRIMARY KEY,base TEXT,                  updated TIMESTAMP);")))
    ;; close the sqlite3 db and open it as needed
    (filedb:finalize-db! fdb)
    (filedb:fdb-set-db! fdb #f)
    fdb))

(define (filedb:reopen-db fdb)
  (let ((db (sqlite3:open-database (filedb:fdb-get-dbpath fdb))))
    (filedb:fdb-set-db! fdb db)
    (sqlite3:set-busy-handler!  db (make-busy-timeout 136000))))
  
111
112
113
114
115
116
117

118
119
120
121
122
123
124
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128







+







    (sqlite3:finalize! stmt)))

(define (filedb:register-path fdb path #!key (save-stat #f))
  (let* ((db        (filedb:fdb-get-db        fdb))
	 (pathcache (filedb:fdb-get-pathcache fdb))
	 (stat      (if save-stat (file-stat path #t)))
	 (id        (hash-table-ref/default pathcache path #f)))
    (if (not db)(filedb:reopen-db fdb))
    (if id id 
        (let ((plist (string-split path "/")))
          (let loop ((head (car plist))
                     (tail (cdr plist))
                     (parent 0))
            (let ((id (filedb:get-path-id db head parent))
                  (done (null? tail)))
217
218
219
220
221
222
223

224
225
226
227
228
229
230
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235







+







     parent-id search-patt)
    res))

(define (filedb:get-path fdb id)
  (let* ((db      (filedb:fdb-get-db      fdb))
	 (idcache (filedb:fdb-get-idcache fdb))
	 (path    (hash-table-ref/default idcache id #f)))
    (if (not db)(filedb:reopen-db fdb))
    (if path path
        (let loop ((curr-id id)
                   (path    ""))
          (let ((path-record (filedb:get-path-record fdb curr-id)))
            (if (not path-record) #f ;; this id has no path
                (let* ((parent-id (list-ref path-record 1))
                       (pname     (list-ref path-record 0))