public interface IgniteFileSystem extends IgniteAsyncSupport
ignite.sh
or
ignite.bat
scripts, like this: ignite.sh config/hadoop/default-config.xml
IGFS
can be started as a data node or as a client node. Data node is responsible for
caching data, while client node is responsible for basic file system operations and accessing
data nodes remotely. When used as Hadoop file system, clients nodes usually started together
with job-submitter
or job-scheduler
processes, while data nodes are usually
started together with Hadoop task-tracker
processes.
IGFS
can be integrated with Hadoop
by
plugging in as Hadoop FileSystem
. Refer to
org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem
or
org.apache.ignite.hadoop.fs.v2.IgniteHadoopFileSystem
for more information.
NOTE: integration with Hadoop is available only in In-Memory Accelerator For Hadoop
edition.
Modifier and Type | Field and Description |
---|---|
static String |
IGFS_SCHEME
IGFS scheme name.
|
Modifier and Type | Method and Description |
---|---|
Collection<IgfsBlockLocation> |
affinity(IgfsPath path,
long start,
long len)
Gets affinity block locations for data blocks of the file, i.e. the nodes, on which the blocks
are stored.
|
Collection<IgfsBlockLocation> |
affinity(IgfsPath path,
long start,
long len,
long maxLen)
Get affinity block locations for data blocks of the file.
|
IgfsOutputStream |
append(IgfsPath path,
boolean create)
Opens an output stream to an existing file for appending data.
|
IgfsOutputStream |
append(IgfsPath path,
int bufSize,
boolean create,
@Nullable Map<String,String> props)
Opens an output stream to an existing file for appending data.
|
void |
clear()
Formats the file system removing all existing entries from it, but not removing anything in secondary
file system (if any).
|
IgniteFuture<Void> |
clearAsync()
Formats the file system removing all existing entries from it, but not removing anything in secondary
file system (if any).
|
FileSystemConfiguration |
configuration()
Gets IGFS configuration.
|
IgfsOutputStream |
create(IgfsPath path,
boolean overwrite)
Creates a file and opens it for writing.
|
IgfsOutputStream |
create(IgfsPath path,
int bufSize,
boolean overwrite,
@Nullable IgniteUuid affKey,
int replication,
long blockSize,
@Nullable Map<String,String> props)
Creates a file and opens it for writing.
|
IgfsOutputStream |
create(IgfsPath path,
int bufSize,
boolean overwrite,
int replication,
long blockSize,
@Nullable Map<String,String> props)
Creates a file and opens it for writing.
|
boolean |
delete(IgfsPath path,
boolean recursive)
Deletes file.
|
<T,R> R |
execute(Class<? extends IgfsTask<T,R>> taskCls,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes IGFS task with overridden maximum range length (see
FileSystemConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> R |
execute(Class<? extends IgfsTask<T,R>> taskCls,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task.
|
<T,R> R |
execute(IgfsTask<T,R> task,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes IGFS task with overridden maximum range length (see
FileSystemConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> R |
execute(IgfsTask<T,R> task,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task.
|
<T,R> IgniteFuture<R> |
executeAsync(Class<? extends IgfsTask<T,R>> taskCls,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes IGFS task asynchronously with overridden maximum range length (see
FileSystemConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> IgniteFuture<R> |
executeAsync(Class<? extends IgfsTask<T,R>> taskCls,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task asynchronously.
|
<T,R> IgniteFuture<R> |
executeAsync(IgfsTask<T,R> task,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes IGFS task asynchronously with overridden maximum range length (see
FileSystemConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> IgniteFuture<R> |
executeAsync(IgfsTask<T,R> task,
@Nullable IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task asynchronously.
|
boolean |
exists(IgfsPath path)
Checks if the specified path exists in the file system.
|
@Nullable 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.
|
IgfsMetrics |
metrics()
Gets metrics snapshot for this file system.
|
void |
mkdirs(IgfsPath path)
Creates directories under specified path.
|
void |
mkdirs(IgfsPath path,
@Nullable Map<String,String> props)
Creates directories under specified path with the specified properties.
|
IgfsMode |
mode(IgfsPath path)
Get mode for the given path.
|
String |
name()
Gets IGFS name.
|
IgfsInputStream |
open(IgfsPath path)
Opens a file for reading.
|
IgfsInputStream |
open(IgfsPath path,
int bufSize)
Opens a file for reading.
|
IgfsInputStream |
open(IgfsPath path,
int bufSize,
int seqReadsBeforePrefetch)
Opens a file for reading.
|
void |
rename(IgfsPath src,
IgfsPath dest)
Renames/moves a file.
|
void |
resetMetrics()
Resets metrics for this file system.
|
void |
setTimes(IgfsPath path,
long modificationTime,
long accessTime)
Sets last access time and last modification time for a given path.
|
long |
size(IgfsPath path)
Determines size of the file denoted by provided path.
|
IgfsPathSummary |
summary(IgfsPath path)
Gets summary (total number of files, total number of directories and total length)
for a given path.
|
IgfsFile |
update(IgfsPath path,
Map<String,String> props)
Updates file information for the specified path.
|
long |
usedSpaceSize()
Gets used space in bytes.
|
IgniteFileSystem |
withAsync()
Deprecated.
|
future, isAsync
static final String IGFS_SCHEME
String name()
FileSystemConfiguration configuration()
IgfsPathSummary summary(IgfsPath path) throws IgniteException
path
- Path to get information for.IgfsPathNotFoundException
- If path is not found.IgniteException
- If failed.IgfsInputStream open(IgfsPath path) throws IgniteException
path
- File path to read.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.IgfsInputStream open(IgfsPath path, int bufSize) throws IgniteException
path
- File path to read.bufSize
- Read buffer size (bytes) or zero
to use default value.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.IgfsInputStream open(IgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws IgniteException
path
- File path to read.bufSize
- Read buffer size (bytes) or zero
to use default value.seqReadsBeforePrefetch
- Amount of sequential reads before prefetch is started.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.IgfsOutputStream create(IgfsPath path, boolean overwrite) throws IgniteException
path
- File path to create.overwrite
- Overwrite file if it already exists. Note: you cannot overwrite an existent directory.IgniteException
- In case of error.IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize, @Nullable @Nullable Map<String,String> props) throws IgniteException
path
- 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.IgniteException
- In case of error.IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, @Nullable @Nullable IgniteUuid affKey, int replication, long blockSize, @Nullable @Nullable Map<String,String> props) throws IgniteException
path
- 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.affKey
- Affinity key used to store file blocks. If not null
, the whole file will be
stored on node where affKey
resides.replication
- Replication factor.blockSize
- Block size.props
- File properties to set.IgniteException
- In case of error.IgfsOutputStream append(IgfsPath path, boolean create) throws IgniteException
path
- File path to append.create
- Create file if it doesn't exist yet.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist and create flag is false
.IgfsOutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable @Nullable Map<String,String> props) throws IgniteException
path
- 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.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist and create flag is false
.void setTimes(IgfsPath path, long modificationTime, long accessTime) throws IgniteException
null
,
corresponding time will not be changed.path
- Path to update.modificationTime
- Optional last modification time to set. Value -1
does not update
modification time.accessTime
- Optional last access time to set. Value -1
does not update access time.IgfsPathNotFoundException
- If target was not found.IgniteException
- If error occurred.Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len) throws IgniteException
path
- File path to get affinity for.start
- Position in the file to start affinity resolution from.len
- Size of data in the file to resolve affinity for.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len, long maxLen) throws IgniteException
maxLen
parameter is set and
particular block location length is greater than this value, block locations will be split into smaller
chunks.path
- File path to get affinity for.start
- Position in the file to start affinity resolution from.len
- Size of data in the file to resolve affinity for.maxLen
- Maximum length of a single returned block location length.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.IgfsMetrics metrics() throws IgniteException
IgniteException
- In case of error.void resetMetrics() throws IgniteException
IgniteException
- In case of error.long size(IgfsPath path) throws IgniteException
path
- File system path.IgniteException
- In case of error.void clear() throws IgniteException
IgniteException
- In case clear failed.IgniteFuture<Void> clearAsync() throws IgniteException
IgniteException
<T,R> R execute(IgfsTask<T,R> task, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
task
- Task to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> IgniteFuture<R> executeAsync(IgfsTask<T,R> task, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
task
- Task to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> R execute(IgfsTask<T,R> task, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).
Supports asynchronous execution (see IgniteAsyncSupport
).
task
- Task to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.skipNonExistentFiles
- Whether to skip non existent files. If set to true
non-existent files will
be ignored. Otherwise an exception will be thrown.maxRangeLen
- Optional maximum range length. If 0
, then by default all consecutive
IGFS blocks will be included.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> IgniteFuture<R> executeAsync(IgfsTask<T,R> task, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).task
- Task to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.skipNonExistentFiles
- Whether to skip non existent files. If set to true
non-existent files will
be ignored. Otherwise an exception will be thrown.maxRangeLen
- Optional maximum range length. If 0
, then by default all consecutive
IGFS blocks will be included.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> R execute(Class<? extends IgfsTask<T,R>> taskCls, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
Supports asynchronous execution (see IgniteAsyncSupport
).
taskCls
- Task class to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T,R>> taskCls, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
taskCls
- Task class to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> R execute(Class<? extends IgfsTask<T,R>> taskCls, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).
Supports asynchronous execution (see IgniteAsyncSupport
).
taskCls
- Task class to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.skipNonExistentFiles
- Whether to skip non existent files. If set to true
non-existent files will
be ignored. Otherwise an exception will be thrown.maxRangeLen
- Maximum range length.arg
- Optional task argument.IgniteException
- If execution failed.<T,R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T,R>> taskCls, @Nullable @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).taskCls
- Task class to execute.rslvr
- Optional resolver to control split boundaries.paths
- Collection of paths to be processed within this task.skipNonExistentFiles
- Whether to skip non existent files. If set to true
non-existent files will
be ignored. Otherwise an exception will be thrown.maxRangeLen
- Maximum range length.arg
- Optional task argument.IgniteException
- If execution failed.boolean exists(IgfsPath path)
path
- Path to check for existence in the file system.True
if such file exists, otherwise - false
.IgniteException
- In case of error.IgfsFile update(IgfsPath path, Map<String,String> props) throws IgniteException
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 with Hadoop secondary file system only the following properties will be updated:
usrName
- file owner name;grpName
- file owner group;permission
- Unix-style string representing file permissions.path
- File path to set properties for.props
- Properties to update.null
if such path does not exist.IgniteException
- In case of error.void rename(IgfsPath src, IgfsPath dest) throws IgniteException
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:
src
- 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.IgniteException
- In case of error.IgfsPathNotFoundException
- If source file doesn't exist.boolean delete(IgfsPath path, boolean recursive) throws IgniteException
path
- File path to delete.recursive
- Delete non-empty directories recursively.True
in case of success, false
otherwise.IgniteException
- In case of error.void mkdirs(IgfsPath path) throws IgniteException
path
- Path of directories chain to create.IgniteException
- In case of error.void mkdirs(IgfsPath path, @Nullable @Nullable Map<String,String> props) throws IgniteException
path
- Path of directories chain to create.props
- Metadata properties to set on created directories.IgniteException
- In case of error.Collection<IgfsPath> listPaths(IgfsPath path) throws IgniteException
path
- Path to list files under.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.Collection<IgfsFile> listFiles(IgfsPath path) throws IgniteException
path
- Path to list files under.IgniteException
- In case of error.IgfsPathNotFoundException
- If path doesn't exist.@Nullable @Nullable IgfsFile info(IgfsPath path) throws IgniteException
path
- Path to get information for.null
if such path does not exist.IgniteException
- In case of error.IgfsMode mode(IgfsPath path)
path
- Path.long usedSpaceSize() throws IgniteException
IgniteException
- In case of error.@Deprecated IgniteFileSystem withAsync()
withAsync
in interface IgniteAsyncSupport
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.7.2 Release Date : February 6 2019