diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-08-07 11:37:38 -0400 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-08-07 13:28:47 -0400 |
commit | 7e9787c947e99b68317f5420951a296cea858daa (patch) | |
tree | ebd7605737b8e9a9a35a8bfa58adf312c9fa0c49 /src/lib/Bcfg2/Server/MultiprocessingCore.py | |
parent | 441a96457ba55529c0316a7459dcb295988824b0 (diff) | |
download | bcfg2-7e9787c947e99b68317f5420951a296cea858daa.tar.gz bcfg2-7e9787c947e99b68317f5420951a296cea858daa.tar.bz2 bcfg2-7e9787c947e99b68317f5420951a296cea858daa.zip |
Plugin: added new Caching interface
This gives a single unified interface for expiring caches, no matter
the plugin. This will be particularly useful with the
MultiprocessingCore, as certain calls must be dispatched to child
processes to expire their caches.
Diffstat (limited to 'src/lib/Bcfg2/Server/MultiprocessingCore.py')
-rw-r--r-- | src/lib/Bcfg2/Server/MultiprocessingCore.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/Bcfg2/Server/MultiprocessingCore.py b/src/lib/Bcfg2/Server/MultiprocessingCore.py index b690242f8..c185a5893 100644 --- a/src/lib/Bcfg2/Server/MultiprocessingCore.py +++ b/src/lib/Bcfg2/Server/MultiprocessingCore.py @@ -15,16 +15,16 @@ import time import threading import lxml.etree import multiprocessing +import Bcfg2.Server.Plugin from itertools import cycle from Bcfg2.Cache import Cache from Bcfg2.Compat import Queue, Empty -from Bcfg2.Server.Plugin import Debuggable from Bcfg2.Server.Core import BaseCore, exposed from Bcfg2.Server.BuiltinCore import Core as BuiltinCore from multiprocessing.connection import Listener, Client -class DispatchingCache(Cache, Debuggable): +class DispatchingCache(Cache, Bcfg2.Server.Plugin.Debuggable): """ Implementation of :class:`Bcfg2.Cache.Cache` that propagates cache expiration events to child nodes. """ @@ -33,7 +33,7 @@ class DispatchingCache(Cache, Debuggable): def __init__(self, *args, **kwargs): self.rpc_q = kwargs.pop("queue") - Debuggable.__init__(self) + Bcfg2.Server.Plugin.Debuggable.__init__(self) Cache.__init__(self, *args, **kwargs) def expire(self, key=None): @@ -41,7 +41,7 @@ class DispatchingCache(Cache, Debuggable): Cache.expire(self, key=key) -class RPCQueue(Debuggable): +class RPCQueue(Bcfg2.Server.Plugin.Debuggable): """ An implementation of a :class:`multiprocessing.Queue` designed for several additional use patterns: @@ -54,7 +54,7 @@ class RPCQueue(Debuggable): poll_wait = 3.0 def __init__(self): - Debuggable.__init__(self) + Bcfg2.Server.Plugin.Debuggable.__init__(self) self._terminate = threading.Event() self._queues = dict() self._available_listeners = Queue() @@ -293,9 +293,9 @@ class ChildCore(BaseCore): @exposed def RecvProbeData(self, address, _): """ Expire the probe cache for a client """ - if 'Probes' in self.plugins: - client = self.resolve_client(address, metadata=False)[0] - self.plugins['Probes'].load_data(client) + self.expire_caches_by_type(Bcfg2.Server.Plugin.Probing, + key=self.resolve_client(address, + metadata=False)[0]) @exposed def GetConfig(self, client): |