/** * Get primary file system info for listing operation. * * @param path Path. * @return Info or {@code null} if not found. * @throws IgniteCheckedException If failed. */ private IgfsEntryInfo primaryInfoForListing(IgfsPath path) throws IgniteCheckedException { IgniteUuid fileId = meta.fileId(path); return fileId != null ? meta.info(fileId) : null; }
/** * Ensure that entry with the given ID exists in meta cache. * * @param fileId File id. * @return {@code True} in case such entry exists. * @throws IgniteCheckedException IF failed. */ public boolean exists(IgniteUuid fileId) throws IgniteCheckedException{ if (busyLock.enterBusy()) { try { assert fileId != null; // containsKey() doesn't work here since meta cache can be PARTITIONED (we do not restrict if!). return info(fileId) != null; } finally { busyLock.leaveBusy(); } } else throw new IllegalStateException("Failed to check file system entry existence because Grid is stopping: " + fileId); }
/** * Get info for the given path. * * @param path Path. * @return Info. * @throws IgniteCheckedException If failed. */ @Nullable public IgfsEntryInfo infoForPath(IgfsPath path) throws IgniteCheckedException { return client ? runClientTask(new IgfsClientMetaInfoForPathCallable(cfg.getName(), IgfsUserContext.currentUser(), path)) : info(fileId(path)); }
info = meta.info(trashId);
/** * Update file info (file properties) in cache in existing transaction. * * @param fileId File ID to update information for. * @param props Properties to set for the file. * @return Updated file info or {@code null} if such file ID not found. * @throws IgniteCheckedException If operation failed. */ @Nullable private IgfsEntryInfo updatePropertiesNonTx(final IgniteUuid fileId, Map<String, String> props) throws IgniteCheckedException { assert fileId != null; assert !F.isEmpty(props) : "Expects not-empty file's properties"; validTxState(true); if (log.isDebugEnabled()) log.debug("Update file properties [fileId=" + fileId + ", props=" + props + ']'); try { final IgfsEntryInfo oldInfo = info(fileId); if (oldInfo == null) return null; return invokeAndGet(fileId, new IgfsMetaUpdatePropertiesProcessor(props)); } catch (GridClosureException e) { throw U.cast(e); } }
IgfsEntryInfo oldInfo = info(fileId);
IgfsEntryInfo childInfo = meta.info(e.getValue().fileId());
@Override public Void applyx() throws IgniteCheckedException { validTxState(true); // Lock file ID for this transaction. IgfsEntryInfo oldInfo = info(fileId); if (oldInfo == null) throw fsException(new IgfsPathNotFoundException("Failed to unlock file (file not " + "found): " + fileId)); if (!F.eq(lockId, oldInfo.lockId())) throw new IgniteCheckedException("Failed to unlock file (inconsistent file lock ID) " + "[fileId=" + fileId + ", lockId=" + lockId + ", actualLockId=" + oldInfo.lockId() + ']'); id2InfoPrj.invoke(fileId, new IgfsMetaFileUnlockProcessor(modificationTime, updateSpace, space, affRange)); return null; } });
private IgfsEntryInfo mkdirsAndGetInfo(String path) throws IgniteCheckedException { IgfsPath p = path(path); mgr.mkdirs(p, IgfsImpl.DFLT_DIR_META); IgniteUuid id = mgr.fileId(p); IgfsEntryInfo info = mgr.info(id); assert info.isDirectory(); return info; }
IgfsEntryInfo newInfo = igfsCtx.meta().info(fileInfo.id());
/** * 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; }
IgfsEntryInfo oldInfo = info(fileId);
/** * @param gridIdx Grid index. * @param path Path to await. * @throws Exception If failed. */ protected void awaitFileFragmenting(int gridIdx, IgfsPath path) throws Exception { IgfsEx igfs = (IgfsEx)grid(gridIdx).fileSystem("igfs"); IgfsMetaManager meta = igfs.context().meta(); IgniteUuid fileId = meta.fileId(path); if (fileId == null) throw new IgfsPathNotFoundException("File not found: " + path); IgfsEntryInfo fileInfo = meta.info(fileId); do { if (fileInfo == null) throw new IgfsPathNotFoundException("File not found: " + path); if (fileInfo.fileMap().ranges().isEmpty()) return; U.sleep(100); fileInfo = meta.info(fileId); } while (true); }
IgfsEntryInfo oldInfo = info(fileId);
IgfsEntryInfo info = meta.info(meta.fileId(FILE));
IgfsEntryInfo info = meta.info(id);
IgniteUuid fileId = req.fileId(); IgfsEntryInfo fileInfo = igfsCtx.meta().info(fileId);