wiki.techinc.nl/includes/filerepo
2022-08-19 16:42:35 +00:00
..
file Improve docs of various ::getQueryInfo functions 2022-08-13 21:18:44 +02:00
Hook Remove some more comments that literally repeat the code 2021-12-09 19:01:36 +01:00
FileBackendDBRepoWrapper.php Add explicit null check for $sha in FileBackend [php8.1] 2022-07-26 11:11:57 -07:00
FileRepo.php Make use of ?? and ?: operators where it makes sense 2022-08-04 21:43:12 +02:00
ForeignAPIRepo.php filerepo: Allow shared caching of ForeignAPIRepo responses across wikis 2022-08-19 14:01:10 +02:00
ForeignDBRepo.php filerepo: Simplify and document 'favicon' FileRepo option 2022-01-26 19:27:35 +00:00
ForeignDBViaLBRepo.php filerepo: Clean up file and class doc comments 2022-04-07 02:28:33 +01:00
IForeignRepoWithMWApi.php filerepo: Clean up file and class doc comments 2022-04-07 02:28:33 +01:00
LocalRepo.php Merge "filerepo: Enable JSON meta-data serialization by default" 2022-04-11 06:50:06 +00:00
NullRepo.php filerepo: Clean up file and class doc comments 2022-04-07 02:28:33 +01:00
README.md docs: Remove ingroup tag from Markdown files 2019-11-12 16:11:30 -08:00
RepoGroup.php RepoGroup: Convert time option of findFile to TS_MW 2022-07-09 01:52:52 +02:00
TempFileRepo.php filerepo: Clean up file and class doc comments 2022-04-07 02:28:33 +01:00

FileRepo Architecture

Some quick notes on the file/repository architecture.

Functionality is, as always, driven by data model.

  • The repository object stores configuration information about a file storage method.

  • The file object is a process-local cache of information about a particular file.

Thus the file object is the primary public entry point for obtaining information about files, since access via the file object can be cached, whereas access via the repository should not be cached.

Functions which can act on any file specified in their parameters typically find their place either in the repository object, where reference to repository-specific configuration is needed, or in static members of File or FileRepo, where no such configuration is needed.

File objects are generated by a factory function from the repository. The repository thus has full control over the behavior of its subsidiary file class, since it can subclass the file class and override functionality at its whim. Thus there is no need for the File subclass to query its parent repository for information about repository-class-dependent behavior -- the file subclass is generally fully aware of the static preferences of its repository. Limited exceptions can be made to this rule to permit sharing of functions, or perhaps even entire classes, between repositories.

These rules alone still do lead to some ambiguity -- it may not be clear whether to implement some functionality in a repository function with a filename parameter, or in the file object itself.

So we introduce the following rule: the file subclass is smarter than the repository subclass. The repository should in general provide a minimal API needed to access the storage backend efficiently.

In particular, note that I have not implemented any database access in LocalRepo.php. LocalRepo provides only file access, and LocalFile provides database access and higher-level functions such as cache management.

Tim Starling, June 2007