Skip to content

Commit

Permalink
storage/callback: add the backend_class property
Browse files Browse the repository at this point in the history
This should be useful for devs to inspect the Callback* classes.
  • Loading branch information
3hhh committed Jul 16, 2020
1 parent 527fa1e commit 409ea88
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions qubes/storage/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,13 @@ def _process_signals_nocoro(self, out):
if line == 'SIGNAL_setup':
raise UnhandledSignalException(self, line)

@property
def backend_class(self):
'''Class of the first non-CallbackPool backend Pool.'''
if isinstance(self._cb_impl, CallbackPool):
return self._cb_impl.backend_class
return self._cb_impl.__class__

@property
def config(self):
return {
Expand Down Expand Up @@ -468,6 +475,13 @@ def _callback(self, cb, cb_args=None, **kwargs):
vol_args = [self.name, self.vid, self.source, *cb_args]
yield from self._cb_pool._callback(cb, cb_args=vol_args, **kwargs) # pylint: disable=protected-access

@property
def backend_class(self):
'''Class of the first non-CallbackVolume backend Volume.'''
if isinstance(self._cb_impl, CallbackVolume):
return self._cb_impl.backend_class
return self._cb_impl.__class__

@asyncio.coroutine
def create(self):
yield from self._assert_initialized()
Expand Down

0 comments on commit 409ea88

Please sign in to comment.