@LRUCache(maxtime=CONTAINER_POLICY_TTL)
def direct_get_container_policy_index(container_ring, account_name, container_name):
 def _eat_client_exception(*args):
  try:
   return direct_head_container(*args)
  except ClientException as err:
   if (err.http_status == 404):
    return err.http_headers
  except (Timeout, socket.error):
   pass
 pile = GreenPile()
 (part, nodes) = container_ring.get_nodes(account_name, container_name)
 for node in nodes:
  pile.spawn(_eat_client_exception, node, part, account_name, container_name)
 headers = [x for x in pile if (x is not None)]
 if (len(headers) < majority_size(len(nodes))):
  return
 return best_policy_index(headers)

@ LRUCache ( maxtime = CONTAINER_POLICY_TTL ) def direct_get_container_policy_index ( container_ring , account_name , container_name ) : def _eat_client_exception ( * args ) : try : return direct_head_container ( * args ) except ClientException as err : if ( err . http_status == 404 ) : return err . http_headers except ( Timeout , socket . error ) : pass pile = GreenPile ( ) ( part , nodes ) = container_ring . get_nodes ( account_name , container_name ) for node in nodes : pile . spawn ( _eat_client_exception , node , part , account_name , container_name ) headers = [ x for x in pile if ( x is not None ) ] if ( len ( headers ) < majority_size ( len ( nodes ) ) ) : return return best_policy_index ( headers )
talk directly to the primary container servers to figure out the storage policy index for a given container .