Check-in [222e571ce8]
Overview
Comment:Added SQLite indexes to tables for faster lookup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:222e571ce89a2e341f7695d0eeeb18cb2d234c24
User & Date: rkeene on 2014-09-18 17:49:14
Other Links: manifest | tags
Context
2014-10-12
02:54
Added start of writability check-in: 5c1bbda2c6 user: rkeene tags: trunk
2014-09-18
17:49
Added SQLite indexes to tables for faster lookup check-in: 222e571ce8 user: rkeene tags: trunk
17:48
Updated to only emit debugging output for debugging builds check-in: ddfec93915 user: rkeene tags: trunk
Changes

Modified appfsd.tcl from [fc1c954390] to [2fbc0cdff7].

   123    123   
   124    124   		if {![info exists ::appfs::db]} {
   125    125   			file mkdir $::appfs::cachedir
   126    126   
   127    127   			sqlite3 ::appfs::db [file join $::appfs::cachedir cache.db]
   128    128   		}
   129    129   
          130  +		# Create tables
   130    131   		_db eval {CREATE TABLE IF NOT EXISTS sites(hostname PRIMARY KEY, lastUpdate, ttl);}
   131    132   		_db eval {CREATE TABLE IF NOT EXISTS packages(hostname, sha1, package, version, os, cpuArch, isLatest, haveManifest);}
   132    133   		_db eval {CREATE TABLE IF NOT EXISTS files(package_sha1, type, time, source, size, perms, file_sha1, file_name, file_directory);}
          134  +
          135  +		# Create indexes
          136  +		_db eval {CREATE INDEX IF NOT EXISTS sites_index ON sites (hostname);}
          137  +		_db eval {CREATE INDEX IF NOT EXISTS packages_index ON packages (hostname, package, version, os, cpuArch);}
          138  +		_db eval {CREATE INDEX IF NOT EXISTS files_index ON files (package_sha1, file_name, file_directory);}
   133    139   	}
   134    140   
   135    141   	proc download {hostname hash {method sha1}} {
   136    142   		set url "http://$hostname/appfs/$method/$hash"
   137    143   		set file [_cachefile $url $hash]
   138    144   
   139    145   		if {![file exists $file]} {