/**
  * @inheritDoc BaseAssetSourceType::processIndex()
  *
  * @param $sessionId
  * @param $offset
  *
  * @return mixed
  */
 public function processIndex($sessionId, $offset)
 {
     $indexEntryModel = craft()->assetIndexing->getIndexEntry($this->model->id, $sessionId, $offset);
     if (empty($indexEntryModel)) {
         return false;
     }
     $uriPath = $indexEntryModel->uri;
     $fileModel = $this->indexFile($uriPath);
     $this->_prepareForRequests();
     if ($fileModel) {
         $settings = $this->getSettings();
         craft()->assetIndexing->updateIndexEntryRecordId($indexEntryModel->id, $fileModel->id);
         $fileModel->size = $indexEntryModel->size;
         $fileInfo = $this->_googleCloud->getObjectInfo($settings->bucket, $this->_getPathPrefix() . $uriPath);
         $targetPath = craft()->path->getAssetsImageSourcePath() . $fileModel->id . '.' . IOHelper::getExtension($fileModel->filename);
         $timeModified = new DateTime('@' . $fileInfo['time']);
         if ($fileModel->kind == 'image' && ($fileModel->dateModified != $timeModified || !IOHelper::fileExists($targetPath))) {
             $this->_googleCloud->getObject($settings->bucket, $this->_getPathPrefix() . $indexEntryModel->uri, $targetPath);
             clearstatcache();
             list($fileModel->width, $fileModel->height) = getimagesize($targetPath);
             // Store the local source or delete - maxCacheCloudImageSize is king.
             craft()->assetTransforms->storeLocalSource($targetPath, $targetPath);
             craft()->assetTransforms->queueSourceForDeletingIfNecessary($targetPath);
         }
         $fileModel->dateModified = $timeModified;
         craft()->assets->storeFile($fileModel);
         return $fileModel->id;
     }
     return false;
 }
 /**
  * Make a local copy of the file and return the path to it.
  *
  * @param AssetFileModel $file
  * @return mixed
  */
 public function getLocalCopy(AssetFileModel $file)
 {
     $location = AssetsHelper::getTempFilePath($file->getExtension());
     $this->_prepareForRequests();
     $this->_googleCloud->getObject($this->getSettings()->bucket, $this->_getS3Path($file), $location);
     return $location;
 }