Y2 ]]XVddlmZmZmZmZddlmZmZddlm Z Gdde Z dS)) IPv4Address IPv4Network IPv6Address IPv6Network)ListUnion)TreeCacheInterfaceceZdZdZdZdZdZdeee e e e ffdZ deee e e e ffdZdZd S) TreeCacheCollectorz] Facade for multiple caches. :param collected_caches: pool of TreeCacheInterface c||_dS)N)_collected_caches)selfcollected_cachess T/opt/imunify360/venv/lib/python3.11/site-packages/im360/utils/tree_cache/adapters.py__init__zTreeCacheCollector.__init__ s!1cZK|jD] }||d{VrdS!dS)zICheck if the cache contains specified ip. :type ip: str NTF)rcontainsripcaches rrzTreeCacheCollector.containssQ +  E^^B'''''''' tt urcZK|jD] }||d{VrdS!dS)zdCheck if the cache contains exactly specified ip, not parent subnet. :type ip: str NTF)rcontains_exactlyrs rrz#TreeCacheCollector.contains_exactlysS +  E++B//////// tt uripscKt}|jD]5}||d{VD]}||6t |S)z)Returns ips those are presented in cache.N)setrfilter_containedaddlist)rrset_rrs rrz#TreeCacheCollector.filter_contained$st uu+  E!22377777777    Dzzrc^K|}|jD] }|r||d{V} |S)z-Returns ips those are NOT presented in cache.N)rfilter_not_contained)rrrvrs rr#z'TreeCacheCollector.filter_not_contained/sV +  E  55b99999999 rcB|jD]}|dS)zr Each of collected_caches will be re-init from so-called SourceInterface on the next call N)rreset)rtreecache_interfaces rr&zTreeCacheCollector.reset<s6 $(#9 ( (   % % ' ' ' ' ( (rN)__name__ __module__ __qualname____doc__rrrrrrrrrrr#r&rrr r s 222  % [+{JK L      % [+{JK L    (((((rr N) ipaddressrrrrtypingrrcorer r r,rrr0sHHHHHHHHHHHH$$$$$$;(;(;(;(;(+;(;(;(;(;(r