def _init_from_body_ack(self, body): # N2H # Process the last update time try: self.ack_lu_time = strptime(body['last update time']) except KeyError: # No such key, ignore pass # Process the progress if 'restore' in body: self.ack_restore_progress = \ map(HeartbeatMessage.deserialize_restore_progress, body['restore']) if 'msgs' in body: self.inbox_update = HeartbeatMessage.deserialize_inbox_update( body['msgs']) logger.verbose('Host received inbox_update: %s', self.inbox_update) if 'auth_tokens' in body: self.auth_tokens = [AuthToken.from_json(t)() for t in body['auth_tokens']] assert consists_of(self.auth_tokens, AuthToken), \ repr(self.auth_tokens) logger.verbose('Host receives auth_tokens: %s', self.auth_tokens)
def _init_from_body(self, body): # H2N if 'settings' in body: self.settings_getter = \ lambda: {name: (value, strptime(time_str)) for name, (value, time_str) in body['settings'].iteritems()} if 'revive' in body: assert not body['revive'] self.revive = bool(body['revive']) # AbstractMessage self.revive_getter = lambda: self.revive if 'msgs' in body: self.inbox_update = HeartbeatMessage.deserialize_inbox_update( body['msgs']) logger.verbose('Node receives inbox_update: %s', self.inbox_update) if 'last_auth_token_sync_ts' in body: self.last_auth_token_sync_ts = \ ts_to_dt(body['last_auth_token_sync_ts']) logger.verbose('Node receives last_auth_token_sync_ts: %s', self.last_auth_token_sync_ts)
def _init_from_body(self, body): # N2H assert isinstance(body, dict), repr(body) self.settings = { name: (base64.b64decode(value), strptime(time)) for name, (value, time) in body['settings'].iteritems() }
def _init_from_body_ack(self, body): # N2H # Process the last update time try: self.ack_lu_time = strptime(body['last update time']) except KeyError: # No such key, ignore pass # Process the progress if 'restore' in body: self.ack_restore_progress = \ map(HeartbeatMessage.deserialize_restore_progress, body['restore']) if 'msgs' in body: self.inbox_update = HeartbeatMessage.deserialize_inbox_update( body['msgs']) logger.verbose('Host received inbox_update: %s', self.inbox_update) if 'auth_tokens' in body: self.auth_tokens = [ AuthToken.from_json(t)() for t in body['auth_tokens'] ] assert consists_of(self.auth_tokens, AuthToken), \ repr(self.auth_tokens) logger.verbose('Host receives auth_tokens: %s', self.auth_tokens)
def _init_from_body(self, body): # N2H assert isinstance(body, dict), repr(body) self.settings = {name: (base64.b64decode(value), strptime(time)) for name, (value, time) in body['settings'].iteritems()}