public class IgniteHadoopIgfsSecondaryFileSystem extends Object implements IgfsSecondaryFileSystem, LifecycleAware, org.apache.ignite.internal.processors.hadoop.HadoopPayloadAware
FileSystem.
Target FileSystem's are created on per-user basis using passed HadoopFileSystemFactory.
| Constructor and Description |
|---|
IgniteHadoopIgfsSecondaryFileSystem()
Default constructor for Spring.
|
IgniteHadoopIgfsSecondaryFileSystem(String uri)
Deprecated.
Use
getFileSystemFactory() instead. |
IgniteHadoopIgfsSecondaryFileSystem(String uri,
String cfgPath)
Deprecated.
Use
getFileSystemFactory() instead. |
IgniteHadoopIgfsSecondaryFileSystem(String uri,
String cfgPath,
String userName)
Deprecated.
Use
getFileSystemFactory() instead. |
| Modifier and Type | Method and Description |
|---|---|
OutputStream |
append(IgfsPath path,
int bufSize,
boolean create,
Map<String,String> props)
Opens an output stream to an existing file for appending data.
|
static IgfsException |
cast(String msg,
IOException e)
Cast IO exception to IGFS exception.
|
OutputStream |
create(IgfsPath path,
boolean overwrite)
Creates a file and opens it for writing.
|
OutputStream |
create(IgfsPath path,
int bufSize,
boolean overwrite,
int replication,
long blockSize,
Map<String,String> props)
Creates a file and opens it for writing.
|
boolean |
delete(IgfsPath path,
boolean recursive)
Deletes file.
|
boolean |
exists(IgfsPath path)
Checks if the specified path exists.
|
FileSystem |
fileSystem()
Gets the underlying
FileSystem. |
String |
getDefaultUserName()
Gets default user name.
|
HadoopFileSystemFactory |
getFileSystemFactory()
Gets secondary file system factory.
|
HadoopFileSystemFactory |
getPayload() |
IgfsFile |
info(IgfsPath path)
Gets file information for the specified path.
|
Collection<IgfsFile> |
listFiles(IgfsPath path)
Lists files under the specified path.
|
Collection<IgfsPath> |
listPaths(IgfsPath path)
Lists file paths under the specified path.
|
void |
mkdirs(IgfsPath path)
Creates directories under specified path.
|
void |
mkdirs(IgfsPath path,
Map<String,String> props)
Creates directories under specified path with the specified properties.
|
IgfsSecondaryFileSystemPositionedReadable |
open(IgfsPath path,
int bufSize)
Opens a file for reading.
|
void |
rename(IgfsPath src,
IgfsPath dest)
Renames/moves a file.
|
void |
setDefaultUserName(String dfltUsrName)
Sets default user name.
|
void |
setFileSystemFactory(HadoopFileSystemFactory factory)
Sets secondary file system factory.
|
void |
start()
Starts grid component, called on grid start.
|
void |
stop()
Stops grid component, called on grid shutdown.
|
IgfsFile |
update(IgfsPath path,
Map<String,String> props)
Updates file information for the specified path.
|
long |
usedSpaceSize()
Gets used space in bytes.
|
public IgniteHadoopIgfsSecondaryFileSystem()
@Deprecated public IgniteHadoopIgfsSecondaryFileSystem(String uri) throws IgniteCheckedException
getFileSystemFactory() instead.uri - URI of file system.IgniteCheckedException - In case of error.@Deprecated public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath) throws IgniteCheckedException
getFileSystemFactory() instead.uri - URI of file system.cfgPath - Additional path to Hadoop configuration.IgniteCheckedException - In case of error.@Deprecated public IgniteHadoopIgfsSecondaryFileSystem(@Nullable String uri, @Nullable String cfgPath, @Nullable String userName) throws IgniteCheckedException
getFileSystemFactory() instead.uri - URI of file system.cfgPath - Additional path to Hadoop configuration.userName - User name.IgniteCheckedException - In case of error.@Nullable public String getDefaultUserName()
Defines user name which will be used during file system invocation in case no user name is defined explicitly
through FileSystem.get(URI, Configuration, String).
Also this name will be used if you manipulate IgniteFileSystem directly and do not set user name
explicitly using IgfsUserContext.doAs(String, IgniteOutClosure) or
IgfsUserContext.doAs(String, Callable) methods.
If not set value of system property "user.name" will be used. If this property is not set either,
"anonymous" will be used.
public void setDefaultUserName(@Nullable
String dfltUsrName)
getDefaultUserName() for details.dfltUsrName - Default user name.public HadoopFileSystemFactory getFileSystemFactory()
This factory will be used whenever a call to a target FileSystem is required.
If not set, CachingHadoopFileSystemFactory will be used.
public void setFileSystemFactory(HadoopFileSystemFactory factory)
getFileSystemFactory() for details.factory - Secondary file system factory.public static IgfsException cast(String msg, IOException e)
e - IO exception.public boolean exists(IgfsPath path)
exists in interface IgfsSecondaryFileSystempath - Path to check for existence.True if such file exists, otherwise - false.@Nullable public IgfsFile update(IgfsPath path, Map<String,String> props)
null values
will be removed from the stored properties or ignored if they don't exist in the file info.
When working in DUAL_SYNC or DUAL_ASYNC modes only the following properties will be propagated
to the secondary file system:
usrName - file owner name;grpName - file owner group;permission - Unix-style string representing file permissions.update in interface IgfsSecondaryFileSystempath - File path to set properties for.props - Properties to update.null if such path does not exist.public void rename(IgfsPath src, IgfsPath dest)
You are free to rename/move data files as you wish, but directories can be only renamed. You cannot move the directory between different parent directories.
Examples:
rename in interface IgfsSecondaryFileSystemsrc - Source file path to rename.dest - Destination file path. If destination path is a directory, then source file will be placed
into destination directory with original name.public boolean delete(IgfsPath path, boolean recursive)
delete in interface IgfsSecondaryFileSystempath - File path to delete.recursive - Delete non-empty directories recursively.True in case of success, false otherwise.public void mkdirs(IgfsPath path)
mkdirs in interface IgfsSecondaryFileSystempath - Path of directories chain to create.public void mkdirs(IgfsPath path, @Nullable Map<String,String> props)
mkdirs in interface IgfsSecondaryFileSystempath - Path of directories chain to create.props - Metadata properties to set on created directories.public Collection<IgfsPath> listPaths(IgfsPath path)
listPaths in interface IgfsSecondaryFileSystempath - Path to list files under.public Collection<IgfsFile> listFiles(IgfsPath path)
listFiles in interface IgfsSecondaryFileSystempath - Path to list files under.public IgfsSecondaryFileSystemPositionedReadable open(IgfsPath path, int bufSize)
open in interface IgfsSecondaryFileSystempath - File path to read.bufSize - Read buffer size (bytes) or zero to use default value.public OutputStream create(IgfsPath path, boolean overwrite)
create in interface IgfsSecondaryFileSystempath - File path to create.overwrite - Overwrite file if it already exists. Note: you cannot overwrite an existent directory.public OutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize, @Nullable Map<String,String> props)
create in interface IgfsSecondaryFileSystempath - File path to create.bufSize - Write buffer size (bytes) or zero to use default value.overwrite - Overwrite file if it already exists. Note: you cannot overwrite an existent directory.replication - Replication factor.blockSize - Block size.props - File properties to set.public OutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable Map<String,String> props)
append in interface IgfsSecondaryFileSystempath - File path to append.bufSize - Write buffer size (bytes) or zero to use default value.create - Create file if it doesn't exist yet.props - File properties to set only in case it file was just created.public IgfsFile info(IgfsPath path)
info in interface IgfsSecondaryFileSystempath - Path to get information for.null if such path does not exist.public long usedSpaceSize()
usedSpaceSize in interface IgfsSecondaryFileSystempublic FileSystem fileSystem()
FileSystem.
This method is used solely for testing.FileSystem.public void start()
throws IgniteException
start in interface LifecycleAwareIgniteException - If failed.public void stop()
throws IgniteException
stop in interface LifecycleAwareIgniteException - If failed.public HadoopFileSystemFactory getPayload()
getPayload in interface org.apache.ignite.internal.processors.hadoop.HadoopPayloadAware
Follow @ApacheIgnite
Ignite Fabric : ver. 1.5.11 Release Date : April 8 2016