/** * Gets all file IDs for components of specified path possibly skipping existing transaction. 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. * @param skipTx Whether to skip existing transaction. * @return Collection of file IDs for components of specified path. * @throws IgniteCheckedException If failed. */ private List<IgniteUuid> fileIds(IgfsPath path, boolean skipTx) throws IgniteCheckedException { assert path != null; // Path components. Collection<String> components = path.components(); // Collection of file IDs for components of specified path. List<IgniteUuid> ids = new ArrayList<>(components.size() + 1); ids.add(IgfsUtils.ROOT_ID); // Always add root ID. IgniteUuid fileId = IgfsUtils.ROOT_ID; for (String s : components) { assert !s.isEmpty(); if (fileId != null) fileId = fileId(fileId, s, skipTx); ids.add(fileId); } return ids; }
List<String> components = endPath.components(); for (int i = startPath.components().size(); i < components.size(); i++) { curPath = new IgfsPath(curPath, components.get(i));
/** * Test public methods of igfs path. * * @throws Exception In case of any exception. */ @Test public void testMethods() throws Exception { IgfsPath path = new IgfsPath("/a/s/d/f"); validateParent("/a/s/d/f", "/a/s/d"); validateParent("/a/s/d", "/a/s"); validateParent("/a/s", "/a"); validateParent("/a", "/"); validateParent("/", null); assertEquals(new IgfsPath("/a/s/d/f-2"), path.suffix("-2")); assertEquals(Arrays.asList("a", "s", "d", "f"), path.components()); assertEquals(4, path.depth()); assertEquals(3, path.parent().depth()); assertEquals("f", path.name()); assertEquals(path, mu(path)); IgfsPath parent = path.parent(); assertTrue(path.compareTo(new IgfsPath(parent, "e")) > 0); assertTrue(path.compareTo(new IgfsPath(parent, "g")) < 0); }
/** * Gets all file IDs for components of specified path possibly skipping existing transaction. 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. * @param skipTx Whether to skip existing transaction. * @return Collection of file IDs for components of specified path. * @throws IgniteCheckedException If failed. */ private List<IgniteUuid> fileIds(IgfsPath path, boolean skipTx) throws IgniteCheckedException { assert path != null; // Path components. Collection<String> components = path.components(); // Collection of file IDs for components of specified path. List<IgniteUuid> ids = new ArrayList<>(components.size() + 1); ids.add(IgfsUtils.ROOT_ID); // Always add root ID. IgniteUuid fileId = IgfsUtils.ROOT_ID; for (String s : components) { assert !s.isEmpty(); if (fileId != null) fileId = fileId(fileId, s, skipTx); ids.add(fileId); } return ids; }
List<String> components = endPath.components(); for (int i = startPath.components().size(); i < components.size(); i++) { curPath = new IgfsPath(curPath, components.get(i));