From 8cdca7aed4448fa8c4ff39e47b8deed930114106 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Borgstr=C3=B6m?= Date: Wed, 27 Oct 2010 20:12:40 +0200 Subject: [PATCH] Renamed dedupestore to darc --- {dedupestore => darc}/__init__.py | 0 {dedupestore => darc}/_speedups.c | 0 {dedupestore => darc}/archive.py | 0 {dedupestore => darc}/archiver.py | 4 ++-- {dedupestore => darc}/cache.py | 2 +- {dedupestore => darc}/chunkifier.py | 0 {dedupestore => darc}/crypto.py | 2 +- {dedupestore => darc}/helpers.py | 0 {dedupestore => darc}/oaep.py | 0 {dedupestore => darc}/store.py | 8 ++++---- {dedupestore => darc}/test.py | 28 ++++++++++++++-------------- doc/design.txt | 22 ++++++++++++++-------- setup.py | 9 +++++---- 13 files changed, 41 insertions(+), 34 deletions(-) rename {dedupestore => darc}/__init__.py (100%) rename {dedupestore => darc}/_speedups.c (100%) rename {dedupestore => darc}/archive.py (100%) rename {dedupestore => darc}/archiver.py (98%) rename {dedupestore => darc}/cache.py (97%) rename {dedupestore => darc}/chunkifier.py (100%) rename {dedupestore => darc}/crypto.py (99%) rename {dedupestore => darc}/helpers.py (100%) rename {dedupestore => darc}/oaep.py (100%) rename {dedupestore => darc}/store.py (97%) rename {dedupestore => darc}/test.py (67%) diff --git a/dedupestore/__init__.py b/darc/__init__.py similarity index 100% rename from dedupestore/__init__.py rename to darc/__init__.py diff --git a/dedupestore/_speedups.c b/darc/_speedups.c similarity index 100% rename from dedupestore/_speedups.c rename to darc/_speedups.c diff --git a/dedupestore/archive.py b/darc/archive.py similarity index 100% rename from dedupestore/archive.py rename to darc/archive.py diff --git a/dedupestore/archiver.py b/darc/archiver.py similarity index 98% rename from dedupestore/archiver.py rename to darc/archiver.py index f022e44ac..13eacb37a 100644 --- a/dedupestore/archiver.py +++ b/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') diff --git a/dedupestore/cache.py b/darc/cache.py similarity index 97% rename from dedupestore/cache.py rename to darc/cache.py index f67cc95fa..1a9c7afc0 100644 --- a/dedupestore/cache.py +++ b/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() diff --git a/dedupestore/chunkifier.py b/darc/chunkifier.py similarity index 100% rename from dedupestore/chunkifier.py rename to darc/chunkifier.py diff --git a/dedupestore/crypto.py b/darc/crypto.py similarity index 99% rename from dedupestore/crypto.py rename to darc/crypto.py index 8b5f9de11..bf418593f 100644 --- a/dedupestore/crypto.py +++ b/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 diff --git a/dedupestore/helpers.py b/darc/helpers.py similarity index 100% rename from dedupestore/helpers.py rename to darc/helpers.py diff --git a/dedupestore/oaep.py b/darc/oaep.py similarity index 100% rename from dedupestore/oaep.py rename to darc/oaep.py diff --git a/dedupestore/store.py b/darc/store.py similarity index 97% rename from dedupestore/store.py rename to darc/store.py index 8cec38626..c773485ef 100644 --- a/dedupestore/store.py +++ b/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)') diff --git a/dedupestore/test.py b/darc/test.py similarity index 67% rename from dedupestore/test.py rename to darc/test.py index a2e1f25bb..f69e7a0d2 100644 --- a/dedupestore/test.py +++ b/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') diff --git a/doc/design.txt b/doc/design.txt index 24c2bd0dc..97071bb50 100644 --- a/doc/design.txt +++ b/doc/design.txt @@ -1,15 +1,21 @@ -""" -Dedupstore -========== +chunk_cache +bandstore +dedupestore => dds +init command + TODO ---- -* Symbolic links -* Owner, group, mode -* msgpack +* Remote stores +* Stat and chunk cache + +DONE +---- +* Encryption * Hard links - - +* cache redesign +* Symbolic links +* Owner, group, mode, ctime, mtime cache = Cache(path,) diff --git a/setup.py b/setup.py index dfbcd3c61..ba8188493 100644 --- a/setup.py +++ b/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', ] })