@PublicAPIClass(maturity=EVOLVING) public abstract class HoodieStorage extends Object implements Closeable
org.apache.hadoop.fs.FileSystem class.| Modifier and Type | Field and Description |
|---|---|
static org.slf4j.Logger |
LOG |
protected StorageConfiguration<?> |
storageConf |
| Constructor and Description |
|---|
HoodieStorage(StorageConfiguration<?> storageConf) |
| Modifier and Type | Method and Description |
|---|---|
abstract OutputStream |
append(StoragePath path)
Appends to an existing file (optional operation).
|
OutputStream |
create(StoragePath path)
Create an OutputStream at the indicated path.
|
abstract OutputStream |
create(StoragePath path,
boolean overwrite)
Creates an OutputStream at the indicated path.
|
abstract OutputStream |
create(StoragePath path,
boolean overwrite,
Integer bufferSize,
Short replication,
Long sizeThreshold)
Creates an OutputStream at the indicated path.
|
abstract boolean |
createDirectory(StoragePath path)
Creates the directory and non-existent parent directories.
|
void |
createImmutableFileInPath(StoragePath path,
Option<HoodieInstantWriter> contentWriter)
Creates a new file with overwrite set to false.
|
void |
createImmutableFileInPath(StoragePath path,
Option<HoodieInstantWriter> contentWriter,
boolean needTempFile)
Creates a new file with overwrite set to false.
|
boolean |
createNewFile(StoragePath path)
Creates an empty new file at the indicated path.
|
abstract boolean |
deleteDirectory(StoragePath path)
Deletes a directory at path.
|
abstract boolean |
deleteFile(StoragePath path)
Deletes a file at path.
|
abstract boolean |
exists(StoragePath path)
Checks if a path exists.
|
StorageConfiguration<?> |
getConf() |
abstract int |
getDefaultBlockSize(StoragePath path) |
abstract int |
getDefaultBufferSize() |
abstract short |
getDefaultReplication(StoragePath path) |
abstract Object |
getFileSystem() |
abstract StoragePathInfo |
getPathInfo(StoragePath path)
Returns a
StoragePathInfo object that represents the path. |
abstract HoodieStorage |
getRawStorage() |
abstract String |
getScheme() |
abstract URI |
getUri()
Returns a URI which identifies this HoodieStorage.
|
List<StoragePathInfo> |
globEntries(StoragePath pathPattern)
Returns all the files that match the pathPattern and are not checksum files.
|
abstract List<StoragePathInfo> |
globEntries(StoragePath pathPattern,
StoragePathFilter filter)
Returns all the files that match the pathPattern and are not checksum files,
and filters the results.
|
List<StoragePathInfo> |
listDirectEntries(List<StoragePath> pathList)
Lists the file info of the direct files/directories in the given list of paths,
if the paths are directory.
|
List<StoragePathInfo> |
listDirectEntries(List<StoragePath> pathList,
StoragePathFilter filter)
Lists the file info of the direct files/directories in the given list of paths
and filters the results, if the paths are directory.
|
abstract List<StoragePathInfo> |
listDirectEntries(StoragePath path)
Lists the path info of the direct files/directories in the given path if the path is a directory.
|
abstract List<StoragePathInfo> |
listDirectEntries(StoragePath path,
StoragePathFilter filter)
Lists the path info of the direct files/directories in the given path
and filters the results, if the path is a directory.
|
abstract List<StoragePathInfo> |
listFiles(StoragePath path)
Lists the path info of all files under the give path recursively.
|
boolean |
needCreateTempFile() |
abstract HoodieStorage |
newInstance(StoragePath path,
StorageConfiguration<?> storageConf) |
abstract InputStream |
open(StoragePath path)
Opens an InputStream at the indicated path.
|
SeekableDataInputStream |
openSeekable(StoragePath path,
boolean wrapStream)
Opens an SeekableDataInputStream at the indicated path with seeks supported.
|
abstract SeekableDataInputStream |
openSeekable(StoragePath path,
int bufferSize,
boolean wrapStream)
Opens an SeekableDataInputStream at the indicated path with seeks supported.
|
abstract boolean |
rename(StoragePath oldPath,
StoragePath newPath)
Renames the path from old to new.
|
abstract void |
setModificationTime(StoragePath path,
long modificationTimeInMillisEpoch)
Sets Modification Time for the storage Path
|
public static final org.slf4j.Logger LOG
protected final StorageConfiguration<?> storageConf
public HoodieStorage(StorageConfiguration<?> storageConf)
@PublicAPIMethod(maturity=EVOLVING) public abstract HoodieStorage newInstance(StoragePath path, StorageConfiguration<?> storageConf)
path - path to instantiate the storage.storageConf - new storage configuration.HoodieStorage instance with the configuration.@PublicAPIMethod(maturity=EVOLVING) public abstract String getScheme()
@PublicAPIMethod(maturity=EVOLVING) public abstract int getDefaultBlockSize(StoragePath path)
@PublicAPIMethod(maturity=EVOLVING) public abstract int getDefaultBufferSize()
@PublicAPIMethod(maturity=EVOLVING) public abstract short getDefaultReplication(StoragePath path)
@PublicAPIMethod(maturity=EVOLVING) public abstract URI getUri()
@PublicAPIMethod(maturity=EVOLVING) public abstract OutputStream create(StoragePath path, boolean overwrite) throws IOException
path - the file to create.overwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an exception will be thrown.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract OutputStream create(StoragePath path, boolean overwrite, Integer bufferSize, Short replication, Long sizeThreshold) throws IOException
path - the file to createoverwrite - if a file with this name already exists, then if true,
the file will be overwritten, and if false an exception will be thrown.bufferSize - the size of the buffer to be usedreplication - required block replication for the filesizeThreshold - block sizeIOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract InputStream open(StoragePath path) throws IOException
path - the file to open.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract SeekableDataInputStream openSeekable(StoragePath path, int bufferSize, boolean wrapStream) throws IOException
path - the file to open.bufferSize - buffer size to use.wrapStream - true if we want to wrap the inputstream based on filesystem specific criteriaIOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract OutputStream append(StoragePath path) throws IOException
path - the file to append.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract boolean exists(StoragePath path) throws IOException
path - to check.true if the path exists.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract StoragePathInfo getPathInfo(StoragePath path) throws IOException
StoragePathInfo object that represents the path.path - to check.StoragePathInfo object.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract boolean createDirectory(StoragePath path) throws IOException
path - to create.true if the directory was created.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract List<StoragePathInfo> listDirectEntries(StoragePath path) throws IOException
path - given path.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract List<StoragePathInfo> listFiles(StoragePath path) throws IOException
path - given path.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract List<StoragePathInfo> listDirectEntries(StoragePath path, StoragePathFilter filter) throws IOException
path - given path.filter - filter to apply.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract void setModificationTime(StoragePath path, long modificationTimeInMillisEpoch) throws IOException
path - modificationTimeInMillisEpoch - Millis since EpochIOException@PublicAPIMethod(maturity=EVOLVING) public abstract List<StoragePathInfo> globEntries(StoragePath pathPattern, StoragePathFilter filter) throws IOException
pathPattern - given pattern.filter - filter to apply.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract boolean rename(StoragePath oldPath, StoragePath newPath) throws IOException
oldPath - source path.newPath - destination path.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract boolean deleteDirectory(StoragePath path) throws IOException
path - directory to delete.true if successful.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract boolean deleteFile(StoragePath path) throws IOException
path - file to delete.true if successful.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public abstract Object getFileSystem()
@PublicAPIMethod(maturity=EVOLVING) public abstract HoodieStorage getRawStorage()
@PublicAPIMethod(maturity=EVOLVING) public final StorageConfiguration<?> getConf()
@PublicAPIMethod(maturity=EVOLVING) public final void createImmutableFileInPath(StoragePath path, Option<HoodieInstantWriter> contentWriter) throws HoodieIOException
CAUTION: if this method is invoked in multi-threads for concurrent write of the same file, an existence check of the file is recommended.
path - File path.contentWriter - handles writing the content to the outputstreamHoodieIOException@PublicAPIMethod(maturity=EVOLVING) public final void createImmutableFileInPath(StoragePath path, Option<HoodieInstantWriter> contentWriter, boolean needTempFile) throws HoodieIOException
CAUTION: if this method is invoked in multi-threads for concurrent write of the same file, an existence check of the file is recommended.
path - File path.contentWriter - handles writing the content to the outputstreamneedTempFile - Whether to create auxiliary temp file.HoodieIOException@PublicAPIMethod(maturity=EVOLVING) public final boolean needCreateTempFile()
@PublicAPIMethod(maturity=EVOLVING) public OutputStream create(StoragePath path) throws IOException
path - the file to create.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public boolean createNewFile(StoragePath path) throws IOException
path - the file to create.true if successfully created; false if already exists.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public SeekableDataInputStream openSeekable(StoragePath path, boolean wrapStream) throws IOException
path - the file to open.wrapStream - true if we want to wrap the inputstream based on filesystem specific criteriaIOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public List<StoragePathInfo> listDirectEntries(List<StoragePath> pathList) throws IOException
pathList - given path list.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public List<StoragePathInfo> listDirectEntries(List<StoragePath> pathList, StoragePathFilter filter) throws IOException
pathList - given path list.filter - filter to apply.FileNotFoundException - when the path does not exist.IOException - IO error.@PublicAPIMethod(maturity=EVOLVING) public List<StoragePathInfo> globEntries(StoragePath pathPattern) throws IOException
pathPattern - given pattern.IOException - IO error.Copyright © 2025 The Apache Software Foundation. All rights reserved.