tahoe-lafs/src/allmydata/storage/shares.py

15 lines
376 B
Python
Raw Normal View History

#! /usr/bin/python
2010-02-26 08:14:33 +00:00
from allmydata.storage.mutable import MutableShareFile
from allmydata.storage.immutable import ShareFile
def get_share_file(filename):
f = open(filename, "rb")
prefix = f.read(32)
f.close()
if prefix == MutableShareFile.MAGIC:
return MutableShareFile(filename)
# otherwise assume it's immutable
return ShareFile(filename)