Browse Source

Renamed dedupestore to darc

Jonas Borgström 14 years ago
parent
commit
8cdca7aed4
13 changed files with 41 additions and 34 deletions
  1. 0 0
      darc/__init__.py
  2. 0 0
      darc/_speedups.c
  3. 0 0
      darc/archive.py
  4. 2 2
      darc/archiver.py
  5. 1 1
      darc/cache.py
  6. 0 0
      darc/chunkifier.py
  7. 1 1
      darc/crypto.py
  8. 0 0
      darc/helpers.py
  9. 0 0
      darc/oaep.py
  10. 4 4
      darc/store.py
  11. 14 14
      darc/test.py
  12. 14 8
      doc/design.txt
  13. 5 4
      setup.py

+ 0 - 0
dedupestore/__init__.py → darc/__init__.py


+ 0 - 0
dedupestore/_speedups.c → darc/_speedups.c


+ 0 - 0
dedupestore/archive.py → darc/archive.py


+ 2 - 2
dedupestore/archiver.py → darc/archiver.py

@@ -97,8 +97,8 @@ class Archiver(object):
 
     def run(self, args=None):
         default_keychain = os.path.join(os.path.expanduser('~'),
-                                        '.dedupestore', 'keychain')
-        parser = argparse.ArgumentParser(description='Dedupestore')
+                                        '.darc', 'keychain')
+        parser = argparse.ArgumentParser(description='DARC - Deduplicating Archiver')
         parser.add_argument('-k', '--keychain', dest='keychain', type=str,
                             default=default_keychain,
                             help='Keychain to use')

+ 1 - 1
dedupestore/cache.py → darc/cache.py

@@ -13,7 +13,7 @@ class Cache(object):
     def __init__(self, store, crypto):
         self.store = store
         self.crypto = crypto
