public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication( info, pool.getDefaultReplication()); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
CachePool destPool = getCachePool(validatePoolName(infoWithDefaults)); if (!srcPool.getPoolName().equals(destPool.getPoolName())) { checkWritePermission(pc, destPool);
public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication(info, (short)1); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
/** * Modifies a directive, skipping most error checking. This is for careful * internal use only. modifyDirective can be non-deterministic since its error * checking depends on current system time, which poses a problem for edit log * replay. */ void modifyDirectiveFromEditLog(CacheDirectiveInfo info) throws InvalidRequestException { // Check for invalid IDs. Long id = info.getId(); if (id == null) { throw new InvalidRequestException("Must supply an ID."); } CacheDirective prevEntry = getById(id); CacheDirectiveInfo newInfo = createFromInfoAndDefaults(info, prevEntry); removeInternal(prevEntry); addInternal(new CacheDirective(newInfo), getCachePool(newInfo.getPool())); }
CachePool destPool = getCachePool(validatePoolName(infoWithDefaults)); if (!srcPool.getPoolName().equals(destPool.getPoolName())) { checkWritePermission(pc, destPool);
public CacheDirectiveInfo addDirective( CacheDirectiveInfo info, FSPermissionChecker pc, EnumSet<CacheFlag> flags) throws IOException { assert namesystem.hasWriteLock(); CacheDirective directive; try { CachePool pool = getCachePool(validatePoolName(info)); checkWritePermission(pc, pool); String path = validatePath(info); short replication = validateReplication(info, (short)1); long expiryTime = validateExpiryTime(info, pool.getMaxRelativeExpiryMs()); // Do quota validation if required if (!flags.contains(CacheFlag.FORCE)) { checkLimit(pool, path, replication); } // All validation passed // Add a new entry with the next available ID. long id = getNextDirectiveId(); directive = new CacheDirective(id, path, replication, expiryTime); addInternal(directive, pool); } catch (IOException e) { LOG.warn("addDirective of " + info + " failed: ", e); throw e; } LOG.info("addDirective of {} successful.", info); return directive.toInfo(); }
CachePool destPool = getCachePool(validatePoolName(infoWithDefaults)); if (!srcPool.getPoolName().equals(destPool.getPoolName())) { checkWritePermission(pc, destPool);