http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathAlreadyExistsException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathAlreadyExistsException.java b/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathAlreadyExistsException.java deleted file mode 100644 index e44fdb5..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathAlreadyExistsException.java +++ /dev/null @@ -1,50 +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.fs; - -import org.jetbrains.annotations.*; - -/** - * Exception thrown when target path supposed to be created already exists. - */ -public class IgniteFsPathAlreadyExistsException extends IgniteFsInvalidPathException { - /** */ - private static final long serialVersionUID = 0L; - - /** - * @param msg Error message. - */ - public IgniteFsPathAlreadyExistsException(String msg) { - super(msg); - } - - /** - * @param cause Exception cause. - */ - public IgniteFsPathAlreadyExistsException(Throwable cause) { - super(cause); - } - - /** - * @param msg Error message. - * @param cause Exception cause. - */ - public IgniteFsPathAlreadyExistsException(String msg, @Nullable Throwable cause) { - super(msg, cause); - } -}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathSummary.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathSummary.java b/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathSummary.java deleted file mode 100644 index 066cdc1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsPathSummary.java +++ /dev/null @@ -1,138 +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.fs; - -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Path summary: total files count, total directories count, total length. - */ -public class IgniteFsPathSummary implements Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Path. */ - private IgniteFsPath path; - - /** File count. */ - private int filesCnt; - - /** Directories count. */ - private int dirCnt; - - /** Length consumed. */ - private long totalLen; - - /** - * Empty constructor required by {@link Externalizable}. - */ - public IgniteFsPathSummary() { - // No-op. - } - - /** - * Construct empty path summary. - * - * @param path Path. - */ - public IgniteFsPathSummary(IgniteFsPath path) { - this.path = path; - } - - /** - * @return Files count. - */ - public int filesCount() { - return filesCnt; - } - - /** - * @param filesCnt Files count. - */ - public void filesCount(int filesCnt) { - this.filesCnt = filesCnt; - } - - /** - * @return Directories count. - */ - public int directoriesCount() { - return dirCnt; - } - - /** - * @param dirCnt Directories count. - */ - public void directoriesCount(int dirCnt) { - this.dirCnt = dirCnt; - } - - /** - * @return Total length. - */ - public long totalLength() { - return totalLen; - } - - /** - * @param totalLen Total length. - */ - public void totalLength(long totalLen) { - this.totalLen = totalLen; - } - - /** - * @return Path for which summary is obtained. - */ - public IgniteFsPath path() { - return path; - } - - /** - * @param path Path for which summary is obtained. - */ - public void path(IgniteFsPath path) { - this.path = path; - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeInt(filesCnt); - out.writeInt(dirCnt); - out.writeLong(totalLen); - - path.writeExternal(out); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - filesCnt = in.readInt(); - dirCnt = in.readInt(); - totalLen = in.readLong(); - - path = new IgniteFsPath(); - path.readExternal(in); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsPathSummary.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsReader.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsReader.java b/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsReader.java deleted file mode 100644 index 73b276a..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/IgniteFsReader.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.fs; - -import java.io.*; - -/** - * The simplest data input interface to read from secondary file system in dual modes. - */ -public interface IgniteFsReader 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/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsFileRange.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsFileRange.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsFileRange.java deleted file mode 100644 index fc18181..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsFileRange.java +++ /dev/null @@ -1,80 +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.fs.mapreduce; - -import org.apache.ignite.fs.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -/** - * Entity representing part of GGFS file identified by file path, start position, and length. - */ -public class IgniteFsFileRange { - /** File path. */ - private IgniteFsPath path; - - /** Start position. */ - private long start; - - /** Length. */ - private long len; - - /** - * Creates file range. - * - * @param path File path. - * @param start Start position. - * @param len Length. - */ - public IgniteFsFileRange(IgniteFsPath path, long start, long len) { - this.path = path; - this.start = start; - this.len = len; - } - - /** - * Gets file path. - * - * @return File path. - */ - public IgniteFsPath path() { - return path; - } - - /** - * Gets range start position. - * - * @return Start position. - */ - public long start() { - return start; - } - - /** - * Gets range length. - * - * @return Length. - */ - public long length() { - return len; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsFileRange.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsInputStreamJobAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsInputStreamJobAdapter.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsInputStreamJobAdapter.java deleted file mode 100644 index 31c4f55..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsInputStreamJobAdapter.java +++ /dev/null @@ -1,52 +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.fs.mapreduce; - -import org.apache.ignite.*; -import org.apache.ignite.fs.*; -import org.apache.ignite.internal.util.*; - -import java.io.*; - -/** - * Convenient {@link IgniteFsJob} adapter. It limits data returned from {@link org.apache.ignite.fs.IgniteFsInputStream} to bytes within - * the {@link IgniteFsFileRange} assigned to the job. - * <p> - * Under the covers it simply puts job's {@code GridGgfsInputStream} position to range start and wraps in into - * {@link GridFixedSizeInputStream} limited to range length. - */ -public abstract class IgniteFsInputStreamJobAdapter extends IgniteFsJobAdapter { - /** {@inheritDoc} */ - @Override public final Object execute(IgniteFs ggfs, IgniteFsFileRange range, IgniteFsInputStream in) - throws IgniteException, IOException { - in.seek(range.start()); - - return execute(ggfs, new IgniteFsRangeInputStream(in, range)); - } - - /** - * Executes this job. - * - * @param ggfs GGFS instance. - * @param in Input stream. - * @return Execution result. - * @throws IgniteException If execution failed. - * @throws IOException If IO exception encountered while working with stream. - */ - public abstract Object execute(IgniteFs ggfs, IgniteFsRangeInputStream in) throws IgniteException, IOException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJob.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJob.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJob.java deleted file mode 100644 index ae04ab7..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJob.java +++ /dev/null @@ -1,69 +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.fs.mapreduce; - -import org.apache.ignite.*; -import org.apache.ignite.fs.*; - -import java.io.*; - -/** - * Defines executable unit for {@link IgniteFsTask}. Before this job is executed, it is assigned one of the - * ranges provided by the {@link IgniteFsRecordResolver} passed to one of the {@code GridGgfs.execute(...)} methods. - * <p> - * {@link #execute(org.apache.ignite.IgniteFs, IgniteFsFileRange, org.apache.ignite.fs.IgniteFsInputStream)} method is given {@link IgniteFsFileRange} this - * job is expected to operate on, and already opened {@link org.apache.ignite.fs.IgniteFsInputStream} for the file this range belongs to. - * <p> - * Note that provided input stream has position already adjusted to range start. However, it will not - * automatically stop on range end. This is done to provide capability in some cases to look beyond - * the range end or seek position before the reange start. - * <p> - * In majority of the cases, when you want to process only provided range, you should explicitly control amount - * of returned data and stop at range end. You can also use {@link IgniteFsInputStreamJobAdapter}, which operates - * on {@link IgniteFsRangeInputStream} bounded to range start and end, or manually wrap provided input stream with - * {@link IgniteFsRangeInputStream}. - * <p> - * You can inject any resources in concrete implementation, just as with regular {@link org.apache.ignite.compute.ComputeJob} implementations. - */ -public interface IgniteFsJob { - /** - * Executes this job. - * - * @param ggfs GGFS instance. - * @param range File range aligned to record boundaries. - * @param in Input stream for split file. This input stream is not aligned to range and points to file start - * by default. - * @return Execution result. - * @throws IgniteException If execution failed. - * @throws IOException If file system operation resulted in IO exception. - */ - public Object execute(IgniteFs ggfs, IgniteFsFileRange range, IgniteFsInputStream in) throws IgniteException, - IOException; - - /** - * This method is called when system detects that completion of this - * job can no longer alter the overall outcome (for example, when parent task - * has already reduced the results). Job is also cancelled when - * {@link org.apache.ignite.compute.ComputeTaskFuture#cancel()} is called. - * <p> - * Note that job cancellation is only a hint, and just like with - * {@link Thread#interrupt()} method, it is really up to the actual job - * instance to gracefully finish execution and exit. - */ - public void cancel(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJobAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJobAdapter.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJobAdapter.java deleted file mode 100644 index c851440..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsJobAdapter.java +++ /dev/null @@ -1,28 +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.fs.mapreduce; - -/** - * Adapter for {@link IgniteFsJob} with no-op implementation of {@link #cancel()} method. - */ -public abstract class IgniteFsJobAdapter implements IgniteFsJob { - /** {@inheritDoc} */ - @Override public void cancel() { - // No-op. - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRangeInputStream.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRangeInputStream.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRangeInputStream.java deleted file mode 100644 index 842b500..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRangeInputStream.java +++ /dev/null @@ -1,197 +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.fs.mapreduce; - -import org.apache.ignite.fs.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.io.*; - -/** - * Decorator for regular {@link org.apache.ignite.fs.IgniteFsInputStream} which streams only data within the given range. - * This stream is used for {@link IgniteFsInputStreamJobAdapter} convenience adapter to create - * jobs which will be working only with the assigned range. You can also use it explicitly when - * working with {@link IgniteFsJob} directly. - */ -public final class IgniteFsRangeInputStream extends IgniteFsInputStream { - /** Base input stream. */ - private final IgniteFsInputStream is; - - /** Start position. */ - private final long start; - - /** Maximum stream length. */ - private final long maxLen; - - /** Current position within the stream. */ - private long pos; - - /** - * Constructor. - * - * @param is Base input stream. - * @param start Start position. - * @param maxLen Maximum stream length. - * @throws IOException In case of exception. - */ - public IgniteFsRangeInputStream(IgniteFsInputStream is, long start, long maxLen) throws IOException { - if (is == null) - throw new IllegalArgumentException("Input stream cannot be null."); - - if (start < 0) - throw new IllegalArgumentException("Start position cannot be negative."); - - if (start >= is.length()) - throw new IllegalArgumentException("Start position cannot be greater that file length."); - - if (maxLen < 0) - throw new IllegalArgumentException("Length cannot be negative."); - - if (start + maxLen > is.length()) - throw new IllegalArgumentException("Sum of start position and length cannot be greater than file length."); - - this.is = is; - this.start = start; - this.maxLen = maxLen; - - is.seek(start); - } - - /** {@inheritDoc} */ - @Override public long length() { - return is.length(); - } - - /** - * Constructor. - * - * @param is Base input stream. - * @param range File range. - * @throws IOException In case of exception. - */ - public IgniteFsRangeInputStream(IgniteFsInputStream is, IgniteFsFileRange range) throws IOException { - this(is, range.start(), range.length()); - } - - /** {@inheritDoc} */ - @Override public int read() throws IOException { - if (pos < maxLen) { - int res = is.read(); - - if (res != -1) - pos++; - - return res; - } - else - return -1; - } - - /** {@inheritDoc} */ - @Override public int read(@NotNull byte[] b, int off, int len) throws IOException { - if (pos < maxLen) { - len = (int)Math.min(len, maxLen - pos); - - int res = is.read(b, off, len); - - if (res != -1) - pos += res; - - return res; - } - else - return -1; - } - - /** {@inheritDoc} */ - @Override public int read(long pos, byte[] buf, int off, int len) throws IOException { - seek(pos); - - return read(buf, off, len); - } - - /** {@inheritDoc} */ - @Override public void readFully(long pos, byte[] buf) throws IOException { - readFully(pos, buf, 0, buf.length); - } - - /** {@inheritDoc} */ - @Override public void readFully(long pos, byte[] buf, int off, int len) throws IOException { - seek(pos); - - for (int readBytes = 0; readBytes < len;) { - int read = read(buf, off + readBytes, len - readBytes); - - if (read == -1) - throw new EOFException("Failed to read stream fully (stream ends unexpectedly) [pos=" + pos + - ", buf.length=" + buf.length + ", off=" + off + ", len=" + len + ']'); - - readBytes += read; - } - } - - /** {@inheritDoc} */ - @Override public void seek(long pos) throws IOException { - if (pos < 0) - throw new IOException("Seek position cannot be negative: " + pos); - - is.seek(start + pos); - - this.pos = pos; - } - - /** {@inheritDoc} */ - @Override public long position() { - return pos; - } - - /** - * Since range input stream represents a part of larger file stream, there is an offset at which this - * range input stream starts in original input stream. This method returns start offset of this input - * stream relative to original input stream. - * - * @return Start offset in original input stream. - */ - public long startOffset() { - return start; - } - - /** {@inheritDoc} */ - @Override public int available() { - long l = maxLen - pos; - - if (l < 0) - return 0; - - if (l > Integer.MAX_VALUE) - return Integer.MAX_VALUE; - - return (int)l; - } - - /** {@inheritDoc} */ - @Override public void close() throws IOException { - is.close(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsRangeInputStream.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRecordResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRecordResolver.java deleted file mode 100644 index c34c304..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsRecordResolver.java +++ /dev/null @@ -1,56 +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.fs.mapreduce; - -import org.apache.ignite.*; -import org.apache.ignite.fs.*; -import org.jetbrains.annotations.*; - -import java.io.*; - -/** - * GGFS record resolver. When {@link IgniteFsTask} is split into {@link IgniteFsJob}s each produced job will obtain - * {@link IgniteFsFileRange} based on file data location. Record resolver is invoked in each job before actual - * execution in order to adjust record boundaries in a way consistent with user data. - * <p> - * E.g., you may want to split your task into jobs so that each job process zero, one or several lines from that file. - * But file is split into ranges based on block locations, not new line boundaries. Using convenient record resolver - * you can adjust job range so that it covers the whole line(s). - * <p> - * The following record resolvers are available out of the box: - * <ul> - * <li>{@link org.apache.ignite.fs.mapreduce.records.IgniteFsFixedLengthRecordResolver}</li> - * <li>{@link org.apache.ignite.fs.mapreduce.records.IgniteFsByteDelimiterRecordResolver}</li> - * <li>{@link org.apache.ignite.fs.mapreduce.records.IgniteFsStringDelimiterRecordResolver}</li> - * <li>{@link org.apache.ignite.fs.mapreduce.records.IgniteFsNewLineRecordResolver}</li> - * </ul> - */ -public interface IgniteFsRecordResolver extends Serializable { - /** - * Adjusts record start offset and length. - * - * @param fs IgniteFs instance to use. - * @param stream Input stream for split file. - * @param suggestedRecord Suggested file system record. - * @return New adjusted record. If this method returns {@code null}, original record is ignored. - * @throws IgniteException If resolve failed. - * @throws IOException If resolve failed. - */ - @Nullable public IgniteFsFileRange resolveRecords(IgniteFs fs, IgniteFsInputStream stream, - IgniteFsFileRange suggestedRecord) throws IgniteException, IOException; -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTask.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTask.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTask.java deleted file mode 100644 index 76de058..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTask.java +++ /dev/null @@ -1,172 +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.fs.mapreduce; - -import org.apache.ignite.*; -import org.apache.ignite.cluster.*; -import org.apache.ignite.compute.*; -import org.apache.ignite.fs.*; -import org.apache.ignite.internal.*; -import org.apache.ignite.internal.processors.fs.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.resources.*; -import org.jetbrains.annotations.*; - -import java.util.*; - -/** - * GGFS task which can be executed on the grid using one of {@code GridGgfs.execute()} methods. Essentially GGFS task - * is regular {@link org.apache.ignite.compute.ComputeTask} with different map logic. Instead of implementing - * {@link org.apache.ignite.compute.ComputeTask#map(List, Object)} method to split task into jobs, you must implement - * {@link IgniteFsTask#createJob(org.apache.ignite.fs.IgniteFsPath, IgniteFsFileRange, IgniteFsTaskArgs)} method. - * <p> - * Each file participating in GGFS task is split into {@link IgniteFsFileRange}s first. Normally range is a number of - * consequent bytes located on a single node (see {@code IgniteFsGroupDataBlocksKeyMapper}). In case maximum range size - * is provided (either through {@link org.apache.ignite.fs.IgniteFsConfiguration#getMaximumTaskRangeLength()} or {@code GridGgfs.execute()} - * argument), then ranges could be further divided into smaller chunks. - * <p> - * Once file is split into ranges, each range is passed to {@code GridGgfsTask.createJob()} method in order to create a - * {@link IgniteFsJob}. - * <p> - * Finally all generated jobs are sent to Grid nodes for execution. - * <p> - * As with regular {@code GridComputeTask} you can define your own logic for results handling and reduce step. - * <p> - * Here is an example of such a task: - * <pre name="code" class="java"> - * public class WordCountTask extends GridGgfsTask<String, Integer> { - * @Override - * public GridGgfsJob createJob(GridGgfsPath path, GridGgfsFileRange range, GridGgfsTaskArgs<T> args) throws IgniteCheckedException { - * // New job will be created for each range within each file. - * // We pass user-provided argument (which is essentially a word to look for) to that job. - * return new WordCountJob(args.userArgument()); - * } - * - * // Aggregate results into one compound result. - * public Integer reduce(List<GridComputeJobResult> results) throws IgniteCheckedException { - * Integer total = 0; - * - * for (GridComputeJobResult res : results) { - * Integer cnt = res.getData(); - * - * // Null can be returned for non-existent file in case we decide to ignore such situations. - * if (cnt != null) - * total += cnt; - * } - * - * return total; - * } - * } - * </pre> - */ -public abstract class IgniteFsTask<T, R> extends ComputeTaskAdapter<IgniteFsTaskArgs<T>, R> { - /** */ - private static final long serialVersionUID = 0L; - - /** Injected grid. */ - @IgniteInstanceResource - private Ignite ignite; - - /** {@inheritDoc} */ - @Nullable @Override public final Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, - @Nullable IgniteFsTaskArgs<T> args) { - assert ignite != null; - assert args != null; - - IgniteFs fs = ignite.fileSystem(args.ggfsName()); - IgniteFsProcessorAdapter ggfsProc = ((IgniteKernal) ignite).context().ggfs(); - - Map<ComputeJob, ClusterNode> splitMap = new HashMap<>(); - - Map<UUID, ClusterNode> nodes = mapSubgrid(subgrid); - - for (IgniteFsPath path : args.paths()) { - IgniteFsFile file = fs.info(path); - - if (file == null) { - if (args.skipNonExistentFiles()) - continue; - else - throw new IgniteException("Failed to process IgniteFs file because it doesn't exist: " + path); - } - - Collection<IgniteFsBlockLocation> aff = fs.affinity(path, 0, file.length(), args.maxRangeLength()); - - long totalLen = 0; - - for (IgniteFsBlockLocation loc : aff) { - ClusterNode node = null; - - for (UUID nodeId : loc.nodeIds()) { - node = nodes.get(nodeId); - - if (node != null) - break; - } - - if (node == null) - throw new IgniteException("Failed to find any of block affinity nodes in subgrid [loc=" + loc + - ", subgrid=" + subgrid + ']'); - - IgniteFsJob job = createJob(path, new IgniteFsFileRange(file.path(), loc.start(), loc.length()), args); - - if (job != null) { - ComputeJob jobImpl = ggfsProc.createJob(job, fs.name(), file.path(), loc.start(), - loc.length(), args.recordResolver()); - - splitMap.put(jobImpl, node); - } - - totalLen += loc.length(); - } - - assert totalLen == file.length(); - } - - return splitMap; - } - - /** - * Callback invoked during task map procedure to create job that will process specified split - * for GGFS file. - * - * @param path Path. - * @param range File range based on consecutive blocks. This range will be further - * realigned to record boundaries on destination node. - * @param args Task argument. - * @return GGFS job. If {@code null} is returned, the passed in file range will be skipped. - * @throws IgniteException If job creation failed. - */ - @Nullable public abstract IgniteFsJob createJob(IgniteFsPath path, IgniteFsFileRange range, - IgniteFsTaskArgs<T> args) throws IgniteException; - - /** - * Maps list by node ID. - * - * @param subgrid Subgrid. - * @return Map. - */ - private Map<UUID, ClusterNode> mapSubgrid(Collection<ClusterNode> subgrid) { - Map<UUID, ClusterNode> res = U.newHashMap(subgrid.size()); - - for (ClusterNode node : subgrid) - res.put(node.id(), node); - - return res; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskArgs.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskArgs.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskArgs.java deleted file mode 100644 index fd56477..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskArgs.java +++ /dev/null @@ -1,82 +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.fs.mapreduce; - -import org.apache.ignite.fs.*; - -import java.util.*; - -/** - * GGFS task arguments. When you initiate new GGFS task execution using one of {@code GridGgfs.execute(...)} methods, - * all passed parameters are encapsulated in a single {@code GridGgfsTaskArgs} object. Later on this object is - * passed to {@link IgniteFsTask#createJob(org.apache.ignite.fs.IgniteFsPath, IgniteFsFileRange, IgniteFsTaskArgs)} method. - * <p> - * Task arguments encapsulates the following data: - * <ul> - * <li>GGFS name</li> - * <li>File paths passed to {@code GridGgfs.execute()} method</li> - * <li>{@link IgniteFsRecordResolver} for that task</li> - * <li>Flag indicating whether to skip non-existent file paths or throw an exception</li> - * <li>User-defined task argument</li> - * <li>Maximum file range length for that task (see {@link org.apache.ignite.fs.IgniteFsConfiguration#getMaximumTaskRangeLength()})</li> - * </ul> - */ -public interface IgniteFsTaskArgs<T> { - /** - * Gets GGFS name. - * - * @return GGFS name. - */ - public String ggfsName(); - - /** - * Gets file paths to process. - * - * @return File paths to process. - */ - public Collection<IgniteFsPath> paths(); - - /** - * Gets record resolver for the task. - * - * @return Record resolver. - */ - public IgniteFsRecordResolver recordResolver(); - - /** - * Flag indicating whether to fail or simply skip non-existent files. - * - * @return {@code True} if non-existent files should be skipped. - */ - public boolean skipNonExistentFiles(); - - /** - * User argument provided for task execution. - * - * @return User argument. - */ - public T userArgument(); - - /** - * Optional maximum allowed range length, {@code 0} by default. If not specified, full range including - * all consecutive blocks will be used without any limitations. - * - * @return Maximum range length. - */ - public long maxRangeLength(); -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskNoReduceAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskNoReduceAdapter.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskNoReduceAdapter.java deleted file mode 100644 index d6ea2c2..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/IgniteFsTaskNoReduceAdapter.java +++ /dev/null @@ -1,42 +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.fs.mapreduce; - -import org.apache.ignite.compute.*; - -import java.util.*; - -/** - * Convenient {@link IgniteFsTask} adapter with empty reduce step. Use this adapter in case you are not interested in - * results returned by jobs. - */ -public abstract class IgniteFsTaskNoReduceAdapter<T, R> extends IgniteFsTask<T, R> { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Default implementation which will ignore all results sent from execution nodes. - * - * @param results Received results of broadcasted remote executions. Note that if task class has - * {@link org.apache.ignite.compute.ComputeTaskNoResultCache} annotation, then this list will be empty. - * @return Will always return {@code null}. - */ - @Override public R reduce(List<ComputeJobResult> results) { - return null; - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/package.html b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/package.html deleted file mode 100644 index 73667f0..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/package.html +++ /dev/null @@ -1,23 +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. - --> -<!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 In-Memory MapReduce over GGFS. -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsByteDelimiterRecordResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsByteDelimiterRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsByteDelimiterRecordResolver.java deleted file mode 100644 index 6d95f8f..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsByteDelimiterRecordResolver.java +++ /dev/null @@ -1,347 +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.fs.mapreduce.records; - -import org.apache.ignite.*; -import org.apache.ignite.fs.*; -import org.apache.ignite.fs.mapreduce.*; -import org.apache.ignite.internal.util.tostring.*; -import org.apache.ignite.internal.util.typedef.*; -import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.util.*; - -/** - * Record resolver which adjusts records based on provided delimiters. Both start position and length are - * shifted to the right, based on delimiter positions. - * <p> - * Note that you can use {@link IgniteFsStringDelimiterRecordResolver} if your delimiter is a plain string. - */ -public class IgniteFsByteDelimiterRecordResolver implements IgniteFsRecordResolver, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Delimiters. */ - private byte[][] delims; - - /** Maximum delimiter length. */ - @GridToStringExclude - private int maxDelimLen; - - /** - * Empty constructor required for {@link Externalizable} support. - */ - public IgniteFsByteDelimiterRecordResolver() { - // No-op. - } - - /** - * Creates delimiter-based record resolver. - * - * @param delims Delimiters. - */ - public IgniteFsByteDelimiterRecordResolver(byte[]... delims) { - if (delims == null || delims.length == 0) - throw new IllegalArgumentException("Delimiters cannot be null or empty."); - - this.delims = delims; - - int maxDelimLen = 0; - - for (byte[] delim : delims) { - if (delim == null) - throw new IllegalArgumentException("Delimiter cannot be null."); - else if (maxDelimLen < delim.length) - maxDelimLen = delim.length; - } - - this.maxDelimLen = maxDelimLen; - } - - /** {@inheritDoc} */ - @Override public IgniteFsFileRange resolveRecords(IgniteFs fs, IgniteFsInputStream stream, - IgniteFsFileRange suggestedRecord) throws IgniteException, IOException { - long suggestedStart = suggestedRecord.start(); - long suggestedEnd = suggestedStart + suggestedRecord.length(); - - IgniteBiTuple<State, Delimiter> firstDelim = findFirstDelimiter(stream, suggestedStart); - - State state = firstDelim != null ? firstDelim.getKey() : new State(); - - Delimiter curDelim = firstDelim.getValue(); - - while (curDelim != null && curDelim.end < suggestedStart) - curDelim = nextDelimiter(stream, state); - - if (curDelim != null && (curDelim.end >= suggestedStart && curDelim.end < suggestedEnd) || - suggestedStart == 0 ) { - // We found start delimiter. - long start = suggestedStart == 0 ? 0 : curDelim.end; - - if (curDelim == null || curDelim.end < suggestedEnd) { - IgniteBiTuple<State, Delimiter> lastDelim = findFirstDelimiter(stream, suggestedEnd); - - state = lastDelim != null ? firstDelim.getKey() : new State(); - - curDelim = lastDelim.getValue(); - - while (curDelim != null && curDelim.end < suggestedEnd) - curDelim = nextDelimiter(stream, state); - } - - long end = curDelim != null ? curDelim.end : stream.position(); - - return new IgniteFsFileRange(suggestedRecord.path(), start, end - start); - } - else - // We failed to find any delimiters up to the EOS. - return null; - } - - /** - * Calculate maximum delimiters length. - * - * @param delims Delimiters. - * @return Maximum delimiter length. - */ - private int maxDelimiterLength(byte[][] delims) { - int maxDelimLen = 0; - - for (byte[] delim : delims) { - if (delim == null) - throw new IllegalArgumentException("Delimiter cannot be null."); - else if (maxDelimLen < delim.length) - maxDelimLen = delim.length; - } - - return maxDelimLen; - } - - /** - * Find first delimiter. In order to achieve this we have to rewind the stream until we find the delimiter - * which stands at least [maxDelimLen] from the start search position or until we faced stream start. - * Otherwise we cannot be sure that delimiter position is determined correctly. - * - * @param stream GGFS input stream. - * @param startPos Start search position. - * @return The first found delimiter. - * @throws IOException In case of IO exception. - */ - @Nullable private IgniteBiTuple<State, Delimiter> findFirstDelimiter(IgniteFsInputStream stream, long startPos) - throws IOException { - State state; - Delimiter delim; - - long curPos = Math.max(0, startPos - maxDelimLen); - - while (true) { - stream.seek(curPos); - - state = new State(); - - delim = nextDelimiter(stream, state); - - if (curPos == 0 || delim == null || delim.start - curPos > maxDelimLen - 1) - break; - else - curPos = Math.max(0, curPos - maxDelimLen); - } - - return F.t(state, delim); - } - - /** - * Resolve next delimiter. - * - * @param is GGFS input stream. - * @param state Current state. - * @return Next delimiter and updated map. - * @throws IOException In case of exception. - */ - private Delimiter nextDelimiter(IgniteFsInputStream is, State state) throws IOException { - assert is != null; - assert state != null; - - Map<Integer, Integer> parts = state.parts; - LinkedList<Delimiter> delimQueue = state.delims; - - int nextByte = is.read(); - - while (nextByte != -1) { - // Process read byte. - for (int idx = 0; idx < delims.length; idx++) { - byte[] delim = delims[idx]; - - int val = parts.containsKey(idx) ? parts.get(idx) : 0; - - if (delim[val] == nextByte) { - if (val == delim.length - 1) { - // Full delimiter is found. - parts.remove(idx); - - Delimiter newDelim = new Delimiter(is.position() - delim.length, is.position()); - - // Read queue from the end looking for the "inner" delimiters. - boolean ignore = false; - - int replaceIdx = -1; - - for (int i = delimQueue.size() - 1; i >= 0; i--) { - Delimiter prevDelim = delimQueue.get(i); - - if (prevDelim.start < newDelim.start) { - if (prevDelim.end > newDelim.start) { - // Ignore this delimiter. - ignore = true; - - break; - } - } - else if (prevDelim.start == newDelim.start) { - // Ok, we found matching delimiter. - replaceIdx = i; - - break; - } - } - - if (!ignore) { - if (replaceIdx >= 0) - delimQueue.removeAll(delimQueue.subList(replaceIdx, delimQueue.size())); - - delimQueue.add(newDelim); - } - } - else - parts.put(idx, ++val); - } - else if (val != 0) { - if (delim[0] == nextByte) { - boolean shift = true; - - for (int k = 1; k < val; k++) { - if (delim[k] != nextByte) { - shift = false; - - break; - } - } - - if (!shift) - parts.put(idx, 1); - } - else - // Delimiter sequence is totally broken. - parts.remove(idx); - } - } - - // Check whether we can be sure that the first delimiter will not change. - if (!delimQueue.isEmpty()) { - Delimiter delim = delimQueue.get(0); - - if (is.position() - delim.end >= maxDelimLen) - return delimQueue.poll(); - } - - nextByte = is.read(); - } - - return delimQueue.poll(); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsByteDelimiterRecordResolver.class, this); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - if (delims != null) { - out.writeBoolean(true); - - out.writeInt(delims.length); - - for (byte[] delim : delims) - U.writeByteArray(out, delim); - } - else - out.writeBoolean(false); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - if (in.readBoolean()) { - int len = in.readInt(); - - delims = new byte[len][]; - - for (int i = 0; i < len; i++) - delims[i] = U.readByteArray(in); - - maxDelimLen = maxDelimiterLength(delims); - } - } - - /** - * Delimiter descriptor. - */ - private static class Delimiter { - /** Delimiter start position. */ - private final long start; - - /** Delimiter end position. */ - private final long end; - - /** - * Constructor. - * - * @param start Delimiter start position. - * @param end Delimiter end position. - */ - private Delimiter(long start, long end) { - assert start >= 0 && end >= 0 && start <= end; - - this.start = start; - this.end = end; - } - } - - /** - * Current resolution state. - */ - private static class State { - /** Partially resolved delimiters. */ - private final Map<Integer, Integer> parts; - - /** Resolved delimiters which could potentially be merged. */ - private final LinkedList<Delimiter> delims; - - /** - * Constructor. - */ - private State() { - parts = new HashMap<>(); - - delims = new LinkedList<>(); - } - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsFixedLengthRecordResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsFixedLengthRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsFixedLengthRecordResolver.java deleted file mode 100644 index e3c64d1..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsFixedLengthRecordResolver.java +++ /dev/null @@ -1,86 +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.fs.mapreduce.records; - -import org.apache.ignite.*; -import org.apache.ignite.fs.*; -import org.apache.ignite.fs.mapreduce.*; -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Record resolver which adjusts records to fixed length. That is, start offset of the record is shifted to the - * nearest position so that {@code newStart % length == 0}. - */ -public class IgniteFsFixedLengthRecordResolver implements IgniteFsRecordResolver, Externalizable { - /** */ - private static final long serialVersionUID = 0L; - - /** Record length. */ - private long recLen; - - /** - * Empty constructor required for {@link Externalizable} support. - */ - public IgniteFsFixedLengthRecordResolver() { - // No-op. - } - - /** - * Creates fixed-length record resolver. - * - * @param recLen Record length. - */ - public IgniteFsFixedLengthRecordResolver(long recLen) { - this.recLen = recLen; - } - - /** {@inheritDoc} */ - @Override public IgniteFsFileRange resolveRecords(IgniteFs fs, IgniteFsInputStream stream, - IgniteFsFileRange suggestedRecord) - throws IgniteException, IOException { - long suggestedEnd = suggestedRecord.start() + suggestedRecord.length(); - - long startRem = suggestedRecord.start() % recLen; - long endRem = suggestedEnd % recLen; - - long start = Math.min(suggestedRecord.start() + (startRem != 0 ? (recLen - startRem) : 0), - stream.length()); - long end = Math.min(suggestedEnd + (endRem != 0 ? (recLen - endRem) : 0), stream.length()); - - assert end >= start; - - return start != end ? new IgniteFsFileRange(suggestedRecord.path(), start, end - start) : null; - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsFixedLengthRecordResolver.class, this); - } - - /** {@inheritDoc} */ - @Override public void writeExternal(ObjectOutput out) throws IOException { - out.writeLong(recLen); - } - - /** {@inheritDoc} */ - @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { - recLen = in.readLong(); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsNewLineRecordResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsNewLineRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsNewLineRecordResolver.java deleted file mode 100644 index 3b599d0..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsNewLineRecordResolver.java +++ /dev/null @@ -1,66 +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.fs.mapreduce.records; - -import org.apache.ignite.internal.util.typedef.internal.*; - -import java.io.*; - -/** - * Record resolver based on new line detection. This resolver can detect new lines based on '\n' or '\r\n' sequences. - * <p> - * Note that this resolver cannot be created and has one constant implementations: {@link #NEW_LINE}. - */ -public class IgniteFsNewLineRecordResolver extends IgniteFsByteDelimiterRecordResolver { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Singleton new line resolver. This resolver will resolve records based on new lines - * regardless if they have '\n' or '\r\n' patterns. - */ - public static final IgniteFsNewLineRecordResolver NEW_LINE = new IgniteFsNewLineRecordResolver(true); - - /** CR symbol. */ - public static final byte SYM_CR = 0x0D; - - /** LF symbol. */ - public static final byte SYM_LF = 0x0A; - - /** - * Empty constructor required for {@link Externalizable} support. - */ - public IgniteFsNewLineRecordResolver() { - // No-op. - } - - /** - * Creates new-line record resolver. - * - * @param b Artificial flag to differentiate from empty constructor. - */ - @SuppressWarnings("UnusedParameters") - private IgniteFsNewLineRecordResolver(boolean b) { - super(new byte[] { SYM_CR, SYM_LF }, new byte[] { SYM_LF }); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsNewLineRecordResolver.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsStringDelimiterRecordResolver.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsStringDelimiterRecordResolver.java b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsStringDelimiterRecordResolver.java deleted file mode 100644 index 5272d92..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/IgniteFsStringDelimiterRecordResolver.java +++ /dev/null @@ -1,84 +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.fs.mapreduce.records; - -import org.apache.ignite.internal.util.typedef.internal.*; -import org.jetbrains.annotations.*; - -import java.io.*; -import java.nio.charset.*; - -/** - * Record resolver based on delimiters represented as strings. Works in the same way as - * {@link IgniteFsByteDelimiterRecordResolver}, but uses strings as delimiters instead of byte arrays. - */ -public class IgniteFsStringDelimiterRecordResolver extends IgniteFsByteDelimiterRecordResolver { - /** */ - private static final long serialVersionUID = 0L; - - /** - * Converts string delimiters to byte delimiters. - * - * @param charset Charset. - * @param delims String delimiters. - * @return Byte delimiters. - */ - @Nullable private static byte[][] toBytes(Charset charset, @Nullable String... delims) { - byte[][] res = null; - - if (delims != null) { - res = new byte[delims.length][]; - - for (int i = 0; i < delims.length; i++) - res[i] = delims[i].getBytes(charset); - } - - return res; - } - - /** - * Empty constructor required for {@link Externalizable} support. - */ - public IgniteFsStringDelimiterRecordResolver() { - // No-op. - } - - /** - * Creates record resolver from given string and given charset. - * - * @param delims Delimiters. - * @param charset Charset. - */ - public IgniteFsStringDelimiterRecordResolver(Charset charset, String... delims) { - super(toBytes(charset, delims)); - } - - /** - * Creates record resolver based on given string with default charset. - * - * @param delims Delimiters. - */ - public IgniteFsStringDelimiterRecordResolver(String... delims) { - super(toBytes(Charset.defaultCharset(), delims)); - } - - /** {@inheritDoc} */ - @Override public String toString() { - return S.toString(IgniteFsStringDelimiterRecordResolver.class, this); - } -} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/package.html b/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/package.html deleted file mode 100644 index 947244d..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/mapreduce/records/package.html +++ /dev/null @@ -1,24 +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. - --> - -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<body> - <!-- Package description. --> - Contains record resolvers for In-Memory MapReduce over GGFS. -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/fs/package.html ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/fs/package.html b/modules/core/src/main/java/org/apache/ignite/fs/package.html deleted file mode 100644 index ea47d6c..0000000 --- a/modules/core/src/main/java/org/apache/ignite/fs/package.html +++ /dev/null @@ -1,24 +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. - --> - -<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<body> - <!-- Package description. --> - Contains <b>G</b>rid<b>G</b>ain <b>F</b>ile <b>S</b>ystem APIs. -</body> -</html> http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsBlockLocation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsBlockLocation.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsBlockLocation.java new file mode 100644 index 0000000..226a01f --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsBlockLocation.java @@ -0,0 +1,63 @@ +/* + * 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.ignitefs; + +import java.util.*; + +/** + * {@code GGFS} 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(IgniteFsPath, long, long)} method. + */ +public interface IgniteFsBlockLocation { + /** + * Start position in the file this block relates to. + * + * @return Start position in the file this block relates to. + */ + public long start(); + + /** + * Length of the data block in the file. + * + * @return Length of the data block in the file. + */ + public long length(); + + /** + * Nodes this block belongs to. First node id in collection is + * primary node id. + * + * @return Nodes this block belongs to. + */ + public Collection<UUID> nodeIds(); + + /** + * Compliant with Hadoop interface. + * + * @return Collection of host:port addresses. + */ + public Collection<String> names(); + + /** + * Compliant with Hadoop interface. + * + * @return Collection of host names. + */ + public Collection<String> hosts(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsConcurrentModificationException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsConcurrentModificationException.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsConcurrentModificationException.java new file mode 100644 index 0000000..af4bbdc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsConcurrentModificationException.java @@ -0,0 +1,36 @@ +/* + * 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.ignitefs; + +/** + * {@code GGFS} exception indicating that file system structure was modified concurrently. This error + * indicates that an operation performed in DUAL mode cannot proceed due to these changes. + */ +public class IgniteFsConcurrentModificationException extends IgniteFsException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new exception. + * + * @param path Affected path. + */ + public IgniteFsConcurrentModificationException(IgniteFsPath path) { + super("File system entry has been modified concurrently: " + path, null); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsCorruptedFileException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsCorruptedFileException.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsCorruptedFileException.java new file mode 100644 index 0000000..0177d5d --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsCorruptedFileException.java @@ -0,0 +1,50 @@ +/* + * 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.ignitefs; + +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/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsException.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsException.java new file mode 100644 index 0000000..45b01d6 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsException.java @@ -0,0 +1,57 @@ +/* + * 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.ignitefs; + +import org.apache.ignite.*; +import org.jetbrains.annotations.*; + +/** + * {@code GGFS} exception thrown by file system components. + */ +public class IgniteFsException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates an instance of GGFS exception with descriptive error message. + * + * @param msg Error message. + */ + public IgniteFsException(String msg) { + super(msg); + } + + /** + * Creates an instance of GGFS exception caused by nested exception. + * + * @param cause Exception cause. + */ + public IgniteFsException(Throwable cause) { + super(cause); + } + + /** + * Creates an instance of GGFS exception with error message and underlying cause. + * + * @param msg Error message. + * @param cause Exception cause. + */ + public IgniteFsException(String msg, @Nullable Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFile.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFile.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFile.java new file mode 100644 index 0000000..95dd55b --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFile.java @@ -0,0 +1,120 @@ +/* + * 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.ignitefs; + +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/afa29526/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFileNotFoundException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFileNotFoundException.java b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFileNotFoundException.java new file mode 100644 index 0000000..bf7cd65 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/ignitefs/IgniteFsFileNotFoundException.java @@ -0,0 +1,44 @@ +/* + * 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.ignitefs; + +/** + * {@code GGFS} exception indicating that target resource is not found. + */ +public class IgniteFsFileNotFoundException extends IgniteFsInvalidPathException { + /** */ + 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); + } +}