Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2008-10-08 16:08:54 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2008-10-08 16:08:54 (GMT)
commitb1c4a254adc0573221c0d6661459248fd3c507ef (patch)
tree53557c11b9634bba9b8e0768e13c4073ac8c3e7f
parent4b2ce176666ee03f44944766235d7d4e9d2a80cd (diff)
Add some copyright notices and docstrings
-rw-r--r--README.txt44
-rw-r--r--src/olpc/datastore/datastore.py30
-rw-r--r--src/olpc/datastore/filestore.py17
-rw-r--r--src/olpc/datastore/indexstore.py18
-rw-r--r--src/olpc/datastore/layoutmanager.py18
-rw-r--r--src/olpc/datastore/migration.py19
-rw-r--r--src/olpc/datastore/optimizer.py17
7 files changed, 105 insertions, 58 deletions
diff --git a/README.txt b/README.txt
index d2901d8..8b13789 100644
--- a/README.txt
+++ b/README.txt
@@ -1,45 +1 @@
-Datastore
----------
-A simple log like datastore able to connect with multiple
-backends. The datastore supports connectionig and disconnecting from
-backends on the fly to help the support the limit space/memory
-characteristics of the OLPC system and the fact that network services
-may become unavailable at times
-
-API
----
-
-For developer information see the doc tests in:
-
- src/olpc/datastore/tests/query.txt
-
-
-Dependencies
-------------
-
-xapian -- integrated full text indexing
- svn co svn://svn.xapian.org/xapian/trunk xapian
- currently this requires a checkout
-
-secore -- pythonic xapian binding -- include in disto but from
- http://flaxcode.googlecode.com/svn/trunk/libs/secore
-
-dbus -- command and control
-
-ore.main -- (optional) A command line application framework/shell
- used in bin/datasore. If you don't want to use this dep
- for now run bin/datasore-native
-
-
-
-Converters
-----------
-(used to index binaries)
-
-pdftotext from poppler-utils
-abiword/write
-
-
-Benjamin Saller
-Copyright ObjectRealms, LLC. 2007
diff --git a/src/olpc/datastore/datastore.py b/src/olpc/datastore/datastore.py
index a7a86d8..8186960 100644
--- a/src/olpc/datastore/datastore.py
+++ b/src/olpc/datastore/datastore.py
@@ -1,14 +1,19 @@
-"""
-olpc.datastore.datastore
-~~~~~~~~~~~~~~~~~~~~~~~~
-the datastore facade
-
-"""
-
-__author__ = 'Benjamin Saller <bcsaller@objectrealms.net>'
-__docformat__ = 'restructuredtext'
-__copyright__ = 'Copyright ObjectRealms, LLC, 2007'
-__license__ = 'The GNU Public License V2+'
+# Copyright (C) 2008, One Laptop Per Child
+# Based on code Copyright (C) 2007, ObjectRealms, LLC
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import logging
import uuid
@@ -36,7 +41,8 @@ DS_OBJECT_PATH = "/org/laptop/sugar/DataStore"
logger = logging.getLogger(DS_LOG_CHANNEL)
class DataStore(dbus.service.Object):
-
+ """D-Bus API and logic for connecting all the other components.
+ """
def __init__(self, **options):
bus_name = dbus.service.BusName(DS_SERVICE,
bus=dbus.SessionBus(),
diff --git a/src/olpc/datastore/filestore.py b/src/olpc/datastore/filestore.py
index c521380..9662885 100644
--- a/src/olpc/datastore/filestore.py
+++ b/src/olpc/datastore/filestore.py
@@ -1,3 +1,19 @@
+# Copyright (C) 2008, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
import os
import errno
import logging
@@ -8,7 +24,6 @@ from olpc.datastore import layoutmanager
class FileStore(object):
"""Handle the storage of one file per entry.
-
"""
# TODO: add protection against store and retrieve operations on entries
# that are being processed async.
diff --git a/src/olpc/datastore/indexstore.py b/src/olpc/datastore/indexstore.py
index 66181ce..ec97b4a 100644
--- a/src/olpc/datastore/indexstore.py
+++ b/src/olpc/datastore/indexstore.py
@@ -1,3 +1,19 @@
+# Copyright (C) 2008, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
import logging
import time
import os
@@ -31,6 +47,8 @@ _PROPERTIES_NOT_TO_INDEX = ['timestamp', 'activity_id', 'keep', 'preview']
_MAX_RESULTS = int(2 ** 31 - 1)
class IndexStore(object):
+ """Index metadata and provide rich query facilities on it.
+ """
def __init__(self):
self._database = None
self._flush_timeout = None
diff --git a/src/olpc/datastore/layoutmanager.py b/src/olpc/datastore/layoutmanager.py
index 36c5811..2b3e521 100644
--- a/src/olpc/datastore/layoutmanager.py
+++ b/src/olpc/datastore/layoutmanager.py
@@ -1,8 +1,26 @@
+# Copyright (C) 2008, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
import os
MAX_QUERY_LIMIT = 40960
class LayoutManager(object):
+ """Provide the logic about how entries are stored inside the datastore directory
+ """
def __init__(self):
profile = os.environ.get('SUGAR_PROFILE', 'default')
base_dir = os.path.join(os.path.expanduser('~'), '.sugar', profile)
diff --git a/src/olpc/datastore/migration.py b/src/olpc/datastore/migration.py
index da3873e..7b47d6f 100644
--- a/src/olpc/datastore/migration.py
+++ b/src/olpc/datastore/migration.py
@@ -1,3 +1,22 @@
+# Copyright (C) 2008, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+"""Transform one DataStore directory in a newer format.
+"""
+
import os
import logging
import shutil
diff --git a/src/olpc/datastore/optimizer.py b/src/olpc/datastore/optimizer.py
index 78e47c2..ed62e55 100644
--- a/src/olpc/datastore/optimizer.py
+++ b/src/olpc/datastore/optimizer.py
@@ -1,3 +1,19 @@
+# Copyright (C) 2008, One Laptop Per Child
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
import os
import errno
import logging
@@ -8,7 +24,6 @@ from olpc.datastore import layoutmanager
class Optimizer(object):
"""Optimizes disk space usage by detecting duplicates and sharing storage.
-
"""
def __init__(self, file_store, metadata_store):
self._file_store = file_store