/** * Gets file ID for specified path possibly skipping existing transaction. * * @param path Path. * @param skipTx Whether to skip existing transaction. * @return File ID for specified path or {@code null} if such file doesn't exist. * @throws IgniteCheckedException If failed. */ @Nullable private IgniteUuid fileId(IgfsPath path, boolean skipTx) throws IgniteCheckedException { List<IgniteUuid> ids = fileIds(path, skipTx); assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']'; return ids.get(ids.size() - 1); }
/** * Gets all file IDs for components of specified path. Result cannot be empty - there is at least root element. * But each element (except the first) can be {@code null} if such files don't exist. * * @param path Path. * @return Collection of file IDs for components of specified path. * @throws IgniteCheckedException If failed. */ public List<IgniteUuid> fileIds(IgfsPath path) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { validTxState(false); return fileIds(path, false); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get file IDS because Grid is stopping: " + 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); }
List<IgniteUuid> newIds = fileIds(paths[i], true);
assertNull(mgr.fileId(b.id(), "f6")); assertEquals(Arrays.asList(ROOT_ID), mgr.fileIds(IgfsPath.ROOT)); assertEquals(Arrays.asList(ROOT_ID, a.id()), mgr.fileIds(new IgfsPath("/a"))); assertEquals(Arrays.asList(ROOT_ID, a.id(), b.id()), mgr.fileIds(new IgfsPath("/a/b"))); assertEquals(Arrays.asList(ROOT_ID, f1.id()), mgr.fileIds(new IgfsPath("/f1"))); assertEquals(Arrays.asList(ROOT_ID, a.id(), f2.id()), mgr.fileIds(new IgfsPath("/a/f2"))); assertEquals(Arrays.asList(ROOT_ID, a.id(), b.id(), f3.id()), mgr.fileIds(new IgfsPath("/a/b/f3"))); assertEquals(Arrays.asList(ROOT_ID, null), mgr.fileIds(new IgfsPath("/f4"))); assertEquals(Arrays.asList(ROOT_ID, a.id(), null), mgr.fileIds(new IgfsPath("/a/f5"))); assertEquals(Arrays.asList(ROOT_ID, a.id(), b.id(), null), mgr.fileIds(new IgfsPath("/a/b/f6"))); assertEquals(Arrays.asList(ROOT_ID, null, null, null, null), mgr.fileIds(new IgfsPath("/f7/a/b/f6")));
/** * Gets file ID for specified path possibly skipping existing transaction. * * @param path Path. * @param skipTx Whether to skip existing transaction. * @return File ID for specified path or {@code null} if such file doesn't exist. * @throws IgniteCheckedException If failed. */ @Nullable private IgniteUuid fileId(IgfsPath path, boolean skipTx) throws IgniteCheckedException { List<IgniteUuid> ids = fileIds(path, skipTx); assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']'; return ids.get(ids.size() - 1); }
/** * Gets all file IDs for components of specified path. Result cannot be empty - there is at least root element. * But each element (except the first) can be {@code null} if such files don't exist. * * @param path Path. * @return Collection of file IDs for components of specified path. * @throws IgniteCheckedException If failed. */ public List<IgniteUuid> fileIds(IgfsPath path) throws IgniteCheckedException { if (busyLock.enterBusy()) { try { validTxState(false); return fileIds(path, false); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get file IDS because Grid is stopping: " + 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); }
List<IgniteUuid> newIds = fileIds(paths[i], true);