use of org.apache.flink.runtime.blob.FileSystemBlobStore in project flink by apache.
the class ZookeeperHaServices method createBlobStore.
/**
* Creates the BLOB store in which BLOBs are stored in a highly-available
* fashion.
*
* @param configuration configuration to extract the storage path from
* @return Blob store
* @throws IOException if the blob store could not be created
*/
public static BlobStore createBlobStore(final Configuration configuration) throws IOException {
String storagePath = configuration.getValue(HighAvailabilityOptions.HA_STORAGE_PATH);
if (isNullOrWhitespaceOnly(storagePath)) {
throw new IllegalConfigurationException("Configuration is missing the mandatory parameter: " + HighAvailabilityOptions.HA_STORAGE_PATH);
}
final Path path;
try {
path = new Path(storagePath);
} catch (Exception e) {
throw new IOException("Invalid path for highly available storage (" + HighAvailabilityOptions.HA_STORAGE_PATH.key() + ')', e);
}
final FileSystem fileSystem;
try {
fileSystem = path.getFileSystem();
} catch (Exception e) {
throw new IOException("Could not create FileSystem for highly available storage (" + HighAvailabilityOptions.HA_STORAGE_PATH.key() + ')', e);
}
final String clusterId = configuration.getValue(HighAvailabilityOptions.HA_CLUSTER_ID);
storagePath += "/" + clusterId;
return new FileSystemBlobStore(fileSystem, storagePath);
}
Aggregations