public final class IgfsImpl extends Object implements IgfsEx
IGFS_SCHEME
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,
Map<String,String> props)
Opens an output stream to an existing file for appending data.
|
IgfsSecondaryFileSystem |
asSecondary()
Return the given IGFS as a secondary file system.
|
void |
await(IgfsPath... paths)
Await for any pending finished writes on the children paths.
|
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).
|
String |
clientLogDirectory()
Gets client file system log directory.
|
void |
clientLogDirectory(String logDir)
Sets client file system log directory.
|
FileSystemConfiguration |
configuration()
Gets IGFS configuration.
|
IgfsContext |
context() |
IgfsOutputStream |
create(IgfsPath path,
boolean overwrite)
Creates a file and opens it for writing.
|
IgfsOutputStream |
create(IgfsPath path,
int bufSize,
boolean overwrite,
IgniteUuid affKey,
int replication,
long blockSize,
Map<String,String> props)
Creates a file and opens it for writing.
|
IgfsOutputStream |
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 |
evictExclude(IgfsPath path,
boolean primary)
Whether this path is excluded from evictions.
|
<T,R> R |
execute(Class<? extends IgfsTask<T,R>> taskCls,
IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeSize,
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,
IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task.
|
<T,R> R |
execute(IgfsTask<T,R> task,
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,
IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task.
|
<T,R> IgniteFuture<R> |
executeAsync(Class<? extends IgfsTask<T,R>> taskCls,
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,
IgfsRecordResolver rslvr,
Collection<IgfsPath> paths,
T arg)
Executes IGFS task asynchronously.
|
<T,R> IgniteFuture<R> |
executeAsync(IgfsTask<T,R> task,
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,
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.
|
<R> IgniteFuture<R> |
future()
Gets and resets future for previous asynchronous operation.
|
Boolean |
globalSampling()
Get sampling state.
|
void |
globalSampling(Boolean val)
Enables, disables or clears sampling flag.
|
IgfsStatus |
globalSpace()
Gets global space counters.
|
long |
groupBlockSize()
Gets group block size, i.e. block size multiplied by group size in affinity mapper.
|
IgfsFile |
info(IgfsPath path)
Gets file information for the specified path.
|
boolean |
isAsync() |
boolean |
isProxy(URI path)
Check whether the given path is proxy 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,
Map<String,String> props)
Creates directories under specified path with the specified properties.
|
IgfsMode |
mode(IgfsPath path)
Get mode for the given path.
|
IgfsModeResolver |
modeResolver() |
String |
name()
Gets IGFS name.
|
IgniteUuid |
nextAffinityKey()
Get next affinity key.
|
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.
|
void |
stop(boolean cancel)
Stops IGFS cleaning all used resources.
|
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()
Gets instance of this component with asynchronous mode enabled.
|
public void stop(boolean cancel)
public void await(IgfsPath... paths)
public IgfsContext context()
public IgfsModeResolver modeResolver()
public String name()
name
in interface IgniteFileSystem
public FileSystemConfiguration configuration()
configuration
in interface IgniteFileSystem
public String clientLogDirectory()
clientLogDirectory
in interface IgfsEx
null
in case no client connections have been created yet.public void clientLogDirectory(String logDir)
clientLogDirectory
in interface IgfsEx
logDir
- Client file system log directory.public IgfsStatus globalSpace()
globalSpace
in interface IgfsEx
public void globalSampling(@Nullable Boolean val) throws IgniteCheckedException
globalSampling
in interface IgfsEx
val
- True
to turn on sampling, false
to turn it off, null
to clear sampling state.IgniteCheckedException
- If failed.@Nullable public Boolean globalSampling()
globalSampling
in interface IgfsEx
True
in case sampling is enabled, false
otherwise, or null
in case sampling
flag is not set.public long groupBlockSize()
groupBlockSize
in interface IgfsEx
public boolean exists(IgfsPath path)
exists
in interface IgniteFileSystem
path
- Path to check for existence in the file system.True
if such file exists, otherwise - false
.@Nullable public IgfsFile info(IgfsPath path)
info
in interface IgniteFileSystem
path
- Path to get information for.null
if such path does not exist.public IgfsMode mode(IgfsPath path)
mode
in interface IgniteFileSystem
path
- Path.public IgfsPathSummary summary(IgfsPath path)
summary
in interface IgniteFileSystem
path
- Path to get information for.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 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.update
in interface IgniteFileSystem
path
- 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 IgniteFileSystem
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.public boolean delete(IgfsPath path, boolean recursive)
delete
in interface IgniteFileSystem
path
- 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 IgniteFileSystem
path
- Path of directories chain to create.public void mkdirs(IgfsPath path, @Nullable Map<String,String> props)
mkdirs
in interface IgniteFileSystem
path
- Path of directories chain to create.props
- Metadata properties to set on created directories.public Collection<IgfsPath> listPaths(IgfsPath path)
listPaths
in interface IgniteFileSystem
path
- Path to list files under.public Collection<IgfsFile> listFiles(IgfsPath path)
listFiles
in interface IgniteFileSystem
path
- Path to list files under.public long usedSpaceSize()
usedSpaceSize
in interface IgniteFileSystem
public IgfsInputStream open(IgfsPath path)
open
in interface IgniteFileSystem
path
- File path to read.public IgfsInputStream open(IgfsPath path, int bufSize)
open
in interface IgniteFileSystem
path
- File path to read.bufSize
- Read buffer size (bytes) or zero
to use default value.public IgfsInputStream open(IgfsPath path, int bufSize, int seqReadsBeforePrefetch)
open
in interface IgniteFileSystem
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.public IgfsOutputStream create(IgfsPath path, boolean overwrite)
create
in interface IgniteFileSystem
path
- File path to create.overwrite
- Overwrite file if it already exists. Note: you cannot overwrite an existent directory.public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize, @Nullable Map<String,String> props)
create
in interface IgniteFileSystem
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.public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, @Nullable IgniteUuid affKey, int replication, long blockSize, @Nullable Map<String,String> props)
create
in interface IgniteFileSystem
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.public IgfsOutputStream append(IgfsPath path, boolean create)
append
in interface IgniteFileSystem
path
- File path to append.create
- Create file if it doesn't exist yet.public IgfsOutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable Map<String,String> props)
append
in interface IgniteFileSystem
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.public void setTimes(IgfsPath path, long modificationTime, long accessTime)
null
,
corresponding time will not be changed.setTimes
in interface IgniteFileSystem
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.public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len)
affinity
in interface IgniteFileSystem
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.public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len, long maxLen)
maxLen
parameter is set and
particular block location length is greater than this value, block locations will be split into smaller
chunks.affinity
in interface IgniteFileSystem
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.public IgfsMetrics metrics()
metrics
in interface IgniteFileSystem
public void resetMetrics()
resetMetrics
in interface IgniteFileSystem
public long size(IgfsPath path)
size
in interface IgniteFileSystem
path
- File system path.public void clear()
clear
in interface IgniteFileSystem
public IgniteFuture<Void> clearAsync() throws IgniteException
clearAsync
in interface IgniteFileSystem
IgniteException
public <T,R> R execute(IgfsTask<T,R> task, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg)
execute
in interface IgniteFileSystem
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.public <T,R> IgniteFuture<R> executeAsync(IgfsTask<T,R> task, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
executeAsync
in interface IgniteFileSystem
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.public <T,R> R execute(IgfsTask<T,R> task, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).
Supports asynchronous execution (see IgniteAsyncSupport
).
execute
in interface IgniteFileSystem
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.public <T,R> IgniteFuture<R> executeAsync(IgfsTask<T,R> task, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).executeAsync
in interface IgniteFileSystem
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.public <T,R> R execute(Class<? extends IgfsTask<T,R>> taskCls, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg)
Supports asynchronous execution (see IgniteAsyncSupport
).
execute
in interface IgniteFileSystem
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.public <T,R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T,R>> taskCls, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException
executeAsync
in interface IgniteFileSystem
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.public <T,R> R execute(Class<? extends IgfsTask<T,R>> taskCls, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeSize, @Nullable T arg)
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).
Supports asynchronous execution (see IgniteAsyncSupport
).
execute
in interface IgniteFileSystem
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.maxRangeSize
- Maximum range length.arg
- Optional task argument.public <T,R> IgniteFuture<R> executeAsync(Class<? extends IgfsTask<T,R>> taskCls, @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws IgniteException
FileSystemConfiguration.getMaximumTaskRangeLength()
for more information).executeAsync
in interface IgniteFileSystem
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.public boolean evictExclude(IgfsPath path, boolean primary)
evictExclude
in interface IgfsEx
path
- Path.primary
- Whether the mode is PRIMARY.True
if path is excluded from evictions.public IgniteFileSystem withAsync()
withAsync
in interface IgniteFileSystem
withAsync
in interface IgniteAsyncSupport
public boolean isAsync()
isAsync
in interface IgniteAsyncSupport
True
if asynchronous mode is enabled.public <R> IgniteFuture<R> future()
future
in interface IgniteAsyncSupport
public IgniteUuid nextAffinityKey()
nextAffinityKey
in interface IgfsEx
public boolean isProxy(URI path)
public IgfsSecondaryFileSystem asSecondary()
asSecondary
in interface IgfsEx
Follow @ApacheIgnite
Ignite Fabric : ver. 2.0.0 Release Date : April 30 2017