/** * Answers if directory of this mode can contain a subdirectory of the given mode. * * @param parent Parent mode. * @param child Child mode. * @return {@code true} if directory of this mode can contain a directory of the given mode. */ public static boolean canContain(IgfsMode parent, IgfsMode child) { return isDualMode(parent) || parent == child; }
@Override public Void call() throws Exception { IgfsMode mode = resolveMode(path); if (mode == PROXY) secondaryFs.setTimes(path, modificationTime, accessTime); else { meta.updateTimes(path, modificationTime, accessTime, IgfsUtils.isDualMode(mode) ? secondaryFs : null); } return null; } });
assert IgfsUtils.isDualMode(mode);
@Override public Collection<IgfsBlockLocation> call() throws Exception { if (log.isDebugEnabled()) log.debug("Get affinity for file block [path=" + path + ", start=" + start + ", len=" + len + ']'); IgfsMode mode = resolveMode(path); if (mode == PROXY) return secondaryFs.affinity(path, start, len, maxLen); // Check memory first. IgfsEntryInfo info = meta.infoForPath(path); if (info == null && mode != PRIMARY) { assert IgfsUtils.isDualMode(mode); assert secondaryFs != null; // Synchronize info = meta.synchronizeFileDual(secondaryFs, path); } if (info == null) throw new IgfsPathNotFoundException("File not found: " + path); if (!info.isFile()) throw new IgfsPathIsDirectoryException("Failed to get affinity for path because it is not " + "a file: " + path); return data.affinity(info, start, len, maxLen); } });
@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(); } });
assert IgfsUtils.isDualMode(mode);
/** * Answers if directory of this mode can contain a subdirectory of the given mode. * * @param parent Parent mode. * @param child Child mode. * @return {@code true} if directory of this mode can contain a directory of the given mode. */ public static boolean canContain(IgfsMode parent, IgfsMode child) { return isDualMode(parent) || parent == child; }
@Override public Void call() throws Exception { IgfsMode mode = resolveMode(path); if (mode == PROXY) secondaryFs.setTimes(path, modificationTime, accessTime); else { meta.updateTimes(path, modificationTime, accessTime, IgfsUtils.isDualMode(mode) ? secondaryFs : null); } return null; } });
assert IgfsUtils.isDualMode(mode);
@Override public Collection<IgfsBlockLocation> call() throws Exception { if (log.isDebugEnabled()) log.debug("Get affinity for file block [path=" + path + ", start=" + start + ", len=" + len + ']'); IgfsMode mode = resolveMode(path); if (mode == PROXY) return secondaryFs.affinity(path, start, len, maxLen); // Check memory first. IgfsEntryInfo info = meta.infoForPath(path); if (info == null && mode != PRIMARY) { assert IgfsUtils.isDualMode(mode); assert secondaryFs != null; // Synchronize info = meta.synchronizeFileDual(secondaryFs, path); } if (info == null) throw new IgfsPathNotFoundException("File not found: " + path); if (!info.isFile()) throw new IgfsPathIsDirectoryException("Failed to get affinity for path because it is not " + "a file: " + path); return data.affinity(info, start, len, maxLen); } });
@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(); } });
assert IgfsUtils.isDualMode(mode);