/** {@inheritDoc} */ @Override public void await(IgfsPath... paths) { igfs.await(paths); } }
@Override public Void call() throws Exception { if (log.isDebugEnabled()) log.debug("Make directories: " + path); IgfsMode mode = resolveMode(path); switch (mode) { case PRIMARY: meta.mkdirs(path, props == null ? DFLT_DIR_META : new HashMap<>(props)); break; case DUAL_ASYNC: case DUAL_SYNC: await(path); meta.mkdirsDual(secondaryFs, path, props); break; case PROXY: secondaryFs.mkdirs(path, props); break; } return null; } });
/** * Create the given directories and files in the given IGFS. * * @param igfs IGFS. * @param dirs Directories. * @param files Files. * @throws Exception If failed. */ @SuppressWarnings("EmptyTryBlock") public static void create(IgfsImpl igfs, @Nullable IgfsPath[] dirs, @Nullable IgfsPath[] files) throws Exception { if (dirs != null) { for (IgfsPath dir : dirs) igfs.mkdirs(dir); } if (files != null) { for (IgfsPath file : files) { try (OutputStream ignored = igfs.create(file, true)) { // No-op. } igfs.await(file); } } }
assert IgfsUtils.isDualMode(mode); await(path);
case DUAL_SYNC: await(path);
@Override public Boolean call() throws Exception { if (log.isDebugEnabled()) log.debug("Deleting file [path=" + path + ", recursive=" + recursive + ']'); if (F.eq(IgfsPath.ROOT, path)) return false; IgfsMode mode = resolveMode(path); if (mode == PROXY) return secondaryFs.delete(path, recursive); boolean dual = IgfsUtils.isDualMode(mode); if (dual) await(path); IgfsDeleteResult res = meta.softDelete(path, recursive, dual ? secondaryFs : null); // Record event if needed. if (res.success() && res.info() != null) IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, res.info().isFile() ? EVT_IGFS_FILE_DELETED : EVT_IGFS_DIR_DELETED); return res.success(); } });
await(path);
await(src, dest);
/** {@inheritDoc} */ @Override public void await(IgfsPath... paths) { igfs.await(paths); } }
@Override public Void call() throws Exception { if (log.isDebugEnabled()) log.debug("Make directories: " + path); IgfsMode mode = resolveMode(path); switch (mode) { case PRIMARY: meta.mkdirs(path, props == null ? DFLT_DIR_META : new HashMap<>(props)); break; case DUAL_ASYNC: case DUAL_SYNC: await(path); meta.mkdirsDual(secondaryFs, path, props); break; case PROXY: secondaryFs.mkdirs(path, props); break; } return null; } });
assert IgfsUtils.isDualMode(mode); await(path);
case DUAL_SYNC: await(path);
@Override public Boolean call() throws Exception { if (log.isDebugEnabled()) log.debug("Deleting file [path=" + path + ", recursive=" + recursive + ']'); if (F.eq(IgfsPath.ROOT, path)) return false; IgfsMode mode = resolveMode(path); if (mode == PROXY) return secondaryFs.delete(path, recursive); boolean dual = IgfsUtils.isDualMode(mode); if (dual) await(path); IgfsDeleteResult res = meta.softDelete(path, recursive, dual ? secondaryFs : null); // Record event if needed. if (res.success() && res.info() != null) IgfsUtils.sendEvents(igfsCtx.kernalContext(), path, res.info().isFile() ? EVT_IGFS_FILE_DELETED : EVT_IGFS_DIR_DELETED); return res.success(); } });
await(src, dest);