-        self.path = os.path.join(os.path.expanduser('~'), '.dedupestore', 'cache',
+        self.path = os.path.join(os.path.expanduser('~'), '.darc', 'cache',
                                  '%s.cache' % self.store.id.encode('hex'))
         self.tid = -1
         self.open()

+ 0 - 0
dedupestore/chunkifier.py → darc/chunkifier.py


+ 1 - 1
dedupestore/crypto.py → darc/crypto.py

@@ -17,7 +17,7 @@ from .oaep import OAEP
 
 
 class KeyChain(object):
-    FILE_ID = 'DDS KEYCHAIN'
+    FILE_ID = 'DARC KEYCHAIN'
 
     def __init__(self, path=None):
         self.aes_id = self.rsa_read = self.rsa_create = None

+ 0 - 0
dedupestore/helpers.py → darc/helpers.py


+ 0 - 0
dedupestore/oaep.py → darc/oaep.py


+ 4 - 4
dedupestore/store.py → darc/store.py

@@ -40,10 +40,10 @@ class Store(object):
 
     def open(self, path):
         if not os.path.isdir(path):
-            raise Exception('%s Does not look like a store' % path)
-        db_path = os.path.join(path, 'dedupestore.db')
+            raise Exception('%s Does not look like a darc store' % path)
+        db_path = os.path.join(path, 'darcstore.db')
         if not os.path.exists(db_path):
-            raise Exception('%s Does not look like a store2')
+            raise Exception('%s Does not look like a darc store')
         self.lock_fd = open(os.path.join(path, 'lock'), 'w')
         fcntl.flock(self.lock_fd, fcntl.LOCK_EX)
         self.path = path
@@ -80,7 +80,7 @@ class Store(object):
         if not os.path.exists(path):
             os.mkdir(path)
         os.mkdir(os.path.join(path, 'bands'))
-        cnx = sqlite3.connect(os.path.join(path, 'dedupestore.db'))
+        cnx = sqlite3.connect(os.path.join(path, 'darcstore.db'))
         cnx.execute('CREATE TABLE objects(ns BINARY NOT NULL, id BINARY NOT NULL, '
                     'band NOT NULL, offset NOT NULL, size NOT NULL)')
         cnx.execute('CREATE UNIQUE INDEX objects_pk ON objects(ns, id)')

+ 14 - 14
dedupestore/test.py → darc/test.py

@@ -15,47 +15,47 @@ class Test(unittest.TestCase):
         self.store_path = os.path.join(self.tmpdir, 'store')
         self.keychain = '/tmp/_test_dedupstore.keychain'
         if not os.path.exists(self.keychain):
-            self.dedupestore('keychain', 'generate')
-        self.dedupestore('init', self.store_path)
+            self.darc('keychain', 'generate')
+        self.darc('init', self.store_path)
 
     def tearDown(self):
         shutil.rmtree(self.tmpdir)
 
-    def dedupestore(self, *args, **kwargs):
+    def darc(self, *args, **kwargs):
         exit_code = kwargs.get('exit_code', 0)
         args = ['--keychain', self.keychain] + list(args)
         self.assertEqual(exit_code, self.archiver.run(args))
 
     def create_src_archive(self, name):
         src_dir = os.path.join(os.getcwd(), os.path.dirname(__file__))
-        self.dedupestore('create', self.store_path + '::' + name, src_dir)
+        self.darc('create', self.store_path + '::' + name, src_dir)
 
     def test_basic_functionality(self):
         self.create_src_archive('test')
-        self.dedupestore('list', self.store_path)
-        self.dedupestore('list', self.store_path + '::test')
-        self.dedupestore('info', self.store_path + '::test')
-        self.dedupestore('verify', self.store_path + '::test')
+        self.darc('list', self.store_path)
+        self.darc('list', self.store_path + '::test')
+        self.darc('info', self.store_path + '::test')
+        self.darc('verify', self.store_path + '::test')
         dest_dir = os.path.join(self.tmpdir, 'dest')
-        self.dedupestore('extract', self.store_path + '::test', dest_dir)
-        self.dedupestore('delete', self.store_path + '::test')
+        self.darc('extract', self.store_path + '::test', dest_dir)
+        self.darc('delete', self.store_path + '::test')
 
     def test_corrupted_store(self):
         self.create_src_archive('test')
-        self.dedupestore('verify', self.store_path + '::test')
+        self.darc('verify', self.store_path + '::test')
         fd = open(os.path.join(self.tmpdir, 'store', 'bands', '0', '0'), 'r+')
         fd.seek(1000)
         fd.write('X')
         fd.close()
-        self.dedupestore('verify', self.store_path + '::test', exit_code=1)
+        self.darc('verify', self.store_path + '::test', exit_code=1)
 
     def test_symlinks(self):
         testdir = os.path.join(self.tmpdir, 'linktest')
         os.mkdir(testdir)
         os.symlink('/tmp/somewhere', os.path.join(testdir, 'link'))
-        self.dedupestore('create', self.store_path + '::symlinktest', testdir)
+        self.darc('create', self.store_path + '::symlinktest', testdir)
         dest_dir = os.path.join(self.tmpdir, 'dest')
-        self.dedupestore('extract', self.store_path + '::symlinktest', dest_dir)
+        self.darc('extract', self.store_path + '::symlinktest', dest_dir)
         dest = os.path.join(dest_dir, testdir[1:])
         self.assertEqual(os.path.islink(os.path.join(dest, 'link')), True)
         self.assertEqual(os.readlink(os.path.join(dest, 'link')), '/tmp/somewhere')

+ 14 - 8
doc/design.txt

@@ -1,15 +1,21 @@
-"""
-Dedupstore
-==========
+chunk_cache
+bandstore
+dedupestore => dds
+init command
+
 
 TODO
 ----
-* Symbolic links
-* Owner, group, mode
-* msgpack
-* Hard links
-
+* Remote stores
+* Stat and chunk cache
 
+DONE
+----
+* Encryption
+* Hard links
+* cache redesign
+* Symbolic links
+* Owner, group, mode, ctime, mtime
 
 cache = Cache(path,)
 

+ 5 - 4
setup.py

@@ -3,15 +3,16 @@
 
 from setuptools import setup, Extension
 
-setup(name='Dedupestore',
+setup(name='darc',
       version='0.1',
       author=u'Jonas Borgström',
       author_email='jonas@borgstrom.se',
-      packages=['dedupestore'],
-      ext_modules=[Extension('dedupestore._speedups', ['dedupestore/_speedups.c'])],
+      packages=['darc'],
+      ext_modules=[Extension('darc._speedups', ['darc/_speedups.c'])],
+      install_requires=['pycrypto', 'msgpack-python', 'pbkdf2.py'],
       entry_points = {
         'console_scripts': [
-            'dedupestore = dedupestore.archiver:main',
+            'darc = darc.archiver:main',
         ]
     })