wiki.techinc.nl/includes/filerepo
Tim Starling e5993ea2db In recordOldUpload, use source path when computing properties
During a file import, it's inefficient to upload the image to Swift and
then download it again to compute its properties. The arrangement
predates Swift -- it was efficient at the time. Instead, use the source
path which is always available.

Change-Id: I60dfb82f577479419ea663cd996738f1e90d5d3f
2021-06-29 18:29:43 +00:00
..
file In recordOldUpload, use source path when computing properties 2021-06-29 18:29:43 +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 FileRepo::findFile - support Authority 2021-05-26 19:01:12 -07:00
ForeignAPIRepo.php FileRepo: replace Title in method signatures 2021-04-16 11:01:48 +00:00
ForeignDBRepo.php Optionally split out parts of file metadata to BlobStore 2021-06-11 08:01:26 +10:00
ForeignDBViaLBRepo.php Replace uses of DB_MASTER with DB_PRIMARY 2021-04-29 09:24:31 -07:00
LocalRepo.php Manual and automatic image metadata reserialization 2021-06-26 22:50:17 +00:00
NullRepo.php
README.md
RepoGroup.php Manual and automatic image metadata reserialization 2021-06-26 22:50:17 +00:00
TempFileRepo.php

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