Esempio n. 1
0
 def _delete_callback(self, callback, resource_type):
     try:
         self._callbacks[resource_type].remove(callback)
         if not self._callbacks[resource_type]:
             del self._callbacks[resource_type]
     except KeyError:
         raise rpc_exc.CallbackNotFound(resource_type=resource_type)
Esempio n. 2
0
    def get_callbacks(self, resource_type):
        """Return the callback if found, None otherwise.

        :param resource_type: must be a valid resource type.
        """
        _validate_resource_type(resource_type)
        callbacks = self._callbacks[resource_type]
        if not callbacks:
            raise rpc_exc.CallbackNotFound(resource_type=resource_type)
        return callbacks
Esempio n. 3
0
 def get_callback(self, resource_type):
     _validate_resource_type(resource_type)
     try:
         return self._callbacks[resource_type]
     except KeyError:
         raise rpc_exc.CallbackNotFound(resource_type=resource_type)