wiki.techinc.nl/includes/filerepo
Umherirrender 226264adfa Use LocalFile::getHookRunner instead of LocalFile::hookRunner
Do not depend on File::__get()

Follow-Up: Iaa84edfe215e71d3d5fd814053d4b787652fa3b5
Change-Id: Ib344a2fa7681e176de863d99e8df13ec37eb143d
2021-10-18 17:50:05 +00:00
..
file Use LocalFile::getHookRunner instead of LocalFile::hookRunner 2021-10-18 17:50:05 +00:00
Hook Deprecate LocalFile::getHistory hook 2021-06-17 08:33:31 +02:00
FileBackendDBRepoWrapper.php Replace uses of DB_MASTER with DB_PRIMARY 2021-04-29 09:24:31 -07:00
FileRepo.php Using @return never documentation on always-throw-function 2021-09-07 17:29:03 +02:00
ForeignAPIRepo.php Using @return never documentation on always-throw-function 2021-09-07 17:29:03 +02:00
ForeignDBRepo.php Replace getMasterDB methods with getPrimaryDB 2021-07-14 16:21:04 -07:00
ForeignDBViaLBRepo.php Follow-up I68198bc3: Hard-deprecate getMasterDB() methods 2021-07-15 09:12:17 +01:00
LocalRepo.php Tag various new 'primary' methods as @since 1.37 2021-09-02 11:58:19 -07:00
NullRepo.php Set method visibility for various constructors 2019-12-03 20:17:30 +01:00
README.md docs: Remove ingroup tag from Markdown files 2019-11-12 16:11:30 -08:00
RepoGroup.php Remove deprecated RepoGroup methods 2021-09-17 00:23:59 +02:00
TempFileRepo.php Using @return never documentation on always-throw-function 2021-09-07 17:29:03 +02: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