Add automatic storage replication

Adds a worker to automatically replicate data between storages and update the database accordingly
This commit is contained in:
Joseph Schorr 2015-06-28 13:29:22 +03:00 committed by Joseph Schorr
parent c693afca6a
commit 724b1607d7
18 changed files with 259 additions and 35 deletions

View file

@ -1,4 +1,5 @@
from storage.basestorage import BaseStorage
from cStringIO import StringIO
_FAKE_STORAGE_MAP = {}
@ -18,6 +19,9 @@ class FakeStorage(BaseStorage):
def stream_read(self, path):
yield _FAKE_STORAGE_MAP[path]
def stream_read_file(self, path):
return StringIO(_FAKE_STORAGE_MAP[path])
def stream_write(self, path, fp, content_type=None, content_encoding=None):
_FAKE_STORAGE_MAP[path] = fp.read()