def get_destination_update(self, gid, destination, user): """ returns last update timestamp for destination """ result = self.get_destination_param(gid, destination, user, S1.updated_key()) if not result: return 0 return float(result)
def remove_from_poller(self, gid): # remove from master set self.rc.zrem(S1.gid_set('all'), gid) # clear cache self.rc.delete(S1.cache_key(gid)) self.del_destination_param(gid, 'cache', gid, S1.updated_key()) self.del_destination_param(gid, 'cache', gid, S1.etag_key()) self.purge_temp_accounts(gid)
def remove_binding(self, gid, destination, user, clean=False): """ clears binding created by bind_user() """ self.logger.info('Unbinding GID: [{0}] -/-> [{1}:{2}]'.format( gid, destination, user)) self.add_log( gid, 'Unbinding Google+ [{0}] -/-> [{1}:{2}]'.format( gid, destination, user)) # remove binding update option self.rc.hdel(S1.destination_option_key_fmt(destination), S1.destination_pair_fmt(gid, user, S1.updated_key())) # remove destination user id from list of destinations for this gid self._delete_hfield_item(S1.destination_key_fmt(destination), gid, user) # remove gid from list of sources for this destination user self._delete_hfield_item(S1.destination_source_key_fmt(destination), user, gid) # clean linked accounts # find the owner(s) of the destination:user pair self.purge_gid_links(destination, user) # the gid->destination:user link is broken # clear this relationship self.remove_linked_account(gid, S1.provider_root_key(destination, user), bag='dst') # remove destination binding if no bindings to this destination left bound_users = self.get_destination_users(gid, destination) if not (bound_users and len(bound_users)): self.logger.info('No links remain for [{0} --> {1}]'.format( gid, destination)) # remove destination from gid destination list self._delete_hfield_item( S1.destination_key_fmt(S1.destinations_key()), gid, destination) # keep message map for the destination:user -- user may re-bind later with new token # unless forced to clean all # keep filters unless forced to clean! if clean: self.filter.del_filter(destination, gid, user) self.filter.del_message_id_map(destination, user) # clear bound timestamp self.del_destination_param(gid, destination, user, S1.bound_key()) # check_orphan() will stop polling the gid if nothing is bound to it self.check_orphan(gid, 0)
def set_destination_update(self, gid, destination, user, timestamp): """ sets last update timestamp for destination """ self.set_destination_param(gid, destination, user, S1.updated_key(), timestamp)