blob: 101f92422c30f6c91ee58364386f755c7845d3a1 [file] [log] [blame]
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
using Org.Apache.REEF.Common.Catalog;
using Org.Apache.REEF.Common.Catalog.Capabilities;
using Org.Apache.REEF.Utilities.Logging;
using System.Net;
namespace Org.Apache.REEF.Bridge.Core.Common.Driver.Events
{
internal sealed class NodeDescriptor : INodeDescriptor
{
private static readonly Logger _log = Logger.GetLogger(typeof(NodeDescriptor));
public IPEndPoint InetSocketAddress { get; set; }
public string HostName { get; set; }
public CPU Cpu { get; set; }
public RAM Ram { get; set; }
public NodeDescriptor(IPEndPoint inetSocketAddress, string hostName, CPU cpu, RAM ram)
{
InetSocketAddress = inetSocketAddress;
HostName = hostName;
Cpu = cpu;
Ram = ram;
}
public NodeDescriptor(string ip, int port, string hostName, CPU cpu, RAM ram)
{
IPAddress address;
if (IPAddress.TryParse(ip, out address))
{
InetSocketAddress = new IPEndPoint(address, port);
}
else
{
_log.Log(Level.Error, "Could not parse ip address {0}", ip);
}
HostName = hostName;
Cpu = cpu;
Ram = ram;
}
}
}