/** * create system entry if it is absent. * * @param id System entry ID. * @return Value of created or existing system entry. * @throws IgniteCheckedException On error. */ private IgfsEntryInfo createSystemDirectoryIfAbsent(IgniteUuid id) throws IgniteCheckedException { assert IgfsUtils.isRootOrTrashId(id); IgfsEntryInfo info = IgfsUtils.createDirectory(id); IgfsEntryInfo oldInfo = id2InfoPrj.getAndPutIfAbsent(id, info); if (oldInfo != null) info = oldInfo; return info; }
/** * Lock file IDs. * * @param fileIds File IDs (sorted). * @return Map with lock info. * @throws IgniteCheckedException If failed. */ private Map<IgniteUuid, IgfsEntryInfo> lockIds(Collection<IgniteUuid> fileIds) throws IgniteCheckedException { assert isSorted(fileIds); validTxState(true); if (log.isDebugEnabled()) log.debug("Locking file ids: " + fileIds); // Lock files and get their infos. Map<IgniteUuid, IgfsEntryInfo> map = getInfos(fileIds); if (log.isDebugEnabled()) log.debug("Locked file ids: " + fileIds); for (IgniteUuid fileId : fileIds) { if (IgfsUtils.isRootOrTrashId(fileId)) { if (!map.containsKey(fileId)) map.put(fileId, createSystemDirectoryIfAbsent(fileId)); } } // Returns detail's map for locked IDs. return map; }
@Override public boolean apply() { int metaSize = 0; for (Object metaId : grid(0).cachex(igfs.configuration().getMetaCacheConfiguration().getName()) .keySet()) { if (!IgfsUtils.isRootOrTrashId((IgniteUuid)metaId)) metaSize++; } return metaSize == 0; } }, 5000);
if (!IgfsUtils.isRootOrTrashId(metaId)) metaSize++;
/** * create system entry if it is absent. * * @param id System entry ID. * @return Value of created or existing system entry. * @throws IgniteCheckedException On error. */ private IgfsEntryInfo createSystemDirectoryIfAbsent(IgniteUuid id) throws IgniteCheckedException { assert IgfsUtils.isRootOrTrashId(id); IgfsEntryInfo info = IgfsUtils.createDirectory(id); IgfsEntryInfo oldInfo = id2InfoPrj.getAndPutIfAbsent(id, info); if (oldInfo != null) info = oldInfo; return info; }
/** * Lock file IDs. * * @param fileIds File IDs (sorted). * @return Map with lock info. * @throws IgniteCheckedException If failed. */ private Map<IgniteUuid, IgfsEntryInfo> lockIds(Collection<IgniteUuid> fileIds) throws IgniteCheckedException { assert isSorted(fileIds); validTxState(true); if (log.isDebugEnabled()) log.debug("Locking file ids: " + fileIds); // Lock files and get their infos. Map<IgniteUuid, IgfsEntryInfo> map = getInfos(fileIds); if (log.isDebugEnabled()) log.debug("Locked file ids: " + fileIds); for (IgniteUuid fileId : fileIds) { if (IgfsUtils.isRootOrTrashId(fileId)) { if (!map.containsKey(fileId)) map.put(fileId, createSystemDirectoryIfAbsent(fileId)); } } // Returns detail's map for locked IDs. return map; }