Ejemplo n.º 1
0
        self._filters.optimize()
        _log.info(
            "Optimized filter stack [%d]: %s" %
            (len(self._filters), ','.join([f.name for f in self._filters])))

        if not self._state.context:
            self._state.context = ResourceContext(params.object_id,
                                                  self._state.config,
                                                  lock=threading.Lock(),
                                                  catalog=dict())

        runner = self._filters.bind(
            self._state, None
        )  # no need for queue as we'll call evaluate(obj) directly, not run()
        obj = Object(self._server_id, params.object_id)
        loader = ObjectLoader(self._state.config, self._state.blob_cache)
        if not loader.source_available(obj):
            raise DiamondRPCFCacheMiss()
        drop = not runner.evaluate(obj)

        return protocol.XDR_attribute_list(
            obj.xdr_attributes(output_attrs, for_drop=drop))

    @RPCHandlers.handler(29, reply_class=protocol.XDR_search_stats)
    @running(True)
    def request_stats(self):
        '''Return current search statistics.'''
        filter_stats = [f.stats for f in self._filters]
        return self._state.stats.xdr(self._scope.get_count(), filter_stats)

    @RPCHandlers.handler(18, reply_class=protocol.XDR_session_vars)
Ejemplo n.º 2
0
 def __init__(self, state):
     _ObjectProcessor.__init__(self)
     self._state = state
     self._loader = ObjectLoader(state.config, state.blob_cache)