Document the db submodule a bit
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 30 Jun 2011 21:26:02 +0000 (23:26 +0200)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Thu, 30 Jun 2011 21:27:52 +0000 (23:27 +0200)
Document the ideas behind the db submodule.
And document what that actually means.

mediagoblin/db/__init__.py

index c129cbf867f69dae978186056728b4a8c123a7df..f0116083f7ce818d58268e67acb92d8ec875d1d6 100644 (file)
 #
 # You should have received a copy of the GNU Affero General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+"""
+Database Abstraction/Wrapper Layer
+==================================
+
+This submodule is for most of the db specific stuff.
+
+There are two main ideas here:
+
+1. Open up a small possibility to replace mongo by another
+   db.  This means, that all direct mongo accesses should
+   happen in the db submodule.  While all the rest uses an
+   API defined by this submodule.
+
+   Currently this API happens to be basicly mongo.
+   Which means, that the abstraction/wrapper layer is
+   extremely thin.
+
+2. Give the rest of the app a simple and easy way to get most of
+   their db needs. Which often means some simple import
+   from db.util.
+
+What does that mean?
+
+* Never import mongo directly outside of this submodule.
+
+* Inside this submodule you can do whatever is needed. The
+  API border is exactly at the submodule layer. Nowhere
+  else.
+
+* helper functions can be moved in here. They become part
+  of the db.* API
+
+"""