[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/docs/tech/ -> files.diviner (source)

   1  @title File Storage Technical Documentation
   2  @group filestorage
   3  
   4  Phabricator file storage details.
   5  
   6  = Overview =
   7  
   8  Phabricator has a simple, general-purpose file storage system with configurable
   9  storage backends that allows you to choose where files are stored. For a user
  10  guide, see @{article:Configuring File Storage}.
  11  
  12  = Class Relationships =
  13  
  14  @{class:PhabricatorFile} holds file metadata (name, author, phid), including an
  15  identifier for a @{class:PhabricatorFileStorageEngine} where the actual file
  16  data is stored, and a data handle which identifies the data within that storage
  17  engine.
  18  
  19  When writing data, a @{class:PhabricatorFileStorageEngineSelector} is
  20  instantiated (by default, @{class:PhabricatorDefaultFileStorageEngineSelector},
  21  but you can change this by setting the ##storage.engine-selector## key in your
  22  configuration). The selector returns a list of satisfactory
  23  @{class:PhabricatorFileStorageEngine}s, in order of preference.
  24  
  25  For instance, suppose the user is uploading a picture. The upload pipeline would
  26  instantiate the configured selector, which might return a
  27  @{class:PhabricatorMySQLFileStorageEngine} and a
  28  @{class:PhabricatorLocalDiskFileStorageEngine}, indicating that the picture may
  29  be stored in either storage engine but MySQL is preferred. If a given storage
  30  engine fails to perform the write, it will fall back to the next engine.
  31  
  32  = Adding New Storage Engines =
  33  
  34  To add a new storage engine, extend @{class:PhabricatorFileStorageEngine}. In
  35  order to make files actually get written to it, you also need to extend
  36  @{class:PhabricatorFileStorageEngineSelector}, provide an implementation which
  37  selects your storage engine for whatever files you want to store there, and then
  38  configure Phabricator to use your selector by setting
  39  `storage.engine-selector`.


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1