wiki.techinc.nl/includes/filerepo
Aaron Schulz 2c4ef137b4 * Renamed FileBackend functions internal to FileBackend/FileOp, making their usage clearer.
* Added convenience functions to FileBackendBase for basic file ops. Previously, doOperation() was the only convenience function...give it some friends :)
* More documentation comments.
2011-12-21 09:16:28 +00:00
..
backend * Renamed FileBackend functions internal to FileBackend/FileOp, making their usage clearer. 2011-12-21 09:16:28 +00:00
file FU r106770: fixed the other getTransform() call 2011-12-20 20:15:05 +00:00
FileRepo.php FU r106752: use "media-" instead of "images-" in container names. Long live books, video, 3D meshes, and animated holograms from the future! 2011-12-20 23:47:53 +00:00
FileRepoStatus.php
ForeignAPIRepo.php FU r106752: Fixed directory b/c for ForeignAPIRepo, which was moved to Setup.php 2011-12-20 07:53:48 +00:00
ForeignDBRepo.php
ForeignDBViaLBRepo.php Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
FSRepo.php FU r106752: use "media-" instead of "images-" in container names. Long live books, video, 3D meshes, and animated holograms from the future! 2011-12-20 23:47:53 +00:00
LocalRepo.php Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00
NullRepo.php Use database to track uploaded chunks and concatenate at the end. 2011-11-30 14:56:40 +00:00
README Removed swift subclass comments from r99546 (that is an extension and it will be done differently as well) 2011-12-08 19:02:36 +00:00
RepoGroup.php Merged FileBackend branch. Manually avoiding merging the many prop-only changes SVN likes to sprinkle in (easy to spot from the change list). Did not add SwiftFileBackend.php as it still is in development. 2011-12-20 03:52:06 +00:00

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 behaviour 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 behaviour -- 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

Structure:

File defines an abstract class File.
    ForeignAPIFile extends File.
    LocalFile extends File.
        ForeignDBFile extends LocalFile
        Image extends LocalFile
    UnregisteredLocalFile extends File.
        UploadStashFile extends UnregisteredLocalFile.
FileRepo defines an abstract class FileRepo.
    ForeignAPIRepo extends FileRepo
    FSRepo extends FileRepo
        LocalRepo extends FSRepo
            ForeignDBRepo extends LocalRepo
            ForeignDBViaLBRepo extends LocalRepo
    NullRepo extends FileRepo

Russ Nelson, March 2011