class_docstr: Implement a consistent hashing ring.
class_docstr_tok: ["Implement","a","consistent","hashing","ring","."]
docstr: hash_ring compatibility implementation.
  
  Given a string key it returns the nodes as a generator that
  can hold the key.
  The generator iterates one time through the ring
  starting at the correct position.
  if `distinct` is set, then the nodes returned will be unique,
  i.e. no virtual copies will be returned.
docstr_tok: ["hash_ring","compatibility","implementation",".","Given","a","string","key","it","returns","the","nodes","as","a","generator","that","can","hold","the","key",".","The","generator","iterates","one","time","through","the","ring","starting","at","the","correct","position",".","if","`","distinct","`","is","set",",","then","the","nodes","returned","will","be","unique",",","i.e",".","no","virtual","copies","will","be","returned","."]
code: def iterate_nodes(self, key, distinct=True):
      """hash_ring compatibility implementation.
  
      Given a string key it returns the nodes as a generator that
      can hold the key.
      The generator iterates one time through the ring
      starting at the correct position.
      if `distinct` is set, then the nodes returned will be unique,
      i.e. no virtual copies will be returned.
      """
      if not self.runtime._ring:
          yield None
      else:
          for node in self.range(key, unique=distinct):
              yield node["nodename"]
  
imports: from bisect import bisect
  from .ring_ketama import KetamaRing
  from .ring_meta import MetaRing
label_desc: Use image node_id 19 for calling the HashRing obj's underlying member method code with example usage: obj.iterate_nodes(key, distinct) without return types