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