# Renaming
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/3ba3dc44 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/3ba3dc44 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/3ba3dc44 Branch: refs/heads/master Commit: 3ba3dc44103f39273513b1dad885beb9526ac55d Parents: cd01ed9 Author: sboikov <sboi...@gridgain.com> Authored: Fri Dec 5 11:19:34 2014 +0300 Committer: sboikov <sboi...@gridgain.com> Committed: Fri Dec 5 11:19:34 2014 +0300 ---------------------------------------------------------------------- examples/config/filesystem/example-ggfs.xml | 2 +- .../main/java/org/apache/ignite/IgniteFs.java | 20 +- .../ggfs/GridGgfsCorruptedFileException.java | 42 ---- .../org/gridgain/grid/ggfs/GridGgfsFile.java | 112 --------- .../ggfs/GridGgfsFileNotFoundException.java | 36 --- .../gridgain/grid/ggfs/GridGgfsFileSystem.java | 208 ---------------- .../ggfs/GridGgfsGroupDataBlocksKeyMapper.java | 93 -------- .../grid/ggfs/IgniteFsConfiguration.java | 6 +- .../ggfs/IgniteFsCorruptedFileException.java | 42 ++++ .../org/gridgain/grid/ggfs/IgniteFsFile.java | 112 +++++++++ .../ggfs/IgniteFsFileNotFoundException.java | 36 +++ .../gridgain/grid/ggfs/IgniteFsFileSystem.java | 208 ++++++++++++++++ .../ggfs/IgniteFsGroupDataBlocksKeyMapper.java | 93 ++++++++ .../grid/ggfs/mapreduce/GridGgfsTask.java | 2 +- .../ggfs/common/GridGgfsControlResponse.java | 18 +- .../processors/ggfs/GridGgfsAsyncImpl.java | 6 +- .../processors/ggfs/GridGgfsAttributes.java | 6 +- .../processors/ggfs/GridGgfsDataManager.java | 4 +- .../processors/ggfs/GridGgfsFileImpl.java | 237 ------------------- .../kernal/processors/ggfs/GridGgfsImpl.java | 46 ++-- .../ggfs/GridGgfsInputStreamImpl.java | 6 +- .../processors/ggfs/GridGgfsMetaManager.java | 46 ++-- .../ggfs/GridGgfsOutputStreamImpl.java | 2 +- .../processors/ggfs/GridGgfsProcessor.java | 8 +- .../processors/ggfs/IgniteFsFileImpl.java | 237 +++++++++++++++++++ .../visor/node/VisorGgfsConfiguration.java | 2 +- modules/core/src/test/config/ggfs-loopback.xml | 2 +- .../core/src/test/config/ggfs-no-endpoint.xml | 2 +- modules/core/src/test/config/ggfs-shmem.xml | 2 +- .../ggfs/GridGgfsEventsAbstractSelfTest.java | 2 +- .../GridGgfsFragmentizerAbstractSelfTest.java | 6 +- ...heGgfsPerBlockLruEvictionPolicySelfTest.java | 4 +- .../ggfs/GridGgfsAbstractSelfTest.java | 26 +- .../processors/ggfs/GridGgfsCacheSelfTest.java | 2 +- .../ggfs/GridGgfsDataManagerSelfTest.java | 2 +- .../ggfs/GridGgfsDualAbstractSelfTest.java | 10 +- ...GgfsGroupDataBlockKeyMapperHashSelfTest.java | 8 +- .../ggfs/GridGgfsMetaManagerSelfTest.java | 2 +- .../ggfs/GridGgfsMetricsSelfTest.java | 4 +- .../processors/ggfs/GridGgfsModesSelfTest.java | 4 +- .../ggfs/GridGgfsProcessorSelfTest.java | 10 +- .../GridGgfsProcessorValidationSelfTest.java | 4 +- ...IpcEndpointRegistrationAbstractSelfTest.java | 2 +- .../processors/ggfs/GridGgfsSizeSelfTest.java | 2 +- .../ggfs/GridGgfsStreamsSelfTest.java | 8 +- .../processors/ggfs/GridGgfsTaskSelfTest.java | 2 +- .../GridGgfsAbstractRecordResolverSelfTest.java | 2 +- .../hadoop/v1/GridGgfsHadoopFileSystem.java | 10 +- .../hadoop/v2/GridGgfsHadoopFileSystem.java | 10 +- .../grid/kernal/ggfs/hadoop/GridGgfsHadoop.java | 6 +- .../hadoop/GridGgfsHadoopFileSystemWrapper.java | 26 +- .../ggfs/hadoop/GridGgfsHadoopInProc.java | 6 +- .../ggfs/hadoop/GridGgfsHadoopOutProc.java | 10 +- .../kernal/ggfs/hadoop/GridGgfsHadoopUtils.java | 2 +- .../ggfs/hadoop/GridGgfsHadoopWrapper.java | 18 +- .../GridHadoopClientProtocolSelfTest.java | 2 +- ...dGgfsHadoop20FileSystemAbstractSelfTest.java | 6 +- .../GridGgfsHadoopDualAbstractSelfTest.java | 6 +- ...ridGgfsHadoopFileSystemAbstractSelfTest.java | 6 +- .../GridGgfsHadoopFileSystemClientSelfTest.java | 2 +- ...idGgfsHadoopFileSystemHandshakeSelfTest.java | 2 +- ...ridGgfsHadoopFileSystemIpcCacheSelfTest.java | 2 +- .../GridGgfsHadoopFileSystemLoggerSelfTest.java | 4 +- ...GgfsHadoopFileSystemLoggerStateSelfTest.java | 2 +- ...fsHadoopFileSystemSecondaryModeSelfTest.java | 4 +- .../ggfs/GridGgfsNearOnlyMultiNodeSelfTest.java | 2 +- .../hadoop/GridHadoopAbstractSelfTest.java | 2 +- ...idHadoopDefaultMapReducePlannerSelfTest.java | 6 +- 68 files changed, 935 insertions(+), 935 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/examples/config/filesystem/example-ggfs.xml ---------------------------------------------------------------------- diff --git a/examples/config/filesystem/example-ggfs.xml b/examples/config/filesystem/example-ggfs.xml index 9c6ec1c..1387438 100644 --- a/examples/config/filesystem/example-ggfs.xml +++ b/examples/config/filesystem/example-ggfs.xml @@ -119,7 +119,7 @@ <property name="distributionMode" value="PARTITIONED_ONLY"/> <property name="backups" value="0"/> <property name="affinityMapper"> - <bean class="org.gridgain.grid.ggfs.GridGgfsGroupDataBlocksKeyMapper"> + <bean class="org.gridgain.grid.ggfs.IgniteFsGroupDataBlocksKeyMapper"> <!-- Haw many blocks in row will be stored on the same node. --> <constructor-arg value="512"/> </bean> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/apache/ignite/IgniteFs.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFs.java b/modules/core/src/main/java/org/apache/ignite/IgniteFs.java index 21b28fb..b2780fc 100644 --- a/modules/core/src/main/java/org/apache/ignite/IgniteFs.java +++ b/modules/core/src/main/java/org/apache/ignite/IgniteFs.java @@ -48,7 +48,7 @@ import java.util.*; * <p> * <b>NOTE:</b> integration with Hadoop is available only in {@code In-Memory Accelerator For Hadoop} edition. */ -public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { +public interface IgniteFs extends IgniteFsFileSystem, IgniteAsyncSupport { /** GGFS scheme name. */ public static final String GGFS_SCHEME = "ggfs"; @@ -75,7 +75,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * * @param path Path to get information for. * @return Summary object. - * @throws GridGgfsFileNotFoundException If path is not found. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path is not found. * @throws GridException If failed. */ public IgniteFsPathSummary summary(IgniteFsPath path) throws GridException; @@ -86,7 +86,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param path File path to read. * @return File input stream to read data from. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist. */ public GridGgfsInputStream open(IgniteFsPath path) throws GridException; @@ -97,7 +97,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param bufSize Read buffer size (bytes) or {@code zero} to use default value. * @return File input stream to read data from. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist. */ @Override public GridGgfsInputStream open(IgniteFsPath path, int bufSize) throws GridException; @@ -109,7 +109,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param seqReadsBeforePrefetch Amount of sequential reads before prefetch is started. * @return File input stream to read data from. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist. */ public GridGgfsInputStream open(IgniteFsPath path, int bufSize, int seqReadsBeforePrefetch) throws GridException; @@ -163,7 +163,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param create Create file if it doesn't exist yet. * @return File output stream to append data to. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist and create flag is {@code false}. */ public GridGgfsOutputStream append(IgniteFsPath path, boolean create) throws GridException; @@ -176,7 +176,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param props File properties to set only in case it file was just created. * @return File output stream to append data to. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist and create flag is {@code false}. */ @Override public GridGgfsOutputStream append(IgniteFsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) throws GridException; @@ -189,7 +189,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param accessTime Optional last access time to set. Value {@code -1} does not update access time. * @param modificationTime Optional last modification time to set. Value {@code -1} does not update * modification time. - * @throws GridGgfsFileNotFoundException If target was not found. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If target was not found. * @throws GridException If error occurred. */ public void setTimes(IgniteFsPath path, long accessTime, long modificationTime) throws GridException; @@ -203,7 +203,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param len Size of data in the file to resolve affinity for. * @return Affinity block locations. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist. */ public Collection<IgniteFsBlockLocation> affinity(IgniteFsPath path, long start, long len) throws GridException; @@ -218,7 +218,7 @@ public interface IgniteFs extends GridGgfsFileSystem, IgniteAsyncSupport { * @param maxLen Maximum length of a single returned block location length. * @return Affinity block locations. * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. + * @throws org.gridgain.grid.ggfs.IgniteFsFileNotFoundException If path doesn't exist. */ public Collection<IgniteFsBlockLocation> affinity(IgniteFsPath path, long start, long len, long maxLen) throws GridException; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsCorruptedFileException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsCorruptedFileException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsCorruptedFileException.java deleted file mode 100644 index 4159042..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsCorruptedFileException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.jetbrains.annotations.*; - -/** - * Exception thrown when target file's block is not found in data cache. - */ -public class GridGgfsCorruptedFileException extends IgniteFsException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param msg Error message. - */ - public GridGgfsCorruptedFileException(String msg) { - super(msg); - } - - /** - * @param cause Error cause. - */ - public GridGgfsCorruptedFileException(Throwable cause) { - super(cause); - } - - /** - * @param msg Error message. - * @param cause Error cause. - */ - public GridGgfsCorruptedFileException(String msg, @Nullable Throwable cause) { - super(msg, cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java deleted file mode 100644 index 558a961..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFile.java +++ /dev/null @@ -1,112 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * {@code GGFS} file or directory descriptor. For example, to get information about - * a file you would use the following code: - * <pre name="code" class="java"> - * GridGgfsPath filePath = new GridGgfsPath("my/working/dir", "file.txt"); - * - * // Get metadata about file. - * GridGgfsFile file = ggfs.info(filePath); - * </pre> - */ -public interface GridGgfsFile { - /** - * Gets path to file. - * - * @return Path to file. - */ - public IgniteFsPath path(); - - /** - * Check this file is a data file. - * - * @return {@code True} if this is a data file. - */ - public boolean isFile(); - - /** - * Check this file is a directory. - * - * @return {@code True} if this is a directory. - */ - public boolean isDirectory(); - - /** - * Gets file's length. - * - * @return File's length or {@code zero} for directories. - */ - public long length(); - - /** - * Gets file's data block size. - * - * @return File's data block size or {@code zero} for directories. - */ - public int blockSize(); - - /** - * Gets file group block size (i.e. block size * group size). - * - * @return File group block size. - */ - public long groupBlockSize(); - - /** - * Gets file last access time. File last access time is not updated automatically due to - * performance considerations and can be updated on demand with - * {@link org.apache.ignite.IgniteFs#setTimes(IgniteFsPath, long, long)} method. - * <p> - * By default last access time equals file creation time. - * - * @return Last access time. - */ - public long accessTime(); - - /** - * Gets file last modification time. File modification time is updated automatically on each file write and - * append. - * - * @return Last modification time. - */ - public long modificationTime(); - - /** - * Get file's property for specified name. - * - * @param name Name of the property. - * @return File's property for specified name. - * @throws IllegalArgumentException If requested property was not found. - */ - public String property(String name) throws IllegalArgumentException; - - /** - * Get file's property for specified name. - * - * @param name Name of the property. - * @param dfltVal Default value if requested property was not found. - * @return File's property for specified name. - */ - @Nullable public String property(String name, @Nullable String dfltVal); - - /** - * Get properties of the file. - * - * @return Properties of the file. - */ - public Map<String, String> properties(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileNotFoundException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileNotFoundException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileNotFoundException.java deleted file mode 100644 index 7bf969f..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileNotFoundException.java +++ /dev/null @@ -1,36 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -/** - * {@code GGFS} exception indicating that target resource is not found. - */ -public class GridGgfsFileNotFoundException extends GridGgfsInvalidPathException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Creates exception with error message specified. - * - * @param msg Error message. - */ - public GridGgfsFileNotFoundException(String msg) { - super(msg); - } - - /** - * Creates exception with given exception cause. - * - * @param cause Exception cause. - */ - public GridGgfsFileNotFoundException(Throwable cause) { - super(cause); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java deleted file mode 100644 index 2b57888..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsFileSystem.java +++ /dev/null @@ -1,208 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.gridgain.grid.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.util.*; - -/** - * Common file system interface. It provides a typical generalized "view" of any file system: - * <ul> - * <li>list directories or get information for a single path</li> - * <li>create/move/delete files or directories</li> - * <li>write/read data streams into/from files</li> - * </ul> - * - * This is the minimum of functionality that is needed to work as secondary file system in dual modes of GGFS. - */ -public interface GridGgfsFileSystem { - /** File property: user name. */ - public static final String PROP_USER_NAME = "usrName"; - - /** File property: group name. */ - public static final String PROP_GROUP_NAME = "grpName"; - - /** File property: permission. */ - public static final String PROP_PERMISSION = "permission"; - - /** - * Checks if the specified path exists in the file system. - * - * @param path Path to check for existence in the file system. - * @return {@code True} if such file exists, otherwise - {@code false}. - * @throws GridException In case of error. - */ - public boolean exists(IgniteFsPath path) throws GridException; - - /** - * Updates file information for the specified path. Existent properties, not listed in the passed collection, - * will not be affected. Other properties will be added or overwritten. Passed properties with {@code null} values - * will be removed from the stored properties or ignored if they don't exist in the file info. - * <p> - * When working in {@code DUAL_SYNC} or {@code DUAL_ASYNC} modes only the following properties will be propagated - * to the secondary file system: - * <ul> - * <li>{@code usrName} - file owner name;</li> - * <li>{@code grpName} - file owner group;</li> - * <li>{@code permission} - Unix-style string representing file permissions.</li> - * </ul> - * - * @param path File path to set properties for. - * @param props Properties to update. - * @return File information for specified path or {@code null} if such path does not exist. - * @throws GridException In case of error. - */ - @Nullable public GridGgfsFile update(IgniteFsPath path, Map<String, String> props) throws GridException; - - /** - * Renames/moves a file. - * <p> - * 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. - * <p> - * Examples: - * <ul> - * <li>"/work/file.txt" => "/home/project/Presentation Scenario.txt"</li> - * <li>"/work" => "/work-2012.bkp"</li> - * <li>"/work" => "<strike>/backups/work</strike>" - such operation is restricted for directories.</li> - * </ul> - * - * @param src Source file path to rename. - * @param dest Destination file path. If destination path is a directory, then source file will be placed - * into destination directory with original name. - * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If source file doesn't exist. - */ - public void rename(IgniteFsPath src, IgniteFsPath dest) throws GridException; - - /** - * Deletes file. - * - * @param path File path to delete. - * @param recursive Delete non-empty directories recursively. - * @return {@code True} in case of success, {@code false} otherwise. - * @throws GridException In case of error. - */ - boolean delete(IgniteFsPath path, boolean recursive) throws GridException; - - /** - * Creates directories under specified path. - * - * @param path Path of directories chain to create. - * @throws GridException In case of error. - */ - public void mkdirs(IgniteFsPath path) throws GridException; - - /** - * Creates directories under specified path with the specified properties. - * - * @param path Path of directories chain to create. - * @param props Metadata properties to set on created directories. - * @throws GridException In case of error. - */ - public void mkdirs(IgniteFsPath path, @Nullable Map<String, String> props) throws GridException; - - /** - * Lists file paths under the specified path. - * - * @param path Path to list files under. - * @return List of files under the specified path. - * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. - */ - public Collection<IgniteFsPath> listPaths(IgniteFsPath path) throws GridException; - - /** - * Lists files under the specified path. - * - * @param path Path to list files under. - * @return List of files under the specified path. - * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. - */ - public Collection<GridGgfsFile> listFiles(IgniteFsPath path) throws GridException; - - /** - * Opens a file for reading. - * - * @param path File path to read. - * @param bufSize Read buffer size (bytes) or {@code zero} to use default value. - * @return File input stream to read data from. - * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist. - */ - public IgniteFsReader open(IgniteFsPath path, int bufSize) throws GridException; - - /** - * Creates a file and opens it for writing. - * - * @param path File path to create. - * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory. - * @return File output stream to write data to. - * @throws GridException In case of error. - */ - public OutputStream create(IgniteFsPath path, boolean overwrite) throws GridException; - - /** - * Creates a file and opens it for writing. - * - * @param path File path to create. - * @param bufSize Write buffer size (bytes) or {@code zero} to use default value. - * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory. - * @param replication Replication factor. - * @param blockSize Block size. - * @param props File properties to set. - * @return File output stream to write data to. - * @throws GridException In case of error. - */ - public OutputStream create(IgniteFsPath path, int bufSize, boolean overwrite, int replication, long blockSize, - @Nullable Map<String, String> props) throws GridException; - - /** - * Opens an output stream to an existing file for appending data. - * - * @param path File path to append. - * @param bufSize Write buffer size (bytes) or {@code zero} to use default value. - * @param create Create file if it doesn't exist yet. - * @param props File properties to set only in case it file was just created. - * @return File output stream to append data to. - * @throws GridException In case of error. - * @throws GridGgfsFileNotFoundException If path doesn't exist and create flag is {@code false}. - */ - public OutputStream append(IgniteFsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) - throws GridException; - - /** - * Gets file information for the specified path. - * - * @param path Path to get information for. - * @return File information for specified path or {@code null} if such path does not exist. - * @throws GridException In case of error. - */ - @Nullable public GridGgfsFile info(IgniteFsPath path) throws GridException; - - /** - * Gets used space in bytes. - * - * @return Used space in bytes. - * @throws GridException In case of error. - */ - public long usedSpaceSize() throws GridException; - - /** - * Gets the implementation specific properties of file system. - * - * @return Map of properties. - */ - public Map<String,String> properties(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsGroupDataBlocksKeyMapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsGroupDataBlocksKeyMapper.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsGroupDataBlocksKeyMapper.java deleted file mode 100644 index 0fd4509..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/GridGgfsGroupDataBlocksKeyMapper.java +++ /dev/null @@ -1,93 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.ggfs; - -import org.gridgain.grid.kernal.processors.cache.*; -import org.gridgain.grid.kernal.processors.ggfs.*; -import org.gridgain.grid.util.typedef.internal.*; - -/** - * {@code GGFS} class providing ability to group file's data blocks together on one node. - * All blocks within the same group are guaranteed to be cached together on the same node. - * Group size parameter controls how many sequential blocks will be cached together on the same node. - * <p> - * For example, if block size is {@code 64kb} and group size is {@code 256}, then each group will contain - * {@code 64kb * 256 = 16Mb}. Larger group sizes would reduce number of splits required to run map-reduce - * tasks, but will increase inequality of data size being stored on different nodes. - * <p> - * Note that {@link #groupSize()} parameter must correlate to Hadoop split size parameter defined - * in Hadoop via {@code mapred.max.split.size} property. Ideally you want all blocks accessed - * within one split to be mapped to {@code 1} group, so they can be located on the same grid node. - * For example, default Hadoop split size is {@code 64mb} and default {@code GGFS} block size - * is {@code 64kb}. This means that to make sure that each split goes only through blocks on - * the same node (without hopping between nodes over network), we have to make the {@link #groupSize()} - * value be equal to {@code 64mb / 64kb = 1024}. - * <p> - * It is required for {@code GGFS} data cache to be configured with this mapper. Here is an - * example of how it can be specified in XML configuration: - * <pre name="code" class="xml"> - * <bean id="cacheCfgBase" class="org.gridgain.grid.cache.GridCacheConfiguration" abstract="true"> - * ... - * <property name="affinityMapper"> - * <bean class="org.gridgain.grid.ggfs.GridGgfsGroupDataBlocksKeyMapper"> - * <!-- How many sequential blocks will be stored on the same node. --> - * <constructor-arg value="512"/> - * </bean> - * </property> - * ... - * </bean> - * </pre> - */ -public class GridGgfsGroupDataBlocksKeyMapper extends GridCacheDefaultAffinityKeyMapper { - /** */ - private static final long serialVersionUID = 0L; - - /** Size of the group. */ - private final int grpSize; - - /*** - * Constructs affinity mapper to group several data blocks with the same key. - * - * @param grpSize Size of the group in blocks. - */ - public GridGgfsGroupDataBlocksKeyMapper(int grpSize) { - A.ensure(grpSize >= 1, "grpSize >= 1"); - - this.grpSize = grpSize; - } - - /** {@inheritDoc} */ - @Override public Object affinityKey(Object key) { - if (key != null && GridGgfsBlockKey.class.equals(key.getClass())) { - GridGgfsBlockKey blockKey = (GridGgfsBlockKey)key; - - if (blockKey.affinityKey() != null) - return blockKey.affinityKey(); - - long grpId = blockKey.getBlockId() / grpSize; - - return blockKey.getFileId().hashCode() + (int)(grpId ^ (grpId >>> 32)); - } - - return super.affinityKey(key); - } - - /** - * @return Size of the group. - */ - public int groupSize() { - return grpSize; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridGgfsGroupDataBlocksKeyMapper.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsConfiguration.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsConfiguration.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsConfiguration.java index 670a3a2..8b43058 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsConfiguration.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsConfiguration.java @@ -115,7 +115,7 @@ public class IgniteFsConfiguration { private int mgmtPort = DFLT_MGMT_PORT; /** Secondary file system */ - private GridGgfsFileSystem secondaryFs; + private IgniteFsFileSystem secondaryFs; /** GGFS mode. */ private GridGgfsMode dfltMode = DFLT_MODE; @@ -511,7 +511,7 @@ public class IgniteFsConfiguration { * * @return Secondary file system. */ - public GridGgfsFileSystem getSecondaryFileSystem() { + public IgniteFsFileSystem getSecondaryFileSystem() { return secondaryFs; } @@ -521,7 +521,7 @@ public class IgniteFsConfiguration { * * @param fileSystem */ - public void setSecondaryFileSystem(GridGgfsFileSystem fileSystem) { + public void setSecondaryFileSystem(IgniteFsFileSystem fileSystem) { secondaryFs = fileSystem; } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsCorruptedFileException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsCorruptedFileException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsCorruptedFileException.java new file mode 100644 index 0000000..b3aeaf6 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsCorruptedFileException.java @@ -0,0 +1,42 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.jetbrains.annotations.*; + +/** + * Exception thrown when target file's block is not found in data cache. + */ +public class IgniteFsCorruptedFileException extends IgniteFsException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * @param msg Error message. + */ + public IgniteFsCorruptedFileException(String msg) { + super(msg); + } + + /** + * @param cause Error cause. + */ + public IgniteFsCorruptedFileException(Throwable cause) { + super(cause); + } + + /** + * @param msg Error message. + * @param cause Error cause. + */ + public IgniteFsCorruptedFileException(String msg, @Nullable Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFile.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFile.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFile.java new file mode 100644 index 0000000..9e39239 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFile.java @@ -0,0 +1,112 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.jetbrains.annotations.*; + +import java.util.*; + +/** + * {@code GGFS} file or directory descriptor. For example, to get information about + * a file you would use the following code: + * <pre name="code" class="java"> + * GridGgfsPath filePath = new GridGgfsPath("my/working/dir", "file.txt"); + * + * // Get metadata about file. + * GridGgfsFile file = ggfs.info(filePath); + * </pre> + */ +public interface IgniteFsFile { + /** + * Gets path to file. + * + * @return Path to file. + */ + public IgniteFsPath path(); + + /** + * Check this file is a data file. + * + * @return {@code True} if this is a data file. + */ + public boolean isFile(); + + /** + * Check this file is a directory. + * + * @return {@code True} if this is a directory. + */ + public boolean isDirectory(); + + /** + * Gets file's length. + * + * @return File's length or {@code zero} for directories. + */ + public long length(); + + /** + * Gets file's data block size. + * + * @return File's data block size or {@code zero} for directories. + */ + public int blockSize(); + + /** + * Gets file group block size (i.e. block size * group size). + * + * @return File group block size. + */ + public long groupBlockSize(); + + /** + * Gets file last access time. File last access time is not updated automatically due to + * performance considerations and can be updated on demand with + * {@link org.apache.ignite.IgniteFs#setTimes(IgniteFsPath, long, long)} method. + * <p> + * By default last access time equals file creation time. + * + * @return Last access time. + */ + public long accessTime(); + + /** + * Gets file last modification time. File modification time is updated automatically on each file write and + * append. + * + * @return Last modification time. + */ + public long modificationTime(); + + /** + * Get file's property for specified name. + * + * @param name Name of the property. + * @return File's property for specified name. + * @throws IllegalArgumentException If requested property was not found. + */ + public String property(String name) throws IllegalArgumentException; + + /** + * Get file's property for specified name. + * + * @param name Name of the property. + * @param dfltVal Default value if requested property was not found. + * @return File's property for specified name. + */ + @Nullable public String property(String name, @Nullable String dfltVal); + + /** + * Get properties of the file. + * + * @return Properties of the file. + */ + public Map<String, String> properties(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileNotFoundException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileNotFoundException.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileNotFoundException.java new file mode 100644 index 0000000..8106679 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileNotFoundException.java @@ -0,0 +1,36 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +/** + * {@code GGFS} exception indicating that target resource is not found. + */ +public class IgniteFsFileNotFoundException extends GridGgfsInvalidPathException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates exception with error message specified. + * + * @param msg Error message. + */ + public IgniteFsFileNotFoundException(String msg) { + super(msg); + } + + /** + * Creates exception with given exception cause. + * + * @param cause Exception cause. + */ + public IgniteFsFileNotFoundException(Throwable cause) { + super(cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileSystem.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileSystem.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileSystem.java new file mode 100644 index 0000000..26c7f1b --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsFileSystem.java @@ -0,0 +1,208 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.gridgain.grid.*; +import org.jetbrains.annotations.*; + +import java.io.*; +import java.util.*; + +/** + * Common file system interface. It provides a typical generalized "view" of any file system: + * <ul> + * <li>list directories or get information for a single path</li> + * <li>create/move/delete files or directories</li> + * <li>write/read data streams into/from files</li> + * </ul> + * + * This is the minimum of functionality that is needed to work as secondary file system in dual modes of GGFS. + */ +public interface IgniteFsFileSystem { + /** File property: user name. */ + public static final String PROP_USER_NAME = "usrName"; + + /** File property: group name. */ + public static final String PROP_GROUP_NAME = "grpName"; + + /** File property: permission. */ + public static final String PROP_PERMISSION = "permission"; + + /** + * Checks if the specified path exists in the file system. + * + * @param path Path to check for existence in the file system. + * @return {@code True} if such file exists, otherwise - {@code false}. + * @throws GridException In case of error. + */ + public boolean exists(IgniteFsPath path) throws GridException; + + /** + * Updates file information for the specified path. Existent properties, not listed in the passed collection, + * will not be affected. Other properties will be added or overwritten. Passed properties with {@code null} values + * will be removed from the stored properties or ignored if they don't exist in the file info. + * <p> + * When working in {@code DUAL_SYNC} or {@code DUAL_ASYNC} modes only the following properties will be propagated + * to the secondary file system: + * <ul> + * <li>{@code usrName} - file owner name;</li> + * <li>{@code grpName} - file owner group;</li> + * <li>{@code permission} - Unix-style string representing file permissions.</li> + * </ul> + * + * @param path File path to set properties for. + * @param props Properties to update. + * @return File information for specified path or {@code null} if such path does not exist. + * @throws GridException In case of error. + */ + @Nullable public IgniteFsFile update(IgniteFsPath path, Map<String, String> props) throws GridException; + + /** + * Renames/moves a file. + * <p> + * 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. + * <p> + * Examples: + * <ul> + * <li>"/work/file.txt" => "/home/project/Presentation Scenario.txt"</li> + * <li>"/work" => "/work-2012.bkp"</li> + * <li>"/work" => "<strike>/backups/work</strike>" - such operation is restricted for directories.</li> + * </ul> + * + * @param src Source file path to rename. + * @param dest Destination file path. If destination path is a directory, then source file will be placed + * into destination directory with original name. + * @throws GridException In case of error. + * @throws IgniteFsFileNotFoundException If source file doesn't exist. + */ + public void rename(IgniteFsPath src, IgniteFsPath dest) throws GridException; + + /** + * Deletes file. + * + * @param path File path to delete. + * @param recursive Delete non-empty directories recursively. + * @return {@code True} in case of success, {@code false} otherwise. + * @throws GridException In case of error. + */ + boolean delete(IgniteFsPath path, boolean recursive) throws GridException; + + /** + * Creates directories under specified path. + * + * @param path Path of directories chain to create. + * @throws GridException In case of error. + */ + public void mkdirs(IgniteFsPath path) throws GridException; + + /** + * Creates directories under specified path with the specified properties. + * + * @param path Path of directories chain to create. + * @param props Metadata properties to set on created directories. + * @throws GridException In case of error. + */ + public void mkdirs(IgniteFsPath path, @Nullable Map<String, String> props) throws GridException; + + /** + * Lists file paths under the specified path. + * + * @param path Path to list files under. + * @return List of files under the specified path. + * @throws GridException In case of error. + * @throws IgniteFsFileNotFoundException If path doesn't exist. + */ + public Collection<IgniteFsPath> listPaths(IgniteFsPath path) throws GridException; + + /** + * Lists files under the specified path. + * + * @param path Path to list files under. + * @return List of files under the specified path. + * @throws GridException In case of error. + * @throws IgniteFsFileNotFoundException If path doesn't exist. + */ + public Collection<IgniteFsFile> listFiles(IgniteFsPath path) throws GridException; + + /** + * Opens a file for reading. + * + * @param path File path to read. + * @param bufSize Read buffer size (bytes) or {@code zero} to use default value. + * @return File input stream to read data from. + * @throws GridException In case of error. + * @throws IgniteFsFileNotFoundException If path doesn't exist. + */ + public IgniteFsReader open(IgniteFsPath path, int bufSize) throws GridException; + + /** + * Creates a file and opens it for writing. + * + * @param path File path to create. + * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory. + * @return File output stream to write data to. + * @throws GridException In case of error. + */ + public OutputStream create(IgniteFsPath path, boolean overwrite) throws GridException; + + /** + * Creates a file and opens it for writing. + * + * @param path File path to create. + * @param bufSize Write buffer size (bytes) or {@code zero} to use default value. + * @param overwrite Overwrite file if it already exists. Note: you cannot overwrite an existent directory. + * @param replication Replication factor. + * @param blockSize Block size. + * @param props File properties to set. + * @return File output stream to write data to. + * @throws GridException In case of error. + */ + public OutputStream create(IgniteFsPath path, int bufSize, boolean overwrite, int replication, long blockSize, + @Nullable Map<String, String> props) throws GridException; + + /** + * Opens an output stream to an existing file for appending data. + * + * @param path File path to append. + * @param bufSize Write buffer size (bytes) or {@code zero} to use default value. + * @param create Create file if it doesn't exist yet. + * @param props File properties to set only in case it file was just created. + * @return File output stream to append data to. + * @throws GridException In case of error. + * @throws IgniteFsFileNotFoundException If path doesn't exist and create flag is {@code false}. + */ + public OutputStream append(IgniteFsPath path, int bufSize, boolean create, @Nullable Map<String, String> props) + throws GridException; + + /** + * Gets file information for the specified path. + * + * @param path Path to get information for. + * @return File information for specified path or {@code null} if such path does not exist. + * @throws GridException In case of error. + */ + @Nullable public IgniteFsFile info(IgniteFsPath path) throws GridException; + + /** + * Gets used space in bytes. + * + * @return Used space in bytes. + * @throws GridException In case of error. + */ + public long usedSpaceSize() throws GridException; + + /** + * Gets the implementation specific properties of file system. + * + * @return Map of properties. + */ + public Map<String,String> properties(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsGroupDataBlocksKeyMapper.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsGroupDataBlocksKeyMapper.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsGroupDataBlocksKeyMapper.java new file mode 100644 index 0000000..b8fd433 --- /dev/null +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/IgniteFsGroupDataBlocksKeyMapper.java @@ -0,0 +1,93 @@ +/* @java.file.header */ + +/* _________ _____ __________________ _____ + * __ ____/___________(_)______ /__ ____/______ ____(_)_______ + * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ + * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / + * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ + */ + +package org.gridgain.grid.ggfs; + +import org.gridgain.grid.kernal.processors.cache.*; +import org.gridgain.grid.kernal.processors.ggfs.*; +import org.gridgain.grid.util.typedef.internal.*; + +/** + * {@code GGFS} class providing ability to group file's data blocks together on one node. + * All blocks within the same group are guaranteed to be cached together on the same node. + * Group size parameter controls how many sequential blocks will be cached together on the same node. + * <p> + * For example, if block size is {@code 64kb} and group size is {@code 256}, then each group will contain + * {@code 64kb * 256 = 16Mb}. Larger group sizes would reduce number of splits required to run map-reduce + * tasks, but will increase inequality of data size being stored on different nodes. + * <p> + * Note that {@link #groupSize()} parameter must correlate to Hadoop split size parameter defined + * in Hadoop via {@code mapred.max.split.size} property. Ideally you want all blocks accessed + * within one split to be mapped to {@code 1} group, so they can be located on the same grid node. + * For example, default Hadoop split size is {@code 64mb} and default {@code GGFS} block size + * is {@code 64kb}. This means that to make sure that each split goes only through blocks on + * the same node (without hopping between nodes over network), we have to make the {@link #groupSize()} + * value be equal to {@code 64mb / 64kb = 1024}. + * <p> + * It is required for {@code GGFS} data cache to be configured with this mapper. Here is an + * example of how it can be specified in XML configuration: + * <pre name="code" class="xml"> + * <bean id="cacheCfgBase" class="org.gridgain.grid.cache.GridCacheConfiguration" abstract="true"> + * ... + * <property name="affinityMapper"> + * <bean class="org.gridgain.grid.ggfs.GridGgfsGroupDataBlocksKeyMapper"> + * <!-- How many sequential blocks will be stored on the same node. --> + * <constructor-arg value="512"/> + * </bean> + * </property> + * ... + * </bean> + * </pre> + */ +public class IgniteFsGroupDataBlocksKeyMapper extends GridCacheDefaultAffinityKeyMapper { + /** */ + private static final long serialVersionUID = 0L; + + /** Size of the group. */ + private final int grpSize; + + /*** + * Constructs affinity mapper to group several data blocks with the same key. + * + * @param grpSize Size of the group in blocks. + */ + public IgniteFsGroupDataBlocksKeyMapper(int grpSize) { + A.ensure(grpSize >= 1, "grpSize >= 1"); + + this.grpSize = grpSize; + } + + /** {@inheritDoc} */ + @Override public Object affinityKey(Object key) { + if (key != null && GridGgfsBlockKey.class.equals(key.getClass())) { + GridGgfsBlockKey blockKey = (GridGgfsBlockKey)key; + + if (blockKey.affinityKey() != null) + return blockKey.affinityKey(); + + long grpId = blockKey.getBlockId() / grpSize; + + return blockKey.getFileId().hashCode() + (int)(grpId ^ (grpId >>> 32)); + } + + return super.affinityKey(key); + } + + /** + * @return Size of the group. + */ + public int groupSize() { + return grpSize; + } + + /** {@inheritDoc} */ + @Override public String toString() { + return S.toString(IgniteFsGroupDataBlocksKeyMapper.class, this); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java index ebf758a..055ef09 100644 --- a/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java +++ b/modules/core/src/main/java/org/gridgain/grid/ggfs/mapreduce/GridGgfsTask.java @@ -89,7 +89,7 @@ public abstract class GridGgfsTask<T, R> extends ComputeTaskAdapter<GridGgfsTask Map<UUID, ClusterNode> nodes = mapSubgrid(subgrid); for (IgniteFsPath path : args.paths()) { - GridGgfsFile file = ggfs.info(path); + IgniteFsFile file = ggfs.info(path); if (file == null) { if (args.skipNonExistentFiles()) http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java index 00919ee..8abd967 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/ggfs/common/GridGgfsControlResponse.java @@ -160,7 +160,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Response. */ - public void response(GridGgfsFile res) { + public void response(IgniteFsFile res) { resType = RES_TYPE_GGFS_FILE; this.res = res; @@ -187,7 +187,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { /** * @param res Response. */ - public void files(Collection<GridGgfsFile> res) { + public void files(Collection<IgniteFsFile> res) { resType = RES_TYPE_COL_GGFS_FILE; this.res = res; @@ -253,7 +253,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { assert errCode != -1; if (errCode == ERR_FILE_NOT_FOUND) - throw new GridGgfsFileNotFoundException(err); + throw new IgniteFsFileNotFoundException(err); else if (errCode == ERR_PATH_ALREADY_EXISTS) throw new IgniteFsPathAlreadyExistsException(err); else if (errCode == ERR_DIRECTORY_NOT_EMPTY) @@ -263,7 +263,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { else if (errCode == ERR_INVALID_HDFS_VERSION) throw new GridGgfsInvalidHdfsVersionException(err); else if (errCode == ERR_CORRUPTED_FILE) - throw new GridGgfsCorruptedFileException(err); + throw new IgniteFsCorruptedFileException(err); else if (errCode == ERR_GGFS_GENERIC) throw new IgniteFsException(err); @@ -324,7 +324,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { */ @SuppressWarnings("unchecked") private int errorCode(GridException e, boolean checkIo) { - if (X.hasCause(e, GridGgfsFileNotFoundException.class)) + if (X.hasCause(e, IgniteFsFileNotFoundException.class)) return ERR_FILE_NOT_FOUND; else if (IgniteFsPathAlreadyExistsException.class.isInstance(e)) return ERR_PATH_ALREADY_EXISTS; @@ -334,7 +334,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { return ERR_PARENT_NOT_DIRECTORY; else if (GridGgfsInvalidHdfsVersionException.class.isInstance(e)) return ERR_INVALID_HDFS_VERSION; - else if (X.hasCause(e, GridGgfsCorruptedFileException.class)) + else if (X.hasCause(e, IgniteFsCorruptedFileException.class)) return ERR_CORRUPTED_FILE; // This check should be the last. else if (IgniteFsException.class.isInstance(e)) @@ -495,7 +495,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { boolean hasVal = in.readBoolean(); if (hasVal) { - GridGgfsFileImpl file = new GridGgfsFileImpl(); + IgniteFsFileImpl file = new IgniteFsFileImpl(); file.readExternal(in); @@ -548,7 +548,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { } case RES_TYPE_COL_GGFS_FILE: { - Collection<GridGgfsFile> files = null; + Collection<IgniteFsFile> files = null; int size = in.readInt(); @@ -556,7 +556,7 @@ public class GridGgfsControlResponse extends GridGgfsMessage { files = new ArrayList<>(size); for (int i = 0; i < size; i++) { - GridGgfsFileImpl file = new GridGgfsFileImpl(); + IgniteFsFileImpl file = new IgniteFsFileImpl(); file.readExternal(in); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAsyncImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAsyncImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAsyncImpl.java index a38de0d..62726bd 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAsyncImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAsyncImpl.java @@ -239,7 +239,7 @@ public class GridGgfsAsyncImpl extends IgniteAsyncSupportAdapter implements Grid } /** {@inheritDoc} */ - @Nullable @Override public GridGgfsFile update(IgniteFsPath path, Map<String, String> props) throws GridException { + @Nullable @Override public IgniteFsFile update(IgniteFsPath path, Map<String, String> props) throws GridException { return ggfs.update(path, props); } @@ -269,12 +269,12 @@ public class GridGgfsAsyncImpl extends IgniteAsyncSupportAdapter implements Grid } /** {@inheritDoc} */ - @Override public Collection<GridGgfsFile> listFiles(IgniteFsPath path) throws GridException { + @Override public Collection<IgniteFsFile> listFiles(IgniteFsPath path) throws GridException { return ggfs.listFiles(path); } /** {@inheritDoc} */ - @Nullable @Override public GridGgfsFile info(IgniteFsPath path) throws GridException { + @Nullable @Override public IgniteFsFile info(IgniteFsPath path) throws GridException { return ggfs.info(path); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAttributes.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAttributes.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAttributes.java index 4336fb1..26b80c5 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAttributes.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsAttributes.java @@ -30,7 +30,7 @@ public class GridGgfsAttributes implements Externalizable { /** File's data block size (bytes). */ private int blockSize; - /** Size of the group figured in {@link GridGgfsGroupDataBlocksKeyMapper}. */ + /** Size of the group figured in {@link org.gridgain.grid.ggfs.IgniteFsGroupDataBlocksKeyMapper}. */ private int grpSize; /** Meta cache name. */ @@ -51,7 +51,7 @@ public class GridGgfsAttributes implements Externalizable { /** * @param ggfsName GGFS name. * @param blockSize File's data block size (bytes). - * @param grpSize Size of the group figured in {@link GridGgfsGroupDataBlocksKeyMapper}. + * @param grpSize Size of the group figured in {@link org.gridgain.grid.ggfs.IgniteFsGroupDataBlocksKeyMapper}. * @param metaCacheName Meta cache name. * @param dataCacheName Data cache name. * @param dfltMode Default mode. @@ -91,7 +91,7 @@ public class GridGgfsAttributes implements Externalizable { } /** - * @return Size of the group figured in {@link GridGgfsGroupDataBlocksKeyMapper}. + * @return Size of the group figured in {@link org.gridgain.grid.ggfs.IgniteFsGroupDataBlocksKeyMapper}. */ public int groupSize() { return grpSize; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java index e3254b5..031c15a 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsDataManager.java @@ -157,8 +157,8 @@ public class GridGgfsDataManager extends GridGgfsManager { GridCacheAffinityKeyMapper mapper = ggfsCtx.kernalContext().cache() .internalCache(ggfsCtx.configuration().getDataCacheName()).configuration().getAffinityMapper(); - grpSize = mapper instanceof GridGgfsGroupDataBlocksKeyMapper ? - ((GridGgfsGroupDataBlocksKeyMapper)mapper).groupSize() : 1; + grpSize = mapper instanceof IgniteFsGroupDataBlocksKeyMapper ? + ((IgniteFsGroupDataBlocksKeyMapper)mapper).groupSize() : 1; grpBlockSize = ggfsCtx.configuration().getBlockSize() * grpSize; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileImpl.java deleted file mode 100644 index 0485761..0000000 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsFileImpl.java +++ /dev/null @@ -1,237 +0,0 @@ -/* @java.file.header */ - -/* _________ _____ __________________ _____ - * __ ____/___________(_)______ /__ ____/______ ____(_)_______ - * _ / __ __ ___/__ / _ __ / _ / __ _ __ `/__ / __ __ \ - * / /_/ / _ / _ / / /_/ / / /_/ / / /_/ / _ / _ / / / - * \____/ /_/ /_/ \_,__/ \____/ \__,_/ /_/ /_/ /_/ - */ - -package org.gridgain.grid.kernal.processors.ggfs; - -import org.apache.ignite.lang.*; -import org.gridgain.grid.ggfs.*; -import org.gridgain.grid.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.util.*; - -/** - * File or directory information. - */ -public final class GridGgfsFileImpl implements GridGgfsFile, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Path to this file. */ - private IgniteFsPath path; - - /** File id. */ - private IgniteUuid fileId; - - /** Block size. */ - private int blockSize; - - /** Group block size. */ - private long grpBlockSize; - - /** File length. */ - private long len; - - /** Last access time. */ - private long accessTime; - - /** Last modification time. */ - private long modificationTime; - - /** Properties. */ - private Map<String, String> props; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public GridGgfsFileImpl() { - // No-op. - } - - /** - * Constructs directory info. - * - * @param path Path. - */ - public GridGgfsFileImpl(IgniteFsPath path, GridGgfsFileInfo info, long globalGrpBlockSize) { - A.notNull(path, "path"); - A.notNull(info, "info"); - - this.path = path; - fileId = info.id(); - - if (info.isFile()) { - blockSize = info.blockSize(); - len = info.length(); - - grpBlockSize = info.affinityKey() == null ? globalGrpBlockSize : - info.length() == 0 ? globalGrpBlockSize : info.length(); - } - - props = info.properties(); - - if (props == null) - props = Collections.emptyMap(); - - accessTime = info.accessTime(); - modificationTime = info.modificationTime(); - } - - /** - * Constructs file instance. - * - * @param path Path. - * @param entry Listing entry. - */ - public GridGgfsFileImpl(IgniteFsPath path, GridGgfsListingEntry entry, long globalGrpSize) { - A.notNull(path, "path"); - A.notNull(entry, "entry"); - - this.path = path; - fileId = entry.fileId(); - - blockSize = entry.blockSize(); - - grpBlockSize = entry.affinityKey() == null ? globalGrpSize : - entry.length() == 0 ? globalGrpSize : entry.length(); - - len = entry.length(); - props = entry.properties(); - - accessTime = entry.accessTime(); - modificationTime = entry.modificationTime(); - } - - /** {@inheritDoc} */ - @Override public IgniteFsPath path() { - return path; - } - - /** - * @return File ID. - */ - public IgniteUuid fileId() { - return fileId; - } - - /** {@inheritDoc} */ - @Override public boolean isFile() { - return blockSize > 0; - } - - /** {@inheritDoc} */ - @Override public boolean isDirectory() { - return blockSize == 0; - } - - /** {@inheritDoc} */ - @Override public long length() { - return len; - } - - /** {@inheritDoc} */ - @Override public int blockSize() { - return blockSize; - } - - /** {@inheritDoc} */ - @Override public long groupBlockSize() { - return grpBlockSize; - } - - /** {@inheritDoc} */ - @Override public long accessTime() { - return accessTime; - } - - /** {@inheritDoc} */ - @Override public long modificationTime() { - return modificationTime; - } - - /** {@inheritDoc} */ - @Override public String property(String name) throws IllegalArgumentException { - String val = props.get(name); - - if (val == null) - throw new IllegalArgumentException("File property not found [path=" + path + ", name=" + name + ']'); - - return val; - } - - /** {@inheritDoc} */ - @Override public String property(String name, @Nullable String dfltVal) { - String val = props.get(name); - - return val == null ? dfltVal : val; - } - - /** {@inheritDoc} */ - @Override public Map<String, String> properties() { - return props; - } - - /** - * Writes object to data output. - * - * @param out Data output. - */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - path.writeExternal(out); - - out.writeInt(blockSize); - out.writeLong(grpBlockSize); - out.writeLong(len); - U.writeStringMap(out, props); - out.writeLong(accessTime); - out.writeLong(modificationTime); - } - - /** - * Reads object from data input. - * - * @param in Data input. - */ - @Override public void readExternal(ObjectInput in) throws IOException { - path = new IgniteFsPath(); - - path.readExternal(in); - - blockSize = in.readInt(); - grpBlockSize = in.readLong(); - len = in.readLong(); - props = U.readStringMap(in); - accessTime = in.readLong(); - modificationTime = in.readLong(); - } - - /** {@inheritDoc} */ - @Override public int hashCode() { - return path.hashCode(); - } - - /** {@inheritDoc} */ - @Override public boolean equals(Object o) { - if (o == this) - return true; - - if (o == null || getClass() != o.getClass()) - return false; - - GridGgfsFileImpl that = (GridGgfsFileImpl)o; - - return path.equals(that.path); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(GridGgfsFileImpl.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsImpl.java index e1d75c3..9c804a4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsImpl.java @@ -81,7 +81,7 @@ public final class GridGgfsImpl implements GridGgfsEx { private final GridGgfsModeResolver modeRslvr; /** Connection to the secondary file system. */ - private GridGgfsFileSystem secondaryFs; + private IgniteFsFileSystem secondaryFs; /** Busy lock. */ private final GridSpinBusyLock busyLock = new GridSpinBusyLock(); @@ -497,7 +497,7 @@ public final class GridGgfsImpl implements GridGgfsEx { } /** {@inheritDoc} */ - @Override public GridGgfsFile info(IgniteFsPath path) throws GridException { + @Override public IgniteFsFile info(IgniteFsPath path) throws GridException { if (enterBusy()) { try { A.notNull(path, "path"); @@ -515,7 +515,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (info == null) return null; - return new GridGgfsFileImpl(path, info, data.groupBlockSize()); + return new IgniteFsFileImpl(path, info, data.groupBlockSize()); } finally { busyLock.leaveBusy(); @@ -537,7 +537,7 @@ public final class GridGgfsImpl implements GridGgfsEx { IgniteUuid fileId = meta.fileId(path); if (fileId == null) - throw new GridGgfsFileNotFoundException("Failed to get path summary (path not found): " + path); + throw new IgniteFsFileNotFoundException("Failed to get path summary (path not found): " + path); IgniteFsPathSummary sum = new IgniteFsPathSummary(path); @@ -554,7 +554,7 @@ public final class GridGgfsImpl implements GridGgfsEx { } /** {@inheritDoc} */ - @Override public GridGgfsFile update(IgniteFsPath path, Map<String, String> props) throws GridException { + @Override public IgniteFsFile update(IgniteFsPath path, Map<String, String> props) throws GridException { if (enterBusy()) { try { A.notNull(path, "path"); @@ -578,7 +578,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (info == null) return null; - return new GridGgfsFileImpl(path, info, data.groupBlockSize()); + return new IgniteFsFileImpl(path, info, data.groupBlockSize()); } List<IgniteUuid> fileIds = meta.fileIds(path); @@ -596,7 +596,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (evts.isRecordable(EVT_GGFS_META_UPDATED)) evts.record(new IgniteFsEvent(path, localNode(), EVT_GGFS_META_UPDATED, props)); - return new GridGgfsFileImpl(path, info, data.groupBlockSize()); + return new IgniteFsFileImpl(path, info, data.groupBlockSize()); } else return null; @@ -661,7 +661,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (mode == PRIMARY) checkConflictWithPrimary(src); - throw new GridGgfsFileNotFoundException("Failed to rename (source path not found): " + src); + throw new IgniteFsFileNotFoundException("Failed to rename (source path not found): " + src); } String srcFileName = src.name(); @@ -681,7 +681,7 @@ public final class GridGgfsImpl implements GridGgfsEx { // Destination directory doesn't exist. if (destDesc == null) - throw new GridGgfsFileNotFoundException("Failed to rename (destination directory does not " + + throw new IgniteFsFileNotFoundException("Failed to rename (destination directory does not " + "exist): " + dest); destFileName = dest.name(); @@ -940,7 +940,7 @@ public final class GridGgfsImpl implements GridGgfsEx { else if (mode == PRIMARY) { checkConflictWithPrimary(path); - throw new GridGgfsFileNotFoundException("Failed to list files (path not found): " + path); + throw new IgniteFsFileNotFoundException("Failed to list files (path not found): " + path); } return F.viewReadOnly(files, new C1<String, IgniteFsPath>() { @@ -959,7 +959,7 @@ public final class GridGgfsImpl implements GridGgfsEx { } /** {@inheritDoc} */ - @Override public Collection<GridGgfsFile> listFiles(final IgniteFsPath path) throws GridException { + @Override public Collection<IgniteFsFile> listFiles(final IgniteFsPath path) throws GridException { if (enterBusy()) { try { A.notNull(path, "path"); @@ -974,18 +974,18 @@ public final class GridGgfsImpl implements GridGgfsEx { Set<GridGgfsMode> childrenModes = modeRslvr.resolveChildrenModes(path); - Collection<GridGgfsFile> files = new HashSet<>(); + Collection<IgniteFsFile> files = new HashSet<>(); if (childrenModes.contains(DUAL_SYNC) || childrenModes.contains(DUAL_ASYNC)) { assert secondaryFs != null; - Collection<GridGgfsFile> children = secondaryFs.listFiles(path); + Collection<IgniteFsFile> children = secondaryFs.listFiles(path); - for (GridGgfsFile child : children) { + for (IgniteFsFile child : children) { GridGgfsFileInfo fsInfo = new GridGgfsFileInfo(cfg.getBlockSize(), child.length(), evictExclude(path, false), child.properties()); - files.add(new GridGgfsFileImpl(child.path(), fsInfo, data.groupBlockSize())); + files.add(new IgniteFsFileImpl(child.path(), fsInfo, data.groupBlockSize())); } } @@ -998,21 +998,21 @@ public final class GridGgfsImpl implements GridGgfsEx { if (info != null) { if (info.isFile()) // If this is a file, return its description. - return Collections.<GridGgfsFile>singleton(new GridGgfsFileImpl(path, info, + return Collections.<IgniteFsFile>singleton(new IgniteFsFileImpl(path, info, data.groupBlockSize())); // Perform the listing. for (Map.Entry<String, GridGgfsListingEntry> e : info.listing().entrySet()) { IgniteFsPath p = new IgniteFsPath(path, e.getKey()); - files.add(new GridGgfsFileImpl(p, e.getValue(), data.groupBlockSize())); + files.add(new IgniteFsFileImpl(p, e.getValue(), data.groupBlockSize())); } } } else if (mode == PRIMARY) { checkConflictWithPrimary(path); - throw new GridGgfsFileNotFoundException("Failed to list files (path not found): " + path); + throw new IgniteFsFileNotFoundException("Failed to list files (path not found): " + path); } return files; @@ -1083,7 +1083,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (info == null) { checkConflictWithPrimary(path); - throw new GridGgfsFileNotFoundException("File not found: " + path); + throw new IgniteFsFileNotFoundException("File not found: " + path); } if (!info.isFile()) @@ -1294,7 +1294,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (!create) { checkConflictWithPrimary(path); - throw new GridGgfsFileNotFoundException("File not found: " + path); + throw new IgniteFsFileNotFoundException("File not found: " + path); } if (parentId == null) @@ -1346,7 +1346,7 @@ public final class GridGgfsImpl implements GridGgfsEx { if (desc == null) { checkConflictWithPrimary(path); - throw new GridGgfsFileNotFoundException("Failed to update times (path not found): " + path); + throw new IgniteFsFileNotFoundException("Failed to update times (path not found): " + path); } // Cannot update times for root. @@ -1414,7 +1414,7 @@ public final class GridGgfsImpl implements GridGgfsEx { } if (info == null) - throw new GridGgfsFileNotFoundException("File not found: " + path); + throw new IgniteFsFileNotFoundException("File not found: " + path); if (!info.isFile()) throw new GridGgfsInvalidPathException("Failed to get affinity info for file (not a file): " + @@ -1800,7 +1800,7 @@ public final class GridGgfsImpl implements GridGgfsEx { info = meta.info(meta.fileId(path)); if (info == null) { - GridGgfsFile status = secondaryFs.info(path); + IgniteFsFile status = secondaryFs.info(path); if (status != null) info = status.isDirectory() ? new GridGgfsFileInfo(true, status.properties()) : http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/3ba3dc44/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsInputStreamImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsInputStreamImpl.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsInputStreamImpl.java index 5fa2366..da60ae4 100644 --- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsInputStreamImpl.java +++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsInputStreamImpl.java @@ -377,7 +377,7 @@ public class GridGgfsInputStreamImpl extends GridGgfsInputStreamAdapter { try { return block(blockIdx); } - catch (GridGgfsCorruptedFileException e) { + catch (IgniteFsCorruptedFileException e) { if (log.isDebugEnabled()) log.debug("Failed to fetch file block [path=" + path + ", fileInfo=" + fileInfo + ", blockIdx=" + blockIdx + ", errMsg=" + e.getMessage() + ']'); @@ -388,7 +388,7 @@ public class GridGgfsInputStreamImpl extends GridGgfsInputStreamAdapter { // File was deleted. if (newInfo == null) - throw new GridGgfsFileNotFoundException("Failed to read file block (file was concurrently " + + throw new IgniteFsFileNotFoundException("Failed to read file block (file was concurrently " + "deleted) [path=" + path + ", blockIdx=" + blockIdx + ']'); fileInfo = newInfo; @@ -451,7 +451,7 @@ public class GridGgfsInputStreamImpl extends GridGgfsInputStreamAdapter { byte[] bytes = bytesFut.get(); if (bytes == null) - throw new GridGgfsCorruptedFileException("Failed to retrieve file's data block (corrupted file?) " + + throw new IgniteFsCorruptedFileException("Failed to retrieve file's data block (corrupted file?) " + "[path=" + path + ", blockIdx=" + blockIdx + ']'); int blockSize = fileInfo.blockSize();