@Override public GridGgfsFileInfo onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { if (infos.get(path) == null) return null; fs.update(path, props); assert path.parent() == null || infos.get(path.parent()) != null; return updatePropertiesNonTx(infos.get(path.parent()).id(), infos.get(path).id(), path.name(), props); }
@Override public GridGgfsFileInfo onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { if (infos.get(path) == null) return null; fs.update(path, props); assert path.parent() == null || infos.get(path.parent()) != null; return updatePropertiesNonTx(infos.get(path.parent()).id(), infos.get(path).id(), path.name(), props); }
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { fs.mkdirs(path, props); assert !infos.isEmpty(); // Now perform synchronization again starting with the last created parent. GridGgfsPath parentPath = null; for (GridGgfsPath curPath : infos.keySet()) { if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) parentPath = curPath; } assert parentPath != null; GridGgfsFileInfo parentPathInfo = infos.get(parentPath); synchronize(fs, parentPath, parentPathInfo, path, true, null); if (evts.isRecordable(EVT_GGFS_DIR_CREATED)) { GridGgfsPath evtPath = path; while (!parentPath.equals(evtPath)) { pendingEvts.addFirst(new GridGgfsEvent(evtPath, locNode, EVT_GGFS_DIR_CREATED)); evtPath = evtPath.parent(); assert evtPath != null; // If this fails, then ROOT does not exist. } } return true; }
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { fs.mkdirs(path, props); assert !infos.isEmpty(); // Now perform synchronization again starting with the last created parent. GridGgfsPath parentPath = null; for (GridGgfsPath curPath : infos.keySet()) { if (parentPath == null || curPath.isSubDirectoryOf(parentPath)) parentPath = curPath; } assert parentPath != null; GridGgfsFileInfo parentPathInfo = infos.get(parentPath); synchronize(fs, parentPath, parentPathInfo, path, true, null); if (evts.isRecordable(EVT_GGFS_DIR_CREATED)) { GridGgfsPath evtPath = path; while (!parentPath.equals(evtPath)) { pendingEvts.addFirst(new GridGgfsEvent(evtPath, locNode, EVT_GGFS_DIR_CREATED)); evtPath = evtPath.parent(); assert evtPath != null; // If this fails, then ROOT does not exist. } } return true; }
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info == null) return false; // File doesn't exist in the secondary file system. if (!fs.delete(path, recursive)) return false; // Delete failed remotely. if (path.parent() != null) { assert infos.containsKey(path.parent()); softDeleteNonTx(infos.get(path.parent()).id(), path.name(), info.id()); } else { assert ROOT_ID.equals(info.id()); softDeleteNonTx(null, path.name(), info.id()); } // Update the deleted file info with path information for delete worker. id2InfoPrj.transform(info.id(), new UpdatePath(path)); return true; // No additional handling is required. }
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info == null) return false; // File doesn't exist in the secondary file system. if (!fs.delete(path, recursive)) return false; // Delete failed remotely. if (path.parent() != null) { assert infos.containsKey(path.parent()); softDeleteNonTx(infos.get(path.parent()).id(), path.name(), info.id()); } else { assert ROOT_ID.equals(info.id()); softDeleteNonTx(null, path.name(), info.id()); } // Update the deleted file info with path information for delete worker. id2InfoPrj.transform(info.id(), new UpdatePath(path)); return true; // No additional handling is required. }
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo srcInfo = infos.get(src); GridGgfsFileInfo srcParentInfo = infos.get(src.parent()); GridGgfsFileInfo destInfo = infos.get(dest); GridGgfsFileInfo destParentInfo = dest.parent() != null ? infos.get(dest.parent()) : null;
@Override public Boolean onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo srcInfo = infos.get(src); GridGgfsFileInfo srcParentInfo = infos.get(src.parent()); GridGgfsFileInfo destInfo = infos.get(dest); GridGgfsFileInfo destParentInfo = dest.parent() != null ? infos.get(dest.parent()) : null;
created.put(curPath.parent(), parentInfo);
created.put(curPath.parent(), parentInfo);
@Override public GridGgfsSecondaryOutputStreamDescriptor onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info.isDirectory()) throw new GridGgfsException("Failed to open output stream to the file in the " + "secondary file system because the path points to a directory: " + path); out = fs.append(path, bufSize, false, null); // Synchronize file ending. long len = info.length(); int blockSize = info.blockSize(); int remainder = (int)(len % blockSize); if (remainder > 0) { int blockIdx = (int)(len / blockSize); GridGgfsReader reader = fs.open(path, bufSize); try { ggfsCtx.data().dataBlock(info, path, blockIdx, reader).get(); } finally { reader.close(); } } // Set lock and return. info = lockInfo(info); metaCache.putx(info.id(), info); return new GridGgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(), info, out); }
@Override public GridGgfsSecondaryOutputStreamDescriptor onSuccess(Map<GridGgfsPath, GridGgfsFileInfo> infos) throws Exception { GridGgfsFileInfo info = infos.get(path); if (info.isDirectory()) throw new GridGgfsException("Failed to open output stream to the file in the " + "secondary file system because the path points to a directory: " + path); out = fs.append(path, bufSize, false, null); // Synchronize file ending. long len = info.length(); int blockSize = info.blockSize(); int remainder = (int)(len % blockSize); if (remainder > 0) { int blockIdx = (int)(len / blockSize); GridGgfsReader reader = fs.open(path, bufSize); try { ggfsCtx.data().dataBlock(info, path, blockIdx, reader).get(); } finally { reader.close(); } } // Set lock and return. info = lockInfo(info); metaCache.putx(info.id(), info); return new GridGgfsSecondaryOutputStreamDescriptor(infos.get(path.parent()).id(), info, out); }
res = delete0(desc, path.parent(), recursive); else if (mode == PRIMARY) checkConflictWithPrimary(path);
res = delete0(desc, path.parent(), recursive); else if (mode == PRIMARY) checkConflictWithPrimary(path);
GridGgfsPath parent = path.parent();