Commit 8bf74cdb authored by Giorgos Korfiatis's avatar Giorgos Korfiatis
Browse files

message for live update

parent fc929a14
......@@ -450,8 +450,10 @@ class LocalfsSourceHandle(object):
live_info = local_path_changes(
self.staged_path, self.source_state)
if live_info is not None:
logger.warning("Actual info differs in %s for object: '%s'; "
"updating..." % (self.SIGNATURE, self.objname))
msg = messaging.LiveInfoUpdateMessage(
archive=self.SIGNATURE, objname=self.objname,
info=live_info, logger=logger)
self.settings.messager.put(msg)
new_state = self.source_state.set(info=live_info)
self.update_state(new_state)
self.source_state = new_state
......
......@@ -49,6 +49,16 @@ class UpdateMessage(Message):
(self.archive, self.objname, self.serial))
class LiveInfoUpdateMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
self.archive = kwargs["archive"]
self.objname = kwargs["objname"]
self.info = kwargs["info"]
self.logger.warning("Actual info differs in %s for object: '%s'; "
"updating..." % (self.archive, self.objname))
class SyncMessage(Message):
def __init__(self, *args, **kwargs):
Message.__init__(self, *args, **kwargs)
......
......@@ -149,8 +149,10 @@ class PithosSourceHandle(object):
def check_update_source_state(self, actual_info):
if actual_info != self.source_state.info:
logger.warning("Actual info differs in %s for object: '%s'; "
"updating..." % (self.SIGNATURE, self.objname))
msg = messaging.LiveInfoUpdateMessage(
archive=self.SIGNATURE, objname=self.objname,
info=actual_info, logger=logger)
self.settings.messager.put(msg)
new_state = self.source_state.set(info=actual_info)
self.update_state(new_state)
self.source_state = new_state
......
......@@ -389,6 +389,7 @@ with open(fchanged_path, "w") as f:
s.decide_file_sync(fchanged)
assert_message(messaging.SyncMessage)
assert_message(messaging.LiveInfoUpdateMessage)
assert_message(messaging.AckSyncMessage)
state = db.get_state(s.SLAVE, fchanged)
......@@ -414,6 +415,7 @@ new_fupch_etag = r1['etag']
s.decide_file_sync(fupch)
assert_message(messaging.SyncMessage)
assert_message(messaging.LiveInfoUpdateMessage)
assert_message(messaging.AckSyncMessage)
state = db.get_state(s.MASTER, fupch)
new_fupch_info = state.info
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment