Beispiel #1
0
        /// <summary>Create a new cache pool based on a CachePoolInfo object and the defaults.
        ///     </summary>
        /// <remarks>
        /// 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.
        /// </remarks>
        /// <exception cref="System.IO.IOException"/>
        internal static CachePool CreateFromInfoAndDefaults(CachePoolInfo info)
        {
            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.DefaultLimit : info.GetLimit
                             ();
            long maxRelativeExpiry = info.GetMaxRelativeExpiryMs() == null ? CachePoolInfo.DefaultMaxRelativeExpiry
                                 : info.GetMaxRelativeExpiryMs();

            return(new CachePool(info.GetPoolName(), ownerName, groupName, mode, limit, maxRelativeExpiry
                                 ));
        }
Beispiel #2
0
            public virtual string GetLongUsage()
            {
                TableListing listing = AdminHelper.GetOptionDescriptionListing();

                listing.AddRow("<name>", "Name of the new pool.");
                listing.AddRow("<owner>", "Username of the owner of the pool. " + "Defaults to the current user."
                               );
                listing.AddRow("<group>", "Group of the pool. " + "Defaults to the primary group name of the current user."
                               );
                listing.AddRow("<mode>", "UNIX-style permissions for the pool. " + "Permissions are specified in octal, e.g. 0755. "
                               + "By default, this is set to " + string.Format("0%03o", FsPermission.GetCachePoolDefault
                                                                                   ().ToShort()) + ".");
                listing.AddRow("<limit>", "The maximum number of bytes that can be " + "cached by directives in this pool, in aggregate. By default, "
                               + "no limit is set.");
                listing.AddRow("<maxTtl>", "The maximum allowed time-to-live for " + "directives being added to the pool. This can be specified in "
                               + "seconds, minutes, hours, and days, e.g. 120s, 30m, 4h, 2d. " + "Valid units are [smhd]. By default, no maximum is set. "
                               + "A value of \"never\" specifies that there is no limit.");
                return(GetShortUsage() + "\n" + "Add a new cache pool.\n\n" + listing.ToString());
            }