/** * 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 GridException If failed. */ @Nullable private GridUuid fileId(GridGgfsPath path, boolean skipTx) throws GridException { List<GridUuid> ids = fileIds(path, skipTx); assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']'; return ids.get(ids.size() - 1); }
/** * 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 GridException If failed. */ @Nullable private GridUuid fileId(GridGgfsPath path, boolean skipTx) throws GridException { List<GridUuid> ids = fileIds(path, skipTx); assert ids != null && !ids.isEmpty() : "Invalid file IDs [path=" + path + ", ids=" + ids + ']'; return ids.get(ids.size() - 1); }
/** * Get file descriptor for specified path. * * @param path Path to file. * @return Detailed file descriptor or {@code null}, if file does not exist. * @throws GridException If failed. */ @Nullable private FileDescriptor getFileDescriptor(GridGgfsPath path) throws GridException { List<GridUuid> ids = meta.fileIds(path); GridGgfsFileInfo fileInfo = meta.info(ids.get(ids.size() - 1)); if (fileInfo == null) return null; // File does not exist. // Resolve parent ID for removed file. GridUuid parentId = ids.size() >= 2 ? ids.get(ids.size() - 2) : null; return new FileDescriptor(parentId, path.name(), fileInfo.id(), fileInfo.isFile()); }
/** * Get file descriptor for specified path. * * @param path Path to file. * @return Detailed file descriptor or {@code null}, if file does not exist. * @throws GridException If failed. */ @Nullable private FileDescriptor getFileDescriptor(GridGgfsPath path) throws GridException { List<GridUuid> ids = meta.fileIds(path); GridGgfsFileInfo fileInfo = meta.info(ids.get(ids.size() - 1)); if (fileInfo == null) return null; // File does not exist. // Resolve parent ID for removed file. GridUuid parentId = ids.size() >= 2 ? ids.get(ids.size() - 2) : null; return new FileDescriptor(parentId, path.name(), fileInfo.id(), fileInfo.isFile()); }
/** * 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 GridException If failed. */ public List<GridUuid> fileIds(GridGgfsPath path) throws GridException { if (busyLock.enterBusy()) { try { assert validTxState(false); return fileIds(path, false); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get file IDS because Grid is stopping: " + path); }
/** * 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 GridException If failed. */ public List<GridUuid> fileIds(GridGgfsPath path) throws GridException { if (busyLock.enterBusy()) { try { assert validTxState(false); return fileIds(path, false); } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to get file IDS because Grid is stopping: " + path); }
List<GridUuid> fileIds = meta.fileIds(path);
List<GridUuid> fileIds = meta.fileIds(path);
List<GridUuid> ids = meta.fileIds(path); List<String> components = path.components();
List<GridUuid> ids = meta.fileIds(path); List<String> components = path.components();
List<GridUuid> ids = meta.fileIds(path);
List<GridUuid> ids = meta.fileIds(path);
mkdirs(parent, props); List<GridUuid> ids = meta.fileIds(path);
mkdirs(parent, props); List<GridUuid> ids = meta.fileIds(path);