r23320 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r23319‎ | r23320 | r23321 >
Date:13:45, 24 June 2007
Author:tstarling
Status:old
Tags:
Comment:
Some notes on architecture.
Modified paths:
  • /trunk/phase3/includes/filerepo/README (added) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/README
@@ -0,0 +1,41 @@
 2+Some quick notes on the file/repository architecture.
 3+
 4+Functionality is, as always, driven by data model.
 5+
 6+* The repository object stores configuration information about a file storage
 7+ method.
 8+
 9+* The file object is a process-local cache of information about a particular
 10+ file.
 11+
 12+Thus the file object is the primary public entry point for obtaining information
 13+about files, since access via the file object can be cached, whereas access via
 14+the repository should not be cached.
 15+
 16+Functions which can act on any file specified in their parameters typically find
 17+their place either in the repository object, where reference to
 18+repository-specific configuration is needed, or in static members of File or
 19+FileRepo, where no such configuration is needed.
 20+
 21+File objects are generated by a factory function from the repository. The
 22+repository thus has full control over the behaviour of its subsidiary file
 23+class, since it can subclass the file class and override functionality at its
 24+whim. Thus there is no need for the File subclass to query its parent repository
 25+for information about repository-class-dependent behaviour -- the file subclass
 26+is generally fully aware of the static preferences of its repository. Limited
 27+exceptions can be made to this rule to permit sharing of functions, or perhaps
 28+even entire classes, between repositories.
 29+
 30+These rules alone still do lead to some ambiguity -- it may not be clear whether
 31+to implement some functionality in a repository function with a filename
 32+parameter, or in the file object itself.
 33+
 34+So we introduce the following rule: the file subclass is smarter than the
 35+repository subclass. The repository should in general provide a minimal API
 36+needed to access the storage backend efficiently.
 37+
 38+In particular, note that I have not implemented any database access in
 39+LocalRepo.php. LocalRepo provides only file access, and LocalFile provides
 40+database access and higher-level functions such as cache management.
 41+
 42+Tim Starling, June 2007

Follow-up revisions

RevisionCommit summaryAuthorDate
r23407Merged revisions 23203-23405 via svnmerge from...david23:00, 25 June 2007

Status & tagging log