;ò
µAc           @   sL   d  k  Z  d f  d     YZ d e f d     YZ d e f d     YZ d  S(   Ns   baseFailOverMethodc           B   sD   t  Z d   Z e d  Z d   Z d d  Z d   Z d   Z RS(   Nc         C   s   | |  _  | |  _ d |  _ d  S(   Ni    (   s   confs   selfs   serverIDs   failures(   s   selfs   confs   serverID(    (    s   /usr/share/yum/failover.pys   __init__   s    		c         C   s   t  Sd S(   sÖ   Returns a serverurl based on this failover method or None 
           if complete failure.  If i is given it is a direct index
           to pull a server URL from instead of using the failures 
           counter.N(   s   None(   s   selfs   i(    (    s   /usr/share/yum/failover.pys   get_serverurl    s     c         C   s   |  i d |  _ d S(   s<   Tells the failover method that the current server is failed.i   N(   s   selfs   failures(   s   self(    (    s   /usr/share/yum/failover.pys   server_failed'   s     i    c         C   s   | |  _ d S(   s,   Reset the failures counter to a given index.N(   s   is   selfs   failures(   s   selfs   i(    (    s   /usr/share/yum/failover.pys   reset+   s     c         C   s   |  i Sd S(   s	  Returns the current number of failures which is also the
           index into the list this object represents.  ger_serverurl()
           should always be used to translate an index into a URL
           as this object may change how indexs map.  (See RoundRobin)N(   s   selfs   failures(   s   self(    (    s   /usr/share/yum/failover.pys	   get_index/   s     c         C   s   t  |  i i |  i  Sd S(   s5   Returns the how many URLs we've got to cycle through.N(   s   lens   selfs   confs	   serverurls   serverID(   s   self(    (    s   /usr/share/yum/failover.pys   len7   s     (	   s   __name__s
   __module__s   __init__s   Nones   get_serverurls   server_faileds   resets	   get_indexs   len(    (    (    s   /usr/share/yum/failover.pys   baseFailOverMethod   s   			s   priorityc           B   s   t  Z d  Z e d  Z RS(   s6   Chooses server based on the first success in the list.c         C   sa   | t j o |  i } n | } | t |  i i |  i  j o t Sn |  i i |  i | Sd S(   sN   Returns a serverurl based on this failover method or None if complete failure.N(	   s   is   Nones   selfs   failuress   indexs   lens   confs	   serverurls   serverID(   s   selfs   is   index(    (    s   /usr/share/yum/failover.pys   get_serverurlB   s      (   s   __name__s
   __module__s   __doc__s   Nones   get_serverurl(    (    (    s   /usr/share/yum/failover.pys   priority>   s    s
   roundRobinc           B   s#   t  Z d  Z d   Z e d  Z RS(   s&   Chooses server based on a round robin.c         C   s6   t  i |  | |  t i   t i d d  |  _ d  S(   Ni    i%   (	   s   baseFailOverMethods   __init__s   selfs   confs   serverIDs   randoms   seeds   randints   offset(   s   selfs   confs   serverID(    (    s   /usr/share/yum/failover.pys   __init__U   s    
c         C   s   | t j o |  i } n | } | t |  i i |  i  j o t Sn | |  i	 t |  i i |  i  } |  i i |  i | Sd S(   sN   Returns a serverurl based on this failover method or None if complete failure.N(   s   is   Nones   selfs   failuress   indexs   lens   confs	   serverurls   serverIDs   offsets   rr(   s   selfs   is   indexs   rr(    (    s   /usr/share/yum/failover.pys   get_serverurlZ   s      $(   s   __name__s
   __module__s   __doc__s   __init__s   Nones   get_serverurl(    (    (    s   /usr/share/yum/failover.pys
   roundRobinQ   s    	(   s   randoms   baseFailOverMethods   prioritys
   roundRobin(   s   baseFailOverMethods   prioritys
   roundRobins   random(    (    s   /usr/share/yum/failover.pys   ?   s   	&