Add automatic storage replication
Adds a worker to automatically replicate data between storages and update the database accordingly
This commit is contained in:
parent
c693afca6a
commit
724b1607d7
18 changed files with 259 additions and 35 deletions
|
@ -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()
|
||||
|
||||
|
|
Reference in a new issue