private void repairImplicitDirectory(Future<GoogleCloudStorageItemInfo> infoFuture)
      throws IOException {
    if (infoFuture == null) {
      return;
    }

    checkState(
        options.getCloudStorageOptions().isAutoRepairImplicitDirectoriesEnabled(),
        "implicit directories auto repair should be enabled");

    GoogleCloudStorageItemInfo info = getFromFuture(infoFuture, "Failed to get info from future");
    StorageResourceId resourceId = info.getResourceId();
    logger.atFine().log("repairImplicitDirectory(%s)", resourceId);

    if (info.exists()
        || resourceId.isRoot()
        || resourceId.isBucket()
        || PATH_DELIMITER.equals(resourceId.getObjectName())) {
      return;
    }

    checkState(resourceId.isDirectory(), "'%s' should be a directory", resourceId);

    // Note that we do not update parent directory timestamps. The idea is that:
    // 1) directory repair isn't a user-invoked action
    // 2) directory repair shouldn't be thought of "creating" directories, instead it drops
    //    markers to help GCSFS and GHFS find directories that already "existed"
    // 3) it's extra RPCs on top of the list and create empty object RPCs
    try {
      gcs.createEmptyObject(resourceId);
      logger.atInfo().log("Successfully repaired '%s' directory.", resourceId);
    } catch (IOException e) {
      logger.atWarning().withCause(e).log("Failed to repair '%s' directory", resourceId);
    }
  }
private void repairImplicitDirectory ( Future < GoogleCloudStorageItemInfo > infoFuture ) throws IOException { if ( infoFuture == null ) { return ; } checkState ( options . getCloudStorageOptions ( ) . isAutoRepairImplicitDirectoriesEnabled ( ) , "implicit directories auto repair should be enabled" ) ; GoogleCloudStorageItemInfo info = getFromFuture ( infoFuture , "Failed to get info from future" ) ; StorageResourceId resourceId = info . getResourceId ( ) ; logger . atFine ( ) . log ( "repairImplicitDirectory(%s)" , resourceId ) ; if ( info . exists ( ) || resourceId . isRoot ( ) || resourceId . isBucket ( ) || PATH_DELIMITER . equals ( resourceId . getObjectName ( ) ) ) { return ; } checkState ( resourceId . isDirectory ( ) , "'%s' should be a directory" , resourceId ) ; try { gcs . createEmptyObject ( resourceId ) ; logger . atInfo ( ) . log ( "Successfully repaired '%s' directory." , resourceId ) ; } catch ( IOException e ) { logger . atWarning ( ) . withCause ( e ) . log ( "Failed to repair '%s' directory" , resourceId ) ; } }
Attempts to create the directory object explicitly for provided {@code infoFuture} if it
doesn't already exist as a directory object.