'Fetch as much as the file\'s content as possible.
This drains the pending_files store by checking which blobs we already have
in the store and issuing calls to the client to receive outstanding blobs.'

def FetchFileContent(self):

    if (not self.state.pending_files):
        return
    blob_hashes = []
    for file_tracker in self.state.pending_files.itervalues():
        for hash_response in file_tracker.get('hash_list', []):
            blob_hashes.append(hash_response.data.encode('hex'))
    existing_blobs = data_store.DB.BlobsExist(blob_hashes, token=self.token)
    self.state.blob_hashes_pending = 0
    for (index, file_tracker) in self.state.pending_files.iteritems():
        for hash_response in file_tracker.get('hash_list', []):
            hash_response.pathspec = file_tracker['stat_entry'].pathspec
            if existing_blobs[hash_response.data.encode('hex')]:
                self.CallState([hash_response], next_state='WriteBuffer', request_data=dict(index=index))
            else:
                self.CallClient(server_stubs.TransferBuffer, hash_response, next_state='WriteBuffer', request_data=dict(index=index))
        file_tracker['hash_list'] = []
