finished = true; throw fsException(new IgfsConcurrentModificationException("File system entry has been " + "modified concurrently: " + changed));
throw fsException(new IgfsPathNotFoundException("Failed to lock source directory (not found?)" + " [srcParentId=" + srcParentId + ']')); throw fsException(new IgfsPathIsNotDirectoryException("Source is not a directory: " + srcInfo)); throw fsException(new IgfsPathNotFoundException("Failed to lock destination directory (not found?)" + " [destParentId=" + destParentId + ']')); throw fsException(new IgfsPathIsNotDirectoryException("Destination is not a directory: " + destInfo)); throw fsException(new IgfsPathNotFoundException("Failed to lock target file (not found?) [fileId=" + fileId + ']')); throw fsException(new IgfsPathNotFoundException("Failed to remove file name from the source directory" + " (file not found) [fileId=" + fileId + ", srcFileName=" + srcFileName + ", srcParentId=" + srcParentId + ", srcEntry=" + srcEntry + ']')); throw fsException(new IgfsPathAlreadyExistsException("Failed to add file name into the destination " + " directory (file already exists) [fileId=" + fileId + ", destFileName=" + destFileName + ", destParentId=" + destParentId + ']'));
/** * Add file into file system structure. Do not create new transaction expecting that the one already exists. * * @param parentId Parent file ID. * @param fileName File name in the parent's listing. * @param newFileInfo File info to store in the parent's listing. * @return File id already stored in meta cache or {@code null} if passed file info was stored. * @throws IgniteCheckedException If failed. */ private IgniteUuid putIfAbsentNonTx(IgniteUuid parentId, String fileName, IgfsEntryInfo newFileInfo) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Locking parent id [parentId=" + parentId + ", fileName=" + fileName + ", newFileInfo=" + newFileInfo + ']'); validTxState(true); // Lock only parent file ID. IgfsEntryInfo parentInfo = info(parentId); if (parentInfo == null) throw fsException(new IgfsPathNotFoundException("Failed to lock parent directory (not found): " + parentId)); if (!parentInfo.isDirectory()) throw fsException(new IgfsPathIsNotDirectoryException("Parent file is not a directory: " + parentInfo)); IgfsListingEntry childEntry = parentInfo.listing().get(fileName); if (childEntry != null) return childEntry.fileId(); createNewEntry(newFileInfo, parentId, fileName); return null; }
throw fsException("Failed to update file info with null value" + " [oldInfo=" + oldInfo + ", newInfo=null, proc=" + proc + ']'); throw fsException("Failed to update file info (file IDs differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", proc=" + proc + ']'); throw fsException("Failed to update file info (file types differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", proc=" + proc + ']');
/** * Put new entry to meta cache immediately linking it to parent. * * @param info Info to put. * @param parentId Parent ID. * @param name Name in parent. * @throws IgniteCheckedException If failed. */ private void createNewEntry(IgfsEntryInfo info, IgniteUuid parentId, String name) throws IgniteCheckedException { validTxState(true); if (!id2InfoPrj.putIfAbsent(info.id(), info)) throw fsException("Failed to create new metadata entry due to ID conflict: " + info.id()); if (parentId != null) id2InfoPrj.invoke(parentId, new IgfsMetaDirectoryListingAddProcessor(name, new IgfsListingEntry(info))); }
throw fsException(new IgfsPathIsDirectoryException("Failed to open file (not a file): " + path));
throw fsException("File has been deleted concurrently: " + fileId);
throw fsException("Failed to open output stream to the file created in " + "the secondary file system because it no longer exists: " + path); else if (status.isDirectory()) throw fsException("Failed to open output stream to the file created in " + "the secondary file system because the path points to a directory: " + path); throw fsException("Failed to overwrite file (file is opened for writing) [path=" + path + ", fileId=" + oldId + ", lockId=" + oldInfo.lockId() + ']');
finished = true; throw fsException(new IgfsConcurrentModificationException("File system entry has been " + "modified concurrently: " + changed));
throw fsException(new IgfsPathNotFoundException("Failed to lock source directory (not found?)" + " [srcParentId=" + srcParentId + ']')); throw fsException(new IgfsPathIsNotDirectoryException("Source is not a directory: " + srcInfo)); throw fsException(new IgfsPathNotFoundException("Failed to lock destination directory (not found?)" + " [destParentId=" + destParentId + ']')); throw fsException(new IgfsPathIsNotDirectoryException("Destination is not a directory: " + destInfo)); throw fsException(new IgfsPathNotFoundException("Failed to lock target file (not found?) [fileId=" + fileId + ']')); throw fsException(new IgfsPathNotFoundException("Failed to remove file name from the source directory" + " (file not found) [fileId=" + fileId + ", srcFileName=" + srcFileName + ", srcParentId=" + srcParentId + ", srcEntry=" + srcEntry + ']')); throw fsException(new IgfsPathAlreadyExistsException("Failed to add file name into the destination " + " directory (file already exists) [fileId=" + fileId + ", destFileName=" + destFileName + ", destParentId=" + destParentId + ']'));
/** * Add file into file system structure. Do not create new transaction expecting that the one already exists. * * @param parentId Parent file ID. * @param fileName File name in the parent's listing. * @param newFileInfo File info to store in the parent's listing. * @return File id already stored in meta cache or {@code null} if passed file info was stored. * @throws IgniteCheckedException If failed. */ private IgniteUuid putIfAbsentNonTx(IgniteUuid parentId, String fileName, IgfsEntryInfo newFileInfo) throws IgniteCheckedException { if (log.isDebugEnabled()) log.debug("Locking parent id [parentId=" + parentId + ", fileName=" + fileName + ", newFileInfo=" + newFileInfo + ']'); validTxState(true); // Lock only parent file ID. IgfsEntryInfo parentInfo = info(parentId); if (parentInfo == null) throw fsException(new IgfsPathNotFoundException("Failed to lock parent directory (not found): " + parentId)); if (!parentInfo.isDirectory()) throw fsException(new IgfsPathIsNotDirectoryException("Parent file is not a directory: " + parentInfo)); IgfsListingEntry childEntry = parentInfo.listing().get(fileName); if (childEntry != null) return childEntry.fileId(); createNewEntry(newFileInfo, parentId, fileName); return null; }
throw fsException("Failed to update file info with null value" + " [oldInfo=" + oldInfo + ", newInfo=null, proc=" + proc + ']'); throw fsException("Failed to update file info (file IDs differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", proc=" + proc + ']'); throw fsException("Failed to update file info (file types differ)" + " [oldInfo=" + oldInfo + ", newInfo=" + newInfo + ", proc=" + proc + ']');
/** * Put new entry to meta cache immediately linking it to parent. * * @param info Info to put. * @param parentId Parent ID. * @param name Name in parent. * @throws IgniteCheckedException If failed. */ private void createNewEntry(IgfsEntryInfo info, IgniteUuid parentId, String name) throws IgniteCheckedException { validTxState(true); if (!id2InfoPrj.putIfAbsent(info.id(), info)) throw fsException("Failed to create new metadata entry due to ID conflict: " + info.id()); if (parentId != null) id2InfoPrj.invoke(parentId, new IgfsMetaDirectoryListingAddProcessor(name, new IgfsListingEntry(info))); }
throw fsException(new IgfsPathIsDirectoryException("Failed to open file (not a file): " + path));
throw fsException("File has been deleted concurrently: " + fileId);
throw fsException("Failed to open output stream to the file created in " + "the secondary file system because it no longer exists: " + path); else if (status.isDirectory()) throw fsException("Failed to open output stream to the file created in " + "the secondary file system because the path points to a directory: " + path); throw fsException("Failed to overwrite file (file is opened for writing) [path=" + path + ", fileId=" + oldId + ", lockId=" + oldInfo.lockId() + ']');