change plugin interface to base class
This commit is contained in:
parent
27fe718966
commit
184a5f8a3d
5 changed files with 9 additions and 6 deletions
|
|
@ -1,5 +1,7 @@
|
|||
import interface
|
||||
import base
|
||||
import repository
|
||||
|
||||
def get_repository():
|
||||
return repository.PluginRepository.get_instance()
|
||||
|
||||
Plugin = base.Plugin
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
class PluginInterface(object):
|
||||
class Plugin(object):
|
||||
@classmethod
|
||||
def _get_default_options(cls):
|
||||
return {}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
import tuned.plugins.interface
|
||||
import tuned.plugins
|
||||
import tuned.monitors
|
||||
|
||||
import os
|
||||
import struct
|
||||
|
||||
class CPULatencyPlugin(tuned.plugins.interface.PluginInterface):
|
||||
class CPULatencyPlugin(tuned.plugins.Plugin):
|
||||
def __init__(self, options = None):
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import tuned.monitors
|
||||
|
||||
class TestPlugin(tuned.plugins.interface.PluginInterface):
|
||||
class TestPlugin(tuned.plugins.Plugin):
|
||||
def __init__(self, options = None):
|
||||
"""
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import tuned.patterns
|
||||
import tuned.logs
|
||||
import tuned.utils
|
||||
import tuned.plugins
|
||||
import tuned.plugins.exception
|
||||
|
||||
log = tuned.logs.get()
|
||||
|
|
@ -8,7 +9,7 @@ log = tuned.logs.get()
|
|||
class PluginRepository(tuned.patterns.Singleton):
|
||||
def __init__(self):
|
||||
super(self.__class__, self).__init__()
|
||||
self._loader = tuned.utils.PluginLoader("tuned.plugins", "plugin_", tuned.plugins.interface.PluginInterface)
|
||||
self._loader = tuned.utils.PluginLoader("tuned.plugins", "plugin_", tuned.plugins.Plugin)
|
||||
self._plugins = set()
|
||||
|
||||
def create(self, plugin_name):
|
||||
|
|
|
|||
Loading…
Reference in a new issue