public interface GridGgfs
ggstart.sh or
ggstart.bat scripts, like this: ggstart.sh config/hadoop/default-config.xml
GGFS 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.
GGFS can be integrated with Hadoop by
plugging in as Hadoop FileSystem. Refer to
org.gridgain.grid.ggfs.hadoop.v1.GridGgfsHadoopFileSystem or
org.gridgain.grid.ggfs.hadoop.v2.GridGgfsHadoopFileSystem 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 |
PROP_GROUP_NAME
Property: group name.
|
static String |
PROP_PERMISSION
Property: permission.
|
static String |
PROP_USER_NAME
Property: user name.
|
| Modifier and Type | Method and Description |
|---|---|
Collection<GridGgfsBlockLocation> |
affinity(GridGgfsPath path,
long start,
long len)
Gets affinity block locations for data blocks of the file, i.e.
|
Collection<GridGgfsBlockLocation> |
affinity(GridGgfsPath path,
long start,
long len,
long maxLen)
Get affinity block locations for data blocks of the file.
|
GridGgfsOutputStream |
append(GridGgfsPath path,
boolean create)
Opens an output stream to an existing file for appending data.
|
GridGgfsOutputStream |
append(GridGgfsPath path,
int bufSize,
boolean create,
Map<String,String> props)
Opens an output stream to an existing file for appending data.
|
GridGgfsConfiguration |
configuration()
Gets GGFS configuration.
|
GridGgfsOutputStream |
create(GridGgfsPath path,
boolean overwrite)
Creates a file and opens it for writing.
|
GridGgfsOutputStream |
create(GridGgfsPath path,
int bufSize,
boolean overwrite,
GridUuid affKey,
int replication,
long blockSize,
Map<String,String> props)
Creates a file and opens it for writing.
|
boolean |
delete(GridGgfsPath path,
boolean recursive)
Deletes file.
|
<T,R> GridFuture<R> |
execute(Class<? extends GridGgfsTask<T,R>> taskCls,
GridGgfsRecordResolver rslvr,
Collection<GridGgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes GGFS task asynchronously with overridden maximum range length (see
GridGgfsConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> GridFuture<R> |
execute(Class<? extends GridGgfsTask<T,R>> taskCls,
GridGgfsRecordResolver rslvr,
Collection<GridGgfsPath> paths,
T arg)
Executes GGFS task asynchronously.
|
<T,R> GridFuture<R> |
execute(GridGgfsTask<T,R> task,
GridGgfsRecordResolver rslvr,
Collection<GridGgfsPath> paths,
boolean skipNonExistentFiles,
long maxRangeLen,
T arg)
Executes GGFS task asynchronously with overridden maximum range length (see
GridGgfsConfiguration.getMaximumTaskRangeLength() for more information). |
<T,R> GridFuture<R> |
execute(GridGgfsTask<T,R> task,
GridGgfsRecordResolver rslvr,
Collection<GridGgfsPath> paths,
T arg)
Executes GGFS task asynchronously.
|
boolean |
exists(GridGgfsPath path)
Checks if the specified path exists in the file system.
|
GridFuture<?> |
format()
Formats the file system removing all existing entries from it.
|
GridGgfsFile |
info(GridGgfsPath path)
Gets file information for the specified path.
|
Collection<GridGgfsFile> |
listFiles(GridGgfsPath path)
Lists files under the specified path.
|
Collection<GridGgfsPath> |
listPaths(GridGgfsPath path)
Lists file paths under the specified path.
|
GridGgfsMetrics |
metrics()
Gets metrics snapshot for this file system.
|
void |
mkdirs(GridGgfsPath path)
Creates directories under specified path.
|
void |
mkdirs(GridGgfsPath path,
Map<String,String> props)
Creates directories under specified path with the specified properties.
|
String |
name()
Gets GGFS name.
|
GridGgfsInputStream |
open(GridGgfsPath path)
Opens a file for reading.
|
GridGgfsInputStream |
open(GridGgfsPath path,
int bufSize)
Opens a file for reading.
|
GridGgfsInputStream |
open(GridGgfsPath path,
int bufSize,
int seqReadsBeforePrefetch)
Opens a file for reading.
|
void |
rename(GridGgfsPath src,
GridGgfsPath dest)
Renames/moves a file.
|
void |
resetMetrics()
Resets metrics for this file system.
|
void |
setTimes(GridGgfsPath path,
long accessTime,
long modificationTime)
Sets last access time and last modification time for a given path.
|
long |
size(GridGgfsPath path)
Determines size of the file denoted by provided path.
|
GridGgfsPathSummary |
summary(GridGgfsPath path)
Gets summary (total number of files, total number of directories and total length)
for a given path.
|
GridGgfsFile |
update(GridGgfsPath path,
Map<String,String> props)
Updates file information for the specified path.
|
static final String PROP_USER_NAME
static final String PROP_GROUP_NAME
static final String PROP_PERMISSION
GridGgfsConfiguration configuration()
boolean exists(GridGgfsPath path) throws GridException
path - Path to check for existence in the file system.True if such file exists, otherwise - false.GridException - In case of error.@Nullable GridGgfsFile info(GridGgfsPath path) throws GridException
path - Path to get information for.null if such path does not exist.GridException - In case of error.GridGgfsPathSummary summary(GridGgfsPath path) throws GridException
path - Path to get information for.GridGgfsFileNotFoundException - If path is not found.GridException - If failed.@Nullable GridGgfsFile update(GridGgfsPath path, Map<String,String> props) throws GridException
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.path - File path to set properties for.props - Properties to update.null if such path does not exist.GridException - In case of error.void rename(GridGgfsPath src, GridGgfsPath dest) throws GridException
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.GridException - In case of error.GridGgfsFileNotFoundException - If source file doesn't exist.boolean delete(GridGgfsPath path, boolean recursive) throws GridException
path - File path to delete.recursive - Delete non-empty directories recursively.True in case of success, false otherwise.GridException - In case of error.void mkdirs(GridGgfsPath path) throws GridException
path - Path of directories chain to create.GridException - In case of error.void mkdirs(GridGgfsPath path, @Nullable Map<String,String> props) throws GridException
path - Path of directories chain to create.props - Metadata properties to set on created directories.GridException - In case of error.Collection<GridGgfsPath> listPaths(GridGgfsPath path) throws GridException
path - Path to list files under.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.Collection<GridGgfsFile> listFiles(GridGgfsPath path) throws GridException
path - Path to list files under.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.GridGgfsInputStream open(GridGgfsPath path) throws GridException
path - File path to read.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.GridGgfsInputStream open(GridGgfsPath path, int bufSize) throws GridException
path - File path to read.bufSize - Read buffer size (bytes) or zero to use default value.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.GridGgfsInputStream open(GridGgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws GridException
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.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.GridGgfsOutputStream create(GridGgfsPath path, boolean overwrite) throws GridException
path - File path to create.overwrite - Overwrite file if it already exists. Note: you cannot overwrite an existent directory.GridException - In case of error.GridGgfsOutputStream create(GridGgfsPath path, int bufSize, boolean overwrite, @Nullable GridUuid affKey, int replication, long blockSize, @Nullable Map<String,String> props) throws GridException
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.GridException - In case of error.GridGgfsOutputStream append(GridGgfsPath path, boolean create) throws GridException
path - File path to append.create - Create file if it doesn't exist yet.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist and create flag is false.GridGgfsOutputStream append(GridGgfsPath path, int bufSize, boolean create, @Nullable Map<String,String> props) throws GridException
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.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist and create flag is false.void setTimes(GridGgfsPath path, long accessTime, long modificationTime) throws GridException
null,
corresponding time will not be changed.path - Path to update.accessTime - Optional last access time to set. Value -1 does not update access time.modificationTime - Optional last modification time to set. Value -1 does not update
modification time.GridGgfsFileNotFoundException - If target was not found.GridException - If error occurred.Collection<GridGgfsBlockLocation> affinity(GridGgfsPath path, long start, long len) throws GridException
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.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.Collection<GridGgfsBlockLocation> affinity(GridGgfsPath path, long start, long len, long maxLen) throws GridException
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.GridException - In case of error.GridGgfsFileNotFoundException - If path doesn't exist.GridGgfsMetrics metrics() throws GridException
GridException - In case of error.void resetMetrics()
throws GridException
GridException - In case of error.long size(GridGgfsPath path) throws GridException
path - File system path.GridException - In case of error.GridFuture<?> format() throws GridException
GridException - In case format has failed.<T,R> GridFuture<R> execute(GridGgfsTask<T,R> task, @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, @Nullable T arg) throws GridException
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.GridException - If execution failed.<T,R> GridFuture<R> execute(GridGgfsTask<T,R> task, @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws GridException
GridGgfsConfiguration.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
GGFS blocks will be included.arg - Optional task argument.GridException - If execution failed.<T,R> GridFuture<R> execute(Class<? extends GridGgfsTask<T,R>> taskCls, @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, @Nullable T arg) throws GridException
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.GridException - If execution failed.<T,R> GridFuture<R> execute(Class<? extends GridGgfsTask<T,R>> taskCls, @Nullable GridGgfsRecordResolver rslvr, Collection<GridGgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg) throws GridException
GridGgfsConfiguration.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.GridException - If execution failed.Copyright © 2014. All rights reserved.