def status(self):
        docs = {'updated'  : [],
                'committed': [],
                'to_commit': []}

        row = self.db.internal.find_one({'_id': 'last_sync'})

        if row and 'update' in row:
            for id in row['update']:
                docs['updated'].append(self.get(id, deleted=True))

        if row and 'commit' in row:
            for id in row['commit']:
                docs['committed'].append(self.get(id, deleted=True))

        to_commit =  self.get_docs_to_commit()
        for row in to_commit:
            doc = Document(**row)
            docs['to_commit'].append(doc)
        return docs
def _execute_rpc_implementor_background(self, context, audit_name, target,
                                           response_queue, args, kwargs):
        """
        Honor a remote procedure call request from a plugin,
        from a background thread. Must only be used as the entry
        point for said background thread!

        :param context: Plugin execution context.
        :type context: PluginContext

        :param audit_name: Name of the audit requesting the call.
        :type audit_name: str

        :param target: RPC implementor function.
        :type target: callable

        :param response_queue: Response queue identity.
        :type response_queue: str

        :param args: Positional arguments to the call.
        :type args: tuple

        :param kwargs: Keyword arguments to the call.
        :type kwargs: dict
        """
        Config._context = context
        self.execute_rpc_implementor(
            audit_name, target, response_queue, args, kwargs)