You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/03/04 10:27:15 UTC
[3/6] incubator-ignite git commit: # IGNITE-386: WIP.
# IGNITE-386: WIP.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/dd06414a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/dd06414a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/dd06414a
Branch: refs/heads/ignite-386
Commit: dd06414a22a5379ac93dc505a04fdca2212da988
Parents: 28fad18
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Mar 3 17:43:01 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Mar 3 17:43:01 2015 +0300
----------------------------------------------------------------------
config/hadoop/default-config.xml | 2 +-
.../ignite/examples/igfs/IgfsExample.java | 18 +-
.../examples/igfs/IgfsMapReduceExample.java | 6 +-
.../src/main/java/org/apache/ignite/Ignite.java | 6 +-
.../org/apache/ignite/IgniteFileSystem.java | 347 ++++++++
.../main/java/org/apache/ignite/IgniteFs.java | 346 --------
.../ignite/configuration/IgfsConfiguration.java | 7 +-
.../main/java/org/apache/ignite/igfs/Igfs.java | 216 -----
.../apache/ignite/igfs/IgfsBlockLocation.java | 2 +-
.../java/org/apache/ignite/igfs/IgfsFile.java | 2 +-
.../org/apache/ignite/igfs/IgfsInputStream.java | 4 +-
.../java/org/apache/ignite/igfs/IgfsReader.java | 38 -
.../mapreduce/IgfsInputStreamJobAdapter.java | 4 +-
.../apache/ignite/igfs/mapreduce/IgfsJob.java | 4 +-
.../igfs/mapreduce/IgfsRecordResolver.java | 2 +-
.../apache/ignite/igfs/mapreduce/IgfsTask.java | 2 +-
.../IgfsByteDelimiterRecordResolver.java | 3 +-
.../records/IgfsFixedLengthRecordResolver.java | 2 +-
.../igfs/secondary/IgfsSecondaryFileSystem.java | 217 +++++
.../IgfsSecondaryFileSystemReader.java | 38 +
.../apache/ignite/igfs/secondary/package.html | 24 +
.../org/apache/ignite/internal/IgniteEx.java | 2 +-
.../apache/ignite/internal/IgniteKernal.java | 8 +-
.../internal/processors/igfs/IgfsAsyncImpl.java | 2 +-
.../processors/igfs/IgfsDataManager.java | 3 +-
.../ignite/internal/processors/igfs/IgfsEx.java | 4 +-
.../internal/processors/igfs/IgfsImpl.java | 9 +-
.../processors/igfs/IgfsInputStreamImpl.java | 5 +-
.../internal/processors/igfs/IgfsJobImpl.java | 2 +-
.../processors/igfs/IgfsMetaManager.java | 25 +-
.../processors/igfs/IgfsNoopProcessor.java | 4 +-
.../processors/igfs/IgfsOutputStreamImpl.java | 2 +-
.../internal/processors/igfs/IgfsProcessor.java | 8 +-
.../processors/igfs/IgfsProcessorAdapter.java | 4 +-
.../IgfsSecondaryInputStreamDescriptor.java | 8 +-
.../ignite/internal/visor/igfs/VisorIgfs.java | 4 +-
.../visor/igfs/VisorIgfsProfilerClearTask.java | 2 +-
.../visor/node/VisorIgfsConfiguration.java | 3 +-
.../visor/node/VisorNodeDataCollectorJob.java | 2 +-
.../internal/visor/util/VisorTaskUtils.java | 2 +-
.../org/apache/ignite_new/IgniteFileSystem.java | 505 ------------
.../configuration/FileSystemConfiguration.java | 809 -------------------
.../filesystem/SecondaryFileSystem.java | 210 -----
.../ignite/igfs/IgfsEventsAbstractSelfTest.java | 2 +-
.../ignite/igfs/IgfsFragmentizerSelfTest.java | 8 +-
.../igfs/IgfsFragmentizerTopologySelfTest.java | 2 +-
...heIgfsPerBlockLruEvictionPolicySelfTest.java | 2 +-
.../processors/igfs/IgfsAbstractSelfTest.java | 19 +-
.../igfs/IgfsDualAbstractSelfTest.java | 2 +-
.../processors/igfs/IgfsMetricsSelfTest.java | 10 +-
.../processors/igfs/IgfsProcessorSelfTest.java | 4 +-
.../processors/igfs/IgfsStreamsSelfTest.java | 10 +-
.../processors/igfs/IgfsTaskSelfTest.java | 6 +-
.../IgfsAbstractRecordResolverSelfTest.java | 2 +-
.../ignite/testframework/junits/IgniteMock.java | 4 +-
.../fs/IgniteHadoopIgfsSecondaryFileSystem.java | 415 ++++++++++
.../fs/IgniteHadoopSecondaryFileSystem.java | 413 ----------
.../hadoop/fs/v1/IgniteHadoopFileSystem.java | 6 +-
.../hadoop/fs/v2/IgniteHadoopFileSystem.java | 6 +-
.../hadoop/igfs/HadoopIgfsEndpoint.java | 2 +-
.../hadoop/igfs/HadoopIgfsProperties.java | 2 +-
.../hadoop/igfs/HadoopIgfsReader.java | 104 ---
.../HadoopIgfsSecondaryFileSystemReader.java | 104 +++
.../planner/HadoopDefaultMapReducePlanner.java | 2 +-
.../hadoop/HadoopClientProtocolSelfTest.java | 6 +-
.../HadoopIgfs20FileSystemAbstractSelfTest.java | 6 +-
.../igfs/HadoopIgfsDualAbstractSelfTest.java | 5 +-
.../apache/ignite/igfs/IgfsEventsTestSuite.java | 8 +-
.../IgniteHadoopFileSystemAbstractSelfTest.java | 4 +-
...IgniteHadoopFileSystemHandshakeSelfTest.java | 2 +-
...teHadoopFileSystemSecondaryModeSelfTest.java | 2 +-
.../HadoopDefaultMapReducePlannerSelfTest.java | 6 +-
.../hadoop/HadoopTaskExecutionSelfTest.java | 2 +-
.../HadoopExternalTaskExecutionSelfTest.java | 2 +-
.../org/apache/ignite/IgniteSpringBean.java | 4 +-
pom.xml | 4 +-
76 files changed, 1301 insertions(+), 2788 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/config/hadoop/default-config.xml
----------------------------------------------------------------------
diff --git a/config/hadoop/default-config.xml b/config/hadoop/default-config.xml
index f500529..bb35b03 100644
--- a/config/hadoop/default-config.xml
+++ b/config/hadoop/default-config.xml
@@ -135,7 +135,7 @@
<property name="defaultMode" value="PROXY"/>
<property name="secondaryFileSystem">
- <bean class="org.apache.ignite.hadoop.fs.IgniteHadoopSecondaryFileSystem">
+ <bean class="org.apache.ignite.hadoop.fs.IgniteHadoopIgfsSecondaryFileSystem">
<constructor-arg name="uri" value="hdfs://1.2.3.4:9000"/>
<constructor-arg name="cfgPath" value="/opt/hadoop-server/etc/hadoop/core-site.xml"/>
</bean>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsExample.java b/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsExample.java
index 56f3fa4..8bfd38d 100644
--- a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsExample.java
@@ -25,7 +25,7 @@ import java.io.*;
import java.util.*;
/**
- * Example that shows usage of {@link org.apache.ignite.IgniteFs} API. It starts a node with {@code IgniteFs}
+ * Example that shows usage of {@link org.apache.ignite.IgniteFileSystem} API. It starts a node with {@code IgniteFs}
* configured and performs several file system operations (create, write, append, read and delete
* files, create, list and delete directories).
* <p>
@@ -50,7 +50,7 @@ public final class IgfsExample {
try {
// Get an instance of Ignite File System.
- IgniteFs fs = ignite.fileSystem("igfs");
+ IgniteFileSystem fs = ignite.fileSystem("igfs");
// Working directory path.
IgfsPath workDir = new IgfsPath("/examples/fs");
@@ -107,7 +107,7 @@ public final class IgfsExample {
* @param path File or directory path.
* @throws IgniteException In case of error.
*/
- private static void delete(IgniteFs fs, IgfsPath path) throws IgniteException {
+ private static void delete(IgniteFileSystem fs, IgfsPath path) throws IgniteException {
assert fs != null;
assert path != null;
@@ -139,7 +139,7 @@ public final class IgfsExample {
* @param path Directory path.
* @throws IgniteException In case of error.
*/
- private static void mkdirs(IgniteFs fs, IgfsPath path) throws IgniteException {
+ private static void mkdirs(IgniteFileSystem fs, IgfsPath path) throws IgniteException {
assert fs != null;
assert path != null;
@@ -166,7 +166,7 @@ public final class IgfsExample {
* @throws IgniteException If file can't be created.
* @throws IOException If data can't be written.
*/
- private static void create(IgniteFs fs, IgfsPath path, @Nullable byte[] data)
+ private static void create(IgniteFileSystem fs, IgfsPath path, @Nullable byte[] data)
throws IgniteException, IOException {
assert fs != null;
assert path != null;
@@ -195,7 +195,7 @@ public final class IgfsExample {
* @throws IgniteException If file can't be created.
* @throws IOException If data can't be written.
*/
- private static void append(IgniteFs fs, IgfsPath path, byte[] data) throws IgniteException, IOException {
+ private static void append(IgniteFileSystem fs, IgfsPath path, byte[] data) throws IgniteException, IOException {
assert fs != null;
assert path != null;
assert data != null;
@@ -220,7 +220,7 @@ public final class IgfsExample {
* @throws IgniteException If file can't be opened.
* @throws IOException If data can't be read.
*/
- private static void read(IgniteFs fs, IgfsPath path) throws IgniteException, IOException {
+ private static void read(IgniteFileSystem fs, IgfsPath path) throws IgniteException, IOException {
assert fs != null;
assert path != null;
assert fs.info(path).isFile();
@@ -242,7 +242,7 @@ public final class IgfsExample {
* @param path Directory path.
* @throws IgniteException In case of error.
*/
- private static void list(IgniteFs fs, IgfsPath path) throws IgniteException {
+ private static void list(IgniteFileSystem fs, IgfsPath path) throws IgniteException {
assert fs != null;
assert path != null;
assert fs.info(path).isDirectory();
@@ -271,7 +271,7 @@ public final class IgfsExample {
* @param path File or directory path.
* @throws IgniteException In case of error.
*/
- private static void printInfo(IgniteFs fs, IgfsPath path) throws IgniteException {
+ private static void printInfo(IgniteFileSystem fs, IgfsPath path) throws IgniteException {
System.out.println();
System.out.println("Information for " + path + ": " + fs.info(path));
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsMapReduceExample.java
----------------------------------------------------------------------
diff --git a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsMapReduceExample.java b/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsMapReduceExample.java
index 22a66a3..ed0abe4 100644
--- a/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsMapReduceExample.java
+++ b/examples/src/main/java/org/apache/ignite/examples/igfs/IgfsMapReduceExample.java
@@ -61,7 +61,7 @@ public class IgfsMapReduceExample {
String regexStr = args[1];
// Get an instance of Ignite File System.
- IgniteFs fs = ignite.fileSystem("igfs");
+ IgniteFileSystem fs = ignite.fileSystem("igfs");
// Working directory path.
IgfsPath workDir = new IgfsPath("/examples/fs");
@@ -94,7 +94,7 @@ public class IgfsMapReduceExample {
* @param file File to write.
* @throws Exception In case of exception.
*/
- private static void writeFile(IgniteFs fs, IgfsPath fsPath, File file) throws Exception {
+ private static void writeFile(IgniteFileSystem fs, IgfsPath fsPath, File file) throws Exception {
System.out.println();
System.out.println("Copying file to IGFS: " + file);
@@ -173,7 +173,7 @@ public class IgfsMapReduceExample {
}
/** {@inheritDoc} */
- @Override public Object execute(IgniteFs igfs, IgfsRangeInputStream in) throws IgniteException, IOException {
+ @Override public Object execute(IgniteFileSystem igfs, IgfsRangeInputStream in) throws IgniteException, IOException {
Collection<Line> res = null;
long start = in.startOffset();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/Ignite.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/Ignite.java b/modules/core/src/main/java/org/apache/ignite/Ignite.java
index 8851d8f..7477690 100644
--- a/modules/core/src/main/java/org/apache/ignite/Ignite.java
+++ b/modules/core/src/main/java/org/apache/ignite/Ignite.java
@@ -43,7 +43,7 @@ import java.util.concurrent.*;
* <ul>
* <li>{@link org.apache.ignite.cache.GridCache} - functionality for in-memory distributed cache.</li>
* <li>{@link IgniteDataLoader} - functionality for loading data large amounts of data into cache.</li>
- * <li>{@link IgniteFs} - functionality for distributed Hadoop-compliant in-memory file system and map-reduce.</li>
+ * <li>{@link IgniteFileSystem} - functionality for distributed Hadoop-compliant in-memory file system and map-reduce.</li>
* <li>{@link IgniteStreamer} - functionality for streaming events workflow with queries and indexes into rolling windows.</li>
* <li>{@link IgniteScheduler} - functionality for scheduling jobs using UNIX Cron syntax.</li>
* <li>{@link IgniteCompute} - functionality for executing tasks and closures on all grid nodes (inherited form {@link ClusterGroup}).</li>
@@ -223,14 +223,14 @@ public interface Ignite extends AutoCloseable {
* @param name IGFS name.
* @return IGFS instance.
*/
- public IgniteFs fileSystem(String name);
+ public IgniteFileSystem fileSystem(String name);
/**
* Gets all instances of the grid file systems.
*
* @return Collection of grid file systems instances.
*/
- public Collection<IgniteFs> fileSystems();
+ public Collection<IgniteFileSystem> fileSystems();
/**
* Gets an instance of streamer by name, if one does not exist then
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
new file mode 100644
index 0000000..893bca8
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteFileSystem.java
@@ -0,0 +1,347 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite;
+
+import org.apache.ignite.configuration.*;
+import org.apache.ignite.igfs.*;
+import org.apache.ignite.igfs.mapreduce.*;
+import org.apache.ignite.igfs.secondary.*;
+import org.apache.ignite.lang.*;
+import org.jetbrains.annotations.*;
+
+import java.util.*;
+
+/**
+ * <b>IG</b>nite <b>F</b>ile <b>S</b>ystem API. It provides a typical file system "view" on a particular cache:
+ * <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>
+ * The data of each file is split on separate data blocks and stored in the cache.
+ * You can access file's data with a standard Java streaming API. Moreover, for each part
+ * of the file you can calculate an affinity and process file's content on corresponding
+ * nodes to escape unnecessary networking.
+ * <p/>
+ * This API is fully thread-safe and you can use it from several threads.
+ * <h1 class="header">IGFS Configuration</h1>
+ * The simplest way to run a Ignite node with configured file system is to pass
+ * special configuration file included in Ignite distribution to {@code ignite.sh} or
+ * {@code ignite.bat} scripts, like this: {@code ignite.sh config/hadoop/default-config.xml}
+ * <p>
+ * {@code IGFS} can be started as a data node or as a client node. Data node is responsible for
+ * caching data, while client node is responsible for basic file system operations and accessing
+ * data nodes remotely. When used as Hadoop file system, clients nodes usually started together
+ * with {@code job-submitter} or {@code job-scheduler} processes, while data nodes are usually
+ * started together with Hadoop {@code task-tracker} processes.
+ * <h1 class="header">Integration With Hadoop</h1>
+ * In addition to direct file system API, {@code IGFS} can be integrated with {@code Hadoop} by
+ * plugging in as {@code Hadoop FileSystem}. Refer to
+ * {@code org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem} or
+ * {@code org.apache.ignite.hadoop.fs.v2.IgniteHadoopFileSystem} for more information.
+ * <p>
+ * <b>NOTE:</b> integration with Hadoop is available only in {@code In-Memory Accelerator For Hadoop} edition.
+ */
+public interface IgniteFileSystem extends IgfsSecondaryFileSystem, IgniteAsyncSupport {
+ /** IGFS scheme name. */
+ public static final String IGFS_SCHEME = "igfs";
+
+ /** File property: prefer writes to local node. */
+ public static final String PROP_PREFER_LOCAL_WRITES = "locWrite";
+
+ /**
+ * Gets IGFS name.
+ *
+ * @return IGFS name, or {@code null} for default file system.
+ */
+ public String name();
+
+ /**
+ * Gets IGFS configuration.
+ *
+ * @return IGFS configuration.
+ */
+ public IgfsConfiguration configuration();
+
+ /**
+ * Gets summary (total number of files, total number of directories and total length)
+ * for a given path.
+ *
+ * @param path Path to get information for.
+ * @return Summary object.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path is not found.
+ * @throws IgniteException If failed.
+ */
+ public IgfsPathSummary summary(IgfsPath path) throws IgniteException;
+
+ /**
+ * Opens a file for reading.
+ *
+ * @param path File path to read.
+ * @return File input stream to read data from.
+ * @throws IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
+ */
+ public IgfsInputStream open(IgfsPath path) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
+ */
+ @Override public IgfsInputStream open(IgfsPath path, int bufSize) throws IgniteException;
+
+ /**
+ * Opens a file for reading.
+ *
+ * @param path File path to read.
+ * @param bufSize Read buffer size (bytes) or {@code zero} to use default value.
+ * @param seqReadsBeforePrefetch Amount of sequential reads before prefetch is started.
+ * @return File input stream to read data from.
+ * @throws IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
+ */
+ public IgfsInputStream open(IgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ @Override public IgfsOutputStream create(IgfsPath path, boolean overwrite) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ @Override public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication,
+ long blockSize, @Nullable Map<String, String> props) throws IgniteException;
+
+ /**
+ * 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 affKey Affinity key used to store file blocks. If not {@code null}, the whole file will be
+ * stored on node where {@code affKey} resides.
+ * @param replication Replication factor.
+ * @param blockSize Block size.
+ * @param props File properties to set.
+ * @return File output stream to write data to.
+ * @throws IgniteException In case of error.
+ */
+ public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite,
+ @Nullable IgniteUuid affKey, int replication, long blockSize, @Nullable Map<String, String> props)
+ throws IgniteException;
+
+ /**
+ * Opens an output stream to an existing file for appending data.
+ *
+ * @param path File path to append.
+ * @param create Create file if it doesn't exist yet.
+ * @return File output stream to append data to.
+ * @throws IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
+ */
+ public IgfsOutputStream append(IgfsPath path, boolean create) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
+ */
+ @Override public IgfsOutputStream append(IgfsPath path, int bufSize, boolean create,
+ @Nullable Map<String, String> props) throws IgniteException;
+
+ /**
+ * Sets last access time and last modification time for a given path. If argument is {@code null},
+ * corresponding time will not be changed.
+ *
+ * @param path Path to update.
+ * @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 org.apache.ignite.igfs.IgfsFileNotFoundException If target was not found.
+ * @throws IgniteException If error occurred.
+ */
+ public void setTimes(IgfsPath path, long accessTime, long modificationTime) throws IgniteException;
+
+ /**
+ * Gets affinity block locations for data blocks of the file, i.e. the nodes, on which the blocks
+ * are stored.
+ *
+ * @param path File path to get affinity for.
+ * @param start Position in the file to start affinity resolution from.
+ * @param len Size of data in the file to resolve affinity for.
+ * @return Affinity block locations.
+ * @throws IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
+ */
+ public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len) throws IgniteException;
+
+ /**
+ * Get affinity block locations for data blocks of the file. In case {@code maxLen} parameter is set and
+ * particular block location length is greater than this value, block locations will be split into smaller
+ * chunks.
+ *
+ * @param path File path to get affinity for.
+ * @param start Position in the file to start affinity resolution from.
+ * @param len Size of data in the file to resolve affinity for.
+ * @param maxLen Maximum length of a single returned block location length.
+ * @return Affinity block locations.
+ * @throws IgniteException In case of error.
+ * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
+ */
+ public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len, long maxLen)
+ throws IgniteException;
+
+ /**
+ * Gets metrics snapshot for this file system.
+ *
+ * @return Metrics.
+ * @throws IgniteException In case of error.
+ */
+ public IgfsMetrics metrics() throws IgniteException;
+
+ /**
+ * Resets metrics for this file system.
+ *
+ * @throws IgniteException In case of error.
+ */
+ public void resetMetrics() throws IgniteException;
+
+ /**
+ * Determines size of the file denoted by provided path. In case if path is a directory, then
+ * total size of all containing entries will be calculated recursively.
+ *
+ * @param path File system path.
+ * @return Total size.
+ * @throws IgniteException In case of error.
+ */
+ public long size(IgfsPath path) throws IgniteException;
+
+ /**
+ * Formats the file system removing all existing entries from it.
+ * <p>
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @throws IgniteException In case format has failed.
+ */
+ @IgniteAsyncSupported
+ public void format() throws IgniteException;
+
+ /**
+ * Executes IGFS task.
+ * <p>
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param task Task to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ @IgniteAsyncSupported
+ public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
+
+ /**
+ * Executes IGFS task with overridden maximum range length (see
+ * {@link org.apache.ignite.configuration.IgfsConfiguration#getMaximumTaskRangeLength()} for more information).
+ * <p>
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param task Task to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Optional maximum range length. If {@code 0}, then by default all consecutive
+ * IGFS blocks will be included.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ @IgniteAsyncSupported
+ public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
+ Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
+ throws IgniteException;
+
+ /**
+ * Executes IGFS task.
+ * <p>
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ @IgniteAsyncSupported
+ public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
+
+ /**
+ * Executes IGFS task with overridden maximum range length (see
+ * {@link org.apache.ignite.configuration.IgfsConfiguration#getMaximumTaskRangeLength()} for more information).
+ * <p>
+ * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
+ *
+ * @param taskCls Task class to execute.
+ * @param rslvr Optional resolver to control split boundaries.
+ * @param paths Collection of paths to be processed within this task.
+ * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
+ * be ignored. Otherwise an exception will be thrown.
+ * @param maxRangeLen Maximum range length.
+ * @param arg Optional task argument.
+ * @return Task result.
+ * @throws IgniteException If execution failed.
+ */
+ @IgniteAsyncSupported
+ public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
+ @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
+ long maxRangeLen, @Nullable T arg) throws IgniteException;
+
+ /** {@inheritDoc} */
+ @Override public IgniteFileSystem withAsync();
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/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
deleted file mode 100644
index 83fba8e..0000000
--- a/modules/core/src/main/java/org/apache/ignite/IgniteFs.java
+++ /dev/null
@@ -1,346 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite;
-
-import org.apache.ignite.configuration.*;
-import org.apache.ignite.igfs.*;
-import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.lang.*;
-import org.jetbrains.annotations.*;
-
-import java.util.*;
-
-/**
- * <b>IG</b>nite <b>F</b>ile <b>S</b>ystem API. It provides a typical file system "view" on a particular cache:
- * <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>
- * The data of each file is split on separate data blocks and stored in the cache.
- * You can access file's data with a standard Java streaming API. Moreover, for each part
- * of the file you can calculate an affinity and process file's content on corresponding
- * nodes to escape unnecessary networking.
- * <p/>
- * This API is fully thread-safe and you can use it from several threads.
- * <h1 class="header">IGFS Configuration</h1>
- * The simplest way to run a Ignite node with configured file system is to pass
- * special configuration file included in Ignite distribution to {@code ignite.sh} or
- * {@code ignite.bat} scripts, like this: {@code ignite.sh config/hadoop/default-config.xml}
- * <p>
- * {@code IGFS} can be started as a data node or as a client node. Data node is responsible for
- * caching data, while client node is responsible for basic file system operations and accessing
- * data nodes remotely. When used as Hadoop file system, clients nodes usually started together
- * with {@code job-submitter} or {@code job-scheduler} processes, while data nodes are usually
- * started together with Hadoop {@code task-tracker} processes.
- * <h1 class="header">Integration With Hadoop</h1>
- * In addition to direct file system API, {@code IGFS} can be integrated with {@code Hadoop} by
- * plugging in as {@code Hadoop FileSystem}. Refer to
- * {@code org.apache.ignite.hadoop.fs.v1.IgniteHadoopFileSystem} or
- * {@code org.apache.ignite.hadoop.fs.v2.IgniteHadoopFileSystem} for more information.
- * <p>
- * <b>NOTE:</b> integration with Hadoop is available only in {@code In-Memory Accelerator For Hadoop} edition.
- */
-public interface IgniteFs extends Igfs, IgniteAsyncSupport {
- /** IGFS scheme name. */
- public static final String IGFS_SCHEME = "igfs";
-
- /** File property: prefer writes to local node. */
- public static final String PROP_PREFER_LOCAL_WRITES = "locWrite";
-
- /**
- * Gets IGFS name.
- *
- * @return IGFS name, or {@code null} for default file system.
- */
- public String name();
-
- /**
- * Gets IGFS configuration.
- *
- * @return IGFS configuration.
- */
- public IgfsConfiguration configuration();
-
- /**
- * Gets summary (total number of files, total number of directories and total length)
- * for a given path.
- *
- * @param path Path to get information for.
- * @return Summary object.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path is not found.
- * @throws IgniteException If failed.
- */
- public IgfsPathSummary summary(IgfsPath path) throws IgniteException;
-
- /**
- * Opens a file for reading.
- *
- * @param path File path to read.
- * @return File input stream to read data from.
- * @throws IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
- */
- public IgfsInputStream open(IgfsPath path) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
- */
- @Override public IgfsInputStream open(IgfsPath path, int bufSize) throws IgniteException;
-
- /**
- * Opens a file for reading.
- *
- * @param path File path to read.
- * @param bufSize Read buffer size (bytes) or {@code zero} to use default value.
- * @param seqReadsBeforePrefetch Amount of sequential reads before prefetch is started.
- * @return File input stream to read data from.
- * @throws IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
- */
- public IgfsInputStream open(IgfsPath path, int bufSize, int seqReadsBeforePrefetch) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- @Override public IgfsOutputStream create(IgfsPath path, boolean overwrite) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- @Override public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication,
- long blockSize, @Nullable Map<String, String> props) throws IgniteException;
-
- /**
- * 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 affKey Affinity key used to store file blocks. If not {@code null}, the whole file will be
- * stored on node where {@code affKey} resides.
- * @param replication Replication factor.
- * @param blockSize Block size.
- * @param props File properties to set.
- * @return File output stream to write data to.
- * @throws IgniteException In case of error.
- */
- public IgfsOutputStream create(IgfsPath path, int bufSize, boolean overwrite,
- @Nullable IgniteUuid affKey, int replication, long blockSize, @Nullable Map<String, String> props)
- throws IgniteException;
-
- /**
- * Opens an output stream to an existing file for appending data.
- *
- * @param path File path to append.
- * @param create Create file if it doesn't exist yet.
- * @return File output stream to append data to.
- * @throws IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
- */
- public IgfsOutputStream append(IgfsPath path, boolean create) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
- */
- @Override public IgfsOutputStream append(IgfsPath path, int bufSize, boolean create,
- @Nullable Map<String, String> props) throws IgniteException;
-
- /**
- * Sets last access time and last modification time for a given path. If argument is {@code null},
- * corresponding time will not be changed.
- *
- * @param path Path to update.
- * @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 org.apache.ignite.igfs.IgfsFileNotFoundException If target was not found.
- * @throws IgniteException If error occurred.
- */
- public void setTimes(IgfsPath path, long accessTime, long modificationTime) throws IgniteException;
-
- /**
- * Gets affinity block locations for data blocks of the file, i.e. the nodes, on which the blocks
- * are stored.
- *
- * @param path File path to get affinity for.
- * @param start Position in the file to start affinity resolution from.
- * @param len Size of data in the file to resolve affinity for.
- * @return Affinity block locations.
- * @throws IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
- */
- public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len) throws IgniteException;
-
- /**
- * Get affinity block locations for data blocks of the file. In case {@code maxLen} parameter is set and
- * particular block location length is greater than this value, block locations will be split into smaller
- * chunks.
- *
- * @param path File path to get affinity for.
- * @param start Position in the file to start affinity resolution from.
- * @param len Size of data in the file to resolve affinity for.
- * @param maxLen Maximum length of a single returned block location length.
- * @return Affinity block locations.
- * @throws IgniteException In case of error.
- * @throws org.apache.ignite.igfs.IgfsFileNotFoundException If path doesn't exist.
- */
- public Collection<IgfsBlockLocation> affinity(IgfsPath path, long start, long len, long maxLen)
- throws IgniteException;
-
- /**
- * Gets metrics snapshot for this file system.
- *
- * @return Metrics.
- * @throws IgniteException In case of error.
- */
- public IgfsMetrics metrics() throws IgniteException;
-
- /**
- * Resets metrics for this file system.
- *
- * @throws IgniteException In case of error.
- */
- public void resetMetrics() throws IgniteException;
-
- /**
- * Determines size of the file denoted by provided path. In case if path is a directory, then
- * total size of all containing entries will be calculated recursively.
- *
- * @param path File system path.
- * @return Total size.
- * @throws IgniteException In case of error.
- */
- public long size(IgfsPath path) throws IgniteException;
-
- /**
- * Formats the file system removing all existing entries from it.
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @throws IgniteException In case format has failed.
- */
- @IgniteAsyncSupported
- public void format() throws IgniteException;
-
- /**
- * Executes IGFS task.
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @param task Task to execute.
- * @param rslvr Optional resolver to control split boundaries.
- * @param paths Collection of paths to be processed within this task.
- * @param arg Optional task argument.
- * @return Task result.
- * @throws IgniteException If execution failed.
- */
- @IgniteAsyncSupported
- public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
- Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
-
- /**
- * Executes IGFS task with overridden maximum range length (see
- * {@link org.apache.ignite.configuration.IgfsConfiguration#getMaximumTaskRangeLength()} for more information).
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @param task Task to execute.
- * @param rslvr Optional resolver to control split boundaries.
- * @param paths Collection of paths to be processed within this task.
- * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
- * be ignored. Otherwise an exception will be thrown.
- * @param maxRangeLen Optional maximum range length. If {@code 0}, then by default all consecutive
- * IGFS blocks will be included.
- * @param arg Optional task argument.
- * @return Task result.
- * @throws IgniteException If execution failed.
- */
- @IgniteAsyncSupported
- public <T, R> R execute(IgfsTask<T, R> task, @Nullable IgfsRecordResolver rslvr,
- Collection<IgfsPath> paths, boolean skipNonExistentFiles, long maxRangeLen, @Nullable T arg)
- throws IgniteException;
-
- /**
- * Executes IGFS task.
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @param taskCls Task class to execute.
- * @param rslvr Optional resolver to control split boundaries.
- * @param paths Collection of paths to be processed within this task.
- * @param arg Optional task argument.
- * @return Task result.
- * @throws IgniteException If execution failed.
- */
- @IgniteAsyncSupported
- public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
- @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, @Nullable T arg) throws IgniteException;
-
- /**
- * Executes IGFS task with overridden maximum range length (see
- * {@link org.apache.ignite.configuration.IgfsConfiguration#getMaximumTaskRangeLength()} for more information).
- * <p>
- * Supports asynchronous execution (see {@link IgniteAsyncSupport}).
- *
- * @param taskCls Task class to execute.
- * @param rslvr Optional resolver to control split boundaries.
- * @param paths Collection of paths to be processed within this task.
- * @param skipNonExistentFiles Whether to skip non existent files. If set to {@code true} non-existent files will
- * be ignored. Otherwise an exception will be thrown.
- * @param maxRangeLen Maximum range length.
- * @param arg Optional task argument.
- * @return Task result.
- * @throws IgniteException If execution failed.
- */
- @IgniteAsyncSupported
- public <T, R> R execute(Class<? extends IgfsTask<T, R>> taskCls,
- @Nullable IgfsRecordResolver rslvr, Collection<IgfsPath> paths, boolean skipNonExistentFiles,
- long maxRangeLen, @Nullable T arg) throws IgniteException;
-
- /** {@inheritDoc} */
- @Override public IgniteFs withAsync();
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/configuration/IgfsConfiguration.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/configuration/IgfsConfiguration.java b/modules/core/src/main/java/org/apache/ignite/configuration/IgfsConfiguration.java
index 2ad79fc..a5dbedf 100644
--- a/modules/core/src/main/java/org/apache/ignite/configuration/IgfsConfiguration.java
+++ b/modules/core/src/main/java/org/apache/ignite/configuration/IgfsConfiguration.java
@@ -18,6 +18,7 @@
package org.apache.ignite.configuration;
import org.apache.ignite.igfs.*;
+import org.apache.ignite.igfs.secondary.*;
import org.apache.ignite.internal.util.typedef.internal.*;
import org.jetbrains.annotations.*;
@@ -121,7 +122,7 @@ public class IgfsConfiguration {
private int mgmtPort = DFLT_MGMT_PORT;
/** Secondary file system */
- private Igfs secondaryFs;
+ private IgfsSecondaryFileSystem secondaryFs;
/** IGFS mode. */
private IgfsMode dfltMode = DFLT_MODE;
@@ -517,7 +518,7 @@ public class IgfsConfiguration {
*
* @return Secondary file system.
*/
- public Igfs getSecondaryFileSystem() {
+ public IgfsSecondaryFileSystem getSecondaryFileSystem() {
return secondaryFs;
}
@@ -527,7 +528,7 @@ public class IgfsConfiguration {
*
* @param fileSystem
*/
- public void setSecondaryFileSystem(Igfs fileSystem) {
+ public void setSecondaryFileSystem(IgfsSecondaryFileSystem fileSystem) {
secondaryFs = fileSystem;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/Igfs.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/Igfs.java b/modules/core/src/main/java/org/apache/ignite/igfs/Igfs.java
deleted file mode 100644
index 48b9b58..0000000
--- a/modules/core/src/main/java/org/apache/ignite/igfs/Igfs.java
+++ /dev/null
@@ -1,216 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.igfs;
-
-import org.apache.ignite.*;
-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 IGFS.
- */
-public interface Igfs {
- /** 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 IgniteException In case of error.
- */
- public boolean exists(IgfsPath path);
-
- /**
- * 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 IgniteException In case of error.
- */
- public IgfsFile update(IgfsPath path, Map<String, String> props) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- * @throws IgfsFileNotFoundException If source file doesn't exist.
- */
- public void rename(IgfsPath src, IgfsPath dest) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- public boolean delete(IgfsPath path, boolean recursive) throws IgniteException;
-
- /**
- * Creates directories under specified path.
- *
- * @param path Path of directories chain to create.
- * @throws IgniteException In case of error.
- */
- public void mkdirs(IgfsPath path) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- public void mkdirs(IgfsPath path, @Nullable Map<String, String> props) throws IgniteException;
-
- /**
- * Lists file paths under the specified path.
- *
- * @param path Path to list files under.
- * @return List of files under the specified path.
- * @throws IgniteException In case of error.
- * @throws IgfsFileNotFoundException If path doesn't exist.
- */
- public Collection<IgfsPath> listPaths(IgfsPath path) throws IgniteException;
-
- /**
- * Lists files under the specified path.
- *
- * @param path Path to list files under.
- * @return List of files under the specified path.
- * @throws IgniteException In case of error.
- * @throws IgfsFileNotFoundException If path doesn't exist.
- */
- public Collection<IgfsFile> listFiles(IgfsPath path) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- * @throws IgfsFileNotFoundException If path doesn't exist.
- */
- public IgfsReader open(IgfsPath path, int bufSize) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- public OutputStream create(IgfsPath path, boolean overwrite) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- public OutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize,
- @Nullable Map<String, String> props) throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- * @throws IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
- */
- public OutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable Map<String, String> props)
- throws IgniteException;
-
- /**
- * 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 IgniteException In case of error.
- */
- public IgfsFile info(IgfsPath path) throws IgniteException;
-
- /**
- * Gets used space in bytes.
- *
- * @return Used space in bytes.
- * @throws IgniteException In case of error.
- */
- public long usedSpaceSize() throws IgniteException;
-
- /**
- * 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/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsBlockLocation.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsBlockLocation.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsBlockLocation.java
index c4f28c6..afd0314 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsBlockLocation.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsBlockLocation.java
@@ -22,7 +22,7 @@ import java.util.*;
/**
* {@code IGFS} file's data block location in the grid. It is used to determine
* node affinity of a certain file block within the Grid by calling
- * {@link org.apache.ignite.IgniteFs#affinity(IgfsPath, long, long)} method.
+ * {@link org.apache.ignite.IgniteFileSystem#affinity(IgfsPath, long, long)} method.
*/
public interface IgfsBlockLocation {
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsFile.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsFile.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsFile.java
index 172dca1..550679a 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsFile.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsFile.java
@@ -77,7 +77,7 @@ public interface IgfsFile {
/**
* 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(IgfsPath, long, long)} method.
+ * {@link org.apache.ignite.IgniteFileSystem#setTimes(IgfsPath, long, long)} method.
* <p>
* By default last access time equals file creation time.
*
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsInputStream.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsInputStream.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsInputStream.java
index 308dbcb..746aa6f 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsInputStream.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsInputStream.java
@@ -17,13 +17,15 @@
package org.apache.ignite.igfs;
+import org.apache.ignite.igfs.secondary.*;
+
import java.io.*;
/**
* {@code IGFS} input stream to read data from the file system.
* It provides several additional methods for asynchronous access.
*/
-public abstract class IgfsInputStream extends InputStream implements IgfsReader {
+public abstract class IgfsInputStream extends InputStream implements IgfsSecondaryFileSystemReader {
/**
* Gets file length during file open.
*
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsReader.java b/modules/core/src/main/java/org/apache/ignite/igfs/IgfsReader.java
deleted file mode 100644
index fff8ca3..0000000
--- a/modules/core/src/main/java/org/apache/ignite/igfs/IgfsReader.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.igfs;
-
-import java.io.*;
-
-/**
- * The simplest data input interface to read from secondary file system in dual modes.
- */
-public interface IgfsReader extends Closeable {
- /**
- * Read up to the specified number of bytes, from a given position within a file, and return the number of bytes
- * read.
- *
- * @param pos Position in the input stream to seek.
- * @param buf Buffer into which data is read.
- * @param off Offset in the buffer from which stream data should be written.
- * @param len The number of bytes to read.
- * @return Total number of bytes read into the buffer, or -1 if there is no more data (EOF).
- * @throws IOException In case of any exception.
- */
- public int read(long pos, byte[] buf, int off, int len) throws IOException;
-}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsInputStreamJobAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsInputStreamJobAdapter.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsInputStreamJobAdapter.java
index bf2636f..d7fd866 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsInputStreamJobAdapter.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsInputStreamJobAdapter.java
@@ -32,7 +32,7 @@ import java.io.*;
*/
public abstract class IgfsInputStreamJobAdapter extends IgfsJobAdapter {
/** {@inheritDoc} */
- @Override public final Object execute(IgniteFs igfs, IgfsFileRange range, IgfsInputStream in)
+ @Override public final Object execute(IgniteFileSystem igfs, IgfsFileRange range, IgfsInputStream in)
throws IgniteException, IOException {
in.seek(range.start());
@@ -48,5 +48,5 @@ public abstract class IgfsInputStreamJobAdapter extends IgfsJobAdapter {
* @throws IgniteException If execution failed.
* @throws IOException If IO exception encountered while working with stream.
*/
- public abstract Object execute(IgniteFs igfs, IgfsRangeInputStream in) throws IgniteException, IOException;
+ public abstract Object execute(IgniteFileSystem igfs, IgfsRangeInputStream in) throws IgniteException, IOException;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsJob.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsJob.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsJob.java
index d12fc79..0fdc0f2 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsJob.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsJob.java
@@ -26,7 +26,7 @@ import java.io.*;
* Defines executable unit for {@link IgfsTask}. Before this job is executed, it is assigned one of the
* ranges provided by the {@link IgfsRecordResolver} passed to one of the {@code IgniteFs.execute(...)} methods.
* <p>
- * {@link #execute(org.apache.ignite.IgniteFs, IgfsFileRange, org.apache.ignite.igfs.IgfsInputStream)} method is given {@link IgfsFileRange} this
+ * {@link #execute(org.apache.ignite.IgniteFileSystem, IgfsFileRange, org.apache.ignite.igfs.IgfsInputStream)} method is given {@link IgfsFileRange} this
* job is expected to operate on, and already opened {@link org.apache.ignite.igfs.IgfsInputStream} for the file this range belongs to.
* <p>
* Note that provided input stream has position already adjusted to range start. However, it will not
@@ -52,7 +52,7 @@ public interface IgfsJob {
* @throws IgniteException If execution failed.
* @throws IOException If file system operation resulted in IO exception.
*/
- public Object execute(IgniteFs igfs, IgfsFileRange range, IgfsInputStream in) throws IgniteException,
+ public Object execute(IgniteFileSystem igfs, IgfsFileRange range, IgfsInputStream in) throws IgniteException,
IOException;
/**
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsRecordResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsRecordResolver.java
index 52afeda..cc1d73f 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsRecordResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsRecordResolver.java
@@ -51,6 +51,6 @@ public interface IgfsRecordResolver extends Serializable {
* @throws IgniteException If resolve failed.
* @throws IOException If resolve failed.
*/
- @Nullable public IgfsFileRange resolveRecords(IgniteFs fs, IgfsInputStream stream,
+ @Nullable public IgfsFileRange resolveRecords(IgniteFileSystem fs, IgfsInputStream stream,
IgfsFileRange suggestedRecord) throws IgniteException, IOException;
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsTask.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsTask.java
index e42b012..e257c38 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsTask.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/IgfsTask.java
@@ -88,7 +88,7 @@ public abstract class IgfsTask<T, R> extends ComputeTaskAdapter<IgfsTaskArgs<T>,
assert ignite != null;
assert args != null;
- IgniteFs fs = ignite.fileSystem(args.igfsName());
+ IgniteFileSystem fs = ignite.fileSystem(args.igfsName());
IgfsProcessorAdapter igfsProc = ((IgniteKernal) ignite).context().igfs();
Map<ComputeJob, ClusterNode> splitMap = new HashMap<>();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsByteDelimiterRecordResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsByteDelimiterRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsByteDelimiterRecordResolver.java
index c1c15a5..c9ed821 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsByteDelimiterRecordResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsByteDelimiterRecordResolver.java
@@ -20,7 +20,6 @@ package org.apache.ignite.igfs.mapreduce.records;
import org.apache.ignite.*;
import org.apache.ignite.igfs.*;
import org.apache.ignite.igfs.mapreduce.*;
-import org.apache.ignite.internal.util.*;
import org.apache.ignite.internal.util.tostring.*;
import org.apache.ignite.internal.util.typedef.*;
import org.apache.ignite.internal.util.typedef.internal.*;
@@ -78,7 +77,7 @@ public class IgfsByteDelimiterRecordResolver implements IgfsRecordResolver, Exte
}
/** {@inheritDoc} */
- @Override public IgfsFileRange resolveRecords(IgniteFs fs, IgfsInputStream stream,
+ @Override public IgfsFileRange resolveRecords(IgniteFileSystem fs, IgfsInputStream stream,
IgfsFileRange suggestedRecord) throws IgniteException, IOException {
long suggestedStart = suggestedRecord.start();
long suggestedEnd = suggestedStart + suggestedRecord.length();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsFixedLengthRecordResolver.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsFixedLengthRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsFixedLengthRecordResolver.java
index fe22627..bcc8f69 100644
--- a/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsFixedLengthRecordResolver.java
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/mapreduce/records/IgfsFixedLengthRecordResolver.java
@@ -52,7 +52,7 @@ public class IgfsFixedLengthRecordResolver implements IgfsRecordResolver, Extern
}
/** {@inheritDoc} */
- @Override public IgfsFileRange resolveRecords(IgniteFs fs, IgfsInputStream stream,
+ @Override public IgfsFileRange resolveRecords(IgniteFileSystem fs, IgfsInputStream stream,
IgfsFileRange suggestedRecord)
throws IgniteException, IOException {
long suggestedEnd = suggestedRecord.start() + suggestedRecord.length();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
new file mode 100644
index 0000000..88fcae4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystem.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.igfs.secondary;
+
+import org.apache.ignite.*;
+import org.apache.ignite.igfs.*;
+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 IGFS.
+ */
+public interface IgfsSecondaryFileSystem {
+ /** 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 IgniteException In case of error.
+ */
+ public boolean exists(IgfsPath path);
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public IgfsFile update(IgfsPath path, Map<String, String> props) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ * @throws IgfsFileNotFoundException If source file doesn't exist.
+ */
+ public void rename(IgfsPath src, IgfsPath dest) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public boolean delete(IgfsPath path, boolean recursive) throws IgniteException;
+
+ /**
+ * Creates directories under specified path.
+ *
+ * @param path Path of directories chain to create.
+ * @throws IgniteException In case of error.
+ */
+ public void mkdirs(IgfsPath path) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public void mkdirs(IgfsPath path, @Nullable Map<String, String> props) throws IgniteException;
+
+ /**
+ * Lists file paths under the specified path.
+ *
+ * @param path Path to list files under.
+ * @return List of files under the specified path.
+ * @throws IgniteException In case of error.
+ * @throws IgfsFileNotFoundException If path doesn't exist.
+ */
+ public Collection<IgfsPath> listPaths(IgfsPath path) throws IgniteException;
+
+ /**
+ * Lists files under the specified path.
+ *
+ * @param path Path to list files under.
+ * @return List of files under the specified path.
+ * @throws IgniteException In case of error.
+ * @throws IgfsFileNotFoundException If path doesn't exist.
+ */
+ public Collection<IgfsFile> listFiles(IgfsPath path) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ * @throws IgfsFileNotFoundException If path doesn't exist.
+ */
+ public IgfsSecondaryFileSystemReader open(IgfsPath path, int bufSize) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public OutputStream create(IgfsPath path, boolean overwrite) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public OutputStream create(IgfsPath path, int bufSize, boolean overwrite, int replication, long blockSize,
+ @Nullable Map<String, String> props) throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ * @throws IgfsFileNotFoundException If path doesn't exist and create flag is {@code false}.
+ */
+ public OutputStream append(IgfsPath path, int bufSize, boolean create, @Nullable Map<String, String> props)
+ throws IgniteException;
+
+ /**
+ * 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 IgniteException In case of error.
+ */
+ public IgfsFile info(IgfsPath path) throws IgniteException;
+
+ /**
+ * Gets used space in bytes.
+ *
+ * @return Used space in bytes.
+ * @throws IgniteException In case of error.
+ */
+ public long usedSpaceSize() throws IgniteException;
+
+ /**
+ * 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/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystemReader.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystemReader.java b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystemReader.java
new file mode 100644
index 0000000..02a135e
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/IgfsSecondaryFileSystemReader.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.igfs.secondary;
+
+import java.io.*;
+
+/**
+ * The simplest data input interface to read from secondary file system in dual modes.
+ */
+public interface IgfsSecondaryFileSystemReader extends Closeable {
+ /**
+ * Read up to the specified number of bytes, from a given position within a file, and return the number of bytes
+ * read.
+ *
+ * @param pos Position in the input stream to seek.
+ * @param buf Buffer into which data is read.
+ * @param off Offset in the buffer from which stream data should be written.
+ * @param len The number of bytes to read.
+ * @return Total number of bytes read into the buffer, or -1 if there is no more data (EOF).
+ * @throws IOException In case of any exception.
+ */
+ public int read(long pos, byte[] buf, int off, int len) throws IOException;
+}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/package.html
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/igfs/secondary/package.html b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/package.html
new file mode 100644
index 0000000..8bd668d
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/igfs/secondary/package.html
@@ -0,0 +1,24 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<body>
+ <!-- Package description. -->
+ Contains APIs for IGFS secondary file system.
+</body>
+</html>
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
index 7557efe..3ede8d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteEx.java
@@ -117,7 +117,7 @@ public interface IgniteEx extends Ignite {
* @param name IGFS name.
* @return IGFS.
*/
- @Nullable public IgniteFs igfsx(@Nullable String name);
+ @Nullable public IgniteFileSystem igfsx(@Nullable String name);
/**
* Get Hadoop facade.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
index 16ffc30..2a371ac 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/IgniteKernal.java
@@ -2358,11 +2358,11 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public IgniteFs fileSystem(String name) {
+ @Override public IgniteFileSystem fileSystem(String name) {
guard();
try{
- IgniteFs fs = ctx.igfs().igfs(name);
+ IgniteFileSystem fs = ctx.igfs().igfs(name);
if (fs == null)
throw new IllegalArgumentException("IGFS is not configured: " + name);
@@ -2375,7 +2375,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Nullable @Override public IgniteFs igfsx(@Nullable String name) {
+ @Nullable @Override public IgniteFileSystem igfsx(@Nullable String name) {
guard();
try {
@@ -2387,7 +2387,7 @@ public class IgniteKernal implements IgniteEx, IgniteMXBean, Externalizable {
}
/** {@inheritDoc} */
- @Override public Collection<IgniteFs> fileSystems() {
+ @Override public Collection<IgniteFileSystem> fileSystems() {
guard();
try {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/dd06414a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
index 1479a88..cb8b833 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/igfs/IgfsAsyncImpl.java
@@ -32,7 +32,7 @@ import java.util.*;
/**
* Igfs supporting asynchronous operations.
*/
-public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFs> implements IgfsEx {
+public class IgfsAsyncImpl extends AsyncSupportAdapter<IgniteFileSystem> implements IgfsEx {
/** */
private final IgfsImpl igfs;