o
    •Û_?  ã                   @   s@   d dl Zd dlZd dlmZ ej ¡ ZdgZG dd„ deƒZ	dS )é    N)ÚPluginLoaderÚ
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                    s   t t| ƒ ¡  tƒ | _d S ©N)Úsuperr   Ú__init__ÚsetÚ	_monitors©Úself©Ú	__class__© ú;/usr/lib/python3/dist-packages/tuned/monitors/repository.pyr      s   zRepository.__init__c                 C   s   | j S r   )r   r	   r   r   r   Úmonitors   s   zRepository.monitorsc                 C   s   d| _ d| _tjj| _d S )Nztuned.monitorsÚmonitor_)Ú
_namespaceÚ_prefixÚtunedr   ÚMonitorÚ
_interfacer	   r   r   r   Ú_set_loader_parameters   s   z!Repository._set_loader_parametersc                 C   s0   t  d| ¡ |  |¡}||ƒ}| j |¡ |S )Nzcreating monitor %s)ÚlogÚdebugÚload_pluginr   Úadd)r
   Úplugin_nameÚdevicesÚmonitor_clsÚmonitor_instancer   r   r   Úcreate   s
   
zRepository.createc                 C   s(   t || jƒsJ ‚| ¡  | j |¡ d S r   )Ú
isinstancer   Úcleanupr   Úremove)r
   Úmonitorr   r   r   Údelete   s   zRepository.delete)
Ú__name__Ú
__module__Ú__qualname__r   Úpropertyr   r   r   r$   Ú__classcell__r   r   r   r   r   	   s    
)
Ú
tuned.logsr   Útuned.monitorsÚtuned.utils.plugin_loaderr   ÚlogsÚgetr   Ú__all__r   r   r   r   r   Ú<module>   s    
