@PublicEvolving public class EntropyInjector extends Object
EntropyInjectingFileSystem
.Modifier and Type | Method and Description |
---|---|
static Path |
addEntropy(FileSystem fs,
Path path)
Handles entropy injection across regular and entropy-aware file systems.
|
static OutputStreamAndPath |
createEntropyAware(FileSystem fs,
Path path,
FileSystem.WriteMode writeMode)
Handles entropy injection across regular and entropy-aware file systems.
|
static boolean |
isEntropyInjecting(FileSystem fs,
Path target) |
static Path |
removeEntropyMarkerIfPresent(FileSystem fs,
Path path)
Removes the entropy marker string from the path, if the given file system is an
entropy-injecting file system (implements
EntropyInjectingFileSystem ) and the entropy
marker key is present. |
public static Path addEntropy(FileSystem fs, Path path) throws IOException
If the given file system is entropy-aware (a implements EntropyInjectingFileSystem
), then this method replaces the entropy marker in the path with
random characters. The entropy marker is defined by EntropyInjectingFileSystem.getEntropyInjectionKey()
.
If the given file system does not implement EntropyInjectingFileSystem
, then this
method returns the same path.
IOException
public static OutputStreamAndPath createEntropyAware(FileSystem fs, Path path, FileSystem.WriteMode writeMode) throws IOException
If the given file system is entropy-aware (a implements EntropyInjectingFileSystem
), then this method replaces the entropy marker in the path with
random characters. The entropy marker is defined by EntropyInjectingFileSystem.getEntropyInjectionKey()
.
If the given file system does not implement EntropyInjectingFileSystem
, then this
method delegates to FileSystem.create(Path, WriteMode)
and returns the same path in
the resulting OutputStreamAndPath
.
IOException
public static Path removeEntropyMarkerIfPresent(FileSystem fs, Path path)
EntropyInjectingFileSystem
) and the entropy
marker key is present. Otherwise, this returns the path as is.path
- The path to filter.public static boolean isEntropyInjecting(FileSystem fs, Path target)
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.