Contains the swDB class which is responsible for the indexes
There is one global instance $db that handles the indexes.
It does not handle writing of new records. This is done in inc/record.php.
It observes changes and updates indexes based on need.
Note that to look up a record by URL, the indexes are not used.
The hashes of the filenames in the current folder are the index for that.
General architecture
Document oriented database inspired from couchdb but using semantic metawiki syntax
The database has no tables and no predefined fields.
Fields are declared inline using the semantic mediawiki syntax [[fieldname::value]].
Fieldnames cannot start with an underscore.
Multiple occurences of the same field are allowed.
The records are self-contained.
The records are stored as revisioned files adding a header with the reserved fields.
_id automatically generated integer
_revision automatically generated integer
_name the wiki name, can change over time
_timestamp sever time
_status ok, request, protected, deleted
The filename is the revision.tx. The written files are never changed afterwards.
Every change creates a new revision,.
On insertion of a new revision, the database writes some indexes.
These indexes are for performance only, they can be rebuild whenever needed from scratch.
Note: PHP needs write access to the site folders and subfolders.
Holds the database indexes Returns the number of the last revision. Returns current revision for a name Returns most recent revision for a name Returns all revisions for a name to build a history Returns the file path for a revision echotime, swDbaExists, swDbaFetch, swDbaFirstKey, swDbaNextKey, swDbaOpen, swDbaReplace, swDbaSync, swIndexBloom, swInitRamdisk, swNameURL $db, $rebuildstarttime, $swAllRevisionsCache, $swCurrentRevisionCache, $swCurrentRevsisionCache, $swError, $swLastRevisionCache, $swOvertime, $swRamdiskPath, $swRoot Short variables: $c, $dir, $dur, $f, $i, $key, $m2, $r, $rev, $s, $url array, error, file, math, php, string, time, variableswDB extends swPersistance
$indexedbitmap revisions that have been indexed in urldb
$currentbitmap revisions that are the last version and have the status ok or protected (these are the only filters should check)
$deletedbitmap revisions with status deleted
$protectedbitmap revisions with status protected
$bloombitmap revisions with have been indexed by the bloom filter
$urldb database of url names and revision
All these objects are persistent in site/indexes/.
The bitmaps are serialized objects.
The urldb is a sqlite3 db.Methods
Properties
Functions
Made a global function to replace global $db declaration in code blocks.swGetCurrentRevisionFromName($name)
@param nameswGetLastRevisionFromName($name)
@param nameswGetAllRevisionsFromName($name)
@param nameswGetPath($revision,$current=false)
@param revision
@param currentUsed elements
Classes
Functions
Globals
Variables
$bitmaperror, $current, $error, $fields, $file, $firststatus, $force, $lastindex, $lastwrite, $line, $maxf, $name, $nowtime, $oldrev, $oldstatus, $path, $revision, $revs, $source, $status, $swIndexError, $swMemoryLimit, $urldbpathFeatures