/** * Get info for the given path. * * @param path Path. * @return Info. * @throws IgniteCheckedException If failed. */ @Nullable public IgfsEntryInfo infoForPath(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaInfoForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path)) : info(fileId(path)); }
/** * Get IDs for the given path. * * @param path Path. * @return IDs. * @throws IgniteCheckedException If failed. */ public List<IgniteUuid> idsForPath(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path)) : fileIds(path); }
/** {@inheritDoc} */ @Override @Nullable public IgfsFile info(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientInfoCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<IgfsFile>() { @Override public IgfsFile call() throws Exception { if (log.isDebugEnabled()) log.debug("Get file info: " + path); IgfsMode mode = resolveMode(path); return resolveFileInfo(path, mode); } }); }
/** {@inheritDoc} */ @Override public long size(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientSizeCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<Long>() { @Override public Long call() throws Exception { return summary0(path).totalLength(); } }); }
runClientTask(new IgfsClientMetaUnlockCallable(cfg.getName(), IgfsUserContext.currentUser(), fileId, lockId, modificationTime, updateSpace, space, affRange));
/** {@inheritDoc} */ @Override public void mkdirs(final IgfsPath path, @Nullable final Map<String, String> props) { A.notNull(path, "path"); if (meta.isClient()) { meta.runClientTask(new IgfsClientMkdirsCallable(cfg.getName(), IgfsUserContext.currentUser(), path, props)); return ; } safeOp(new Callable<Void>() { @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; } }); }
/** {@inheritDoc} */ @Override public IgfsPathSummary summary(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientSummaryCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<IgfsPathSummary>() { @Override public IgfsPathSummary call() throws Exception { if (log.isDebugEnabled()) log.debug("Calculating path summary: " + path); return summary0(path); } }); }
List<IgniteUuid> ids = runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path));
/** {@inheritDoc} */ @Override public void setTimes(final IgfsPath path, final long modificationTime, final long accessTime) { A.notNull(path, "path"); if (accessTime == -1 && modificationTime == -1) return; if (meta.isClient()) { meta.runClientTask(new IgfsClientSetTimesCallable(cfg.getName(), IgfsUserContext.currentUser(), path, accessTime, modificationTime)); return; } safeOp(new Callable<Void>() { @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; } }); }
/** {@inheritDoc} */ @Override public boolean delete(final IgfsPath path, final boolean recursive) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientDeleteCallable(cfg.getName(), IgfsUserContext.currentUser(), path, recursive)); return safeOp(new Callable<Boolean>() { @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(); } }); }
return meta.runClientTask(new IgfsClientExistsCallable(cfg.getName(), IgfsUserContext.currentUser(), path));
return meta.runClientTask(new IgfsClientUpdateCallable(cfg.getName(), IgfsUserContext.currentUser(), path, props));
meta.runClientTask(new IgfsClientListPathsCallable(cfg.getName(), IgfsUserContext.currentUser(), path));
meta.runClientTask(new IgfsClientRenameCallable(cfg.getName(), IgfsUserContext.currentUser(), src, dest));
meta.runClientTask(new IgfsClientListFilesCallable(cfg.getName(), IgfsUserContext.currentUser(), path));
return meta.runClientTask(new IgfsClientAffinityCallable(cfg.getName(), IgfsUserContext.currentUser(), path, start, len, maxLen));
/** * Get info for the given path. * * @param path Path. * @return Info. * @throws IgniteCheckedException If failed. */ @Nullable public IgfsEntryInfo infoForPath(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaInfoForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path)) : info(fileId(path)); }
/** * Get IDs for the given path. * * @param path Path. * @return IDs. * @throws IgniteCheckedException If failed. */ public List<IgniteUuid> idsForPath(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaIdsForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path)) : fileIds(path); }
/** {@inheritDoc} */ @Override @Nullable public IgfsFile info(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientInfoCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<IgfsFile>() { @Override public IgfsFile call() throws Exception { if (log.isDebugEnabled()) log.debug("Get file info: " + path); IgfsMode mode = resolveMode(path); return resolveFileInfo(path, mode); } }); }
/** {@inheritDoc} */ @Override public long size(final IgfsPath path) { A.notNull(path, "path"); if (meta.isClient()) return meta.runClientTask(new IgfsClientSizeCallable(cfg.getName(), IgfsUserContext.currentUser(), path)); return safeOp(new Callable<Long>() { @Override public Long call() throws Exception { return summary0(path).totalLength(); } }); }