original_docstring: Reconstructs replication_pb2.AuthDB proto from shards in datastore.
  
    Runs in performance critical and memory-constrained code path.
  
    Logs an error and returns None if some shard is missing. Any other unexpected
    errors are raised as corresponding exceptions (there should be none).
  
    Args:
      primary_url: URL of the primary auth service that pushed the DB.
      auth_db_rev: revision of AuthDB to fetch.
      shard_ids: IDs of AuthDBSnapshotShard entities, must be non-empty.
  
    Returns:
      replication_pb2.AuthDB message.
    
docstring: Reconstructs replication_pb2.AuthDB proto from shards in datastore.
  Runs in performance critical and memory-constrained code path.
  
  Logs an error and returns None if some shard is missing. Any other unexpected
  errors are raised as corresponding exceptions (there should be none).
docstring_tokens: Reconstructs replication_pb2 . AuthDB proto from shards in datastore . Runs in performance critical and memory - constrained code path . Logs an error and returns None if some shard is missing . Any other unexpected errors are raised as corresponding exceptions ( there should be none ) .
code: def load_sharded_auth_db(primary_url, auth_db_rev, shard_ids):
    """Reconstructs replication_pb2.AuthDB proto from shards in datastore.
  
    Runs in performance critical and memory-constrained code path.
  
    Logs an error and returns None if some shard is missing. Any other unexpected
    errors are raised as corresponding exceptions (there should be none).
  
    Args:
      primary_url: URL of the primary auth service that pushed the DB.
      auth_db_rev: revision of AuthDB to fetch.
      shard_ids: IDs of AuthDBSnapshotShard entities, must be non-empty.
  
    Returns:
      replication_pb2.AuthDB message.
    """
    shards = ndb.get_multi(
        model.snapshot_shard_key(primary_url, auth_db_rev, shard_id)
        for shard_id in shard_ids)
  
    missing = [sid for sid, shard in zip(shard_ids, shards) if not shard]
    if missing:
      logging.error(
          'Cannot reconstruct AuthDB from %s at rev %d due to missing '
          'AuthDBSnapshotShard: %r', primary_url, auth_db_rev, missing)
      return None
  
    out = cStringIO.StringIO()
    decompressor = zlib.decompressobj()
    for idx, shard in enumerate(shards):
      data = decompressor.decompress(shard.blob)
      # Release the memory held by the shard ASAP
      shards[idx] = None
      shard.blob = None
      out.write(data)
    out.write(decompressor.flush())
    del decompressor
  
    buf = out.getvalue()
    del out
  
    return replication_pb2.AuthDB.FromString(buf)
code_tokens: def load_sharded_auth_db ( primary_url , auth_db_rev , shard_ids ) : shards = ndb . get_multi ( model . snapshot_shard_key ( primary_url , auth_db_rev , shard_id ) for shard_id in shard_ids ) missing = [ sid for sid , shard in zip ( shard_ids , shards ) if not shard ] if missing : logging . error ( 'Cannot reconstruct AuthDB from %s at rev %d due to missing ' 'AuthDBSnapshotShard: %r' , primary_url , auth_db_rev , missing ) return None out = cStringIO . StringIO ( ) decompressor = zlib . decompressobj ( ) for idx , shard in enumerate ( shards ) : data = decompressor . decompress ( shard . blob ) shards [ idx ] = None shard . blob = None out . write ( data ) out . write ( decompressor . flush ( ) ) del decompressor buf = out . getvalue ( ) del out return replication_pb2 . AuthDB . FromString ( buf )
short_docstring: Reconstructs replication_pb2.AuthDB proto from shards in datastore.
short_docstring_tokens: Reconstructs replication_pb2 . AuthDB proto from shards in datastore .
comment: """Reconstructs replication_pb2.AuthDB proto from shards in datastore.
  
    Runs in performance critical and memory-constrained code path.
  
    Logs an error and returns None if some shard is missing. Any other unexpected
    errors are raised as corresponding exceptions (there should be none).
  
    Args:
      primary_url: URL of the primary auth service that pushed the DB.
      auth_db_rev: revision of AuthDB to fetch.
      shard_ids: IDs of AuthDBSnapshotShard entities, must be non-empty.
  
    Returns:
      replication_pb2.AuthDB message.
    """$SEP$# Release the memory held by the shard ASAP