aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Slaven <bpk@hoopajoo.net>2009-07-24 23:37:22 (GMT)
committerSteve Slaven <bpk@hoopajoo.net>2009-07-24 23:37:22 (GMT)
commit0e331018ad18846522ba833842867e40ef14c69a (patch)
tree56a375246098a6b1c162c23b57bc860458e52395
parent54c2eb333a65d8b16f7edca0b7d0909f76088829 (diff)
downloadfusearchive-0e331018ad18846522ba833842867e40ef14c69a.zip
fusearchive-0e331018ad18846522ba833842867e40ef14c69a.tar.gz
fusearchive-0e331018ad18846522ba833842867e40ef14c69a.tar.bz2
Allow switching chunk styles
-rwxr-xr-xfusearchive.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/fusearchive.py b/fusearchive.py
index faf465a..2ed69ed 100755
--- a/fusearchive.py
+++ b/fusearchive.py
@@ -32,6 +32,7 @@ magic_blocksize = 1024 * 128
#magic_blocksize = 1024
magic_depth = 5
gzip_compress_level = 6
+chunkstyle = 'fs'
# Memory for dirty blocks, per file (1M)
dirty_size = 1024 * 1024 * 1;
@@ -43,10 +44,20 @@ def dmsg(level,message):
print str(level) + ": " + str(message)
def save_chunk( chunk ):
- return _save_chunk_zip( chunk )
+ if chunkstyle == 'fs':
+ return _save_chunk_fs( chunk )
+ elif chunkstyle == 'zip':
+ return _save_chunk_zip( chunk )
+ else:
+ raise ValueError( 'Unknown chunk style' )
def load_chunk( key ):
- return _load_chunk_zip( key )
+ if chunkstyle == 'fs':
+ return _load_chunk_fs( key )
+ elif chunkstyle == 'zip':
+ return _load_chunk_zip( key )
+ else:
+ raise ValueError( 'Unknown chunk style' )
# This will write out a data block, it will return a key that can get this
# data back later