def __mark_link(self, link_id, status): """ Method for updating link status """ self.manager.update( {'status': status}, Condition('id', link_id) )
def finish(self): self.manager.update( {'status': Link.Status.DONE}, Condition('type', Link.Type.SEARCH) )
def get_current_state(self): return self.select(columns=('state', ), condition=Condition('id', 1)).fetchone()[0]
def set_current_state(self, state): self.update({'id': 1, 'state': state}, Condition('id', 1))
def get_waiting_links(self): return self.select( condition=Condition('status', Link.Status.WAITING)).fetchall()
def get_finished_links(self): return self.select( condition=Condition('status', Link.Status.DONE)).fetchall()
def get_search_link_id(self): return self.select(('id', ), condition=Condition('type', Link.Type.SEARCH)).fetchone()[0]