Exemple #1
0
            internal Dest(string path, MethodInfo method, Type cls, IList <string> pathParams,
                          WebApp.HTTP httpMethod)
            {
                prefix          = Preconditions.CheckNotNull(path);
                action          = Preconditions.CheckNotNull(method);
                controllerClass = Preconditions.CheckNotNull(cls);
                this.pathParams = pathParams != null?ImmutableList.CopyOf(pathParams) : EmptyList;

                methods = EnumSet.Of(httpMethod);
            }
Exemple #2
0
                public override XAttrFeature GetXAttrFeature()
                {
                    XAttrFeature x;

                    if (useDefault)
                    {
                        x = inode.GetXAttrFeature();
                    }
                    else
                    {
                        x = new XAttrFeature(ImmutableList.CopyOf(Lists.NewArrayList(new XAttr.Builder().
                                                                                     SetName("test").SetValue(new byte[] { 1, 2 }).Build())));
                    }
                    return(x);
                }
Exemple #3
0
 /// <summary>
 /// Instantiates a
 /// <see cref="ContainerRequest"/>
 /// with the given constraints.
 /// </summary>
 /// <param name="capability">
 /// The
 /// <see cref="Org.Apache.Hadoop.Yarn.Api.Records.Resource"/>
 /// to be requested for each container.
 /// </param>
 /// <param name="nodes">Any hosts to request that the containers are placed on.</param>
 /// <param name="racks">
 /// Any racks to request that the containers are placed on. The
 /// racks corresponding to any hosts requested will be automatically
 /// added to this list.
 /// </param>
 /// <param name="priority">
 /// The priority at which to request the containers. Higher
 /// priorities have lower numerical values.
 /// </param>
 /// <param name="relaxLocality">
 /// If true, containers for this request may be assigned on hosts
 /// and racks other than the ones explicitly requested.
 /// </param>
 /// <param name="nodeLabelsExpression">
 /// Set node labels to allocate resource, now we only support
 /// asking for only a single node label
 /// </param>
 public ContainerRequest(Resource capability, string[] nodes, string[] racks, Priority
                         priority, bool relaxLocality, string nodeLabelsExpression)
 {
     // Validate request
     Preconditions.CheckArgument(capability != null, "The Resource to be requested for each container "
                                 + "should not be null ");
     Preconditions.CheckArgument(priority != null, "The priority at which to request containers should not be null "
                                 );
     Preconditions.CheckArgument(!(!relaxLocality && (racks == null || racks.Length ==
                                                      0) && (nodes == null || nodes.Length == 0)), "Can't turn off locality relaxation on a "
                                 + "request with no location constraints");
     this.capability           = capability;
     this.nodes                = (nodes != null ? ImmutableList.CopyOf(nodes) : null);
     this.racks                = (racks != null ? ImmutableList.CopyOf(racks) : null);
     this.priority             = priority;
     this.relaxLocality        = relaxLocality;
     this.nodeLabelsExpression = nodeLabelsExpression;
 }
Exemple #4
0
        /// <summary>Update xattrs of inode.</summary>
        /// <remarks>
        /// Update xattrs of inode.
        /// <p/>
        /// Must be called while holding the FSDirectory write lock.
        /// </remarks>
        /// <param name="inode">INode to update</param>
        /// <param name="xAttrs">to update xAttrs.</param>
        /// <param name="snapshotId">id of the latest snapshot of the inode</param>
        /// <exception cref="Org.Apache.Hadoop.Hdfs.Protocol.QuotaExceededException"/>
        public static void UpdateINodeXAttrs(INode inode, IList <XAttr> xAttrs, int snapshotId
                                             )
        {
            if (xAttrs == null || xAttrs.IsEmpty())
            {
                if (inode.GetXAttrFeature() != null)
                {
                    inode.RemoveXAttrFeature(snapshotId);
                }
                return;
            }
            // Dedupe the xAttr name and save them into a new interned list
            IList <XAttr> internedXAttrs = Lists.NewArrayListWithCapacity(xAttrs.Count);

            foreach (XAttr xAttr in xAttrs)
            {
                string name         = xAttr.GetName();
                string internedName = internedNames[name];
                if (internedName == null)
                {
                    internedName = name;
                    internedNames[internedName] = internedName;
                }
                XAttr internedXAttr = new XAttr.Builder().SetName(internedName).SetNameSpace(xAttr
                                                                                             .GetNameSpace()).SetValue(xAttr.GetValue()).Build();
                internedXAttrs.AddItem(internedXAttr);
            }
            // Save the list of interned xattrs
            ImmutableList <XAttr> newXAttrs = ImmutableList.CopyOf(internedXAttrs);

            if (inode.GetXAttrFeature() != null)
            {
                inode.RemoveXAttrFeature(snapshotId);
            }
            inode.AddXAttrFeature(new XAttrFeature(newXAttrs), snapshotId);
        }
Exemple #5
0
 public virtual IList <FSImageStorageInspector.FSImageFile> GetFoundImages()
 {
     return(ImmutableList.CopyOf(foundImages));
 }
Exemple #6
0
 public AsyncLoggerSet(IList <AsyncLogger> loggers)
 {
     this.loggers = ImmutableList.CopyOf(loggers);
 }