Search in sources :

Example 76 with IgfsPath

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

the class IgfsModeResolver method writeExternal.

/**
 * {@inheritDoc}
 */
@Override
public void writeExternal(ObjectOutput out) throws IOException {
    U.writeEnum(out, dfltMode);
    if (modes != null) {
        out.writeBoolean(true);
        out.writeInt(modes.size());
        for (T2<IgfsPath, IgfsMode> pathMode : modes) {
            assert pathMode.getKey() != null;
            pathMode.getKey().writeExternal(out);
            U.writeEnum(out, pathMode.getValue());
        }
    } else
        out.writeBoolean(false);
    if (!F.isEmpty(dualParentsWithPrimaryChildren)) {
        out.writeBoolean(true);
        out.writeInt(dualParentsWithPrimaryChildren.size());
        for (IgfsPath p : dualParentsWithPrimaryChildren) p.writeExternal(out);
    } else
        out.writeBoolean(false);
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath) IgfsMode(org.apache.ignite.igfs.IgfsMode)

Example 77 with IgfsPath

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

the class IgfsBenchmark method handleFile.

/**
 * {@inheritDoc}
 */
@Override
public void handleFile(String strPath) throws Exception {
    IgfsPath path = new IgfsPath(strPath);
    IgfsOutputStream out;
    try {
        out = fs.create(path, false);
    } catch (IgniteException ex) {
        System.out.println("create file " + path.toString() + " failed: " + ex);
        throw ex;
    }
    try {
        for (int i = 0; i < size / dataBufer.capacity(); i++) out.write(dataBufer.array());
    } catch (IOException ex) {
        System.out.println("write file " + path.toString() + " failed: " + ex);
        throw ex;
    } finally {
        out.close();
    }
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath) IgniteException(org.apache.ignite.IgniteException) IOException(java.io.IOException) IgfsOutputStream(org.apache.ignite.igfs.IgfsOutputStream)

Example 78 with IgfsPath

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

the class IgfsBenchmark method postHandleDir.

/**
 * {@inheritDoc}
 */
@Override
public void postHandleDir(String strPath) throws Exception {
    IgfsPath path = new IgfsPath(strPath);
    fs.delete(path, false);
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath)

Example 79 with IgfsPath

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

the class IgfsMetaManagerSelfTest method mkdirsAndGetInfo.

private IgfsEntryInfo mkdirsAndGetInfo(String path) throws IgniteCheckedException {
    IgfsPath p = path(path);
    mgr.mkdirs(p, IgfsImpl.DFLT_DIR_META);
    IgniteUuid id = mgr.fileId(p);
    IgfsEntryInfo info = mgr.info(id);
    assert info.isDirectory();
    return info;
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath) IgniteUuid(org.apache.ignite.lang.IgniteUuid)

Example 80 with IgfsPath

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

the class IgfsMetaManagerSelfTest method createFileAndGetInfo.

private IgfsEntryInfo createFileAndGetInfo(String path) throws IgniteCheckedException {
    IgfsPath p = path(path);
    IgfsEntryInfo res = mgr.create(p, null, false, 400, null, false, null, null).info();
    assert res != null;
    assert !res.isDirectory();
    return res;
}
Also used : IgfsPath(org.apache.ignite.igfs.IgfsPath)

Aggregations

IgfsPath (org.apache.ignite.igfs.IgfsPath)161 IgfsOutputStream (org.apache.ignite.igfs.IgfsOutputStream)24 IOException (java.io.IOException)22 ArrayList (java.util.ArrayList)15 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)14 HashMap (java.util.HashMap)13 IgniteException (org.apache.ignite.IgniteException)13 IgniteFileSystem (org.apache.ignite.IgniteFileSystem)13 IgfsFile (org.apache.ignite.igfs.IgfsFile)13 IgfsException (org.apache.ignite.igfs.IgfsException)12 IgniteUuid (org.apache.ignite.lang.IgniteUuid)11 IgfsBlockLocation (org.apache.ignite.igfs.IgfsBlockLocation)10 Map (java.util.Map)9 Path (org.apache.hadoop.fs.Path)9 IgfsInputStream (org.apache.ignite.igfs.IgfsInputStream)9 IgfsPathNotFoundException (org.apache.ignite.igfs.IgfsPathNotFoundException)8 FileNotFoundException (java.io.FileNotFoundException)6 OutputStream (java.io.OutputStream)6 IgfsDirectoryNotEmptyException (org.apache.ignite.igfs.IgfsDirectoryNotEmptyException)6 IgfsParentNotDirectoryException (org.apache.ignite.igfs.IgfsParentNotDirectoryException)6