Esempio n. 1
0
        /// <summary>Get name with prefix from <code>XAttr</code></summary>
        public static string GetPrefixName(XAttr xAttr)
        {
            if (xAttr == null)
            {
                return(null);
            }
            string @namespace = xAttr.GetNameSpace().ToString();

            return(StringUtils.ToLowerCase(@namespace) + "." + xAttr.GetName());
        }
Esempio n. 2
0
        /// <summary>
        /// Verifies that the combined size of the name and value of an xattr is within
        /// the configured limit.
        /// </summary>
        /// <remarks>
        /// Verifies that the combined size of the name and value of an xattr is within
        /// the configured limit. Setting a limit of zero disables this check.
        /// </remarks>
        private static void CheckXAttrSize(FSDirectory fsd, XAttr xAttr)
        {
            if (fsd.GetXattrMaxSize() == 0)
            {
                return;
            }
            int size = Sharpen.Runtime.GetBytesForString(xAttr.GetName(), Charsets.Utf8).Length;

            if (xAttr.GetValue() != null)
            {
                size += xAttr.GetValue().Length;
            }
            if (size > fsd.GetXattrMaxSize())
            {
                throw new HadoopIllegalArgumentException("The XAttr is too big. The maximum combined size of the"
                                                         + " name and value is " + fsd.GetXattrMaxSize() + ", but the total size is " +
                                                         size);
            }
        }
 public static bool IsStoragePolicyXAttr(XAttr xattr)
 {
     return(xattr != null && xattr.GetNameSpace() == XAttrNS && xattr.GetName().Equals
                (StoragePolicyXattrName));
 }