o
    •Û_ú  ã                   @   s@   d dl mZ d dlZd dlZej ¡ ZdgZG dd„ deƒZ	dS )é    )ÚPluginLoaderNÚ
Repositoryc                       s@   e Zd Z‡ fdd„Zedd„ ƒZdd„ Zdd„ Zd	d
„ Z‡  Z	S )r   c	           	         sJ   t t| ƒ ¡  tƒ | _|| _|| _|| _|| _|| _	|| _
|| _|| _d S ©N)Úsuperr   Ú__init__ÚsetÚ_pluginsÚ_monitor_repositoryÚ_storage_factoryÚ_hardware_inventoryÚ_device_matcherÚ_device_matcher_udevÚ_plugin_instance_factoryÚ_global_cfgÚ
_variables)	ÚselfÚmonitor_repositoryÚstorage_factoryÚhardware_inventoryÚdevice_matcherÚdevice_matcher_udevÚplugin_instance_factoryÚ
global_cfgÚ	variables©Ú	__class__© ú:/usr/lib/python3/dist-packages/tuned/plugins/repository.pyr      s   
zRepository.__init__c                 C   s   | j S r   )r   ©r   r   r   r   Úplugins   s   zRepository.pluginsc                 C   s   d| _ d| _tjjj| _d S )Nztuned.pluginsÚplugin_)Ú
_namespaceÚ_prefixÚtunedr   ÚbaseÚPluginÚ
_interfacer   r   r   r   Ú_set_loader_parameters   s   z!Repository._set_loader_parametersc              	   C   sN   t  d| ¡ |  |¡}|| j| j| j| j| j| j| j	| j
ƒ}| j |¡ |S )Nzcreating plugin %s)ÚlogÚdebugÚload_pluginr	   r
   r   r   r   r   r   r   r   Úadd)r   Úplugin_nameÚ
plugin_clsÚplugin_instancer   r   r   Úcreate    s   
ÿzRepository.createc                 C   s6   t || jƒsJ ‚t d| ¡ | ¡  | j |¡ d S )Nzremoving plugin %s)Ú
isinstancer&   r(   r)   Úcleanupr   Úremove)r   Úpluginr   r   r   Údelete(   s   zRepository.delete)
Ú__name__Ú
__module__Ú__qualname__r   Úpropertyr   r'   r/   r4   Ú__classcell__r   r   r   r   r   	   s    
)
Útuned.utils.plugin_loaderr   Útuned.plugins.baser#   Ú
tuned.logsÚlogsÚgetr(   Ú__all__r   r   r   r   r   Ú<module>   s    
