/** * Create a new cache pool based on a CachePoolInfo object. * No fields in the CachePoolInfo can be blank. */ static CachePool createFromInfo(CachePoolInfo info) { return new CachePool(info.getPoolName(), info.getOwnerName(), info.getGroupName(), info.getMode(), info.getLimit(), info.getDefaultReplication(), info.getMaxRelativeExpiryMs()); }
CachePoolInfo.DEFAULT_MAX_RELATIVE_EXPIRY : info.getMaxRelativeExpiryMs(); return new CachePool(info.getPoolName(), ownerName, groupName, mode, limit, defaultReplication, maxRelativeExpiry);
/** * Create a new cache pool based on a CachePoolInfo object. * No fields in the CachePoolInfo can be blank. */ static CachePool createFromInfo(CachePoolInfo info) { return new CachePool(info.getPoolName(), info.getOwnerName(), info.getGroupName(), info.getMode(), info.getLimit(), info.getMaxRelativeExpiryMs()); }
/** * Create a new cache pool based on a CachePoolInfo object. * No fields in the CachePoolInfo can be blank. */ static CachePool createFromInfo(CachePoolInfo info) { return new CachePool(info.getPoolName(), info.getOwnerName(), info.getGroupName(), info.getMode(), info.getLimit(), info.getMaxRelativeExpiryMs()); }
/** * Create a new cache pool based on a CachePoolInfo object and the defaults. * We will fill in information that was not supplied according to the * defaults. */ static CachePool createFromInfoAndDefaults(CachePoolInfo info) throws IOException { UserGroupInformation ugi = null; String ownerName = info.getOwnerName(); if (ownerName == null) { ugi = NameNode.getRemoteUser(); ownerName = ugi.getShortUserName(); } String groupName = info.getGroupName(); if (groupName == null) { if (ugi == null) { ugi = NameNode.getRemoteUser(); } groupName = ugi.getPrimaryGroupName(); } FsPermission mode = (info.getMode() == null) ? FsPermission.getCachePoolDefault() : info.getMode(); long limit = info.getLimit() == null ? CachePoolInfo.DEFAULT_LIMIT : info.getLimit(); long maxRelativeExpiry = info.getMaxRelativeExpiryMs() == null ? CachePoolInfo.DEFAULT_MAX_RELATIVE_EXPIRY : info.getMaxRelativeExpiryMs(); return new CachePool(info.getPoolName(), ownerName, groupName, mode, limit, maxRelativeExpiry); }
/** * Create a new cache pool based on a CachePoolInfo object and the defaults. * We will fill in information that was not supplied according to the * defaults. */ static CachePool createFromInfoAndDefaults(CachePoolInfo info) throws IOException { UserGroupInformation ugi = null; String ownerName = info.getOwnerName(); if (ownerName == null) { ugi = NameNode.getRemoteUser(); ownerName = ugi.getShortUserName(); } String groupName = info.getGroupName(); if (groupName == null) { if (ugi == null) { ugi = NameNode.getRemoteUser(); } groupName = ugi.getPrimaryGroupName(); } FsPermission mode = (info.getMode() == null) ? FsPermission.getCachePoolDefault() : info.getMode(); long limit = info.getLimit() == null ? CachePoolInfo.DEFAULT_LIMIT : info.getLimit(); long maxRelativeExpiry = info.getMaxRelativeExpiryMs() == null ? CachePoolInfo.DEFAULT_MAX_RELATIVE_EXPIRY : info.getMaxRelativeExpiryMs(); return new CachePool(info.getPoolName(), ownerName, groupName, mode, limit, maxRelativeExpiry); }