Commit | Line | Data |
---|---|---|
1815f5ce | 1 | # GNU MediaGoblin -- federated, autonomous media hosting |
cf29e8a8 | 2 | # Copyright (C) 2011, 2012 MediaGoblin contributors. See AUTHORS. |
1815f5ce CAW |
3 | # |
4 | # This program is free software: you can redistribute it and/or modify | |
5 | # it under the terms of the GNU Affero General Public License as published by | |
6 | # the Free Software Foundation, either version 3 of the License, or | |
7 | # (at your option) any later version. | |
8 | # | |
9 | # This program is distributed in the hope that it will be useful, | |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU Affero General Public License for more details. | |
13 | # | |
14 | # You should have received a copy of the GNU Affero General Public License | |
15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
3f9d9340 E |
16 | |
17 | """ | |
18 | Database Abstraction/Wrapper Layer | |
19 | ================================== | |
20 | ||
21 | This submodule is for most of the db specific stuff. | |
22 | ||
23 | There are two main ideas here: | |
24 | ||
25 | 1. Open up a small possibility to replace mongo by another | |
26 | db. This means, that all direct mongo accesses should | |
27 | happen in the db submodule. While all the rest uses an | |
28 | API defined by this submodule. | |
29 | ||
30 | Currently this API happens to be basicly mongo. | |
31 | Which means, that the abstraction/wrapper layer is | |
32 | extremely thin. | |
33 | ||
34 | 2. Give the rest of the app a simple and easy way to get most of | |
35 | their db needs. Which often means some simple import | |
36 | from db.util. | |
37 | ||
38 | What does that mean? | |
39 | ||
40 | * Never import mongo directly outside of this submodule. | |
41 | ||
42 | * Inside this submodule you can do whatever is needed. The | |
43 | API border is exactly at the submodule layer. Nowhere | |
44 | else. | |
45 | ||
46 | * helper functions can be moved in here. They become part | |
47 | of the db.* API | |
48 | ||
49 | """ |