Search in sources :

Example 26 with IgfsInputStream

use of org.apache.ignite.igfs.IgfsInputStream in project ignite by apache.

the class IgfsJobImpl method execute.

/** {@inheritDoc} */
@Override
public Object execute() {
    IgniteFileSystem fs = ignite.fileSystem(igfsName);
    try (IgfsInputStream in = fs.open(path)) {
        IgfsFileRange split = new IgfsFileRange(path, start, len);
        if (rslvr != null) {
            split = rslvr.resolveRecords(fs, in, split);
            if (split == null) {
                log.warning("No data found for split on local node after resolver is applied " + "[igfsName=" + igfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']');
                return null;
            }
        }
        in.seek(split.start());
        return job.execute(fs, new IgfsFileRange(path, split.start(), split.length()), in);
    } catch (IOException e) {
        throw new IgniteException("Failed to execute IGFS job for file split [igfsName=" + igfsName + ", path=" + path + ", start=" + start + ", len=" + len + ']', e);
    }
}
Also used : IgfsInputStream(org.apache.ignite.igfs.IgfsInputStream) IgfsFileRange(org.apache.ignite.igfs.mapreduce.IgfsFileRange) IgniteException(org.apache.ignite.IgniteException) IgniteFileSystem(org.apache.ignite.IgniteFileSystem) IOException(java.io.IOException)

Example 27 with IgfsInputStream

use of org.apache.ignite.igfs.IgfsInputStream in project ignite by apache.

the class IgfsCachePerBlockLruEvictionPolicySelfTest method read.

/**
     * Read some data from the given file with the given offset.
     *
     * @param path File path.
     * @param off Offset.
     * @param len Length.
     * @throws Exception If failed.
     */
private void read(IgfsPath path, int off, int len) throws Exception {
    IgfsInputStream is = igfsPrimary.open(path);
    is.readFully(off, new byte[len]);
    is.close();
}
Also used : IgfsInputStream(org.apache.ignite.igfs.IgfsInputStream)

Aggregations

IgfsInputStream (org.apache.ignite.igfs.IgfsInputStream)27 IgfsPath (org.apache.ignite.igfs.IgfsPath)11 IgfsFileRange (org.apache.ignite.igfs.mapreduce.IgfsFileRange)9 IgfsOutputStream (org.apache.ignite.igfs.IgfsOutputStream)8 IOException (java.io.IOException)5 IgniteException (org.apache.ignite.IgniteException)5 IgniteFileSystem (org.apache.ignite.IgniteFileSystem)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)3 IgfsMetrics (org.apache.ignite.igfs.IgfsMetrics)3 IgfsByteDelimiterRecordResolver (org.apache.ignite.igfs.mapreduce.records.IgfsByteDelimiterRecordResolver)3 IgfsException (org.apache.ignite.igfs.IgfsException)2 IgfsFile (org.apache.ignite.igfs.IgfsFile)2 IgfsPathNotFoundException (org.apache.ignite.igfs.IgfsPathNotFoundException)2 IgfsFixedLengthRecordResolver (org.apache.ignite.igfs.mapreduce.records.IgfsFixedLengthRecordResolver)2 IgfsNewLineRecordResolver (org.apache.ignite.igfs.mapreduce.records.IgfsNewLineRecordResolver)2 InputStream (java.io.InputStream)1 URI (java.net.URI)1 HashMap (java.util.HashMap)1 Random (java.util.Random)1 UUID (java.util.UUID)1