/// <summary>Set the namespace, storagespace and typespace quota for a directory.</summary> /// <remarks> /// Set the namespace, storagespace and typespace quota for a directory. /// Note: This does not support ".inodes" relative path. /// </remarks> /// <exception cref="System.IO.IOException"/> internal static void SetQuota(FSDirectory fsd, string src, long nsQuota, long ssQuota , StorageType type) { if (fsd.IsPermissionEnabled()) { FSPermissionChecker pc = fsd.GetPermissionChecker(); pc.CheckSuperuserPrivilege(); } fsd.WriteLock(); try { INodeDirectory changed = UnprotectedSetQuota(fsd, src, nsQuota, ssQuota, type); if (changed != null) { QuotaCounts q = changed.GetQuotaCounts(); if (type == null) { fsd.GetEditLog().LogSetQuota(src, q.GetNameSpace(), q.GetStorageSpace()); } else { fsd.GetEditLog().LogSetQuotaByStorageType(src, q.GetTypeSpaces().Get(type), type); } } } finally { fsd.WriteUnlock(); } }
/// <exception cref="System.IO.IOException"/> internal static void ModifyCachePool(FSNamesystem fsn, CacheManager cacheManager, CachePoolInfo req, bool logRetryCache) { FSPermissionChecker pc = GetFsPermissionChecker(fsn); if (pc != null) { pc.CheckSuperuserPrivilege(); } cacheManager.ModifyCachePool(req); fsn.GetEditLog().LogModifyCachePool(req, logRetryCache); }
/// <exception cref="System.IO.IOException"/> internal static void RemoveCachePool(FSNamesystem fsn, CacheManager cacheManager, string cachePoolName, bool logRetryCache) { FSPermissionChecker pc = GetFsPermissionChecker(fsn); if (pc != null) { pc.CheckSuperuserPrivilege(); } cacheManager.RemoveCachePool(cachePoolName); fsn.GetEditLog().LogRemoveCachePool(cachePoolName, logRetryCache); }
/// <exception cref="System.IO.IOException"/> internal static CachePoolInfo AddCachePool(FSNamesystem fsn, CacheManager cacheManager , CachePoolInfo req, bool logRetryCache) { FSPermissionChecker pc = GetFsPermissionChecker(fsn); if (pc != null) { pc.CheckSuperuserPrivilege(); } CachePoolInfo info = cacheManager.AddCachePool(req); fsn.GetEditLog().LogAddCachePool(info, logRetryCache); return(info); }