You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@reef.apache.org by we...@apache.org on 2015/02/06 02:32:57 UTC
[1/5] incubator-reef git commit: [REEF-139] Changing .Net project
structure for Network and Evaluator
Repository: incubator-reef
Updated Branches:
refs/heads/master c1b5200f6 -> b6c4e9838
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Properties/AssemblyInfo.cs b/lang/cs/Source/REEF/reef-io/Network/Properties/AssemblyInfo.cs
deleted file mode 100644
index 82fb3ba..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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 System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("NetWork")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("NetWork")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("b3f5e608-8908-4f06-a87e-5e41c88133ac")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Utilities/BlockingCollectionExtensions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Utilities/BlockingCollectionExtensions.cs b/lang/cs/Source/REEF/reef-io/Network/Utilities/BlockingCollectionExtensions.cs
deleted file mode 100644
index ae80880..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Utilities/BlockingCollectionExtensions.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-
-namespace Org.Apache.REEF.IO.Network.Utilities
-{
- public static class BlockingCollectionExtensions
- {
- /// <summary>
- /// Removes the given item from the BlockingCollection if it is present.
- /// If it is not present, it blocks until any item is available in the
- /// BlockingCollection. It then removes and returns that first available
- /// item.
- /// </summary>
- /// <typeparam name="T">The type of BlockingCollection</typeparam>
- /// <param name="collection">The BlockingCollection to remove the specified item</param>
- /// <param name="item">The item to remove from the BlockingCollection, if it exists</param>
- /// <returns>The specified item, or the first available item if the specified item is
- /// not present in the BlockingCollection</returns>
- public static T Take<T>(this BlockingCollection<T> collection, T item)
- {
- T ret = default(T);
- bool foundItem = false;
- List<T> removedItems = new List<T>();
-
- // Empty the collection
- for (int i = 0; i < collection.Count; i++)
- {
- T removed;
- if (collection.TryTake(out removed))
- {
- removedItems.Add(removed);
- }
- }
-
- // Add them back to the collection minus the specified item
- foreach (T removedItem in removedItems)
- {
- if (removedItem.Equals(item))
- {
- ret = removedItem;
- foundItem = true;
- }
- else
- {
- collection.Add(removedItem);
- }
- }
-
- if (!foundItem)
- {
- // Error: the element wasn't in the collection
- throw new InvalidOperationException(item + " not found in blocking collection");
- }
-
- return ret;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Utilities/Utils.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Utilities/Utils.cs b/lang/cs/Source/REEF/reef-io/Network/Utilities/Utils.cs
deleted file mode 100644
index 49ce5c3..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Utilities/Utils.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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 System.IO;
-using Microsoft.Hadoop.Avro;
-using Org.Apache.REEF.Driver.Context;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Exceptions;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tang.Util;
-using Org.Apache.REEF.Tang.Implementations.Tang;
-
-namespace Org.Apache.REEF.IO.Network.Utilities
-{
- internal class Utils
- {
- private static Logger LOGGER = Logger.GetLogger(typeof(Utils));
-
- /// <summary>
- /// Returns the TaskIdentifier from the Configuration.
- /// </summary>
- /// <param name="taskConfiguration">The Configuration object</param>
- /// <returns>The TaskIdentifier for the given Configuration</returns>
- public static string GetTaskId(IConfiguration taskConfiguration)
- {
- try
- {
- IInjector injector = TangFactory.GetTang().NewInjector(taskConfiguration);
- return injector.GetNamedInstance<TaskConfigurationOptions.Identifier, string>(
- GenericType<TaskConfigurationOptions.Identifier>.Class);
- }
- catch (InjectionException)
- {
- LOGGER.Log(Level.Error, "Unable to find task identifier");
- throw;
- }
- }
-
- /// <summary>
- /// Returns the Context Identifier from the Configuration.
- /// </summary>
- /// <param name="contextConfiguration">The Configuration object</param>
- /// <returns>The TaskIdentifier for the given Configuration</returns>
- public static string GetContextId(IConfiguration contextConfiguration)
- {
- try
- {
- IInjector injector = TangFactory.GetTang().NewInjector(contextConfiguration);
- return injector.GetNamedInstance<ContextConfigurationOptions.ContextIdentifier, string>(
- GenericType<ContextConfigurationOptions.ContextIdentifier>.Class);
- }
- catch (InjectionException)
- {
- LOGGER.Log(Level.Error, "Unable to find task identifier");
- throw;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/packages.config b/lang/cs/Source/REEF/reef-io/Network/packages.config
deleted file mode 100644
index 88cf17b..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/packages.config
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<packages>
- <package id="Microsoft.Hadoop.Avro" version="1.4.0.0" targetFramework="net45" />
- <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
- <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
- <package id="Rx-Core" version="2.2.5" targetFramework="net45" />
- <package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
-</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/Tools/ReefAll/ReefAll.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Source/Tools/ReefAll/ReefAll.csproj b/lang/cs/Source/Tools/ReefAll/ReefAll.csproj
index 2a1bf70..abd71e3 100644
--- a/lang/cs/Source/Tools/ReefAll/ReefAll.csproj
+++ b/lang/cs/Source/Tools/ReefAll/ReefAll.csproj
@@ -82,29 +82,33 @@ under the License.
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="$(SourceDir)\REEF\reef-applications\Evaluator\Evaluator.csproj">
- <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
- <Name>Evaluator</Name>
- </ProjectReference>
- <ProjectReference Include="$(SourceDir)\REEF\reef-io\NetWork\NetWork.csproj">
- <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
- <Name>NetWork</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\Org.Apache.Reef.Common\Org.Apache.Reef.Common.csproj">
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
<Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.Reef.Common</Name>
+ <Name>Org.Apache.REEF.Common</Name>
</ProjectReference>
- <ProjectReference Include="..\..\..\Org.Apache.Reef.Driver\Org.Apache.Reef.Driver.csproj">
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.Reef.Driver</Name>
+ <Name>Org.Apache.REEF.Driver</Name>
</ProjectReference>
- <ProjectReference Include="..\..\..\Org.Apache.Reef.Tang\Org.Apache.Reef.Tang.csproj">
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Evaluator\Org.Apache.REEF.Evaluator.csproj">
+ <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
+ <Name>Org.Apache.REEF.Evaluator</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
<Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.Reef.Tang</Name>
+ <Name>Org.Apache.REEF.Tang</Name>
</ProjectReference>
- <ProjectReference Include="..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
<Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Org.Apache.Reef.Wake</Name>
+ <Name>Org.Apache.REEF.Wake</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\..\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.REEF.Utilities</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
index 41a80cc..686bef4 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Bridge/TestSimpleEventHandlers.cs
@@ -27,7 +27,7 @@ using Org.Apache.REEF.Driver.Defaults;
using Org.Apache.REEF.Examples.HelloCLRBridge;
using Org.Apache.REEF.Examples.HelloCLRBridge.handlers;
using Org.Apache.REEF.Examples.HelloCLRBridge.Handlers;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Tang.Interface;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
index 7199af1..7a82029 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageDriver.cs
@@ -27,7 +27,7 @@ using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Driver.Context;
using Org.Apache.REEF.Driver.Evaluator;
using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Services;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Utilities;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
index 5c85426..2661cf1 100644
--- a/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
+++ b/lang/cs/Tests/ReefTests/Functional.Tests/Messaging/MessageTask.cs
@@ -22,7 +22,7 @@ using System.Globalization;
using System.Linq;
using System.Net;
using System.Threading;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Tasks.Events;
using Org.Apache.REEF.Utilities;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
index 2ae67d2..4b21b1e 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/BlockingCollectionExtensionTests.cs
@@ -17,7 +17,7 @@
* under the License.
*/
-using Org.Apache.REEF.IO.Network.Utilities;
+using Org.Apache.REEF.Network.Utilities;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Concurrent;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
index 6caac93..3ceb21b 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/NameServerTests.cs
@@ -25,8 +25,8 @@ using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming;
-using Org.Apache.REEF.IO.Network.Naming.Events;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Network.Naming.Events;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations;
using Org.Apache.REEF.Tang.Interface;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs b/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
index 1f827e2..3a38621 100644
--- a/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
+++ b/lang/cs/Tests/ReefTests/IO.Tests/NetworkServiceTests.cs
@@ -18,8 +18,8 @@
*/
using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming;
-using Org.Apache.REEF.IO.Network.NetworkService;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Network.NetworkService;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations;
using Org.Apache.REEF.Tang.Interface;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Tests/ReefTests/ReefTests.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Tests/ReefTests/ReefTests.csproj b/lang/cs/Tests/ReefTests/ReefTests.csproj
index fce90f6..1aa89ba 100644
--- a/lang/cs/Tests/ReefTests/ReefTests.csproj
+++ b/lang/cs/Tests/ReefTests/ReefTests.csproj
@@ -152,6 +152,14 @@ under the License.
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
<Name>Org.Apache.Reef.Driver</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\Org.Apache.REEF.Evaluator\Org.Apache.REEF.Evaluator.csproj">
+ <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
+ <Name>Org.Apache.REEF.Evaluator</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\Org.Apache.Reef.Tang\Org.Apache.Reef.Tang.csproj">
<Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
<Name>Org.Apache.Reef.Tang</Name>
@@ -168,18 +176,10 @@ under the License.
<Project>{5094c35b-4fdb-4322-ac05-45d684501cbf}</Project>
<Name>CLRBridgeClient</Name>
</ProjectReference>
- <ProjectReference Include="..\..\Source\REEF\reef-applications\Evaluator\Evaluator.csproj">
- <Project>{1b983182-9c30-464c-948d-f87eb93a8240}</Project>
- <Name>Evaluator</Name>
- </ProjectReference>
<ProjectReference Include="..\..\Source\REEF\reef-examples\HelloCLRBridge\HelloCLRBridge.csproj">
<Project>{a78dd8e8-31d0-4506-8738-daa9da86d55b}</Project>
<Name>HelloCLRBridge</Name>
</ProjectReference>
- <ProjectReference Include="..\..\Source\REEF\reef-io\NetWork\NetWork.csproj">
- <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
- <Name>NetWork</Name>
- </ProjectReference>
<ProjectReference Include="..\..\Source\REEF\reef-tasks\Tasks\Tasks.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
<Name>Tasks</Name>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a334f75..19c9090 100644
--- a/pom.xml
+++ b/pom.xml
@@ -250,11 +250,12 @@ under the License.
<exclude>**/obj/**</exclude>
<exclude>**/Release/**</exclude>
<exclude>**/Debug/**</exclude>
+ <exclude>**/TestResults/**</exclude>
<!-- NuGet dependencies downloaded as part of the build -->
<exclude>**/packages/**</exclude>
<!-- The below are auto generated files for serialization -->
- <exclude>**/ReefCommon/protobuf/cs/*</exclude>
- <exclude>**/ReefCommon/avro/*</exclude>
+ <exclude>**/Org.Apache.REEF.Common/protobuf/cs/*</exclude>
+ <exclude>**/Org.Apache.REEF.Common/avro/*</exclude>
<!-- The below are binary data files used in tests -->
<exclude>**/ConfigFiles/evaluator.conf</exclude>
<exclude>**/TangTests/evaluator.conf</exclude>
[2/5] incubator-reef git commit: [REEF-139] Changing .Net project
structure for Network and Evaluator
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NameClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NameClient.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NameClient.cs
deleted file mode 100644
index 806f1d0..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NameClient.cs
+++ /dev/null
@@ -1,279 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Codec;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Utilities.Diagnostics;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Wake;
-using Org.Apache.REEF.Wake.Remote;
-using Org.Apache.REEF.Wake.Remote.Impl;
-using Org.Apache.REEF.Wake.RX;
-using Org.Apache.REEF.Wake.RX.Impl;
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Reactive;
-
-namespace Org.Apache.REEF.IO.Network.Naming
-{
- /// <summary>
- /// Client for the Reef name service.
- /// Used to register, unregister, and lookup IP Addresses of known hosts.
- /// </summary>
- public class NameClient : INameClient
- {
- private static Logger _logger = Logger.GetLogger(typeof(NameClient));
-
- private BlockingCollection<NamingLookupResponse> _lookupResponseQueue;
- private BlockingCollection<NamingGetAllResponse> _getAllResponseQueue;
- private BlockingCollection<NamingRegisterResponse> _registerResponseQueue;
- private BlockingCollection<NamingUnregisterResponse> _unregisterResponseQueue;
-
- private TransportClient<NamingEvent> _client;
-
- private NameLookupClient _lookupClient;
- private NameRegisterClient _registerClient;
-
- private bool _disposed;
-
- /// <summary>
- /// Constructs a NameClient to register, lookup, and unregister IPEndpoints
- /// with the NameServer.
- /// </summary>
- /// <param name="remoteAddress">The ip address of the NameServer</param>
- /// <param name="remotePort">The port of the NameServer</param>
- [Inject]
- public NameClient(
- [Parameter(typeof(NamingConfigurationOptions.NameServerAddress))] string remoteAddress,
- [Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int remotePort)
- {
- IPEndPoint remoteEndpoint = new IPEndPoint(IPAddress.Parse(remoteAddress), remotePort);
- Initialize(remoteEndpoint);
- _disposed = false;
- }
-
- /// <summary>
- /// Constructs a NameClient to register, lookup, and unregister IPEndpoints
- /// with the NameServer.
- /// </summary>
- /// <param name="remoteEndpoint">The endpoint of the NameServer</param>
- public NameClient(IPEndPoint remoteEndpoint)
- {
- Initialize(remoteEndpoint);
- _disposed = false;
- }
-
- /// <summary>
- /// Synchronously registers the identifier with the NameService.
- /// Overwrites the previous mapping if the identifier has already
- /// been registered.
- /// </summary>
- /// <param name="id">The key used to map the remote endpoint</param>
- /// <param name="endpoint">The endpoint to map</param>
- public void Register(string id, IPEndPoint endpoint)
- {
- if (id == null)
- {
- Exceptions.Throw(new ArgumentNullException("id"), _logger);
- }
- if (endpoint == null)
- {
- Exceptions.Throw(new ArgumentNullException("endpoint"), _logger);
- }
-
- _logger.Log(Level.Info, "Registering id: " + id + ", and endpoint: " + endpoint);
- _registerClient.Register(id, endpoint);
- }
-
- /// <summary>
- /// Synchronously unregisters the remote identifier with the NameService
- /// </summary>
- /// <param name="id">The identifier to unregister</param>
- public void Unregister(string id)
- {
- if (id == null)
- {
- Exceptions.Throw(new ArgumentNullException("id"), _logger);
- }
-
- _logger.Log(Level.Info, "Unregistering id: " + id);
- _registerClient.Unregister(id);
- }
-
- /// <summary>
- /// Synchronously looks up the IPEndpoint for the registered identifier.
- /// </summary>
- /// <param name="id">The identifier to look up</param>
- /// <returns>The mapped IPEndpoint for the identifier, or null if
- /// the identifier has not been registered with the NameService</returns>
- public IPEndPoint Lookup(string id)
- {
- if (id == null)
- {
- Exceptions.Throw(new ArgumentNullException("id"), _logger);
- }
-
- List<NameAssignment> assignments = Lookup(new List<string> { id });
- if (assignments != null && assignments.Count > 0)
- {
- return assignments.First().Endpoint;
- }
-
- return null;
- }
-
- /// <summary>
- /// Synchronously looks up the IPEndpoint for each of the registered identifiers in the list.
- /// </summary>
- /// <param name="ids">The list of identifiers to look up</param>
- /// <returns>The list of NameAssignments representing a pair of identifer
- /// and mapped IPEndpoint for that identifier. If any of the requested identifiers
- /// are not registered with the NameService, their corresponding NameAssignment
- /// IPEndpoint value will be null.</returns>
- public List<NameAssignment> Lookup(List<string> ids)
- {
- if (ids == null || ids.Count == 0)
- {
- Exceptions.Throw(new ArgumentNullException("ids cannot be null or empty"), _logger);
- }
-
- _logger.Log(Level.Verbose, "Looking up ids");
- List<NameAssignment> assignments = _lookupClient.Lookup(ids);
- if (assignments != null)
- {
- return assignments;
- }
- Exceptions.Throw(new WakeRuntimeException("NameClient failed to look up ids."), _logger);
- return null; //above line will throw exception. So null will never be returned.
- }
-
- /// <summary>
- /// Restart the name client in case of failure.
- /// </summary>
- /// <param name="serverEndpoint">The new server endpoint to connect to</param>
- public void Restart(IPEndPoint serverEndpoint)
- {
- _client.Dispose();
- Initialize(serverEndpoint);
- }
-
- /// <summary>
- /// Releases resources used by NameClient
- /// </summary>
- public void Dispose()
- {
- Dispose(true);
- GC.SuppressFinalize(this);
- }
-
- protected virtual void Dispose(bool disposing)
- {
- if (_disposed)
- {
- return;
- }
- if (disposing)
- {
- _client.Dispose();
- }
- _disposed = true;
- }
-
- /// <summary>
- /// Create a new transport client connected to the NameServer at the given remote endpoint.
- /// </summary>
- /// <param name="serverEndpoint">The NameServer endpoint to connect to.</param>
- private void Initialize(IPEndPoint serverEndpoint)
- {
- _lookupResponseQueue = new BlockingCollection<NamingLookupResponse>();
- _getAllResponseQueue = new BlockingCollection<NamingGetAllResponse>();
- _registerResponseQueue = new BlockingCollection<NamingRegisterResponse>();
- _unregisterResponseQueue = new BlockingCollection<NamingUnregisterResponse>();
-
- IObserver<TransportEvent<NamingEvent>> clientHandler = CreateClientHandler();
- ICodec<NamingEvent> codec = CreateClientCodec();
- _client = new TransportClient<NamingEvent>(serverEndpoint, codec, clientHandler);
-
- _lookupClient = new NameLookupClient(_client, _lookupResponseQueue, _getAllResponseQueue);
- _registerClient = new NameRegisterClient(_client, _registerResponseQueue, _unregisterResponseQueue);
- }
-
- /// <summary>
- /// Create handler to handle async responses from the NameServer.
- /// </summary>
- /// <returns>The client handler to manage responses from the NameServer</returns>
- private IObserver<TransportEvent<NamingEvent>> CreateClientHandler()
- {
- PubSubSubject<NamingEvent> subject = new PubSubSubject<NamingEvent>();
- subject.Subscribe(Observer.Create<NamingLookupResponse>(msg => HandleResponse(_lookupResponseQueue, msg)));
- subject.Subscribe(Observer.Create<NamingGetAllResponse>(msg => HandleResponse(_getAllResponseQueue, msg)));
- subject.Subscribe(Observer.Create<NamingRegisterResponse>(msg => HandleResponse(_registerResponseQueue, msg)));
- subject.Subscribe(Observer.Create<NamingUnregisterResponse>(msg => HandleResponse(_unregisterResponseQueue, msg)));
- return new ClientObserver(subject);
- }
-
- /// <summary>
- /// Create the codec used to serialize/deserialize NamingEvent messages
- /// </summary>
- /// <returns>The serialization codec</returns>
- private ICodec<NamingEvent> CreateClientCodec()
- {
- MultiCodec<NamingEvent> codec = new MultiCodec<NamingEvent>();
- codec.Register(new NamingLookupRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupRequest");
- codec.Register(new NamingLookupResponseCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupResponse");
- NamingRegisterRequestCodec requestCodec = new NamingRegisterRequestCodec();
- codec.Register(requestCodec, "org.apache.reef.io.network.naming.serialization.NamingRegisterRequest");
- codec.Register(new NamingRegisterResponseCodec(requestCodec), "org.apache.reef.io.network.naming.serialization.NamingRegisterResponse");
- codec.Register(new NamingUnregisterRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingUnregisterRequest");
- return codec;
- }
-
- private void HandleResponse<T>(BlockingCollection<T> queue, T message)
- {
- queue.Add(message);
- }
-
- /// <summary>
- /// Helper class used to handle response events from the NameServer.
- /// Delegates the event to the appropriate response queue depending on
- /// its event type.
- /// </summary>
- private class ClientObserver : AbstractObserver<TransportEvent<NamingEvent>>
- {
- private IObserver<NamingEvent> _handler;
-
- public ClientObserver(IObserver<NamingEvent> handler)
- {
- _handler = handler;
- }
-
- public override void OnNext(TransportEvent<NamingEvent> value)
- {
- NamingEvent message = value.Data;
- message.Link = value.Link;
- _handler.OnNext(message);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NameLookupClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NameLookupClient.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NameLookupClient.cs
deleted file mode 100644
index 7499734..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NameLookupClient.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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 System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Threading;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.Remote.Impl;
-
-namespace Org.Apache.REEF.IO.Network.Naming
-{
- /// <summary>
- /// Helper class to send lookup events to the name server
- /// </summary>
- internal class NameLookupClient
- {
- private TransportClient<NamingEvent> _client;
- private BlockingCollection<NamingLookupResponse> _lookupResponseQueue;
- private BlockingCollection<NamingGetAllResponse> _getAllResponseQueue;
-
- /// <summary>
- /// Constructs a new NameLookupClient.
- /// </summary>
- /// <param name="client">The transport client used to connect to the NameServer</param>
- /// <param name="lookupQueue">The queue used to signal that a response
- /// has been received from the NameServer</param>
- /// <param name="getAllQueue">The queue used to signal that a GetAllResponse
- /// has been received from the NameServer</param>
- public NameLookupClient(TransportClient<NamingEvent> client,
- BlockingCollection<NamingLookupResponse> lookupQueue,
- BlockingCollection<NamingGetAllResponse> getAllQueue)
- {
- _client = client;
- _lookupResponseQueue = lookupQueue;
- _getAllResponseQueue = getAllQueue;
- }
-
- /// <summary>
- /// Look up the IPEndPoint that has been registered with the NameServer using
- /// the given identifier as the key.
- /// </summary>
- /// <param name="id">The id for the IPEndPoint</param>
- /// <param name="token">The cancellation token used for timeout</param>
- /// <returns>The registered IPEndpoint, or null if the identifer has not
- /// been registered with the NameServer or if the operation times out.</returns>
- public IPEndPoint Lookup(string id, CancellationToken token)
- {
- List<string> ids = new List<string> { id };
- List<NameAssignment> assignment = Lookup(ids);
- return (assignment == null || assignment.Count == 0) ? null : assignment.First().Endpoint;
- }
-
- /// <summary>
- /// Look up IPEndPoints that have been registered with the NameService
- /// </summary>
- /// <param name="ids">The list of ids to look up</param>
- /// <returns>A list of NameAssignments representing the mapped identifier/IPEndpoint
- /// pairs</returns>
- public List<NameAssignment> Lookup(List<string> ids)
- {
- _client.Send(new NamingLookupRequest(ids));
- NamingLookupResponse response = _lookupResponseQueue.Take();
- return response.NameAssignments;
- }
-
- /// <summary>
- /// Synchronously gets all of the identifier/IPEndpoint pairs registered with the NameService.
- /// </summary>
- /// <returns>A list of NameAssignments representing the mapped identifier/IPEndpoint
- /// pairs</returns>
- public List<NameAssignment> GetAll()
- {
- _client.Send(new NamingGetAllRequest());
- NamingGetAllResponse response = _getAllResponseQueue.Take();
- return response.Assignments;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NameRegisterClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NameRegisterClient.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NameRegisterClient.cs
deleted file mode 100644
index 88dc3c0..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NameRegisterClient.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * 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 System.Collections.Concurrent;
-using System.Net;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.Remote.Impl;
-
-namespace Org.Apache.REEF.IO.Network.Naming
-{
- /// <summary>
- /// Helper class to send register and unregister events to the NameServer.
- /// </summary>
- internal class NameRegisterClient
- {
- private TransportClient<NamingEvent> _client;
- private BlockingCollection<NamingRegisterResponse> _registerResponseQueue;
- private BlockingCollection<NamingUnregisterResponse> _unregisterResponseQueue;
-
- public NameRegisterClient(TransportClient<NamingEvent> client,
- BlockingCollection<NamingRegisterResponse> registerQueue,
- BlockingCollection<NamingUnregisterResponse> unregisterQueue)
- {
- _client = client;
- _registerResponseQueue = registerQueue;
- _unregisterResponseQueue = unregisterQueue;
- }
-
- /// <summary>
- /// Synchronously register the id and endpoint with the NameServer.
- /// </summary>
- /// <param name="id">The identifier</param>
- /// <param name="endpoint">The endpoint</param>
- public void Register(string id, IPEndPoint endpoint)
- {
- NameAssignment assignment = new NameAssignment(id, endpoint);
- _client.Send(new NamingRegisterRequest(assignment));
- _registerResponseQueue.Take();
- }
-
- /// <summary>
- /// Synchronously unregisters the identifier with the NameServer.
- /// </summary>
- /// <param name="id">The identifer to unregister</param>
- public void Unregister(string id)
- {
- _client.Send(new NamingUnregisterRequest(id));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NameServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NameServer.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NameServer.cs
deleted file mode 100644
index 462e05a..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NameServer.cs
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Codec;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.IO.Network.Naming.Observers;
-using Org.Apache.REEF.Utilities.Diagnostics;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Wake.Remote;
-using Org.Apache.REEF.Wake.Remote.Impl;
-using Org.Apache.REEF.Wake.RX;
-using Org.Apache.REEF.Wake.RX.Impl;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-
-namespace Org.Apache.REEF.IO.Network.Naming
-{
- /// <summary>
- /// Service that manages names and IPEndpoints for well known hosts.
- /// Can register, unregister, and look up IPAddresses using a string identifier.
- /// </summary>
- public class NameServer : INameServer
- {
- private static Logger _logger = Logger.GetLogger(typeof(NameServer));
-
- private TransportServer<NamingEvent> _server;
- private Dictionary<string, IPEndPoint> _idToAddrMap;
-
- /// <summary>
- /// Create a new NameServer to run on the specified port.
- /// </summary>
- /// <param name="port">The port to listen for incoming connections on.</param>
- [Inject]
- public NameServer([Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int port)
- {
- IObserver<TransportEvent<NamingEvent>> handler = CreateServerHandler();
- _idToAddrMap = new Dictionary<string, IPEndPoint>();
- ICodec<NamingEvent> codec = CreateServerCodec();
-
- // Start transport server, get listening IP endpoint
- _logger.Log(Level.Info, "Starting naming server");
- _server = new TransportServer<NamingEvent>(port, handler, codec);
- _server.Run();
- LocalEndpoint = _server.LocalEndpoint;
- }
-
- public IPEndPoint LocalEndpoint { get; private set; }
-
- /// <summary>
- /// Looks up the IPEndpoints for each string identifier
- /// </summary>
- /// <param name="ids">The IDs to look up</param>
- /// <returns>A list of Name assignments representing the identifier
- /// that was searched for and the mapped IPEndpoint</returns>
- public List<NameAssignment> Lookup(List<string> ids)
- {
- if (ids == null)
- {
- Exceptions.Throw(new ArgumentNullException("ids"), _logger);
- }
-
- return ids.Where(id => _idToAddrMap.ContainsKey(id))
- .Select(id => new NameAssignment(id, _idToAddrMap[id]))
- .ToList();
- }
-
- /// <summary>
- /// Gets all of the registered identifier/endpoint pairs.
- /// </summary>
- /// <returns>A list of all of the registered identifiers and their
- /// mapped IPEndpoints</returns>
- public List<NameAssignment> GetAll()
- {
- return _idToAddrMap.Select(pair => new NameAssignment(pair.Key, pair.Value)).ToList();
- }
-
- /// <summary>
- /// Registers the string identifier with the given IPEndpoint
- /// </summary>
- /// <param name="id">The string ident</param>
- /// <param name="endpoint">The mapped endpoint</param>
- public void Register(string id, IPEndPoint endpoint)
- {
- if (id == null)
- {
- Exceptions.Throw(new ArgumentNullException("id"), _logger);
- }
- if (endpoint == null)
- {
- Exceptions.Throw(new ArgumentNullException("endpoint"), _logger);
- }
-
- _logger.Log(Level.Info, "Registering id: " + id + ", and endpoint: " + endpoint);
- _idToAddrMap[id] = endpoint;
- }
-
- /// <summary>
- /// Unregister the given identifier with the NameServer
- /// </summary>
- /// <param name="id">The identifier to unregister</param>
- public void Unregister(string id)
- {
- if (id == null)
- {
- Exceptions.Throw(new ArgumentNullException("id"), _logger);
- }
-
- _logger.Log(Level.Info, "Unregistering id: " + id);
- _idToAddrMap.Remove(id);
- }
-
- /// <summary>
- /// Stops the NameServer
- /// </summary>
- public void Dispose()
- {
- _server.Dispose();
- }
-
- /// <summary>
- /// Create the handler to manage incoming NamingEvent types
- /// </summary>
- /// <returns>The server handler</returns>
- private IObserver<TransportEvent<NamingEvent>> CreateServerHandler()
- {
- PubSubSubject<NamingEvent> subject = new PubSubSubject<NamingEvent>();
- subject.Subscribe(new NamingLookupRequestObserver(this));
- subject.Subscribe(new NamingGetAllRequestObserver(this));
- subject.Subscribe(new NamingRegisterRequestObserver(this));
- subject.Subscribe(new NamingUnregisterRequestObserver(this));
- return new ServerHandler(subject);
- }
-
- /// <summary>
- /// Create the codec used to serialize/deserialize NamingEvent messages
- /// </summary>
- /// <returns>The serialization codec</returns>
- private ICodec<NamingEvent> CreateServerCodec()
- {
- MultiCodec<NamingEvent> codec = new MultiCodec<NamingEvent>();
- codec.Register(new NamingLookupRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupRequest");
- codec.Register(new NamingLookupResponseCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupResponse");
- NamingRegisterRequestCodec requestCodec = new NamingRegisterRequestCodec();
- codec.Register(requestCodec, "org.apache.reef.io.network.naming.serialization.NamingRegisterRequest");
- codec.Register(new NamingRegisterResponseCodec(requestCodec), "org.apache.reef.io.network.naming.serialization.NamingRegisterResponse");
- codec.Register(new NamingUnregisterRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingUnregisterRequest");
- return codec;
- }
-
- [NamedParameter("Port for the NameServer to listen on")]
- public class Port : Name<int>
- {
- }
-
- /// <summary>
- /// Class used to handle incoming NamingEvent messages.
- /// Delegates the event to the prescribed handler depending on its type
- /// </summary>
- private class ServerHandler : AbstractObserver<TransportEvent<NamingEvent>>
- {
- private IObserver<NamingEvent> _handler;
-
- public ServerHandler(IObserver<NamingEvent> handler)
- {
- _handler = handler;
- }
-
- public override void OnNext(TransportEvent<NamingEvent> value)
- {
- NamingEvent message = value.Data;
- message.Link = value.Link;
- _handler.OnNext(message);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfiguration.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfiguration.cs
deleted file mode 100644
index 3daac70..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfiguration.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Org.Apache.REEF.Tang.Formats;
-using Org.Apache.REEF.Tang.Util;
-
-namespace Org.Apache.REEF.Naming
-{
- public class NamingConfiguration : ConfigurationModuleBuilder
- {
- [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
- public static readonly RequiredParameter<string> NameServerAddress = new RequiredParameter<string>();
-
- [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
- public static readonly RequiredParameter<int> NameServerPort = new RequiredParameter<int>();
-
- public static ConfigurationModule ConfigurationModule
- {
- get
- {
- return new NamingConfiguration()
- .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerAddress>.Class, NameServerAddress)
- .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerPort>.Class, NameServerPort)
- .Build();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfigurationOptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfigurationOptions.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfigurationOptions.cs
deleted file mode 100644
index aa9b6e6..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/NamingConfigurationOptions.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.Naming
-{
- public class NamingConfigurationOptions
- {
- [NamedParameter("IP address of NameServer")]
- public class NameServerAddress : Name<string>
- {
- }
-
- [NamedParameter("Port of NameServer")]
- public class NameServerPort : Name<int>
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingGetAllRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingGetAllRequestObserver.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingGetAllRequestObserver.cs
deleted file mode 100644
index 92cc158..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingGetAllRequestObserver.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.RX;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Observers
-{
- /// <summary>
- /// Handler for NameService for events of type NamingGetAllRequest.
- /// Gets all of the identifiers and their mapped IPEndpoints registered
- /// with the NameServer.
- /// </summary>
- internal class NamingGetAllRequestObserver : AbstractObserver<NamingGetAllRequest>
- {
- private NameServer _server;
-
- public NamingGetAllRequestObserver(NameServer server)
- {
- _server = server;
- }
-
- public override void OnNext(NamingGetAllRequest value)
- {
- List<NameAssignment> assignments = _server.GetAll();
- value.Link.Write(new NamingGetAllResponse(assignments));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingLookupRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingLookupRequestObserver.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingLookupRequestObserver.cs
deleted file mode 100644
index 220aaa5..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingLookupRequestObserver.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.RX;
-using System.Collections.Generic;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Observers
-{
- /// <summary>
- /// Handler for looking up IPEndpoints registered with the NameServer
- /// </summary>
- internal class NamingLookupRequestObserver : AbstractObserver<NamingLookupRequest>
- {
- private NameServer _server;
-
- public NamingLookupRequestObserver(NameServer server)
- {
- _server = server;
- }
-
- /// <summary>
- /// Look up the IPEndpoints for the given identifiers and write them
- /// back to the NameClient
- /// </summary>
- /// <param name="value">The lookup request event</param>
- public override void OnNext(NamingLookupRequest value)
- {
- List<NameAssignment> assignments = _server.Lookup(value.Identifiers);
- value.Link.Write(new NamingLookupResponse(assignments));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingRegisterRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingRegisterRequestObserver.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingRegisterRequestObserver.cs
deleted file mode 100644
index 2da45a1..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingRegisterRequestObserver.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.RX;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Observers
-{
- /// <summary>
- /// Handler for registering an identifier and endpoint with the Name Service
- /// </summary>
- internal class NamingRegisterRequestObserver : AbstractObserver<NamingRegisterRequest>
- {
- private NameServer _server;
-
- public NamingRegisterRequestObserver(NameServer server)
- {
- _server = server;
- }
-
- /// <summary>
- /// Register the identifier and IPEndpoint with the NameServer and send
- /// the response back to the NameClient
- /// </summary>
- /// <param name="value">The register request event</param>
- public override void OnNext(NamingRegisterRequest value)
- {
- NameAssignment assignment = value.NameAssignment;
- _server.Register(assignment.Identifier, assignment.Endpoint);
-
- value.Link.Write(new NamingRegisterResponse(value));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingUnregisterRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingUnregisterRequestObserver.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingUnregisterRequestObserver.cs
deleted file mode 100644
index 17d2d50..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Observers/NamingUnregisterRequestObserver.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.RX;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Observers
-{
- /// <summary>
- /// Handler for unregistering an identifier with the NameServer
- /// </summary>
- internal class NamingUnregisterRequestObserver : AbstractObserver<NamingUnregisterRequest>
- {
- private NameServer _server;
-
- public NamingUnregisterRequestObserver(NameServer server)
- {
- _server = server;
- }
-
- /// <summary>
- /// Unregister the identifer with the NameServer.
- /// </summary>
- /// <param name="value">The unregister request event</param>
- public override void OnNext(NamingUnregisterRequest value)
- {
- // Don't send a response
- _server.Unregister(value.Identifier);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Network.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Network.csproj b/lang/cs/Source/REEF/reef-io/Network/Network.csproj
deleted file mode 100644
index fd46373..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Network.csproj
+++ /dev/null
@@ -1,180 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.Reef.IO.Network</RootNamespace>
- <AssemblyName>Org.Apache.Reef.IO.Network</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <RestorePackages>true</RestorePackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..</SolutionDir>
- </PropertyGroup>
- <Import Project="$(SolutionDir)\Source\build.props" />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.Hadoop.Avro">
- <HintPath>$(PackagesDir)\Microsoft.Hadoop.Avro.$(AvroVersion)\lib\net40\Microsoft.Hadoop.Avro.dll</HintPath>
- </Reference>
- <Reference Include="Newtonsoft.Json">
- <HintPath>$(PackagesDir)\Newtonsoft.Json.$(NewtonsoftJsonVersion)\lib\net45\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="protobuf-net">
- <HintPath>$(PackagesDir)\protobuf-net.$(ProtobufVersion)\lib\net40\protobuf-net.dll</HintPath>
- </Reference>
- <Reference Include="System.Reactive.Core">
- <HintPath>$(PackagesDir)\Rx-Core.$(RxVersion)\lib\net45\System.Reactive.Core.dll</HintPath>
- </Reference>
- <Reference Include="System.Reactive.Interfaces">
- <HintPath>$(PackagesDir)\Rx-Interfaces.$(RxVersion)\lib\net45\System.Reactive.Interfaces.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Naming\Codec\NamingLookupRequestCodec.cs" />
- <Compile Include="Naming\Codec\NamingLookupResponseCodec.cs" />
- <Compile Include="Naming\Codec\NamingRegisterRequestCodec.cs" />
- <Compile Include="Naming\Codec\NamingRegisterResponseCodec.cs" />
- <Compile Include="Naming\Codec\NamingUnregisterRequestCodec.cs" />
- <Compile Include="Naming\Contracts\AvroNamingAssignment.cs" />
- <Compile Include="Naming\Contracts\AvroNamingLookupRequest.cs" />
- <Compile Include="Naming\Contracts\AvroNamingLookupResponse.cs" />
- <Compile Include="Naming\Contracts\AvroNamingRegisterRequest.cs" />
- <Compile Include="Naming\Contracts\AvroNamingUnRegisterRequest.cs" />
- <Compile Include="Naming\Events\NamingEvent.cs" />
- <Compile Include="Naming\Events\NamingGetAllRequest.cs" />
- <Compile Include="Naming\Events\NamingGetAllResponse.cs" />
- <Compile Include="Naming\Events\NamingLookupRequest.cs" />
- <Compile Include="Naming\Events\NamingLookupResponse.cs" />
- <Compile Include="Naming\Events\NamingRegisterRequest.cs" />
- <Compile Include="Naming\Events\NamingRegisterResponse.cs" />
- <Compile Include="Naming\Events\NamingUnregisterRequest.cs" />
- <Compile Include="Naming\Events\NamingUnregisterResponse.cs" />
- <Compile Include="Naming\INameServer.cs" />
- <Compile Include="Naming\NameClient.cs" />
- <Compile Include="Naming\NameLookupClient.cs" />
- <Compile Include="Naming\NameRegisterClient.cs" />
- <Compile Include="Naming\NameServer.cs" />
- <Compile Include="Naming\NamingConfiguration.cs" />
- <Compile Include="Naming\NamingConfigurationOptions.cs" />
- <Compile Include="Naming\Observers\NamingGetAllRequestObserver.cs" />
- <Compile Include="Naming\Observers\NamingLookupRequestObserver.cs" />
- <Compile Include="Naming\Observers\NamingRegisterRequestObserver.cs" />
- <Compile Include="Naming\Observers\NamingUnregisterRequestObserver.cs" />
- <Compile Include="NetworkService\Codec\ControlMessageCodec.cs" />
- <Compile Include="NetworkService\Codec\NsMessageCodec.cs" />
- <Compile Include="NetworkService\Codec\NsMessageProto.cs" />
- <Compile Include="NetworkService\ControlMessage.cs" />
- <Compile Include="NetworkService\IConnection.cs" />
- <Compile Include="NetworkService\INetworkService.cs" />
- <Compile Include="NetworkService\NetworkService.cs" />
- <Compile Include="NetworkService\NetworkServiceConfiguration.cs" />
- <Compile Include="NetworkService\NetworkServiceOptions.cs" />
- <Compile Include="NetworkService\NsConnection.cs" />
- <Compile Include="NetworkService\NsMessage.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Utilities\BlockingCollectionExtensions.cs" />
- <Compile Include="Utilities\Utils.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.Reef.Tang\Org.Apache.Reef.Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.Reef.Tang</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.Reef.Utilities\Org.Apache.Reef.Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Org.Apache.Reef.Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Common\Org.Apache.Reef.Common.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.Reef.Common</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Driver\Org.Apache.Reef.Driver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.Reef.Driver</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
- <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Org.Apache.Reef.Wake</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <WCFMetadata Include="Service References\" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/ControlMessageCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/ControlMessageCodec.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/ControlMessageCodec.cs
deleted file mode 100644
index 09ecfbe..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/ControlMessageCodec.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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 System;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService.Codec
-{
- public class ControlMessageCodec : ICodec<ControlMessage>
- {
- [Inject]
- public ControlMessageCodec()
- {
- }
-
- public byte[] Encode(ControlMessage message)
- {
- return BitConverter.GetBytes((int) message);
- }
-
- public ControlMessage Decode(byte[] data)
- {
- return (ControlMessage) BitConverter.ToInt32(data, 0);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageCodec.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageCodec.cs
deleted file mode 100644
index 454182e..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageCodec.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.Wake;
-using Org.Apache.REEF.Wake.Remote;
-using ProtoBuf;
-using System;
-using System.IO;
-using System.Linq;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService.Codec
-{
- /// <summary>
- /// Codec to serialize NsMessages for NetworkService.
- /// </summary>
- /// <typeparam name="T">The message type</typeparam>
- public class NsMessageCodec<T> : ICodec<NsMessage<T>>
- {
- private ICodec<T> _codec;
- private IIdentifierFactory _idFactory;
-
- /// <summary>
- /// Create new NsMessageCodec.
- /// </summary>
- /// <param name="codec">The codec used to serialize message data</param>
- /// <param name="idFactory">Used to create identifier from string.</param>
- public NsMessageCodec(ICodec<T> codec, IIdentifierFactory idFactory)
- {
- _codec = codec;
- _idFactory = idFactory;
- }
-
- /// <summary>
- /// Serialize the NsMessage.
- /// </summary>
- /// <param name="obj">The object to serialize</param>
- /// <returns>The serialized object in byte array form</returns>
- public byte[] Encode(NsMessage<T> obj)
- {
- NsMessageProto proto = NsMessageProto.Create(obj, _codec);
- using (var stream = new MemoryStream())
- {
- Serializer.Serialize(stream, proto);
- return stream.ToArray();
- }
- }
-
- /// <summary>
- /// Deserialize the byte array into NsMessage.
- /// </summary>
- /// <param name="data">The serialized byte array</param>
- /// <returns>The deserialized NsMessage</returns>
- public NsMessage<T> Decode(byte[] data)
- {
- using (var stream = new MemoryStream(data))
- {
- NsMessageProto proto = Serializer.Deserialize<NsMessageProto>(stream);
-
- IIdentifier sourceId = _idFactory.Create(proto.SourceId);
- IIdentifier destId = _idFactory.Create(proto.DestId);
- NsMessage<T> message = new NsMessage<T>(sourceId, destId);
-
- var messages = proto.Data.Select(byteArr => _codec.Decode(byteArr));
- message.Data.AddRange(messages);
- return message;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageProto.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageProto.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageProto.cs
deleted file mode 100644
index 8345e3a..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/Codec/NsMessageProto.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.Serialization;
-using System.Text;
-using System.Threading.Tasks;
-using Org.Apache.REEF.Wake.Remote;
-using ProtoBuf;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService.Codec
-{
- [ProtoContract]
- public class NsMessageProto
- {
- public NsMessageProto()
- {
- Data = new List<byte[]>();
- }
-
- [ProtoMember(1)]
- public string SourceId { get; set; }
-
- [ProtoMember(2)]
- public string DestId { get; set; }
-
- [ProtoMember(3)]
- public List<byte[]> Data { get; set; }
-
- public static NsMessageProto Create<T>(NsMessage<T> message, ICodec<T> codec)
- {
- NsMessageProto proto = new NsMessageProto();
-
- proto.SourceId = message.SourceId.ToString();
- proto.DestId = message.DestId.ToString();
-
- foreach (T item in message.Data)
- {
- proto.Data.Add(codec.Encode(item));
- }
-
- return proto;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/ControlMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/ControlMessage.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/ControlMessage.cs
deleted file mode 100644
index 1309c32..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/ControlMessage.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.
- */
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- public enum ControlMessage
- {
- /// <summary>
- /// default state
- /// </summary>
- UNDEFINED = 0,
-
- /// <summary>
- /// expecting data to be sent/received
- /// </summary>
- RECEIVE = 1,
-
- /// <summary>
- /// stop group communications
- /// </summary>
- STOP = 2,
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/IConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/IConnection.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/IConnection.cs
deleted file mode 100644
index 0a13d60..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/IConnection.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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 System;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- /// <summary>
- /// Represents a connection between two endpoints named by identifiers
- /// </summary>
- public interface IConnection<T> : IDisposable
- {
- /// <summary>
- /// Opens the connection
- /// </summary>
- void Open();
-
- /// <summary>
- /// Writes the object to the connection
- /// </summary>
- /// <param name="obj">The message to send</param>
- void Write(T obj);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/INetworkService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/INetworkService.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/INetworkService.cs
deleted file mode 100644
index f9e1a0b..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/INetworkService.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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 System;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.Services;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Wake;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- /// <summary>
- /// Network service used for Reef Task communication.
- /// </summary>
- /// <typeparam name="T">The message type</typeparam>
- public interface INetworkService<T> : IService, IDisposable
- {
- /// <summary>
- /// Name client for registering ids
- /// </summary>
- INameClient NamingClient { get; }
-
- /// <summary>
- /// Open a new connection to the remote host registered to
- /// the name service with the given identifier
- /// </summary>
- /// <param name="destinationId">The identifier of the remote host</param>
- /// <returns>The IConnection used for communication</returns>
- IConnection<T> NewConnection(IIdentifier destinationId);
-
- /// <summary>
- /// Register the identifier for the NetworkService with the NameService.
- /// </summary>
- /// <param name="id">The identifier to register</param>
- void Register(IIdentifier id);
-
- /// <summary>
- /// Unregister the identifier for the NetworkService with the NameService.
- /// </summary>
- void Unregister();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkService.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkService.cs
deleted file mode 100644
index 041cd8d..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkService.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Reactive;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming;
-using Org.Apache.REEF.IO.Network.NetworkService.Codec;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Annotations;
-using Org.Apache.REEF.Tang.Exceptions;
-using Org.Apache.REEF.Wake;
-using Org.Apache.REEF.Wake.Remote;
-using Org.Apache.REEF.Wake.Remote.Impl;
-using Org.Apache.REEF.Wake.Util;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- /// <summary>
- /// Network service used for Reef Task communication.
- /// </summary>
- /// <typeparam name="T">The message type</typeparam>
- public class NetworkService<T> : INetworkService<T>
- {
- private Logger LOGGER = Logger.GetLogger(typeof(NetworkService<>));
-
- private IRemoteManager<NsMessage<T>> _remoteManager;
- private IObserver<NsMessage<T>> _messageHandler;
- private ICodec<NsMessage<T>> _codec;
- private IIdentifier _localIdentifier;
- private IDisposable _messageHandlerDisposable;
- private Dictionary<IIdentifier, IConnection<T>> _connectionMap;
-
- /// <summary>
- /// Create a new NetworkFactory.
- /// </summary>
- /// <param name="nsPort">The port that the NetworkService will listen on</param>
- /// <param name="nameServerAddr">The address of the NameServer</param>
- /// <param name="nameServerPort">The port of the NameServer</param>
- /// <param name="messageHandler">The observer to handle incoming messages</param>
- /// <param name="idFactory">The factory used to create IIdentifiers</param>
- /// <param name="codec">The codec used for serialization</param>
- [Inject]
- public NetworkService(
- [Parameter(typeof(NetworkServiceOptions.NetworkServicePort))] int nsPort,
- [Parameter(typeof(NamingConfigurationOptions.NameServerAddress))] string nameServerAddr,
- [Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int nameServerPort,
- IObserver<NsMessage<T>> messageHandler,
- IIdentifierFactory idFactory,
- ICodec<T> codec)
- {
- _codec = new NsMessageCodec<T>(codec, idFactory);
-
- IPAddress localAddress = NetworkUtils.LocalIPAddress;
- _remoteManager = new DefaultRemoteManager<NsMessage<T>>(localAddress, nsPort, _codec);
- _messageHandler = messageHandler;
-
- NamingClient = new NameClient(nameServerAddr, nameServerPort);
- _connectionMap = new Dictionary<IIdentifier, IConnection<T>>();
-
- LOGGER.Log(Level.Info, "Started network service");
- }
-
- /// <summary>
- /// Name client for registering ids
- /// </summary>
- public INameClient NamingClient { get; private set; }
-
- /// <summary>
- /// Open a new connection to the remote host registered to
- /// the name service with the given identifier
- /// </summary>
- /// <param name="destinationId">The identifier of the remote host</param>
- /// <returns>The IConnection used for communication</returns>
- public IConnection<T> NewConnection(IIdentifier destinationId)
- {
- if (_localIdentifier == null)
- {
- throw new IllegalStateException("Cannot open connection without first registering an ID");
- }
-
- IConnection<T> connection;
- if (_connectionMap.TryGetValue(destinationId, out connection))
- {
- return connection;
- }
-
- connection = new NsConnection<T>(_localIdentifier, destinationId,
- NamingClient, _remoteManager, _connectionMap);
-
- _connectionMap[destinationId] = connection;
- return connection;
- }
-
- /// <summary>
- /// Register the identifier for the NetworkService with the NameService.
- /// </summary>
- /// <param name="id">The identifier to register</param>
- public void Register(IIdentifier id)
- {
- LOGGER.Log(Level.Info, "Registering id {0} with network service.", id);
-
- _localIdentifier = id;
- NamingClient.Register(id.ToString(), _remoteManager.LocalEndpoint);
-
- // Create and register incoming message handler
- var anyEndpoint = new IPEndPoint(IPAddress.Any, 0);
- _messageHandlerDisposable = _remoteManager.RegisterObserver(anyEndpoint, _messageHandler);
- }
-
- /// <summary>
- /// Unregister the identifier for the NetworkService with the NameService.
- /// </summary>
- public void Unregister()
- {
- if (_localIdentifier == null)
- {
- throw new IllegalStateException("Cannot unregister a non existant identifier");
- }
-
- NamingClient.Unregister(_localIdentifier.ToString());
- _localIdentifier = null;
- _messageHandlerDisposable.Dispose();
- }
-
- /// <summary>
- /// Dispose of the NetworkService's resources
- /// </summary>
- public void Dispose()
- {
- NamingClient.Dispose();
- _remoteManager.Dispose();
-
- LOGGER.Log(Level.Info, "Disposed of network service");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceConfiguration.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceConfiguration.cs
deleted file mode 100644
index 29c4097..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceConfiguration.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Diagnostics.CodeAnalysis;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming;
-using Org.Apache.REEF.Tang.Formats;
-using Org.Apache.REEF.Tang.Util;
-using Org.Apache.REEF.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- public class NetworkServiceConfiguration : ConfigurationModuleBuilder
- {
- [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
- public static readonly RequiredParameter<int> NetworkServicePort = new RequiredParameter<int>();
-
- [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
- public static readonly RequiredImpl<ICodecFactory> NetworkServiceCodecFactory = new RequiredImpl<ICodecFactory>();
-
- public static ConfigurationModule ConfigurationModule
- {
- get
- {
- return new NetworkServiceConfiguration()
- .BindNamedParameter(GenericType<NetworkServiceOptions.NetworkServicePort>.Class, NetworkServicePort)
- .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerPort>.Class,
- NamingConfiguration.NameServerPort)
- .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerAddress>.Class,
- NamingConfiguration.NameServerAddress)
- .BindImplementation(GenericType<ICodecFactory>.Class, NetworkServiceCodecFactory)
- .Build();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceOptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceOptions.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceOptions.cs
deleted file mode 100644
index dcf5bcc..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NetworkServiceOptions.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.Tang.Annotations;
-using Org.Apache.REEF.Wake;
-using Org.Apache.REEF.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- public class NetworkServiceOptions
- {
- [NamedParameter("Port of NetworkService", "NsPort", "0")]
- public class NetworkServicePort : Name<int>
- {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsConnection.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsConnection.cs
deleted file mode 100644
index 7e586d8..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsConnection.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Globalization;
-using System.IO;
-using System.Net;
-using System.Net.Sockets;
-using System.Runtime.Remoting;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Tang.Exceptions;
-using Org.Apache.REEF.Wake;
-using Org.Apache.REEF.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- /// <summary>
- /// Represents a connection between two hosts using the NetworkService.
- /// </summary>
- public class NsConnection<T> : IConnection<T>
- {
- private static readonly Logger LOGGER = Logger.GetLogger(typeof(NsConnection<T>));
-
- private IIdentifier _sourceId;
- private IIdentifier _destId;
- private INameClient _nameClient;
- private IRemoteManager<NsMessage<T>> _remoteManager;
- private Dictionary<IIdentifier, IConnection<T>> _connectionMap;
- private IObserver<NsMessage<T>> _remoteSender;
-
- /// <summary>
- /// Creates a new NsConnection between two hosts.
- /// </summary>
- /// <param name="sourceId">The identifier of the sender</param>
- /// <param name="destId">The identifier of the receiver</param>
- /// <param name="nameClient">The NameClient used for naming lookup</param>
- /// <param name="remoteManager">The remote manager used for network communication</param>
- /// <param name="connectionMap">A cache of opened connections. Will remove itself from
- /// the cache when the NsConnection is disposed.</param>
- public NsConnection(
- IIdentifier sourceId,
- IIdentifier destId,
- INameClient nameClient,
- IRemoteManager<NsMessage<T>> remoteManager,
- Dictionary<IIdentifier, IConnection<T>> connectionMap)
- {
- _sourceId = sourceId;
- _destId = destId;
- _nameClient = nameClient;
- _remoteManager = remoteManager;
- _connectionMap = connectionMap;
- }
-
- /// <summary>
- /// Opens the connection to the remote host.
- /// </summary>
- public void Open()
- {
- string destStr = _destId.ToString();
- LOGGER.Log(Level.Verbose, "Network service opening connection to {0}...", destStr);
-
- IPEndPoint destAddr = _nameClient.Lookup(_destId.ToString());
- if (destAddr == null)
- {
- throw new RemotingException("Cannot register Identifier with NameService");
- }
-
- try
- {
- _remoteSender = _remoteManager.GetRemoteObserver(destAddr);
- LOGGER.Log(Level.Verbose, "Network service completed connection to {0}.", destStr);
- }
- catch (SocketException)
- {
- LOGGER.Log(Level.Error, "Network Service cannot open connection to " + destAddr);
- throw;
- }
- catch (ObjectDisposedException)
- {
- LOGGER.Log(Level.Error, "Network Service cannot open connection to " + destAddr);
- throw;
- }
- }
-
- /// <summary>
- /// Writes the object to the remote host.
- /// </summary>
- /// <param name="message">The message to send</param>
- public void Write(T message)
- {
- if (_remoteSender == null)
- {
- throw new IllegalStateException("NsConnection has not been opened yet.");
- }
-
- try
- {
- _remoteSender.OnNext(new NsMessage<T>(_sourceId, _destId, message));
- }
- catch (IOException)
- {
- LOGGER.Log(Level.Error, "Network Service cannot write message to {0}", _destId);
- throw;
- }
- catch (ObjectDisposedException)
- {
- LOGGER.Log(Level.Error, "Network Service cannot write message to {0}", _destId);
- throw;
- }
- }
-
- /// <summary>
- /// Closes the connection
- /// </summary>
- public void Dispose()
- {
- _connectionMap.Remove(_destId);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsMessage.cs b/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsMessage.cs
deleted file mode 100644
index 3c99ffd..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/NetworkService/NsMessage.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using Org.Apache.REEF.Wake;
-
-namespace Org.Apache.REEF.IO.Network.NetworkService
-{
- /// <summary>
- /// Message sent between NetworkServices
- /// </summary>
- /// <typeparam name="T">The type of data being sent</typeparam>
- public class NsMessage<T>
- {
- /// <summary>
- /// Create a new NsMessage with no data.
- /// </summary>
- /// <param name="sourceId">The identifier of the sender</param>
- /// <param name="destId">The identifier of the receiver</param>
- public NsMessage(IIdentifier sourceId, IIdentifier destId)
- {
- SourceId = sourceId;
- DestId = destId;
- Data = new List<T>();
- }
-
- /// <summary>
- /// Create a new NsMessage with data.
- /// </summary>
- /// <param name="sourceId">The identifier of the sender</param>
- /// <param name="destId">The identifier of the receiver</param>
- /// <param name="message">The message to send</param>
- public NsMessage(IIdentifier sourceId, IIdentifier destId, T message)
- {
- SourceId = sourceId;
- DestId = destId;
- Data = new List<T> { message };
- }
-
- /// <summary>
- /// The identifier of the sender of the message.
- /// </summary>
- public IIdentifier SourceId { get; private set; }
-
- /// <summary>
- /// The identifier of the receiver of the message.
- /// </summary>
- public IIdentifier DestId { get; private set; }
-
- /// <summary>
- /// A list of data being sent in the message.
- /// </summary>
- public List<T> Data { get; private set; }
- }
-}
[4/5] incubator-reef git commit: [REEF-139] Changing .Net project
structure for Network and Evaluator
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NameLookupClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NameLookupClient.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NameLookupClient.cs
new file mode 100644
index 0000000..b8c4018
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NameLookupClient.cs
@@ -0,0 +1,97 @@
+/**
+ * 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 System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Threading;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Wake.Remote.Impl;
+
+namespace Org.Apache.REEF.Network.Naming
+{
+ /// <summary>
+ /// Helper class to send lookup events to the name server
+ /// </summary>
+ internal class NameLookupClient
+ {
+ private TransportClient<NamingEvent> _client;
+ private BlockingCollection<NamingLookupResponse> _lookupResponseQueue;
+ private BlockingCollection<NamingGetAllResponse> _getAllResponseQueue;
+
+ /// <summary>
+ /// Constructs a new NameLookupClient.
+ /// </summary>
+ /// <param name="client">The transport client used to connect to the NameServer</param>
+ /// <param name="lookupQueue">The queue used to signal that a response
+ /// has been received from the NameServer</param>
+ /// <param name="getAllQueue">The queue used to signal that a GetAllResponse
+ /// has been received from the NameServer</param>
+ public NameLookupClient(TransportClient<NamingEvent> client,
+ BlockingCollection<NamingLookupResponse> lookupQueue,
+ BlockingCollection<NamingGetAllResponse> getAllQueue)
+ {
+ _client = client;
+ _lookupResponseQueue = lookupQueue;
+ _getAllResponseQueue = getAllQueue;
+ }
+
+ /// <summary>
+ /// Look up the IPEndPoint that has been registered with the NameServer using
+ /// the given identifier as the key.
+ /// </summary>
+ /// <param name="id">The id for the IPEndPoint</param>
+ /// <param name="token">The cancellation token used for timeout</param>
+ /// <returns>The registered IPEndpoint, or null if the identifer has not
+ /// been registered with the NameServer or if the operation times out.</returns>
+ public IPEndPoint Lookup(string id, CancellationToken token)
+ {
+ List<string> ids = new List<string> { id };
+ List<NameAssignment> assignment = Lookup(ids);
+ return (assignment == null || assignment.Count == 0) ? null : assignment.First().Endpoint;
+ }
+
+ /// <summary>
+ /// Look up IPEndPoints that have been registered with the NameService
+ /// </summary>
+ /// <param name="ids">The list of ids to look up</param>
+ /// <returns>A list of NameAssignments representing the mapped identifier/IPEndpoint
+ /// pairs</returns>
+ public List<NameAssignment> Lookup(List<string> ids)
+ {
+ _client.Send(new NamingLookupRequest(ids));
+ NamingLookupResponse response = _lookupResponseQueue.Take();
+ return response.NameAssignments;
+ }
+
+ /// <summary>
+ /// Synchronously gets all of the identifier/IPEndpoint pairs registered with the NameService.
+ /// </summary>
+ /// <returns>A list of NameAssignments representing the mapped identifier/IPEndpoint
+ /// pairs</returns>
+ public List<NameAssignment> GetAll()
+ {
+ _client.Send(new NamingGetAllRequest());
+ NamingGetAllResponse response = _getAllResponseQueue.Take();
+ return response.Assignments;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NameRegisterClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NameRegisterClient.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NameRegisterClient.cs
new file mode 100644
index 0000000..a18cb31
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NameRegisterClient.cs
@@ -0,0 +1,67 @@
+/**
+ * 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 System.Collections.Concurrent;
+using System.Net;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Wake.Remote.Impl;
+
+namespace Org.Apache.REEF.Network.Naming
+{
+ /// <summary>
+ /// Helper class to send register and unregister events to the NameServer.
+ /// </summary>
+ internal class NameRegisterClient
+ {
+ private TransportClient<NamingEvent> _client;
+ private BlockingCollection<NamingRegisterResponse> _registerResponseQueue;
+ private BlockingCollection<NamingUnregisterResponse> _unregisterResponseQueue;
+
+ public NameRegisterClient(TransportClient<NamingEvent> client,
+ BlockingCollection<NamingRegisterResponse> registerQueue,
+ BlockingCollection<NamingUnregisterResponse> unregisterQueue)
+ {
+ _client = client;
+ _registerResponseQueue = registerQueue;
+ _unregisterResponseQueue = unregisterQueue;
+ }
+
+ /// <summary>
+ /// Synchronously register the id and endpoint with the NameServer.
+ /// </summary>
+ /// <param name="id">The identifier</param>
+ /// <param name="endpoint">The endpoint</param>
+ public void Register(string id, IPEndPoint endpoint)
+ {
+ NameAssignment assignment = new NameAssignment(id, endpoint);
+ _client.Send(new NamingRegisterRequest(assignment));
+ _registerResponseQueue.Take();
+ }
+
+ /// <summary>
+ /// Synchronously unregisters the identifier with the NameServer.
+ /// </summary>
+ /// <param name="id">The identifer to unregister</param>
+ public void Unregister(string id)
+ {
+ _client.Send(new NamingUnregisterRequest(id));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NameServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NameServer.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NameServer.cs
new file mode 100644
index 0000000..26207e0
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NameServer.cs
@@ -0,0 +1,196 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Codec;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Network.Naming.Observers;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Wake.Remote.Impl;
+using Org.Apache.REEF.Wake.RX;
+using Org.Apache.REEF.Wake.RX.Impl;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+
+namespace Org.Apache.REEF.Network.Naming
+{
+ /// <summary>
+ /// Service that manages names and IPEndpoints for well known hosts.
+ /// Can register, unregister, and look up IPAddresses using a string identifier.
+ /// </summary>
+ public class NameServer : INameServer
+ {
+ private static Logger _logger = Logger.GetLogger(typeof(NameServer));
+
+ private TransportServer<NamingEvent> _server;
+ private Dictionary<string, IPEndPoint> _idToAddrMap;
+
+ /// <summary>
+ /// Create a new NameServer to run on the specified port.
+ /// </summary>
+ /// <param name="port">The port to listen for incoming connections on.</param>
+ [Inject]
+ public NameServer([Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int port)
+ {
+ IObserver<TransportEvent<NamingEvent>> handler = CreateServerHandler();
+ _idToAddrMap = new Dictionary<string, IPEndPoint>();
+ ICodec<NamingEvent> codec = CreateServerCodec();
+
+ // Start transport server, get listening IP endpoint
+ _logger.Log(Level.Info, "Starting naming server");
+ _server = new TransportServer<NamingEvent>(port, handler, codec);
+ _server.Run();
+ LocalEndpoint = _server.LocalEndpoint;
+ }
+
+ public IPEndPoint LocalEndpoint { get; private set; }
+
+ /// <summary>
+ /// Looks up the IPEndpoints for each string identifier
+ /// </summary>
+ /// <param name="ids">The IDs to look up</param>
+ /// <returns>A list of Name assignments representing the identifier
+ /// that was searched for and the mapped IPEndpoint</returns>
+ public List<NameAssignment> Lookup(List<string> ids)
+ {
+ if (ids == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("ids"), _logger);
+ }
+
+ return ids.Where(id => _idToAddrMap.ContainsKey(id))
+ .Select(id => new NameAssignment(id, _idToAddrMap[id]))
+ .ToList();
+ }
+
+ /// <summary>
+ /// Gets all of the registered identifier/endpoint pairs.
+ /// </summary>
+ /// <returns>A list of all of the registered identifiers and their
+ /// mapped IPEndpoints</returns>
+ public List<NameAssignment> GetAll()
+ {
+ return _idToAddrMap.Select(pair => new NameAssignment(pair.Key, pair.Value)).ToList();
+ }
+
+ /// <summary>
+ /// Registers the string identifier with the given IPEndpoint
+ /// </summary>
+ /// <param name="id">The string ident</param>
+ /// <param name="endpoint">The mapped endpoint</param>
+ public void Register(string id, IPEndPoint endpoint)
+ {
+ if (id == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("id"), _logger);
+ }
+ if (endpoint == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("endpoint"), _logger);
+ }
+
+ _logger.Log(Level.Info, "Registering id: " + id + ", and endpoint: " + endpoint);
+ _idToAddrMap[id] = endpoint;
+ }
+
+ /// <summary>
+ /// Unregister the given identifier with the NameServer
+ /// </summary>
+ /// <param name="id">The identifier to unregister</param>
+ public void Unregister(string id)
+ {
+ if (id == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("id"), _logger);
+ }
+
+ _logger.Log(Level.Info, "Unregistering id: " + id);
+ _idToAddrMap.Remove(id);
+ }
+
+ /// <summary>
+ /// Stops the NameServer
+ /// </summary>
+ public void Dispose()
+ {
+ _server.Dispose();
+ }
+
+ /// <summary>
+ /// Create the handler to manage incoming NamingEvent types
+ /// </summary>
+ /// <returns>The server handler</returns>
+ private IObserver<TransportEvent<NamingEvent>> CreateServerHandler()
+ {
+ PubSubSubject<NamingEvent> subject = new PubSubSubject<NamingEvent>();
+ subject.Subscribe(new NamingLookupRequestObserver(this));
+ subject.Subscribe(new NamingGetAllRequestObserver(this));
+ subject.Subscribe(new NamingRegisterRequestObserver(this));
+ subject.Subscribe(new NamingUnregisterRequestObserver(this));
+ return new ServerHandler(subject);
+ }
+
+ /// <summary>
+ /// Create the codec used to serialize/deserialize NamingEvent messages
+ /// </summary>
+ /// <returns>The serialization codec</returns>
+ private ICodec<NamingEvent> CreateServerCodec()
+ {
+ MultiCodec<NamingEvent> codec = new MultiCodec<NamingEvent>();
+ codec.Register(new NamingLookupRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupRequest");
+ codec.Register(new NamingLookupResponseCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupResponse");
+ NamingRegisterRequestCodec requestCodec = new NamingRegisterRequestCodec();
+ codec.Register(requestCodec, "org.apache.reef.io.network.naming.serialization.NamingRegisterRequest");
+ codec.Register(new NamingRegisterResponseCodec(requestCodec), "org.apache.reef.io.network.naming.serialization.NamingRegisterResponse");
+ codec.Register(new NamingUnregisterRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingUnregisterRequest");
+ return codec;
+ }
+
+ [NamedParameter("Port for the NameServer to listen on")]
+ public class Port : Name<int>
+ {
+ }
+
+ /// <summary>
+ /// Class used to handle incoming NamingEvent messages.
+ /// Delegates the event to the prescribed handler depending on its type
+ /// </summary>
+ private class ServerHandler : AbstractObserver<TransportEvent<NamingEvent>>
+ {
+ private IObserver<NamingEvent> _handler;
+
+ public ServerHandler(IObserver<NamingEvent> handler)
+ {
+ _handler = handler;
+ }
+
+ public override void OnNext(TransportEvent<NamingEvent> value)
+ {
+ NamingEvent message = value.Data;
+ message.Link = value.Link;
+ _handler.OnNext(message);
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfiguration.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfiguration.cs
new file mode 100644
index 0000000..3daac70
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfiguration.cs
@@ -0,0 +1,50 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Util;
+
+namespace Org.Apache.REEF.Naming
+{
+ public class NamingConfiguration : ConfigurationModuleBuilder
+ {
+ [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
+ public static readonly RequiredParameter<string> NameServerAddress = new RequiredParameter<string>();
+
+ [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
+ public static readonly RequiredParameter<int> NameServerPort = new RequiredParameter<int>();
+
+ public static ConfigurationModule ConfigurationModule
+ {
+ get
+ {
+ return new NamingConfiguration()
+ .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerAddress>.Class, NameServerAddress)
+ .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerPort>.Class, NameServerPort)
+ .Build();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfigurationOptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfigurationOptions.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfigurationOptions.cs
new file mode 100644
index 0000000..aa9b6e6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NamingConfigurationOptions.cs
@@ -0,0 +1,41 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Naming
+{
+ public class NamingConfigurationOptions
+ {
+ [NamedParameter("IP address of NameServer")]
+ public class NameServerAddress : Name<string>
+ {
+ }
+
+ [NamedParameter("Port of NameServer")]
+ public class NameServerPort : Name<int>
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingGetAllRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingGetAllRequestObserver.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingGetAllRequestObserver.cs
new file mode 100644
index 0000000..df3a4a9
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingGetAllRequestObserver.cs
@@ -0,0 +1,47 @@
+/**
+ * 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 System.Collections.Generic;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Wake.RX;
+
+namespace Org.Apache.REEF.Network.Naming.Observers
+{
+ /// <summary>
+ /// Handler for NameService for events of type NamingGetAllRequest.
+ /// Gets all of the identifiers and their mapped IPEndpoints registered
+ /// with the NameServer.
+ /// </summary>
+ internal class NamingGetAllRequestObserver : AbstractObserver<NamingGetAllRequest>
+ {
+ private NameServer _server;
+
+ public NamingGetAllRequestObserver(NameServer server)
+ {
+ _server = server;
+ }
+
+ public override void OnNext(NamingGetAllRequest value)
+ {
+ List<NameAssignment> assignments = _server.GetAll();
+ value.Link.Write(new NamingGetAllResponse(assignments));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingLookupRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingLookupRequestObserver.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingLookupRequestObserver.cs
new file mode 100644
index 0000000..21c602d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingLookupRequestObserver.cs
@@ -0,0 +1,50 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Wake.RX;
+using System.Collections.Generic;
+
+namespace Org.Apache.REEF.Network.Naming.Observers
+{
+ /// <summary>
+ /// Handler for looking up IPEndpoints registered with the NameServer
+ /// </summary>
+ internal class NamingLookupRequestObserver : AbstractObserver<NamingLookupRequest>
+ {
+ private NameServer _server;
+
+ public NamingLookupRequestObserver(NameServer server)
+ {
+ _server = server;
+ }
+
+ /// <summary>
+ /// Look up the IPEndpoints for the given identifiers and write them
+ /// back to the NameClient
+ /// </summary>
+ /// <param name="value">The lookup request event</param>
+ public override void OnNext(NamingLookupRequest value)
+ {
+ List<NameAssignment> assignments = _server.Lookup(value.Identifiers);
+ value.Link.Write(new NamingLookupResponse(assignments));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingRegisterRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingRegisterRequestObserver.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingRegisterRequestObserver.cs
new file mode 100644
index 0000000..8ab8f6c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingRegisterRequestObserver.cs
@@ -0,0 +1,51 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Wake.RX;
+
+namespace Org.Apache.REEF.Network.Naming.Observers
+{
+ /// <summary>
+ /// Handler for registering an identifier and endpoint with the Name Service
+ /// </summary>
+ internal class NamingRegisterRequestObserver : AbstractObserver<NamingRegisterRequest>
+ {
+ private NameServer _server;
+
+ public NamingRegisterRequestObserver(NameServer server)
+ {
+ _server = server;
+ }
+
+ /// <summary>
+ /// Register the identifier and IPEndpoint with the NameServer and send
+ /// the response back to the NameClient
+ /// </summary>
+ /// <param name="value">The register request event</param>
+ public override void OnNext(NamingRegisterRequest value)
+ {
+ NameAssignment assignment = value.NameAssignment;
+ _server.Register(assignment.Identifier, assignment.Endpoint);
+
+ value.Link.Write(new NamingRegisterResponse(value));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingUnregisterRequestObserver.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingUnregisterRequestObserver.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingUnregisterRequestObserver.cs
new file mode 100644
index 0000000..6127a4d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Observers/NamingUnregisterRequestObserver.cs
@@ -0,0 +1,47 @@
+/**
+ * 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.Network.Naming.Events;
+using Org.Apache.REEF.Wake.RX;
+
+namespace Org.Apache.REEF.Network.Naming.Observers
+{
+ /// <summary>
+ /// Handler for unregistering an identifier with the NameServer
+ /// </summary>
+ internal class NamingUnregisterRequestObserver : AbstractObserver<NamingUnregisterRequest>
+ {
+ private NameServer _server;
+
+ public NamingUnregisterRequestObserver(NameServer server)
+ {
+ _server = server;
+ }
+
+ /// <summary>
+ /// Unregister the identifer with the NameServer.
+ /// </summary>
+ /// <param name="value">The unregister request event</param>
+ public override void OnNext(NamingUnregisterRequest value)
+ {
+ // Don't send a response
+ _server.Unregister(value.Identifier);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/ControlMessageCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/ControlMessageCodec.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/ControlMessageCodec.cs
new file mode 100644
index 0000000..471e651
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/ControlMessageCodec.cs
@@ -0,0 +1,43 @@
+/**
+ * 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 System;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.NetworkService.Codec
+{
+ public class ControlMessageCodec : ICodec<ControlMessage>
+ {
+ [Inject]
+ public ControlMessageCodec()
+ {
+ }
+
+ public byte[] Encode(ControlMessage message)
+ {
+ return BitConverter.GetBytes((int) message);
+ }
+
+ public ControlMessage Decode(byte[] data)
+ {
+ return (ControlMessage) BitConverter.ToInt32(data, 0);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageCodec.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageCodec.cs
new file mode 100644
index 0000000..d01a7ae
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageCodec.cs
@@ -0,0 +1,85 @@
+/**
+ * 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.Wake;
+using Org.Apache.REEF.Wake.Remote;
+using ProtoBuf;
+using System;
+using System.IO;
+using System.Linq;
+
+namespace Org.Apache.REEF.Network.NetworkService.Codec
+{
+ /// <summary>
+ /// Codec to serialize NsMessages for NetworkService.
+ /// </summary>
+ /// <typeparam name="T">The message type</typeparam>
+ public class NsMessageCodec<T> : ICodec<NsMessage<T>>
+ {
+ private ICodec<T> _codec;
+ private IIdentifierFactory _idFactory;
+
+ /// <summary>
+ /// Create new NsMessageCodec.
+ /// </summary>
+ /// <param name="codec">The codec used to serialize message data</param>
+ /// <param name="idFactory">Used to create identifier from string.</param>
+ public NsMessageCodec(ICodec<T> codec, IIdentifierFactory idFactory)
+ {
+ _codec = codec;
+ _idFactory = idFactory;
+ }
+
+ /// <summary>
+ /// Serialize the NsMessage.
+ /// </summary>
+ /// <param name="obj">The object to serialize</param>
+ /// <returns>The serialized object in byte array form</returns>
+ public byte[] Encode(NsMessage<T> obj)
+ {
+ NsMessageProto proto = NsMessageProto.Create(obj, _codec);
+ using (var stream = new MemoryStream())
+ {
+ Serializer.Serialize(stream, proto);
+ return stream.ToArray();
+ }
+ }
+
+ /// <summary>
+ /// Deserialize the byte array into NsMessage.
+ /// </summary>
+ /// <param name="data">The serialized byte array</param>
+ /// <returns>The deserialized NsMessage</returns>
+ public NsMessage<T> Decode(byte[] data)
+ {
+ using (var stream = new MemoryStream(data))
+ {
+ NsMessageProto proto = Serializer.Deserialize<NsMessageProto>(stream);
+
+ IIdentifier sourceId = _idFactory.Create(proto.SourceId);
+ IIdentifier destId = _idFactory.Create(proto.DestId);
+ NsMessage<T> message = new NsMessage<T>(sourceId, destId);
+
+ var messages = proto.Data.Select(byteArr => _codec.Decode(byteArr));
+ message.Data.AddRange(messages);
+ return message;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageProto.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageProto.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageProto.cs
new file mode 100644
index 0000000..0de8be1
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/NsMessageProto.cs
@@ -0,0 +1,63 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.Text;
+using System.Threading.Tasks;
+using Org.Apache.REEF.Wake.Remote;
+using ProtoBuf;
+
+namespace Org.Apache.REEF.Network.NetworkService.Codec
+{
+ [ProtoContract]
+ public class NsMessageProto
+ {
+ public NsMessageProto()
+ {
+ Data = new List<byte[]>();
+ }
+
+ [ProtoMember(1)]
+ public string SourceId { get; set; }
+
+ [ProtoMember(2)]
+ public string DestId { get; set; }
+
+ [ProtoMember(3)]
+ public List<byte[]> Data { get; set; }
+
+ public static NsMessageProto Create<T>(NsMessage<T> message, ICodec<T> codec)
+ {
+ NsMessageProto proto = new NsMessageProto();
+
+ proto.SourceId = message.SourceId.ToString();
+ proto.DestId = message.DestId.ToString();
+
+ foreach (T item in message.Data)
+ {
+ proto.Data.Add(codec.Encode(item));
+ }
+
+ return proto;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/ControlMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/ControlMessage.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/ControlMessage.cs
new file mode 100644
index 0000000..bcc7a8c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/ControlMessage.cs
@@ -0,0 +1,39 @@
+/**
+ * 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.
+ */
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ public enum ControlMessage
+ {
+ /// <summary>
+ /// default state
+ /// </summary>
+ UNDEFINED = 0,
+
+ /// <summary>
+ /// expecting data to be sent/received
+ /// </summary>
+ RECEIVE = 1,
+
+ /// <summary>
+ /// stop group communications
+ /// </summary>
+ STOP = 2,
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/IConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/IConnection.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/IConnection.cs
new file mode 100644
index 0000000..78b9c37
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/IConnection.cs
@@ -0,0 +1,40 @@
+/**
+ * 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 System;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ /// <summary>
+ /// Represents a connection between two endpoints named by identifiers
+ /// </summary>
+ public interface IConnection<T> : IDisposable
+ {
+ /// <summary>
+ /// Opens the connection
+ /// </summary>
+ void Open();
+
+ /// <summary>
+ /// Writes the object to the connection
+ /// </summary>
+ /// <param name="obj">The message to send</param>
+ void Write(T obj);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/INetworkService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/INetworkService.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/INetworkService.cs
new file mode 100644
index 0000000..a4b845a
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/INetworkService.cs
@@ -0,0 +1,58 @@
+/**
+ * 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 System;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Services;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ /// <summary>
+ /// Network service used for Reef Task communication.
+ /// </summary>
+ /// <typeparam name="T">The message type</typeparam>
+ public interface INetworkService<T> : IService, IDisposable
+ {
+ /// <summary>
+ /// Name client for registering ids
+ /// </summary>
+ INameClient NamingClient { get; }
+
+ /// <summary>
+ /// Open a new connection to the remote host registered to
+ /// the name service with the given identifier
+ /// </summary>
+ /// <param name="destinationId">The identifier of the remote host</param>
+ /// <returns>The IConnection used for communication</returns>
+ IConnection<T> NewConnection(IIdentifier destinationId);
+
+ /// <summary>
+ /// Register the identifier for the NetworkService with the NameService.
+ /// </summary>
+ /// <param name="id">The identifier to register</param>
+ void Register(IIdentifier id);
+
+ /// <summary>
+ /// Unregister the identifier for the NetworkService with the NameService.
+ /// </summary>
+ void Unregister();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkService.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkService.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkService.cs
new file mode 100644
index 0000000..57eae81
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkService.cs
@@ -0,0 +1,156 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Reactive;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Network.NetworkService.Codec;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Tang.Exceptions;
+using Org.Apache.REEF.Wake;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Wake.Remote.Impl;
+using Org.Apache.REEF.Wake.Util;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ /// <summary>
+ /// Network service used for Reef Task communication.
+ /// </summary>
+ /// <typeparam name="T">The message type</typeparam>
+ public class NetworkService<T> : INetworkService<T>
+ {
+ private Logger LOGGER = Logger.GetLogger(typeof(NetworkService<>));
+
+ private IRemoteManager<NsMessage<T>> _remoteManager;
+ private IObserver<NsMessage<T>> _messageHandler;
+ private ICodec<NsMessage<T>> _codec;
+ private IIdentifier _localIdentifier;
+ private IDisposable _messageHandlerDisposable;
+ private Dictionary<IIdentifier, IConnection<T>> _connectionMap;
+
+ /// <summary>
+ /// Create a new NetworkFactory.
+ /// </summary>
+ /// <param name="nsPort">The port that the NetworkService will listen on</param>
+ /// <param name="nameServerAddr">The address of the NameServer</param>
+ /// <param name="nameServerPort">The port of the NameServer</param>
+ /// <param name="messageHandler">The observer to handle incoming messages</param>
+ /// <param name="idFactory">The factory used to create IIdentifiers</param>
+ /// <param name="codec">The codec used for serialization</param>
+ [Inject]
+ public NetworkService(
+ [Parameter(typeof(NetworkServiceOptions.NetworkServicePort))] int nsPort,
+ [Parameter(typeof(NamingConfigurationOptions.NameServerAddress))] string nameServerAddr,
+ [Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int nameServerPort,
+ IObserver<NsMessage<T>> messageHandler,
+ IIdentifierFactory idFactory,
+ ICodec<T> codec)
+ {
+ _codec = new NsMessageCodec<T>(codec, idFactory);
+
+ IPAddress localAddress = NetworkUtils.LocalIPAddress;
+ _remoteManager = new DefaultRemoteManager<NsMessage<T>>(localAddress, nsPort, _codec);
+ _messageHandler = messageHandler;
+
+ NamingClient = new NameClient(nameServerAddr, nameServerPort);
+ _connectionMap = new Dictionary<IIdentifier, IConnection<T>>();
+
+ LOGGER.Log(Level.Info, "Started network service");
+ }
+
+ /// <summary>
+ /// Name client for registering ids
+ /// </summary>
+ public INameClient NamingClient { get; private set; }
+
+ /// <summary>
+ /// Open a new connection to the remote host registered to
+ /// the name service with the given identifier
+ /// </summary>
+ /// <param name="destinationId">The identifier of the remote host</param>
+ /// <returns>The IConnection used for communication</returns>
+ public IConnection<T> NewConnection(IIdentifier destinationId)
+ {
+ if (_localIdentifier == null)
+ {
+ throw new IllegalStateException("Cannot open connection without first registering an ID");
+ }
+
+ IConnection<T> connection;
+ if (_connectionMap.TryGetValue(destinationId, out connection))
+ {
+ return connection;
+ }
+
+ connection = new NsConnection<T>(_localIdentifier, destinationId,
+ NamingClient, _remoteManager, _connectionMap);
+
+ _connectionMap[destinationId] = connection;
+ return connection;
+ }
+
+ /// <summary>
+ /// Register the identifier for the NetworkService with the NameService.
+ /// </summary>
+ /// <param name="id">The identifier to register</param>
+ public void Register(IIdentifier id)
+ {
+ LOGGER.Log(Level.Info, "Registering id {0} with network service.", id);
+
+ _localIdentifier = id;
+ NamingClient.Register(id.ToString(), _remoteManager.LocalEndpoint);
+
+ // Create and register incoming message handler
+ var anyEndpoint = new IPEndPoint(IPAddress.Any, 0);
+ _messageHandlerDisposable = _remoteManager.RegisterObserver(anyEndpoint, _messageHandler);
+ }
+
+ /// <summary>
+ /// Unregister the identifier for the NetworkService with the NameService.
+ /// </summary>
+ public void Unregister()
+ {
+ if (_localIdentifier == null)
+ {
+ throw new IllegalStateException("Cannot unregister a non existant identifier");
+ }
+
+ NamingClient.Unregister(_localIdentifier.ToString());
+ _localIdentifier = null;
+ _messageHandlerDisposable.Dispose();
+ }
+
+ /// <summary>
+ /// Dispose of the NetworkService's resources
+ /// </summary>
+ public void Dispose()
+ {
+ NamingClient.Dispose();
+ _remoteManager.Dispose();
+
+ LOGGER.Log(Level.Info, "Disposed of network service");
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceConfiguration.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceConfiguration.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceConfiguration.cs
new file mode 100644
index 0000000..003260c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceConfiguration.cs
@@ -0,0 +1,57 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ public class NetworkServiceConfiguration : ConfigurationModuleBuilder
+ {
+ [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
+ public static readonly RequiredParameter<int> NetworkServicePort = new RequiredParameter<int>();
+
+ [SuppressMessage("Microsoft.Security", "CA2104:Do not declare read only mutable reference types", Justification = "not applicable")]
+ public static readonly RequiredImpl<ICodecFactory> NetworkServiceCodecFactory = new RequiredImpl<ICodecFactory>();
+
+ public static ConfigurationModule ConfigurationModule
+ {
+ get
+ {
+ return new NetworkServiceConfiguration()
+ .BindNamedParameter(GenericType<NetworkServiceOptions.NetworkServicePort>.Class, NetworkServicePort)
+ .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerPort>.Class,
+ NamingConfiguration.NameServerPort)
+ .BindNamedParameter(GenericType<NamingConfigurationOptions.NameServerAddress>.Class,
+ NamingConfiguration.NameServerAddress)
+ .BindImplementation(GenericType<ICodecFactory>.Class, NetworkServiceCodecFactory)
+ .Build();
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceOptions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceOptions.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceOptions.cs
new file mode 100644
index 0000000..008751d
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/NetworkServiceOptions.cs
@@ -0,0 +1,33 @@
+/**
+ * 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.Tang.Annotations;
+using Org.Apache.REEF.Wake;
+using Org.Apache.REEF.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ public class NetworkServiceOptions
+ {
+ [NamedParameter("Port of NetworkService", "NsPort", "0")]
+ public class NetworkServicePort : Name<int>
+ {
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/NsConnection.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/NsConnection.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/NsConnection.cs
new file mode 100644
index 0000000..5465faa
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/NsConnection.cs
@@ -0,0 +1,139 @@
+/**
+ * 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 System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Globalization;
+using System.IO;
+using System.Net;
+using System.Net.Sockets;
+using System.Runtime.Remoting;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Exceptions;
+using Org.Apache.REEF.Wake;
+using Org.Apache.REEF.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ /// <summary>
+ /// Represents a connection between two hosts using the NetworkService.
+ /// </summary>
+ public class NsConnection<T> : IConnection<T>
+ {
+ private static readonly Logger LOGGER = Logger.GetLogger(typeof(NsConnection<T>));
+
+ private IIdentifier _sourceId;
+ private IIdentifier _destId;
+ private INameClient _nameClient;
+ private IRemoteManager<NsMessage<T>> _remoteManager;
+ private Dictionary<IIdentifier, IConnection<T>> _connectionMap;
+ private IObserver<NsMessage<T>> _remoteSender;
+
+ /// <summary>
+ /// Creates a new NsConnection between two hosts.
+ /// </summary>
+ /// <param name="sourceId">The identifier of the sender</param>
+ /// <param name="destId">The identifier of the receiver</param>
+ /// <param name="nameClient">The NameClient used for naming lookup</param>
+ /// <param name="remoteManager">The remote manager used for network communication</param>
+ /// <param name="connectionMap">A cache of opened connections. Will remove itself from
+ /// the cache when the NsConnection is disposed.</param>
+ public NsConnection(
+ IIdentifier sourceId,
+ IIdentifier destId,
+ INameClient nameClient,
+ IRemoteManager<NsMessage<T>> remoteManager,
+ Dictionary<IIdentifier, IConnection<T>> connectionMap)
+ {
+ _sourceId = sourceId;
+ _destId = destId;
+ _nameClient = nameClient;
+ _remoteManager = remoteManager;
+ _connectionMap = connectionMap;
+ }
+
+ /// <summary>
+ /// Opens the connection to the remote host.
+ /// </summary>
+ public void Open()
+ {
+ string destStr = _destId.ToString();
+ LOGGER.Log(Level.Verbose, "Network service opening connection to {0}...", destStr);
+
+ IPEndPoint destAddr = _nameClient.Lookup(_destId.ToString());
+ if (destAddr == null)
+ {
+ throw new RemotingException("Cannot register Identifier with NameService");
+ }
+
+ try
+ {
+ _remoteSender = _remoteManager.GetRemoteObserver(destAddr);
+ LOGGER.Log(Level.Verbose, "Network service completed connection to {0}.", destStr);
+ }
+ catch (SocketException)
+ {
+ LOGGER.Log(Level.Error, "Network Service cannot open connection to " + destAddr);
+ throw;
+ }
+ catch (ObjectDisposedException)
+ {
+ LOGGER.Log(Level.Error, "Network Service cannot open connection to " + destAddr);
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Writes the object to the remote host.
+ /// </summary>
+ /// <param name="message">The message to send</param>
+ public void Write(T message)
+ {
+ if (_remoteSender == null)
+ {
+ throw new IllegalStateException("NsConnection has not been opened yet.");
+ }
+
+ try
+ {
+ _remoteSender.OnNext(new NsMessage<T>(_sourceId, _destId, message));
+ }
+ catch (IOException)
+ {
+ LOGGER.Log(Level.Error, "Network Service cannot write message to {0}", _destId);
+ throw;
+ }
+ catch (ObjectDisposedException)
+ {
+ LOGGER.Log(Level.Error, "Network Service cannot write message to {0}", _destId);
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Closes the connection
+ /// </summary>
+ public void Dispose()
+ {
+ _connectionMap.Remove(_destId);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/NetworkService/NsMessage.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/NsMessage.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/NsMessage.cs
new file mode 100644
index 0000000..0eba888
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/NsMessage.cs
@@ -0,0 +1,71 @@
+/**
+ * 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 System.Collections.Generic;
+using Org.Apache.REEF.Wake;
+
+namespace Org.Apache.REEF.Network.NetworkService
+{
+ /// <summary>
+ /// Message sent between NetworkServices
+ /// </summary>
+ /// <typeparam name="T">The type of data being sent</typeparam>
+ public class NsMessage<T>
+ {
+ /// <summary>
+ /// Create a new NsMessage with no data.
+ /// </summary>
+ /// <param name="sourceId">The identifier of the sender</param>
+ /// <param name="destId">The identifier of the receiver</param>
+ public NsMessage(IIdentifier sourceId, IIdentifier destId)
+ {
+ SourceId = sourceId;
+ DestId = destId;
+ Data = new List<T>();
+ }
+
+ /// <summary>
+ /// Create a new NsMessage with data.
+ /// </summary>
+ /// <param name="sourceId">The identifier of the sender</param>
+ /// <param name="destId">The identifier of the receiver</param>
+ /// <param name="message">The message to send</param>
+ public NsMessage(IIdentifier sourceId, IIdentifier destId, T message)
+ {
+ SourceId = sourceId;
+ DestId = destId;
+ Data = new List<T> { message };
+ }
+
+ /// <summary>
+ /// The identifier of the sender of the message.
+ /// </summary>
+ public IIdentifier SourceId { get; private set; }
+
+ /// <summary>
+ /// The identifier of the receiver of the message.
+ /// </summary>
+ public IIdentifier DestId { get; private set; }
+
+ /// <summary>
+ /// A list of data being sent in the message.
+ /// </summary>
+ public List<T> Data { get; private set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj b/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
new file mode 100644
index 0000000..6824277
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Org.Apache.REEF.Network.csproj
@@ -0,0 +1,184 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Org.Apache.REEF.Network</RootNamespace>
+ <AssemblyName>Org.Apache.REEF.Network</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <RestorePackages>true</RestorePackages>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\Source\build.props" />
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.Hadoop.Avro">
+ <HintPath>$(PackagesDir)\Microsoft.Hadoop.Avro.$(AvroVersion)\lib\net40\Microsoft.Hadoop.Avro.dll</HintPath>
+ </Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>$(PackagesDir)\Newtonsoft.Json.$(NewtonsoftJsonVersion)\lib\net45\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="protobuf-net">
+ <HintPath>$(PackagesDir)\protobuf-net.$(ProtobufVersion)\lib\net40\protobuf-net.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Core">
+ <HintPath>$(PackagesDir)\Rx-Core.$(RxVersion)\lib\net45\System.Reactive.Core.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Reactive.Interfaces">
+ <HintPath>$(PackagesDir)\Rx-Interfaces.$(RxVersion)\lib\net45\System.Reactive.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Naming\Codec\NamingLookupRequestCodec.cs" />
+ <Compile Include="Naming\Codec\NamingLookupResponseCodec.cs" />
+ <Compile Include="Naming\Codec\NamingRegisterRequestCodec.cs" />
+ <Compile Include="Naming\Codec\NamingRegisterResponseCodec.cs" />
+ <Compile Include="Naming\Codec\NamingUnregisterRequestCodec.cs" />
+ <Compile Include="Naming\Contracts\AvroNamingAssignment.cs" />
+ <Compile Include="Naming\Contracts\AvroNamingLookupRequest.cs" />
+ <Compile Include="Naming\Contracts\AvroNamingLookupResponse.cs" />
+ <Compile Include="Naming\Contracts\AvroNamingRegisterRequest.cs" />
+ <Compile Include="Naming\Contracts\AvroNamingUnRegisterRequest.cs" />
+ <Compile Include="Naming\Events\NamingEvent.cs" />
+ <Compile Include="Naming\Events\NamingGetAllRequest.cs" />
+ <Compile Include="Naming\Events\NamingGetAllResponse.cs" />
+ <Compile Include="Naming\Events\NamingLookupRequest.cs" />
+ <Compile Include="Naming\Events\NamingLookupResponse.cs" />
+ <Compile Include="Naming\Events\NamingRegisterRequest.cs" />
+ <Compile Include="Naming\Events\NamingRegisterResponse.cs" />
+ <Compile Include="Naming\Events\NamingUnregisterRequest.cs" />
+ <Compile Include="Naming\Events\NamingUnregisterResponse.cs" />
+ <Compile Include="Naming\INameServer.cs" />
+ <Compile Include="Naming\NameClient.cs" />
+ <Compile Include="Naming\NameLookupClient.cs" />
+ <Compile Include="Naming\NameRegisterClient.cs" />
+ <Compile Include="Naming\NameServer.cs" />
+ <Compile Include="Naming\NamingConfiguration.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Naming\NamingConfigurationOptions.cs">
+ <SubType>Code</SubType>
+ </Compile>
+ <Compile Include="Naming\Observers\NamingGetAllRequestObserver.cs" />
+ <Compile Include="Naming\Observers\NamingLookupRequestObserver.cs" />
+ <Compile Include="Naming\Observers\NamingRegisterRequestObserver.cs" />
+ <Compile Include="Naming\Observers\NamingUnregisterRequestObserver.cs" />
+ <Compile Include="NetworkService\Codec\ControlMessageCodec.cs" />
+ <Compile Include="NetworkService\Codec\NsMessageCodec.cs" />
+ <Compile Include="NetworkService\Codec\NsMessageProto.cs" />
+ <Compile Include="NetworkService\ControlMessage.cs" />
+ <Compile Include="NetworkService\IConnection.cs" />
+ <Compile Include="NetworkService\INetworkService.cs" />
+ <Compile Include="NetworkService\NetworkService.cs" />
+ <Compile Include="NetworkService\NetworkServiceConfiguration.cs" />
+ <Compile Include="NetworkService\NetworkServiceOptions.cs" />
+ <Compile Include="NetworkService\NsConnection.cs" />
+ <Compile Include="NetworkService\NsMessage.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="Utilities\BlockingCollectionExtensions.cs" />
+ <Compile Include="Utilities\Utils.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
+ <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
+ <Name>Org.Apache.REEF.Tang</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.REEF.Utilities</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+ <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+ <Name>Org.Apache.REEF.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ <Name>Org.Apache.REEF.Driver</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
+ <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+ <Name>Org.Apache.REEF.Wake</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <WCFMetadata Include="Service References\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Network/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..536e986
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+/**
+ * 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 System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Org.Apache.REEF.Network")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Org.Apache.REEF.Network")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("b3f5e608-8908-4f06-a87e-5e41c88133ac")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Utilities/BlockingCollectionExtensions.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Utilities/BlockingCollectionExtensions.cs b/lang/cs/Org.Apache.REEF.Network/Utilities/BlockingCollectionExtensions.cs
new file mode 100644
index 0000000..9dc057c
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Utilities/BlockingCollectionExtensions.cs
@@ -0,0 +1,78 @@
+/**
+ * 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 System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+
+namespace Org.Apache.REEF.Network.Utilities
+{
+ public static class BlockingCollectionExtensions
+ {
+ /// <summary>
+ /// Removes the given item from the BlockingCollection if it is present.
+ /// If it is not present, it blocks until any item is available in the
+ /// BlockingCollection. It then removes and returns that first available
+ /// item.
+ /// </summary>
+ /// <typeparam name="T">The type of BlockingCollection</typeparam>
+ /// <param name="collection">The BlockingCollection to remove the specified item</param>
+ /// <param name="item">The item to remove from the BlockingCollection, if it exists</param>
+ /// <returns>The specified item, or the first available item if the specified item is
+ /// not present in the BlockingCollection</returns>
+ public static T Take<T>(this BlockingCollection<T> collection, T item)
+ {
+ T ret = default(T);
+ bool foundItem = false;
+ List<T> removedItems = new List<T>();
+
+ // Empty the collection
+ for (int i = 0; i < collection.Count; i++)
+ {
+ T removed;
+ if (collection.TryTake(out removed))
+ {
+ removedItems.Add(removed);
+ }
+ }
+
+ // Add them back to the collection minus the specified item
+ foreach (T removedItem in removedItems)
+ {
+ if (removedItem.Equals(item))
+ {
+ ret = removedItem;
+ foundItem = true;
+ }
+ else
+ {
+ collection.Add(removedItem);
+ }
+ }
+
+ if (!foundItem)
+ {
+ // Error: the element wasn't in the collection
+ throw new InvalidOperationException(item + " not found in blocking collection");
+ }
+
+ return ret;
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Utilities/Utils.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Utilities/Utils.cs b/lang/cs/Org.Apache.REEF.Network/Utilities/Utils.cs
new file mode 100644
index 0000000..bc02b89
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Utilities/Utils.cs
@@ -0,0 +1,76 @@
+/**
+ * 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 System.IO;
+using Microsoft.Hadoop.Avro;
+using Org.Apache.REEF.Driver.Context;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Exceptions;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tang.Util;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+
+namespace Org.Apache.REEF.Network.Utilities
+{
+ internal class Utils
+ {
+ private static Logger LOGGER = Logger.GetLogger(typeof(Utils));
+
+ /// <summary>
+ /// Returns the TaskIdentifier from the Configuration.
+ /// </summary>
+ /// <param name="taskConfiguration">The Configuration object</param>
+ /// <returns>The TaskIdentifier for the given Configuration</returns>
+ public static string GetTaskId(IConfiguration taskConfiguration)
+ {
+ try
+ {
+ IInjector injector = TangFactory.GetTang().NewInjector(taskConfiguration);
+ return injector.GetNamedInstance<TaskConfigurationOptions.Identifier, string>(
+ GenericType<TaskConfigurationOptions.Identifier>.Class);
+ }
+ catch (InjectionException)
+ {
+ LOGGER.Log(Level.Error, "Unable to find task identifier");
+ throw;
+ }
+ }
+
+ /// <summary>
+ /// Returns the Context Identifier from the Configuration.
+ /// </summary>
+ /// <param name="contextConfiguration">The Configuration object</param>
+ /// <returns>The TaskIdentifier for the given Configuration</returns>
+ public static string GetContextId(IConfiguration contextConfiguration)
+ {
+ try
+ {
+ IInjector injector = TangFactory.GetTang().NewInjector(contextConfiguration);
+ return injector.GetNamedInstance<ContextConfigurationOptions.ContextIdentifier, string>(
+ GenericType<ContextConfigurationOptions.ContextIdentifier>.Class);
+ }
+ catch (InjectionException)
+ {
+ LOGGER.Log(Level.Error, "Unable to find task identifier");
+ throw;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/packages.config b/lang/cs/Org.Apache.REEF.Network/packages.config
new file mode 100644
index 0000000..88cf17b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/packages.config
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<packages>
+ <package id="Microsoft.Hadoop.Avro" version="1.4.0.0" targetFramework="net45" />
+ <package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
+ <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
+ <package id="Rx-Core" version="2.2.5" targetFramework="net45" />
+ <package id="Rx-Interfaces" version="2.2.5" targetFramework="net45" />
+</packages>
\ No newline at end of file
[5/5] incubator-reef git commit: [REEF-139] Changing .Net project
structure for Network and Evaluator
Posted by we...@apache.org.
[REEF-139] Changing .Net project structure for Network and Evaluator
This is to change .Net project structure for Network and Evaluator
* Move project folders under cs
* Rename projects to follow name convention
* Update namespace for projects
* Update csproj file for the references
* Fixed license exclusions with the folder structure change
JIRA:
[REEF-139] https://issues.apache.org/jira/browse/REEF-139
Pull Request:
This closes #69
Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/b6c4e983
Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/b6c4e983
Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/b6c4e983
Branch: refs/heads/master
Commit: b6c4e983879a0f38983b123f9b55514892442b61
Parents: c1b5200
Author: Julia Wang <jw...@yahoo.com>
Authored: Thu Feb 5 14:38:44 2015 -0800
Committer: Markus Weimer <we...@apache.org>
Committed: Thu Feb 5 17:31:18 2015 -0800
----------------------------------------------------------------------
.../bridge/ClrHandlerHelper.cs | 2 +-
lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs | 261 +++++++++++++++++
.../Org.Apache.REEF.Evaluator.csproj | 124 +++++++++
.../Properties/AssemblyInfo.cs | 55 ++++
.../Org.Apache.REEF.Evaluator/packages.config | 22 ++
.../Naming/Codec/NamingLookupRequestCodec.cs | 41 +++
.../Naming/Codec/NamingLookupResponseCodec.cs | 55 ++++
.../Naming/Codec/NamingRegisterRequestCodec.cs | 47 ++++
.../Naming/Codec/NamingRegisterResponseCodec.cs | 44 +++
.../Codec/NamingUnregisterRequestCodec.cs | 41 +++
.../Naming/Contracts/AvroNamingAssignment.cs | 62 +++++
.../Naming/Contracts/AvroNamingLookupRequest.cs | 51 ++++
.../Contracts/AvroNamingLookupResponse.cs | 51 ++++
.../Contracts/AvroNamingRegisterRequest.cs | 62 +++++
.../Contracts/AvroNamingUnRegisterRequest.cs | 50 ++++
.../Naming/Events/NamingEvent.cs | 35 +++
.../Naming/Events/NamingGetAllRequest.cs | 29 ++
.../Naming/Events/NamingGetAllResponse.cs | 38 +++
.../Naming/Events/NamingLookupRequest.cs | 36 +++
.../Naming/Events/NamingLookupResponse.cs | 39 +++
.../Naming/Events/NamingRegisterRequest.cs | 36 +++
.../Naming/Events/NamingRegisterResponse.cs | 34 +++
.../Naming/Events/NamingUnregisterRequest.cs | 34 +++
.../Naming/Events/NamingUnregisterResponse.cs | 34 +++
.../Naming/INameServer.cs | 69 +++++
.../Naming/NameClient.cs | 279 +++++++++++++++++++
.../Naming/NameLookupClient.cs | 97 +++++++
.../Naming/NameRegisterClient.cs | 67 +++++
.../Naming/NameServer.cs | 196 +++++++++++++
.../Naming/NamingConfiguration.cs | 50 ++++
.../Naming/NamingConfigurationOptions.cs | 41 +++
.../Observers/NamingGetAllRequestObserver.cs | 47 ++++
.../Observers/NamingLookupRequestObserver.cs | 50 ++++
.../Observers/NamingRegisterRequestObserver.cs | 51 ++++
.../NamingUnregisterRequestObserver.cs | 47 ++++
.../NetworkService/Codec/ControlMessageCodec.cs | 43 +++
.../NetworkService/Codec/NsMessageCodec.cs | 85 ++++++
.../NetworkService/Codec/NsMessageProto.cs | 63 +++++
.../NetworkService/ControlMessage.cs | 39 +++
.../NetworkService/IConnection.cs | 40 +++
.../NetworkService/INetworkService.cs | 58 ++++
.../NetworkService/NetworkService.cs | 156 +++++++++++
.../NetworkServiceConfiguration.cs | 57 ++++
.../NetworkService/NetworkServiceOptions.cs | 33 +++
.../NetworkService/NsConnection.cs | 139 +++++++++
.../NetworkService/NsMessage.cs | 71 +++++
.../Org.Apache.REEF.Network.csproj | 184 ++++++++++++
.../Properties/AssemblyInfo.cs | 55 ++++
.../Utilities/BlockingCollectionExtensions.cs | 78 ++++++
.../Org.Apache.REEF.Network/Utilities/Utils.cs | 76 +++++
lang/cs/Org.Apache.REEF.Network/packages.config | 26 ++
lang/cs/ReefDotNet.sln | 40 +--
.../CLRBridgeClient/CLRBridgeClient.cs | 2 +-
.../CLRBridgeClient/CLRBridgeClient.csproj | 8 +-
.../reef-applications/Evaluator/Evaluator.cs | 261 -----------------
.../Evaluator/Evaluator.csproj | 124 ---------
.../Evaluator/Properties/AssemblyInfo.cs | 55 ----
.../reef-applications/Evaluator/packages.config | 22 --
.../HelloCLRBridge/HelloCLRBridge.csproj | 8 +-
.../handlers/HelloAllocatedEvaluatorHandler.cs | 2 +-
.../handlers/HelloSimpleEventHandlers.cs | 2 +-
.../handlers/HelloStartHandler.cs | 2 +-
.../Naming/Codec/NamingLookupRequestCodec.cs | 41 ---
.../Naming/Codec/NamingLookupResponseCodec.cs | 55 ----
.../Naming/Codec/NamingRegisterRequestCodec.cs | 47 ----
.../Naming/Codec/NamingRegisterResponseCodec.cs | 44 ---
.../Codec/NamingUnregisterRequestCodec.cs | 41 ---
.../Naming/Contracts/AvroNamingAssignment.cs | 62 -----
.../Naming/Contracts/AvroNamingLookupRequest.cs | 51 ----
.../Contracts/AvroNamingLookupResponse.cs | 51 ----
.../Contracts/AvroNamingRegisterRequest.cs | 62 -----
.../Contracts/AvroNamingUnRegisterRequest.cs | 50 ----
.../Network/Naming/Events/NamingEvent.cs | 35 ---
.../Naming/Events/NamingGetAllRequest.cs | 29 --
.../Naming/Events/NamingGetAllResponse.cs | 38 ---
.../Naming/Events/NamingLookupRequest.cs | 36 ---
.../Naming/Events/NamingLookupResponse.cs | 39 ---
.../Naming/Events/NamingRegisterRequest.cs | 36 ---
.../Naming/Events/NamingRegisterResponse.cs | 34 ---
.../Naming/Events/NamingUnregisterRequest.cs | 34 ---
.../Naming/Events/NamingUnregisterResponse.cs | 34 ---
.../REEF/reef-io/Network/Naming/INameServer.cs | 69 -----
.../REEF/reef-io/Network/Naming/NameClient.cs | 279 -------------------
.../reef-io/Network/Naming/NameLookupClient.cs | 97 -------
.../Network/Naming/NameRegisterClient.cs | 67 -----
.../REEF/reef-io/Network/Naming/NameServer.cs | 196 -------------
.../Network/Naming/NamingConfiguration.cs | 50 ----
.../Naming/NamingConfigurationOptions.cs | 41 ---
.../Observers/NamingGetAllRequestObserver.cs | 47 ----
.../Observers/NamingLookupRequestObserver.cs | 50 ----
.../Observers/NamingRegisterRequestObserver.cs | 51 ----
.../NamingUnregisterRequestObserver.cs | 47 ----
.../Source/REEF/reef-io/Network/Network.csproj | 180 ------------
.../NetworkService/Codec/ControlMessageCodec.cs | 43 ---
.../NetworkService/Codec/NsMessageCodec.cs | 85 ------
.../NetworkService/Codec/NsMessageProto.cs | 63 -----
.../Network/NetworkService/ControlMessage.cs | 39 ---
.../Network/NetworkService/IConnection.cs | 40 ---
.../Network/NetworkService/INetworkService.cs | 58 ----
.../Network/NetworkService/NetworkService.cs | 156 -----------
.../NetworkServiceConfiguration.cs | 57 ----
.../NetworkService/NetworkServiceOptions.cs | 33 ---
.../Network/NetworkService/NsConnection.cs | 139 ---------
.../reef-io/Network/NetworkService/NsMessage.cs | 71 -----
.../reef-io/Network/Properties/AssemblyInfo.cs | 55 ----
.../Utilities/BlockingCollectionExtensions.cs | 78 ------
.../REEF/reef-io/Network/Utilities/Utils.cs | 76 -----
.../Source/REEF/reef-io/Network/packages.config | 26 --
lang/cs/Source/Tools/ReefAll/ReefAll.csproj | 36 +--
.../Bridge/TestSimpleEventHandlers.cs | 2 +-
.../Functional.Tests/Messaging/MessageDriver.cs | 2 +-
.../Functional.Tests/Messaging/MessageTask.cs | 2 +-
.../BlockingCollectionExtensionTests.cs | 2 +-
.../Tests/ReefTests/IO.Tests/NameServerTests.cs | 4 +-
.../ReefTests/IO.Tests/NetworkServiceTests.cs | 4 +-
lang/cs/Tests/ReefTests/ReefTests.csproj | 16 +-
pom.xml | 5 +-
117 files changed, 3550 insertions(+), 3541 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Driver/bridge/ClrHandlerHelper.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Driver/bridge/ClrHandlerHelper.cs b/lang/cs/Org.Apache.REEF.Driver/bridge/ClrHandlerHelper.cs
index c6dd02f..8d9020c 100644
--- a/lang/cs/Org.Apache.REEF.Driver/bridge/ClrHandlerHelper.cs
+++ b/lang/cs/Org.Apache.REEF.Driver/bridge/ClrHandlerHelper.cs
@@ -43,7 +43,7 @@ namespace Org.Apache.REEF.Driver.Bridge
{
get
{
- return new[] { "Microsoft.Hadoop.Avro.dll", "Org.Apache.REEF.Driver.dll", "Org.Apache.REEF.Common.dll", "Org.Apache.REEF.Utilities.dll", "Org.Apache.REEF.IO.Network.dll", "Org.Apache.REEF.Tang.dll", "Org.Apache.REEF.Wake.dll", "Newtonsoft.Json.dll", "protobuf-net.dll" };
+ return new[] { "Microsoft.Hadoop.Avro.dll", "Org.Apache.REEF.Driver.dll", "Org.Apache.REEF.Common.dll", "Org.Apache.REEF.Utilities.dll", "Org.Apache.REEF.Network.dll", "Org.Apache.REEF.Tang.dll", "Org.Apache.REEF.Wake.dll", "Newtonsoft.Json.dll", "protobuf-net.dll" };
}
}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
new file mode 100644
index 0000000..39ebfc3
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs
@@ -0,0 +1,261 @@
+/**
+ * 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;
+using Org.Apache.REEF.Common.Context;
+using Org.Apache.REEF.Common.Evaluator.Context;
+using Org.Apache.REEF.Common.ProtoBuf.ReefProtocol;
+using Org.Apache.REEF.Driver.Bridge;
+using Org.Apache.REEF.Services;
+using Org.Apache.REEF.Tang.Formats;
+using Org.Apache.REEF.Tang.Implementations.InjectionPlan;
+using Org.Apache.REEF.Tang.Implementations.Tang;
+using Org.Apache.REEF.Tang.Interface;
+using Org.Apache.REEF.Tasks;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Wake.Remote.Impl;
+using Org.Apache.REEF.Wake.Time.Runtime.Event;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Diagnostics;
+using System.Globalization;
+using System.IO;
+using System.Linq;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Org.Apache.REEF.Evaluator
+{
+ public class Evaluator
+ {
+ private static Logger _logger;
+
+ private static int _heartbeatPeriodInMs = Constants.DefaultEvaluatorHeartbeatPeriodInMs;
+
+ private static int _heartbeatMaxRetry = Constants.DefaultEvaluatorHeartbeatMaxRetry;
+
+ private static IInjector _injector;
+
+ private static EvaluatorConfigurations _evaluatorConfig;
+
+ public static void Main(string[] args)
+ {
+ Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "START: {0} Evaluator::InitInjector.", DateTime.Now));
+ Stopwatch timer = new Stopwatch();
+ InitInjector();
+ SetCustomTraceListners();
+ timer.Stop();
+ Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "EXIT: {0} Evaluator::InitInjector. Duration: [{1}].", DateTime.Now, timer.Elapsed));
+
+ RuntimeClock clock;
+
+ using (_logger.LogScope("Evaluator::Main"))
+ {
+ string debugEnabledString = Environment.GetEnvironmentVariable("Org.Apache.REEF.EvaluatorDebug");
+ if (!string.IsNullOrWhiteSpace(debugEnabledString) &&
+ debugEnabledString.Equals("enabled", StringComparison.OrdinalIgnoreCase))
+ {
+ while (true)
+ {
+ if (Debugger.IsAttached)
+ {
+ break;
+ }
+ else
+ {
+ _logger.Log(Level.Info, "Evaluator in debug mode, waiting for debugger to be attached...");
+ Thread.Sleep(2000);
+ }
+ }
+ }
+
+ AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
+
+ string heartbeatPeriodFromConfig = ConfigurationManager.AppSettings["EvaluatorHeartbeatPeriodInMs"];
+
+ int heartbeatPeriod = 0;
+
+ if (!string.IsNullOrWhiteSpace(heartbeatPeriodFromConfig) &&
+ int.TryParse(heartbeatPeriodFromConfig, out heartbeatPeriod))
+ {
+ _heartbeatPeriodInMs = heartbeatPeriod;
+ }
+ _logger.Log(Level.Verbose,
+ "Evaluator heartbeat period set to be " + _heartbeatPeriodInMs + " milliSeconds.");
+
+ int maxHeartbeatRetry = 0;
+ string heartbeatMaxRetryFromConfig = ConfigurationManager.AppSettings["EvaluatorHeartbeatRetryMaxTimes"];
+
+ if (!string.IsNullOrWhiteSpace(heartbeatMaxRetryFromConfig) &&
+ int.TryParse(heartbeatMaxRetryFromConfig, out maxHeartbeatRetry))
+ {
+ _heartbeatMaxRetry = maxHeartbeatRetry;
+ }
+ _logger.Log(Level.Verbose, "Evaluator heatrbeat max retry set to be " + _heartbeatMaxRetry + " times.");
+
+ if (args.Count() < 2)
+ {
+ var e = new InvalidOperationException("must supply at least the rId and evaluator config file");
+ Exceptions.Throw(e, _logger);
+ }
+
+ // remote driver Id
+ string rId = args[0];
+
+ // evaluator configuraiton file
+ string evaluatorConfigurationPath = args[1];
+
+ ICodec<REEFMessage> reefMessageCodec = new REEFMessageCodec();
+
+ _evaluatorConfig = new EvaluatorConfigurations(evaluatorConfigurationPath);
+
+ string rootContextConfigString = _evaluatorConfig.RootContextConfiguration;
+ if (string.IsNullOrWhiteSpace(rootContextConfigString))
+ {
+ Exceptions.Throw(new ArgumentException("empty or null rootContextConfigString"), _logger);
+ }
+ ContextConfiguration rootContextConfiguration = new ContextConfiguration(rootContextConfigString);
+
+ string taskConfig = _evaluatorConfig.TaskConfiguration;
+ Optional<TaskConfiguration> rootTaskConfig = string.IsNullOrEmpty(taskConfig)
+ ? Optional<TaskConfiguration>.Empty()
+ : Optional<TaskConfiguration>.Of(
+ new TaskConfiguration(taskConfig));
+ string rootServiceConfigString = _evaluatorConfig.RootServiceConfiguration;
+ Optional<ServiceConfiguration> rootServiceConfig = string.IsNullOrEmpty(rootServiceConfigString)
+ ? Optional<ServiceConfiguration>.Empty()
+ : Optional<ServiceConfiguration>.Of(
+ new ServiceConfiguration(
+ rootServiceConfigString));
+
+ // remoteManager used as client-only in evaluator
+ IRemoteManager<REEFMessage> remoteManager = new DefaultRemoteManager<REEFMessage>(reefMessageCodec);
+ IRemoteIdentifier remoteId = new SocketRemoteIdentifier(NetUtilities.ParseIpEndpoint(rId));
+
+ ConfigurationModule module = new ConfigurationModuleBuilder().Build();
+ IConfiguration clockConfiguraiton = module.Build();
+
+ clock =
+ TangFactory.GetTang().NewInjector(clockConfiguraiton).GetInstance<RuntimeClock>();
+ _logger.Log(Level.Info, "Application Id: " + _evaluatorConfig.ApplicationId);
+
+ EvaluatorSettings evaluatorSettings = new EvaluatorSettings(
+ _evaluatorConfig.ApplicationId,
+ _evaluatorConfig.EvaluatorId,
+ _heartbeatPeriodInMs,
+ _heartbeatMaxRetry,
+ rootContextConfiguration,
+ clock,
+ remoteManager,
+ _injector);
+
+ HeartBeatManager heartBeatManager = new HeartBeatManager(evaluatorSettings, remoteId);
+ ContextManager contextManager = new ContextManager(heartBeatManager, rootServiceConfig, rootTaskConfig);
+ EvaluatorRuntime evaluatorRuntime = new EvaluatorRuntime(contextManager, heartBeatManager);
+
+ // TODO: repalce with injectionFuture
+ heartBeatManager._evaluatorRuntime = evaluatorRuntime;
+ heartBeatManager._contextManager = contextManager;
+
+ SetRuntimeHanlders(evaluatorRuntime, clock);
+ }
+
+ Task evaluatorTask = Task.Run(new Action(clock.Run));
+ evaluatorTask.Wait();
+ }
+
+ private static void InitInjector()
+ {
+ string clrRuntimeConfigurationFile = Path.Combine(Directory.GetCurrentDirectory(), "reef", "global",
+ Common.Constants.ClrBridgeRuntimeConfiguration);
+ if (!File.Exists(clrRuntimeConfigurationFile))
+ {
+ var e =
+ new InvalidOperationException("Cannot find clrRuntimeConfiguration from " +
+ clrRuntimeConfigurationFile);
+ Exceptions.Throw(e, _logger);
+ }
+
+ try
+ {
+ IConfiguration clrBridgeConfiguration =
+ new AvroConfigurationSerializer().FromFile(clrRuntimeConfigurationFile);
+ _injector = TangFactory.GetTang().NewInjector(clrBridgeConfiguration);
+ }
+ catch (Exception e)
+ {
+ Exceptions.Caught(e, Level.Error, "Cannot obtain injector from clr bridge configuration.", _logger);
+ Exceptions.Throw(
+ new InvalidOperationException("Cannot obtain injector from clr bridge configuration.", e),
+ _logger);
+ }
+ }
+
+ private static void SetCustomTraceListners()
+ {
+ ISet<TraceListener> customTraceListeners;
+ CustomTraceListeners listeners = null;
+ try
+ {
+ listeners = _injector.GetInstance<CustomTraceListeners>();
+ customTraceListeners = listeners.Listeners;
+ }
+ catch (Exception e)
+ {
+ Exceptions.Caught(e, Level.Error, _logger);
+ // custom trace listner not set properly, use empty set
+ customTraceListeners = new HashSet<TraceListener>();
+ }
+ foreach (TraceListener listener in customTraceListeners)
+ {
+ Logger.AddTraceListner(listener);
+ }
+ _logger = Logger.GetLogger(typeof(Evaluator));
+ CustomTraceLevel traceLevel = _injector.GetInstance<CustomTraceLevel>();
+ Logger.SetCustomLevel(traceLevel.TraceLevel);
+ }
+
+ private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
+ {
+ Exception ex = default(Exception);
+ ex = (Exception)e.ExceptionObject;
+ _logger.Log(Level.Error, "Unhandled exception caught in Evaluator.", ex);
+ Exceptions.Throw(new InvalidOperationException("Unhandled exception caught in Evaluator.", ex), _logger);
+ }
+
+ // set the handlers for runtimeclock manually
+ // we only need runtimestart and runtimestop handlers now
+ private static void SetRuntimeHanlders(EvaluatorRuntime evaluatorRuntime, RuntimeClock clock)
+ {
+ HashSet<IObserver<RuntimeStart>> runtimeStarts = new HashSet<IObserver<RuntimeStart>>();
+ runtimeStarts.Add(evaluatorRuntime);
+ InjectionFutureImpl<ISet<IObserver<RuntimeStart>>> injectRuntimeStart = new InjectionFutureImpl<ISet<IObserver<RuntimeStart>>>(runtimeStarts);
+ clock.InjectedRuntimeStartHandler = injectRuntimeStart;
+
+ HashSet<IObserver<RuntimeStop>> runtimeStops = new HashSet<IObserver<RuntimeStop>>();
+ runtimeStops.Add(evaluatorRuntime);
+ InjectionFutureImpl<ISet<IObserver<RuntimeStop>>> injectRuntimeStop = new InjectionFutureImpl<ISet<IObserver<RuntimeStop>>>(runtimeStops);
+ clock.InjectedRuntimeStopHandler = injectRuntimeStop;
+ }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Evaluator/Org.Apache.REEF.Evaluator.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Org.Apache.REEF.Evaluator.csproj b/lang/cs/Org.Apache.REEF.Evaluator/Org.Apache.REEF.Evaluator.csproj
new file mode 100644
index 0000000..f5fc9de
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Evaluator/Org.Apache.REEF.Evaluator.csproj
@@ -0,0 +1,124 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{1B983182-9C30-464C-948D-F87EB93A8240}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Org.Apache.REEF.Evaluator</RootNamespace>
+ <AssemblyName>Org.Apache.REEF.Evaluator</AssemblyName>
+ <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <RestorePackages>true</RestorePackages>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
+ <RestorePackages>true</RestorePackages>
+ </PropertyGroup>
+ <Import Project="$(SolutionDir)\Source\build.props" />
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="protobuf-net">
+ <HintPath>$(PackagesDir)\protobuf-net.$(ProtobufVersion)\lib\net40\protobuf-net.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Evaluator.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Tang\Org.Apache.REEF.Tang.csproj">
+ <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
+ <Name>Org.Apache.REEF.Tang</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Utilities\Org.Apache.REEF.Utilities.csproj">
+ <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
+ <Name>Org.Apache.REEF.Utilities</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Common\Org.Apache.REEF.Common.csproj">
+ <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
+ <Name>Org.Apache.REEF.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj">
+ <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
+ <Name>Org.Apache.REEF.Driver</Name>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\Org.Apache.REEF.Wake\Org.Apache.REEF.Wake.csproj">
+ <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
+ <Name>Org.Apache.REEF.Wake</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs b/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..51ff356
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Evaluator/Properties/AssemblyInfo.cs
@@ -0,0 +1,55 @@
+/**
+ * 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 System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Evaluator")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Evaluator")]
+[assembly: AssemblyCopyright("Copyright © 2015")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("a64dc535-9b1e-41a4-8303-117f8b28c8c0")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Evaluator/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Evaluator/packages.config b/lang/cs/Org.Apache.REEF.Evaluator/packages.config
new file mode 100644
index 0000000..81b0ef5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Evaluator/packages.config
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<packages>
+ <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
+</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupRequestCodec.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupRequestCodec.cs
new file mode 100644
index 0000000..e411013
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupRequestCodec.cs
@@ -0,0 +1,41 @@
+/**
+ * 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.Network.Naming.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Network.Naming.Contracts;
+
+namespace Org.Apache.REEF.Network.Naming.Codec
+{
+ internal class NamingLookupRequestCodec : ICodec<NamingLookupRequest>
+ {
+ public byte[] Encode(NamingLookupRequest obj)
+ {
+ var request = new AvroNamingLookupRequest { ids = obj.Identifiers };
+ return AvroUtils.AvroSerialize(request);
+ }
+
+ public NamingLookupRequest Decode(byte[] data)
+ {
+ AvroNamingLookupRequest request = AvroUtils.AvroDeserialize<AvroNamingLookupRequest>(data);
+ return new NamingLookupRequest(request.ids);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupResponseCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupResponseCodec.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupResponseCodec.cs
new file mode 100644
index 0000000..0ee44f2
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingLookupResponseCodec.cs
@@ -0,0 +1,55 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Wake.Remote;
+using System.Collections.Generic;
+using System.Linq;
+using Org.Apache.REEF.Network.Naming.Contracts;
+
+namespace Org.Apache.REEF.Network.Naming.Codec
+{
+ internal class NamingLookupResponseCodec : ICodec<NamingLookupResponse>
+ {
+ public byte[] Encode(NamingLookupResponse obj)
+ {
+ List<AvroNamingAssignment> tuples = obj.NameAssignments
+ .Select(assignment => new AvroNamingAssignment()
+ {
+ id = assignment.Identifier,
+ host = assignment.Endpoint.Address.ToString(),
+ port = assignment.Endpoint.Port
+ }).ToList();
+
+ AvroNamingLookupResponse response = new AvroNamingLookupResponse { tuples = tuples };
+ return AvroUtils.AvroSerialize(response);
+ }
+
+ public NamingLookupResponse Decode(byte[] data)
+ {
+ AvroNamingLookupResponse response = AvroUtils.AvroDeserialize<AvroNamingLookupResponse>(data);
+ List<NameAssignment> assignments =
+ response.tuples.Select(x => new NameAssignment(x.id, x.host, x.port)).ToList();
+
+ return new NamingLookupResponse(assignments);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterRequestCodec.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterRequestCodec.cs
new file mode 100644
index 0000000..ae07bac
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterRequestCodec.cs
@@ -0,0 +1,47 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Network.Naming.Contracts;
+
+namespace Org.Apache.REEF.Network.Naming.Codec
+{
+ internal class NamingRegisterRequestCodec : ICodec<NamingRegisterRequest>
+ {
+ public byte[] Encode(NamingRegisterRequest obj)
+ {
+ AvroNamingRegisterRequest request = new AvroNamingRegisterRequest
+ {
+ id = obj.NameAssignment.Identifier,
+ host = obj.NameAssignment.Endpoint.Address.ToString(),
+ port = obj.NameAssignment.Endpoint.Port
+ };
+ return AvroUtils.AvroSerialize(request);
+ }
+
+ public NamingRegisterRequest Decode(byte[] data)
+ {
+ AvroNamingRegisterRequest request = AvroUtils.AvroDeserialize<AvroNamingRegisterRequest>(data);
+ return new NamingRegisterRequest(new NameAssignment(request.id, request.host, request.port));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterResponseCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterResponseCodec.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterResponseCodec.cs
new file mode 100644
index 0000000..8749d96
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingRegisterResponseCodec.cs
@@ -0,0 +1,44 @@
+/**
+ * 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.Network.Naming.Events;
+using Org.Apache.REEF.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.Naming.Codec
+{
+ internal class NamingRegisterResponseCodec : ICodec<NamingRegisterResponse>
+ {
+ private NamingRegisterRequestCodec _codec;
+
+ public NamingRegisterResponseCodec(NamingRegisterRequestCodec codec)
+ {
+ _codec = codec;
+ }
+
+ public byte[] Encode(NamingRegisterResponse obj)
+ {
+ return _codec.Encode(obj.Request);
+ }
+
+ public NamingRegisterResponse Decode(byte[] data)
+ {
+ return new NamingRegisterResponse(_codec.Decode(data));
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingUnregisterRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingUnregisterRequestCodec.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingUnregisterRequestCodec.cs
new file mode 100644
index 0000000..44fd08b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Codec/NamingUnregisterRequestCodec.cs
@@ -0,0 +1,41 @@
+/**
+ * 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.Network.Naming.Events;
+using Org.Apache.REEF.Utilities;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Network.Naming.Contracts;
+
+namespace Org.Apache.REEF.Network.Naming.Codec
+{
+ internal class NamingUnregisterRequestCodec : ICodec<NamingUnregisterRequest>
+ {
+ public byte[] Encode(NamingUnregisterRequest obj)
+ {
+ AvroNamingUnRegisterRequest request = new AvroNamingUnRegisterRequest { id = obj.Identifier };
+ return AvroUtils.AvroSerialize(request);
+ }
+
+ public NamingUnregisterRequest Decode(byte[] data)
+ {
+ AvroNamingUnRegisterRequest request = AvroUtils.AvroDeserialize<AvroNamingUnRegisterRequest>(data);
+ return new NamingUnregisterRequest(request.id);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingAssignment.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingAssignment.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingAssignment.cs
new file mode 100644
index 0000000..9506c88
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingAssignment.cs
@@ -0,0 +1,62 @@
+/**
+ * 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 System.Runtime.Serialization;
+
+//---------- Auto-generated ------------
+namespace Org.Apache.REEF.Network.Naming.Contracts
+{
+ /// <summary>
+ /// Used to serialize and deserialize Avro record Org.Apache.REEF.Network.Naming.Contracts.AvroNamingAssignment.
+ /// </summary>
+ [DataContract]
+ public class AvroNamingAssignment
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingAssignment"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the id field.
+ /// </summary>
+ [DataMember]
+ public string id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the host field.
+ /// </summary>
+ [DataMember]
+ public string host { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port field.
+ /// </summary>
+ [DataMember]
+ public int port { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupRequest.cs
new file mode 100644
index 0000000..e367f2b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupRequest.cs
@@ -0,0 +1,51 @@
+/**
+ * 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 System.Collections.Generic;
+using System.Runtime.Serialization;
+
+//---------- Auto-generated ------------
+namespace Org.Apache.REEF.Network.Naming.Contracts
+{
+ /// <summary>
+ /// Used to serialize and deserialize Avro record Org.Apache.REEF.Network.Naming.Contracts.AvroNamingLookupRequest.
+ /// </summary>
+ [DataContract]
+ public class AvroNamingLookupRequest
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingLookupRequest"",""fields"":[{""name"":""ids"",""type"":{""type"":""array"",""items"":""string""}}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the ids field.
+ /// </summary>
+ [DataMember]
+ public List<string> ids { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupResponse.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupResponse.cs
new file mode 100644
index 0000000..edda028
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingLookupResponse.cs
@@ -0,0 +1,51 @@
+/**
+ * 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 System.Collections.Generic;
+using System.Runtime.Serialization;
+
+//---------- Auto-generated ------------
+namespace Org.Apache.REEF.Network.Naming.Contracts
+{
+ /// <summary>
+ /// Used to serialize and deserialize Avro record Org.Apache.REEF.Network.Naming.Contracts.AvroNamingLookupResponse.
+ /// </summary>
+ [DataContract]
+ public class AvroNamingLookupResponse
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingLookupResponse"",""fields"":[{""name"":""tuples"",""type"":{""type"":""array"",""items"":{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingAssignment"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}}}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the tuples field.
+ /// </summary>
+ [DataMember]
+ public List<AvroNamingAssignment> tuples { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingRegisterRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingRegisterRequest.cs
new file mode 100644
index 0000000..8d4b832
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingRegisterRequest.cs
@@ -0,0 +1,62 @@
+/**
+ * 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 System.Runtime.Serialization;
+
+//---------- Auto-generated ------------
+namespace Org.Apache.REEF.Network.Naming.Contracts
+{
+ /// <summary>
+ /// Used to serialize and deserialize Avro record Org.Apache.REEF.Network.Naming.Contracts.AvroNamingRegisterRequest.
+ /// </summary>
+ [DataContract]
+ public class AvroNamingRegisterRequest
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingRegisterRequest"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the id field.
+ /// </summary>
+ [DataMember]
+ public string id { get; set; }
+
+ /// <summary>
+ /// Gets or sets the host field.
+ /// </summary>
+ [DataMember]
+ public string host { get; set; }
+
+ /// <summary>
+ /// Gets or sets the port field.
+ /// </summary>
+ [DataMember]
+ public int port { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
new file mode 100644
index 0000000..cdf9749
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
@@ -0,0 +1,50 @@
+/**
+ * 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 System.Runtime.Serialization;
+
+//---------- Auto-generated ------------
+namespace Org.Apache.REEF.Network.Naming.Contracts
+{
+ /// <summary>
+ /// Used to serialize and deserialize Avro record Org.Apache.REEF.Network.Naming.Contracts.AvroNamingUnRegisterRequest.
+ /// </summary>
+ [DataContract]
+ public class AvroNamingUnRegisterRequest
+ {
+ private const string JsonSchema = @"{""type"":""record"",""name"":""Org.Apache.REEF.Network.Naming.Contracts.AvroNamingUnRegisterRequest"",""fields"":[{""name"":""id"",""type"":""string""}]}";
+
+ /// <summary>
+ /// Gets the schema.
+ /// </summary>
+ public static string Schema
+ {
+ get
+ {
+ return JsonSchema;
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the id field.
+ /// </summary>
+ [DataMember]
+ public string id { get; set; }
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingEvent.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingEvent.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingEvent.cs
new file mode 100644
index 0000000..981e777
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingEvent.cs
@@ -0,0 +1,35 @@
+/**
+ * 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.Wake.Remote;
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event representing a lookup, registering, or unregistering of
+ /// an identifier with the Name Service.
+ /// </summary>
+ internal class NamingEvent
+ {
+ /// <summary>
+ /// The link for communication between the NameClient and NameServer
+ /// </summary>
+ public ILink<NamingEvent> Link { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllRequest.cs
new file mode 100644
index 0000000..d101bcb
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllRequest.cs
@@ -0,0 +1,29 @@
+/**
+ * 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.
+ */
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event to request all registered identifiers and their mapped
+ /// IPEndpoints
+ /// </summary>
+ internal class NamingGetAllRequest : NamingEvent
+ {
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllResponse.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllResponse.cs
new file mode 100644
index 0000000..fa89afc
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingGetAllResponse.cs
@@ -0,0 +1,38 @@
+/**
+ * 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 System.Collections.Generic;
+using Org.Apache.REEF.Common.io;
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Response event for looking up all registered identifiers and their
+ /// mapped IPEndpoints
+ /// </summary>
+ internal class NamingGetAllResponse : NamingEvent
+ {
+ public NamingGetAllResponse(List<NameAssignment> assignments)
+ {
+ Assignments = assignments;
+ }
+
+ public List<NameAssignment> Assignments { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupRequest.cs
new file mode 100644
index 0000000..aad8659
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupRequest.cs
@@ -0,0 +1,36 @@
+/**
+ * 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 System.Collections.Generic;
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event to request look up of IPEndpoints in the Name Service
+ /// </summary>
+ internal class NamingLookupRequest : NamingEvent
+ {
+ public NamingLookupRequest(List<string> ids)
+ {
+ Identifiers = ids;
+ }
+
+ public List<string> Identifiers { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupResponse.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupResponse.cs
new file mode 100644
index 0000000..8f9a05b
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingLookupResponse.cs
@@ -0,0 +1,39 @@
+/**
+ * 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 System.Collections.Generic;
+using Microsoft.Hadoop.Avro;
+using Org.Apache.REEF.Common.io;
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event for lookup response in Name Service.
+ /// </summary>
+ internal class NamingLookupResponse : NamingEvent
+ {
+ public NamingLookupResponse(List<NameAssignment> nameAssignments)
+ {
+ NameAssignments = nameAssignments;
+ }
+
+ [NullableSchema]
+ public List<NameAssignment> NameAssignments { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterRequest.cs
new file mode 100644
index 0000000..49cbeb6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterRequest.cs
@@ -0,0 +1,36 @@
+/**
+ * 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.io;
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event to request registering an identifier and endpoint with the Name Service
+ /// </summary>
+ internal class NamingRegisterRequest : NamingEvent
+ {
+ public NamingRegisterRequest(NameAssignment nameAssignment)
+ {
+ NameAssignment = nameAssignment;
+ }
+
+ public NameAssignment NameAssignment { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterResponse.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterResponse.cs
new file mode 100644
index 0000000..d8a16c4
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingRegisterResponse.cs
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Response event for registering an IPEndpoint with the Name Service
+ /// </summary>
+ internal class NamingRegisterResponse : NamingEvent
+ {
+ public NamingRegisterResponse(NamingRegisterRequest request)
+ {
+ Request = request;
+ }
+
+ public NamingRegisterRequest Request { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterRequest.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterRequest.cs
new file mode 100644
index 0000000..e571e18
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterRequest.cs
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Event to request unregistering of an IPEndpoint with the Name Service
+ /// </summary>
+ internal class NamingUnregisterRequest : NamingEvent
+ {
+ public NamingUnregisterRequest(string identifier)
+ {
+ Identifier = identifier;
+ }
+
+ public string Identifier { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterResponse.cs b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterResponse.cs
new file mode 100644
index 0000000..7428fb5
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/Events/NamingUnregisterResponse.cs
@@ -0,0 +1,34 @@
+/**
+ * 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.
+ */
+
+namespace Org.Apache.REEF.Network.Naming.Events
+{
+ /// <summary>
+ /// Response event for unregistering of an IPEndpoint with the Name Service
+ /// </summary>
+ internal class NamingUnregisterResponse : NamingEvent
+ {
+ public NamingUnregisterResponse(NamingUnregisterRequest request)
+ {
+ Request = request;
+ }
+
+ public NamingUnregisterRequest Request { get; set; }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/INameServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/INameServer.cs b/lang/cs/Org.Apache.REEF.Network/Naming/INameServer.cs
new file mode 100644
index 0000000..c27abe6
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/INameServer.cs
@@ -0,0 +1,69 @@
+/**
+ * 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 System;
+using System.Collections.Generic;
+using System.Net;
+using Org.Apache.REEF.Common.io;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Tang.Annotations;
+
+namespace Org.Apache.REEF.Network.Naming
+{
+ /// <summary>
+ /// Service that manages names and IPEndpoints for well known hosts.
+ /// Can register, unregister, and look up IPAddresses using a string identifier.
+ /// </summary>
+ [DefaultImplementation(typeof(NameServer))]
+ public interface INameServer : IDisposable
+ {
+ /// <summary>
+ /// Listening endpoint for the NameServer
+ /// </summary>
+ IPEndPoint LocalEndpoint { get; }
+
+ /// <summary>
+ /// Looks up the IPEndpoints for each string identifier
+ /// </summary>
+ /// <param name="ids">The IDs to look up</param>
+ /// <returns>A list of Name assignments representing the identifier
+ /// that was searched for and the mapped IPEndpoint</returns>
+ List<NameAssignment> Lookup(List<string> ids);
+
+ /// <summary>
+ /// Gets all of the registered identifier/endpoint pairs.
+ /// </summary>
+ /// <returns>A list of all of the registered identifiers and their
+ /// mapped IPEndpoints</returns>
+ List<NameAssignment> GetAll();
+
+ /// <summary>
+ /// Registers the string identifier with the given IPEndpoint
+ /// </summary>
+ /// <param name="id">The string ident</param>
+ /// <param name="endpoint">The mapped endpoint</param>
+ void Register(string id, IPEndPoint endpoint);
+
+ /// <summary>
+ /// Unregister the given identifier with the NameServer
+ /// </summary>
+ /// <param name="id">The identifier to unregister</param>
+ void Unregister(string id);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Org.Apache.REEF.Network/Naming/NameClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Org.Apache.REEF.Network/Naming/NameClient.cs b/lang/cs/Org.Apache.REEF.Network/Naming/NameClient.cs
new file mode 100644
index 0000000..9b69cec
--- /dev/null
+++ b/lang/cs/Org.Apache.REEF.Network/Naming/NameClient.cs
@@ -0,0 +1,279 @@
+/**
+ * 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.io;
+using Org.Apache.REEF.Network.Naming.Codec;
+using Org.Apache.REEF.Network.Naming.Events;
+using Org.Apache.REEF.Utilities.Diagnostics;
+using Org.Apache.REEF.Utilities.Logging;
+using Org.Apache.REEF.Tang.Annotations;
+using Org.Apache.REEF.Wake;
+using Org.Apache.REEF.Wake.Remote;
+using Org.Apache.REEF.Wake.Remote.Impl;
+using Org.Apache.REEF.Wake.RX;
+using Org.Apache.REEF.Wake.RX.Impl;
+using System;
+using System.Collections.Concurrent;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Reactive;
+
+namespace Org.Apache.REEF.Network.Naming
+{
+ /// <summary>
+ /// Client for the Reef name service.
+ /// Used to register, unregister, and lookup IP Addresses of known hosts.
+ /// </summary>
+ public class NameClient : INameClient
+ {
+ private static Logger _logger = Logger.GetLogger(typeof(NameClient));
+
+ private BlockingCollection<NamingLookupResponse> _lookupResponseQueue;
+ private BlockingCollection<NamingGetAllResponse> _getAllResponseQueue;
+ private BlockingCollection<NamingRegisterResponse> _registerResponseQueue;
+ private BlockingCollection<NamingUnregisterResponse> _unregisterResponseQueue;
+
+ private TransportClient<NamingEvent> _client;
+
+ private NameLookupClient _lookupClient;
+ private NameRegisterClient _registerClient;
+
+ private bool _disposed;
+
+ /// <summary>
+ /// Constructs a NameClient to register, lookup, and unregister IPEndpoints
+ /// with the NameServer.
+ /// </summary>
+ /// <param name="remoteAddress">The ip address of the NameServer</param>
+ /// <param name="remotePort">The port of the NameServer</param>
+ [Inject]
+ public NameClient(
+ [Parameter(typeof(NamingConfigurationOptions.NameServerAddress))] string remoteAddress,
+ [Parameter(typeof(NamingConfigurationOptions.NameServerPort))] int remotePort)
+ {
+ IPEndPoint remoteEndpoint = new IPEndPoint(IPAddress.Parse(remoteAddress), remotePort);
+ Initialize(remoteEndpoint);
+ _disposed = false;
+ }
+
+ /// <summary>
+ /// Constructs a NameClient to register, lookup, and unregister IPEndpoints
+ /// with the NameServer.
+ /// </summary>
+ /// <param name="remoteEndpoint">The endpoint of the NameServer</param>
+ public NameClient(IPEndPoint remoteEndpoint)
+ {
+ Initialize(remoteEndpoint);
+ _disposed = false;
+ }
+
+ /// <summary>
+ /// Synchronously registers the identifier with the NameService.
+ /// Overwrites the previous mapping if the identifier has already
+ /// been registered.
+ /// </summary>
+ /// <param name="id">The key used to map the remote endpoint</param>
+ /// <param name="endpoint">The endpoint to map</param>
+ public void Register(string id, IPEndPoint endpoint)
+ {
+ if (id == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("id"), _logger);
+ }
+ if (endpoint == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("endpoint"), _logger);
+ }
+
+ _logger.Log(Level.Info, "Registering id: " + id + ", and endpoint: " + endpoint);
+ _registerClient.Register(id, endpoint);
+ }
+
+ /// <summary>
+ /// Synchronously unregisters the remote identifier with the NameService
+ /// </summary>
+ /// <param name="id">The identifier to unregister</param>
+ public void Unregister(string id)
+ {
+ if (id == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("id"), _logger);
+ }
+
+ _logger.Log(Level.Info, "Unregistering id: " + id);
+ _registerClient.Unregister(id);
+ }
+
+ /// <summary>
+ /// Synchronously looks up the IPEndpoint for the registered identifier.
+ /// </summary>
+ /// <param name="id">The identifier to look up</param>
+ /// <returns>The mapped IPEndpoint for the identifier, or null if
+ /// the identifier has not been registered with the NameService</returns>
+ public IPEndPoint Lookup(string id)
+ {
+ if (id == null)
+ {
+ Exceptions.Throw(new ArgumentNullException("id"), _logger);
+ }
+
+ List<NameAssignment> assignments = Lookup(new List<string> { id });
+ if (assignments != null && assignments.Count > 0)
+ {
+ return assignments.First().Endpoint;
+ }
+
+ return null;
+ }
+
+ /// <summary>
+ /// Synchronously looks up the IPEndpoint for each of the registered identifiers in the list.
+ /// </summary>
+ /// <param name="ids">The list of identifiers to look up</param>
+ /// <returns>The list of NameAssignments representing a pair of identifer
+ /// and mapped IPEndpoint for that identifier. If any of the requested identifiers
+ /// are not registered with the NameService, their corresponding NameAssignment
+ /// IPEndpoint value will be null.</returns>
+ public List<NameAssignment> Lookup(List<string> ids)
+ {
+ if (ids == null || ids.Count == 0)
+ {
+ Exceptions.Throw(new ArgumentNullException("ids cannot be null or empty"), _logger);
+ }
+
+ _logger.Log(Level.Verbose, "Looking up ids");
+ List<NameAssignment> assignments = _lookupClient.Lookup(ids);
+ if (assignments != null)
+ {
+ return assignments;
+ }
+ Exceptions.Throw(new WakeRuntimeException("NameClient failed to look up ids."), _logger);
+ return null; //above line will throw exception. So null will never be returned.
+ }
+
+ /// <summary>
+ /// Restart the name client in case of failure.
+ /// </summary>
+ /// <param name="serverEndpoint">The new server endpoint to connect to</param>
+ public void Restart(IPEndPoint serverEndpoint)
+ {
+ _client.Dispose();
+ Initialize(serverEndpoint);
+ }
+
+ /// <summary>
+ /// Releases resources used by NameClient
+ /// </summary>
+ public void Dispose()
+ {
+ Dispose(true);
+ GC.SuppressFinalize(this);
+ }
+
+ protected virtual void Dispose(bool disposing)
+ {
+ if (_disposed)
+ {
+ return;
+ }
+ if (disposing)
+ {
+ _client.Dispose();
+ }
+ _disposed = true;
+ }
+
+ /// <summary>
+ /// Create a new transport client connected to the NameServer at the given remote endpoint.
+ /// </summary>
+ /// <param name="serverEndpoint">The NameServer endpoint to connect to.</param>
+ private void Initialize(IPEndPoint serverEndpoint)
+ {
+ _lookupResponseQueue = new BlockingCollection<NamingLookupResponse>();
+ _getAllResponseQueue = new BlockingCollection<NamingGetAllResponse>();
+ _registerResponseQueue = new BlockingCollection<NamingRegisterResponse>();
+ _unregisterResponseQueue = new BlockingCollection<NamingUnregisterResponse>();
+
+ IObserver<TransportEvent<NamingEvent>> clientHandler = CreateClientHandler();
+ ICodec<NamingEvent> codec = CreateClientCodec();
+ _client = new TransportClient<NamingEvent>(serverEndpoint, codec, clientHandler);
+
+ _lookupClient = new NameLookupClient(_client, _lookupResponseQueue, _getAllResponseQueue);
+ _registerClient = new NameRegisterClient(_client, _registerResponseQueue, _unregisterResponseQueue);
+ }
+
+ /// <summary>
+ /// Create handler to handle async responses from the NameServer.
+ /// </summary>
+ /// <returns>The client handler to manage responses from the NameServer</returns>
+ private IObserver<TransportEvent<NamingEvent>> CreateClientHandler()
+ {
+ PubSubSubject<NamingEvent> subject = new PubSubSubject<NamingEvent>();
+ subject.Subscribe(Observer.Create<NamingLookupResponse>(msg => HandleResponse(_lookupResponseQueue, msg)));
+ subject.Subscribe(Observer.Create<NamingGetAllResponse>(msg => HandleResponse(_getAllResponseQueue, msg)));
+ subject.Subscribe(Observer.Create<NamingRegisterResponse>(msg => HandleResponse(_registerResponseQueue, msg)));
+ subject.Subscribe(Observer.Create<NamingUnregisterResponse>(msg => HandleResponse(_unregisterResponseQueue, msg)));
+ return new ClientObserver(subject);
+ }
+
+ /// <summary>
+ /// Create the codec used to serialize/deserialize NamingEvent messages
+ /// </summary>
+ /// <returns>The serialization codec</returns>
+ private ICodec<NamingEvent> CreateClientCodec()
+ {
+ MultiCodec<NamingEvent> codec = new MultiCodec<NamingEvent>();
+ codec.Register(new NamingLookupRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupRequest");
+ codec.Register(new NamingLookupResponseCodec(), "org.apache.reef.io.network.naming.serialization.NamingLookupResponse");
+ NamingRegisterRequestCodec requestCodec = new NamingRegisterRequestCodec();
+ codec.Register(requestCodec, "org.apache.reef.io.network.naming.serialization.NamingRegisterRequest");
+ codec.Register(new NamingRegisterResponseCodec(requestCodec), "org.apache.reef.io.network.naming.serialization.NamingRegisterResponse");
+ codec.Register(new NamingUnregisterRequestCodec(), "org.apache.reef.io.network.naming.serialization.NamingUnregisterRequest");
+ return codec;
+ }
+
+ private void HandleResponse<T>(BlockingCollection<T> queue, T message)
+ {
+ queue.Add(message);
+ }
+
+ /// <summary>
+ /// Helper class used to handle response events from the NameServer.
+ /// Delegates the event to the appropriate response queue depending on
+ /// its event type.
+ /// </summary>
+ private class ClientObserver : AbstractObserver<TransportEvent<NamingEvent>>
+ {
+ private IObserver<NamingEvent> _handler;
+
+ public ClientObserver(IObserver<NamingEvent> handler)
+ {
+ _handler = handler;
+ }
+
+ public override void OnNext(TransportEvent<NamingEvent> value)
+ {
+ NamingEvent message = value.Data;
+ message.Link = value.Link;
+ _handler.OnNext(message);
+ }
+ }
+ }
+}
[3/5] incubator-reef git commit: [REEF-139] Changing .Net project
structure for Network and Evaluator
Posted by we...@apache.org.
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/ReefDotNet.sln
----------------------------------------------------------------------
diff --git a/lang/cs/ReefDotNet.sln b/lang/cs/ReefDotNet.sln
index 962149a..10258b3 100644
--- a/lang/cs/ReefDotNet.sln
+++ b/lang/cs/ReefDotNet.sln
@@ -10,14 +10,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{2B7EE9
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Network", "Source\REEF\reef-io\Network\Network.csproj", "{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tasks", "Source\REEF\reef-tasks\Tasks\Tasks.csproj", "{75503F90-7B82-4762-9997-94B5C68F15DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CLRBridgeClient", "Source\REEF\reef-applications\CLRBridgeClient\CLRBridgeClient.csproj", "{5094C35B-4FDB-4322-AC05-45D684501CBF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Evaluator", "Source\REEF\reef-applications\Evaluator\Evaluator.csproj", "{1B983182-9C30-464C-948D-F87EB93A8240}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HelloCLRBridge", "Source\REEF\reef-examples\HelloCLRBridge\HelloCLRBridge.csproj", "{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RetainedEvalCLRBridge", "Source\REEF\reef-examples\RetainedEvalCLRBridge\RetainedEvalCLRBridge.csproj", "{A33C20FB-A76E-494C-80C5-BCE4BAD876D3}"
@@ -44,6 +40,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Common", "O
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Driver", "Org.Apache.REEF.Driver\Org.Apache.REEF.Driver.csproj", "{A6BAA2A7-F52F-4329-884E-1BCF711D6805}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Evaluator", "Org.Apache.REEF.Evaluator\Org.Apache.REEF.Evaluator.csproj", "{1B983182-9C30-464C-948D-F87EB93A8240}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Org.Apache.REEF.Network", "Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj", "{883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -52,14 +52,6 @@ Global
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|x64.ActiveCfg = Debug|x64
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|x64.Build.0 = Debug|x64
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|Any CPU.Build.0 = Release|Any CPU
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.ActiveCfg = Release|x64
- {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.Build.0 = Release|x64
{75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{75503F90-7B82-4762-9997-94B5C68F15DB}.Debug|x64.ActiveCfg = Debug|x64
@@ -76,14 +68,6 @@ Global
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Release|Any CPU.Build.0 = Release|Any CPU
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Release|x64.ActiveCfg = Release|x64
{5094C35B-4FDB-4322-AC05-45D684501CBF}.Release|x64.Build.0 = Release|x64
- {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|x64.ActiveCfg = Debug|x64
- {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|x64.Build.0 = Debug|x64
- {1B983182-9C30-464C-948D-F87EB93A8240}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {1B983182-9C30-464C-948D-F87EB93A8240}.Release|Any CPU.Build.0 = Release|Any CPU
- {1B983182-9C30-464C-948D-F87EB93A8240}.Release|x64.ActiveCfg = Release|x64
- {1B983182-9C30-464C-948D-F87EB93A8240}.Release|x64.Build.0 = Release|x64
{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A78DD8E8-31D0-4506-8738-DAA9DA86D55B}.Debug|x64.ActiveCfg = Debug|x64
@@ -188,6 +172,22 @@ Global
{A6BAA2A7-F52F-4329-884E-1BCF711D6805}.Release|Any CPU.Build.0 = Release|Any CPU
{A6BAA2A7-F52F-4329-884E-1BCF711D6805}.Release|x64.ActiveCfg = Release|x64
{A6BAA2A7-F52F-4329-884E-1BCF711D6805}.Release|x64.Build.0 = Release|x64
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|x64.ActiveCfg = Debug|x64
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Debug|x64.Build.0 = Debug|x64
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Release|x64.ActiveCfg = Release|x64
+ {1B983182-9C30-464C-948D-F87EB93A8240}.Release|x64.Build.0 = Release|x64
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|x64.ActiveCfg = Debug|x64
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Debug|x64.Build.0 = Debug|x64
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.ActiveCfg = Release|x64
+ {883CE800-6A6A-4E0A-B7FE-C054F4F2C1DC}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs
index da64eff..ce2857f 100644
--- a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs
+++ b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.cs
@@ -24,7 +24,7 @@ using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Driver.Defaults;
using Org.Apache.REEF.Examples.HelloCLRBridge;
using Org.Apache.REEF.Examples.HelloCLRBridge.Handlers;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Tang.Interface;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj
index 20c8f97..8b732ba 100644
--- a/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj
+++ b/lang/cs/Source/REEF/reef-applications/CLRBridgeClient/CLRBridgeClient.csproj
@@ -98,10 +98,6 @@ under the License.
<Project>{a33c20fb-a76e-494c-80c5-bce4bad876d3}</Project>
<Name>RetainedEvalCLRBridge</Name>
</ProjectReference>
- <ProjectReference Include="$(SourceDir)\Reef\reef-io\NetWork\NetWork.csproj">
- <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
- <Name>NetWork</Name>
- </ProjectReference>
<ProjectReference Include="$(SourceDir)\Reef\reef-tasks\Tasks\Tasks.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
<Name>Tasks</Name>
@@ -118,6 +114,10 @@ under the License.
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
<Name>Org.Apache.Reef.Driver</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
<Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
<Name>Org.Apache.Reef.Wake</Name>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.cs b/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.cs
deleted file mode 100644
index 39ebfc3..0000000
--- a/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.cs
+++ /dev/null
@@ -1,261 +0,0 @@
-/**
- * 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;
-using Org.Apache.REEF.Common.Context;
-using Org.Apache.REEF.Common.Evaluator.Context;
-using Org.Apache.REEF.Common.ProtoBuf.ReefProtocol;
-using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.Services;
-using Org.Apache.REEF.Tang.Formats;
-using Org.Apache.REEF.Tang.Implementations.InjectionPlan;
-using Org.Apache.REEF.Tang.Implementations.Tang;
-using Org.Apache.REEF.Tang.Interface;
-using Org.Apache.REEF.Tasks;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Utilities.Diagnostics;
-using Org.Apache.REEF.Utilities.Logging;
-using Org.Apache.REEF.Wake.Remote;
-using Org.Apache.REEF.Wake.Remote.Impl;
-using Org.Apache.REEF.Wake.Time.Runtime.Event;
-using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-
-namespace Org.Apache.REEF.Evaluator
-{
- public class Evaluator
- {
- private static Logger _logger;
-
- private static int _heartbeatPeriodInMs = Constants.DefaultEvaluatorHeartbeatPeriodInMs;
-
- private static int _heartbeatMaxRetry = Constants.DefaultEvaluatorHeartbeatMaxRetry;
-
- private static IInjector _injector;
-
- private static EvaluatorConfigurations _evaluatorConfig;
-
- public static void Main(string[] args)
- {
- Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "START: {0} Evaluator::InitInjector.", DateTime.Now));
- Stopwatch timer = new Stopwatch();
- InitInjector();
- SetCustomTraceListners();
- timer.Stop();
- Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "EXIT: {0} Evaluator::InitInjector. Duration: [{1}].", DateTime.Now, timer.Elapsed));
-
- RuntimeClock clock;
-
- using (_logger.LogScope("Evaluator::Main"))
- {
- string debugEnabledString = Environment.GetEnvironmentVariable("Org.Apache.REEF.EvaluatorDebug");
- if (!string.IsNullOrWhiteSpace(debugEnabledString) &&
- debugEnabledString.Equals("enabled", StringComparison.OrdinalIgnoreCase))
- {
- while (true)
- {
- if (Debugger.IsAttached)
- {
- break;
- }
- else
- {
- _logger.Log(Level.Info, "Evaluator in debug mode, waiting for debugger to be attached...");
- Thread.Sleep(2000);
- }
- }
- }
-
- AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionHandler;
-
- string heartbeatPeriodFromConfig = ConfigurationManager.AppSettings["EvaluatorHeartbeatPeriodInMs"];
-
- int heartbeatPeriod = 0;
-
- if (!string.IsNullOrWhiteSpace(heartbeatPeriodFromConfig) &&
- int.TryParse(heartbeatPeriodFromConfig, out heartbeatPeriod))
- {
- _heartbeatPeriodInMs = heartbeatPeriod;
- }
- _logger.Log(Level.Verbose,
- "Evaluator heartbeat period set to be " + _heartbeatPeriodInMs + " milliSeconds.");
-
- int maxHeartbeatRetry = 0;
- string heartbeatMaxRetryFromConfig = ConfigurationManager.AppSettings["EvaluatorHeartbeatRetryMaxTimes"];
-
- if (!string.IsNullOrWhiteSpace(heartbeatMaxRetryFromConfig) &&
- int.TryParse(heartbeatMaxRetryFromConfig, out maxHeartbeatRetry))
- {
- _heartbeatMaxRetry = maxHeartbeatRetry;
- }
- _logger.Log(Level.Verbose, "Evaluator heatrbeat max retry set to be " + _heartbeatMaxRetry + " times.");
-
- if (args.Count() < 2)
- {
- var e = new InvalidOperationException("must supply at least the rId and evaluator config file");
- Exceptions.Throw(e, _logger);
- }
-
- // remote driver Id
- string rId = args[0];
-
- // evaluator configuraiton file
- string evaluatorConfigurationPath = args[1];
-
- ICodec<REEFMessage> reefMessageCodec = new REEFMessageCodec();
-
- _evaluatorConfig = new EvaluatorConfigurations(evaluatorConfigurationPath);
-
- string rootContextConfigString = _evaluatorConfig.RootContextConfiguration;
- if (string.IsNullOrWhiteSpace(rootContextConfigString))
- {
- Exceptions.Throw(new ArgumentException("empty or null rootContextConfigString"), _logger);
- }
- ContextConfiguration rootContextConfiguration = new ContextConfiguration(rootContextConfigString);
-
- string taskConfig = _evaluatorConfig.TaskConfiguration;
- Optional<TaskConfiguration> rootTaskConfig = string.IsNullOrEmpty(taskConfig)
- ? Optional<TaskConfiguration>.Empty()
- : Optional<TaskConfiguration>.Of(
- new TaskConfiguration(taskConfig));
- string rootServiceConfigString = _evaluatorConfig.RootServiceConfiguration;
- Optional<ServiceConfiguration> rootServiceConfig = string.IsNullOrEmpty(rootServiceConfigString)
- ? Optional<ServiceConfiguration>.Empty()
- : Optional<ServiceConfiguration>.Of(
- new ServiceConfiguration(
- rootServiceConfigString));
-
- // remoteManager used as client-only in evaluator
- IRemoteManager<REEFMessage> remoteManager = new DefaultRemoteManager<REEFMessage>(reefMessageCodec);
- IRemoteIdentifier remoteId = new SocketRemoteIdentifier(NetUtilities.ParseIpEndpoint(rId));
-
- ConfigurationModule module = new ConfigurationModuleBuilder().Build();
- IConfiguration clockConfiguraiton = module.Build();
-
- clock =
- TangFactory.GetTang().NewInjector(clockConfiguraiton).GetInstance<RuntimeClock>();
- _logger.Log(Level.Info, "Application Id: " + _evaluatorConfig.ApplicationId);
-
- EvaluatorSettings evaluatorSettings = new EvaluatorSettings(
- _evaluatorConfig.ApplicationId,
- _evaluatorConfig.EvaluatorId,
- _heartbeatPeriodInMs,
- _heartbeatMaxRetry,
- rootContextConfiguration,
- clock,
- remoteManager,
- _injector);
-
- HeartBeatManager heartBeatManager = new HeartBeatManager(evaluatorSettings, remoteId);
- ContextManager contextManager = new ContextManager(heartBeatManager, rootServiceConfig, rootTaskConfig);
- EvaluatorRuntime evaluatorRuntime = new EvaluatorRuntime(contextManager, heartBeatManager);
-
- // TODO: repalce with injectionFuture
- heartBeatManager._evaluatorRuntime = evaluatorRuntime;
- heartBeatManager._contextManager = contextManager;
-
- SetRuntimeHanlders(evaluatorRuntime, clock);
- }
-
- Task evaluatorTask = Task.Run(new Action(clock.Run));
- evaluatorTask.Wait();
- }
-
- private static void InitInjector()
- {
- string clrRuntimeConfigurationFile = Path.Combine(Directory.GetCurrentDirectory(), "reef", "global",
- Common.Constants.ClrBridgeRuntimeConfiguration);
- if (!File.Exists(clrRuntimeConfigurationFile))
- {
- var e =
- new InvalidOperationException("Cannot find clrRuntimeConfiguration from " +
- clrRuntimeConfigurationFile);
- Exceptions.Throw(e, _logger);
- }
-
- try
- {
- IConfiguration clrBridgeConfiguration =
- new AvroConfigurationSerializer().FromFile(clrRuntimeConfigurationFile);
- _injector = TangFactory.GetTang().NewInjector(clrBridgeConfiguration);
- }
- catch (Exception e)
- {
- Exceptions.Caught(e, Level.Error, "Cannot obtain injector from clr bridge configuration.", _logger);
- Exceptions.Throw(
- new InvalidOperationException("Cannot obtain injector from clr bridge configuration.", e),
- _logger);
- }
- }
-
- private static void SetCustomTraceListners()
- {
- ISet<TraceListener> customTraceListeners;
- CustomTraceListeners listeners = null;
- try
- {
- listeners = _injector.GetInstance<CustomTraceListeners>();
- customTraceListeners = listeners.Listeners;
- }
- catch (Exception e)
- {
- Exceptions.Caught(e, Level.Error, _logger);
- // custom trace listner not set properly, use empty set
- customTraceListeners = new HashSet<TraceListener>();
- }
- foreach (TraceListener listener in customTraceListeners)
- {
- Logger.AddTraceListner(listener);
- }
- _logger = Logger.GetLogger(typeof(Evaluator));
- CustomTraceLevel traceLevel = _injector.GetInstance<CustomTraceLevel>();
- Logger.SetCustomLevel(traceLevel.TraceLevel);
- }
-
- private static void UnhandledExceptionHandler(object sender, UnhandledExceptionEventArgs e)
- {
- Exception ex = default(Exception);
- ex = (Exception)e.ExceptionObject;
- _logger.Log(Level.Error, "Unhandled exception caught in Evaluator.", ex);
- Exceptions.Throw(new InvalidOperationException("Unhandled exception caught in Evaluator.", ex), _logger);
- }
-
- // set the handlers for runtimeclock manually
- // we only need runtimestart and runtimestop handlers now
- private static void SetRuntimeHanlders(EvaluatorRuntime evaluatorRuntime, RuntimeClock clock)
- {
- HashSet<IObserver<RuntimeStart>> runtimeStarts = new HashSet<IObserver<RuntimeStart>>();
- runtimeStarts.Add(evaluatorRuntime);
- InjectionFutureImpl<ISet<IObserver<RuntimeStart>>> injectRuntimeStart = new InjectionFutureImpl<ISet<IObserver<RuntimeStart>>>(runtimeStarts);
- clock.InjectedRuntimeStartHandler = injectRuntimeStart;
-
- HashSet<IObserver<RuntimeStop>> runtimeStops = new HashSet<IObserver<RuntimeStop>>();
- runtimeStops.Add(evaluatorRuntime);
- InjectionFutureImpl<ISet<IObserver<RuntimeStop>>> injectRuntimeStop = new InjectionFutureImpl<ISet<IObserver<RuntimeStop>>>(runtimeStops);
- clock.InjectedRuntimeStopHandler = injectRuntimeStop;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.csproj b/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.csproj
deleted file mode 100644
index f64b15f..0000000
--- a/lang/cs/Source/REEF/reef-applications/Evaluator/Evaluator.csproj
+++ /dev/null
@@ -1,124 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{1B983182-9C30-464C-948D-F87EB93A8240}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Org.Apache.Reef.Evaluator</RootNamespace>
- <AssemblyName>Org.Apache.Reef.Evaluator</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- <RestorePackages>true</RestorePackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\..\..</SolutionDir>
- <RestorePackages>true</RestorePackages>
- </PropertyGroup>
- <Import Project="$(SolutionDir)\Source\build.props" />
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' ">
- <PlatformTarget>AnyCPU</PlatformTarget>
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>$(BinDir)\$(Platform)\$(Configuration)\$(RootNamespace)</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="protobuf-net">
- <HintPath>$(PackagesDir)\protobuf-net.$(ProtobufVersion)\lib\net40\protobuf-net.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Evaluator.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <None Include="packages.config" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.Reef.Tang\Org.Apache.Reef.Tang.csproj">
- <Project>{97dbb573-3994-417a-9f69-ffa25f00d2a6}</Project>
- <Name>Org.Apache.Reef.Tang</Name>
- </ProjectReference>
- <ProjectReference Include="$(SolutionDir)\Org.Apache.Reef.Utilities\Org.Apache.Reef.Utilities.csproj">
- <Project>{79e7f89a-1dfb-45e1-8d43-d71a954aeb98}</Project>
- <Name>Org.Apache.Reef.Utilities</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Common\Org.Apache.Reef.Common.csproj">
- <Project>{545a0582-4105-44ce-b99c-b1379514a630}</Project>
- <Name>Org.Apache.Reef.Common</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Driver\Org.Apache.Reef.Driver.csproj">
- <Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
- <Name>Org.Apache.Reef.Driver</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
- <Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
- <Name>Org.Apache.Reef.Wake</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/Evaluator/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/Evaluator/Properties/AssemblyInfo.cs b/lang/cs/Source/REEF/reef-applications/Evaluator/Properties/AssemblyInfo.cs
deleted file mode 100644
index 51ff356..0000000
--- a/lang/cs/Source/REEF/reef-applications/Evaluator/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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 System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("Evaluator")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("Evaluator")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("a64dc535-9b1e-41a4-8303-117f8b28c8c0")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-applications/Evaluator/packages.config
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-applications/Evaluator/packages.config b/lang/cs/Source/REEF/reef-applications/Evaluator/packages.config
deleted file mode 100644
index 81b0ef5..0000000
--- a/lang/cs/Source/REEF/reef-applications/Evaluator/packages.config
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-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.
--->
-<packages>
- <package id="protobuf-net" version="2.0.0.668" targetFramework="net45" />
-</packages>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj
index 604943e..29f173b 100644
--- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj
+++ b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/HelloCLRBridge.csproj
@@ -98,10 +98,6 @@ under the License.
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <ProjectReference Include="$(SourceDir)\Reef\reef-io\NetWork\NetWork.csproj">
- <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
- <Name>NetWork</Name>
- </ProjectReference>
<ProjectReference Include="$(SourceDir)\Reef\reef-tasks\Tasks\Tasks.csproj">
<Project>{75503f90-7b82-4762-9997-94b5c68f15db}</Project>
<Name>Tasks</Name>
@@ -122,6 +118,10 @@ under the License.
<Project>{a6baa2a7-f52f-4329-884e-1bcf711d6805}</Project>
<Name>Org.Apache.Reef.Driver</Name>
</ProjectReference>
+ <ProjectReference Include="..\..\..\..\Org.Apache.REEF.Network\Org.Apache.REEF.Network.csproj">
+ <Project>{883ce800-6a6a-4e0a-b7fe-c054f4f2c1dc}</Project>
+ <Name>Org.Apache.REEF.Network</Name>
+ </ProjectReference>
<ProjectReference Include="..\..\..\..\Org.Apache.Reef.Wake\Org.Apache.Reef.Wake.csproj">
<Project>{cdfb3464-4041-42b1-9271-83af24cd5008}</Project>
<Name>Org.Apache.Reef.Wake</Name>
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
index 5d8438c..bdf04cf 100644
--- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
+++ b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloAllocatedEvaluatorHandler.cs
@@ -21,7 +21,7 @@ using Org.Apache.REEF.Common.io;
using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Driver.Context;
using Org.Apache.REEF.Driver.Evaluator;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Services;
using Org.Apache.REEF.Tang.Annotations;
using Org.Apache.REEF.Tang.Implementations.Configuration;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
index 8fa18da..43962cb 100644
--- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
+++ b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloSimpleEventHandlers.cs
@@ -30,7 +30,7 @@ using Org.Apache.REEF.Driver.Bridge;
using Org.Apache.REEF.Driver.Context;
using Org.Apache.REEF.Driver.Evaluator;
using Org.Apache.REEF.Driver.Task;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Utilities;
using Org.Apache.REEF.Utilities.Logging;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloStartHandler.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloStartHandler.cs b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloStartHandler.cs
index 37cdca4..8d10471 100644
--- a/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloStartHandler.cs
+++ b/lang/cs/Source/REEF/reef-examples/HelloCLRBridge/handlers/HelloStartHandler.cs
@@ -22,7 +22,7 @@ using Org.Apache.REEF.Common.io;
using Org.Apache.REEF.Driver;
using Org.Apache.REEF.Driver.bridge;
using Org.Apache.REEF.Driver.Bridge;
-using Org.Apache.REEF.IO.Network.Naming;
+using Org.Apache.REEF.Network.Naming;
using Org.Apache.REEF.Tasks;
using Org.Apache.REEF.Utilities.Logging;
using Org.Apache.REEF.Tang.Annotations;
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupRequestCodec.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupRequestCodec.cs
deleted file mode 100644
index dd08079..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupRequestCodec.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.IO.Network.Naming.Events;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Wake.Remote;
-using org.apache.reef.io.network.naming.avro;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Codec
-{
- internal class NamingLookupRequestCodec : ICodec<NamingLookupRequest>
- {
- public byte[] Encode(NamingLookupRequest obj)
- {
- var request = new AvroNamingLookupRequest { ids = obj.Identifiers };
- return AvroUtils.AvroSerialize(request);
- }
-
- public NamingLookupRequest Decode(byte[] data)
- {
- AvroNamingLookupRequest request = AvroUtils.AvroDeserialize<AvroNamingLookupRequest>(data);
- return new NamingLookupRequest(request.ids);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupResponseCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupResponseCodec.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupResponseCodec.cs
deleted file mode 100644
index 9e391ae..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingLookupResponseCodec.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Wake.Remote;
-using System.Collections.Generic;
-using System.Linq;
-using org.apache.reef.io.network.naming.avro;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Codec
-{
- internal class NamingLookupResponseCodec : ICodec<NamingLookupResponse>
- {
- public byte[] Encode(NamingLookupResponse obj)
- {
- List<AvroNamingAssignment> tuples = obj.NameAssignments
- .Select(assignment => new AvroNamingAssignment()
- {
- id = assignment.Identifier,
- host = assignment.Endpoint.Address.ToString(),
- port = assignment.Endpoint.Port
- }).ToList();
-
- AvroNamingLookupResponse response = new AvroNamingLookupResponse { tuples = tuples };
- return AvroUtils.AvroSerialize(response);
- }
-
- public NamingLookupResponse Decode(byte[] data)
- {
- AvroNamingLookupResponse response = AvroUtils.AvroDeserialize<AvroNamingLookupResponse>(data);
- List<NameAssignment> assignments =
- response.tuples.Select(x => new NameAssignment(x.id, x.host, x.port)).ToList();
-
- return new NamingLookupResponse(assignments);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterRequestCodec.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterRequestCodec.cs
deleted file mode 100644
index dcf2928..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterRequestCodec.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Wake.Remote;
-using org.apache.reef.io.network.naming.avro;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Codec
-{
- internal class NamingRegisterRequestCodec : ICodec<NamingRegisterRequest>
- {
- public byte[] Encode(NamingRegisterRequest obj)
- {
- AvroNamingRegisterRequest request = new AvroNamingRegisterRequest
- {
- id = obj.NameAssignment.Identifier,
- host = obj.NameAssignment.Endpoint.Address.ToString(),
- port = obj.NameAssignment.Endpoint.Port
- };
- return AvroUtils.AvroSerialize(request);
- }
-
- public NamingRegisterRequest Decode(byte[] data)
- {
- AvroNamingRegisterRequest request = AvroUtils.AvroDeserialize<AvroNamingRegisterRequest>(data);
- return new NamingRegisterRequest(new NameAssignment(request.id, request.host, request.port));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterResponseCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterResponseCodec.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterResponseCodec.cs
deleted file mode 100644
index b851718..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingRegisterResponseCodec.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.IO.Network.Naming.Events;
-using Org.Apache.REEF.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Codec
-{
- internal class NamingRegisterResponseCodec : ICodec<NamingRegisterResponse>
- {
- private NamingRegisterRequestCodec _codec;
-
- public NamingRegisterResponseCodec(NamingRegisterRequestCodec codec)
- {
- _codec = codec;
- }
-
- public byte[] Encode(NamingRegisterResponse obj)
- {
- return _codec.Encode(obj.Request);
- }
-
- public NamingRegisterResponse Decode(byte[] data)
- {
- return new NamingRegisterResponse(_codec.Decode(data));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingUnregisterRequestCodec.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingUnregisterRequestCodec.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingUnregisterRequestCodec.cs
deleted file mode 100644
index 94b3b1f..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Codec/NamingUnregisterRequestCodec.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.IO.Network.Naming.Events;
-using Org.Apache.REEF.Utilities;
-using Org.Apache.REEF.Wake.Remote;
-using org.apache.reef.io.network.naming.avro;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Codec
-{
- internal class NamingUnregisterRequestCodec : ICodec<NamingUnregisterRequest>
- {
- public byte[] Encode(NamingUnregisterRequest obj)
- {
- AvroNamingUnRegisterRequest request = new AvroNamingUnRegisterRequest { id = obj.Identifier };
- return AvroUtils.AvroSerialize(request);
- }
-
- public NamingUnregisterRequest Decode(byte[] data)
- {
- AvroNamingUnRegisterRequest request = AvroUtils.AvroDeserialize<AvroNamingUnRegisterRequest>(data);
- return new NamingUnregisterRequest(request.id);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingAssignment.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingAssignment.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingAssignment.cs
deleted file mode 100644
index 5cfd5ab..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingAssignment.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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 System.Runtime.Serialization;
-
-//---------- Auto-generated ------------
-namespace org.apache.reef.io.network.naming.avro
-{
- /// <summary>
- /// Used to serialize and deserialize Avro record org.apache.reef.io.network.naming.avro.AvroNamingAssignment.
- /// </summary>
- [DataContract]
- public class AvroNamingAssignment
- {
- private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingAssignment"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}";
-
- /// <summary>
- /// Gets the schema.
- /// </summary>
- public static string Schema
- {
- get
- {
- return JsonSchema;
- }
- }
-
- /// <summary>
- /// Gets or sets the id field.
- /// </summary>
- [DataMember]
- public string id { get; set; }
-
- /// <summary>
- /// Gets or sets the host field.
- /// </summary>
- [DataMember]
- public string host { get; set; }
-
- /// <summary>
- /// Gets or sets the port field.
- /// </summary>
- [DataMember]
- public int port { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupRequest.cs
deleted file mode 100644
index 0698fd6..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupRequest.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using System.Runtime.Serialization;
-
-//---------- Auto-generated ------------
-namespace org.apache.reef.io.network.naming.avro
-{
- /// <summary>
- /// Used to serialize and deserialize Avro record org.apache.reef.io.network.naming.avro.AvroNamingLookupRequest.
- /// </summary>
- [DataContract]
- public class AvroNamingLookupRequest
- {
- private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingLookupRequest"",""fields"":[{""name"":""ids"",""type"":{""type"":""array"",""items"":""string""}}]}";
-
- /// <summary>
- /// Gets the schema.
- /// </summary>
- public static string Schema
- {
- get
- {
- return JsonSchema;
- }
- }
-
- /// <summary>
- /// Gets or sets the ids field.
- /// </summary>
- [DataMember]
- public List<string> ids { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupResponse.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupResponse.cs
deleted file mode 100644
index 4599faa..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingLookupResponse.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using System.Runtime.Serialization;
-
-//---------- Auto-generated ------------
-namespace org.apache.reef.io.network.naming.avro
-{
- /// <summary>
- /// Used to serialize and deserialize Avro record org.apache.reef.io.network.naming.avro.AvroNamingLookupResponse.
- /// </summary>
- [DataContract]
- public class AvroNamingLookupResponse
- {
- private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingLookupResponse"",""fields"":[{""name"":""tuples"",""type"":{""type"":""array"",""items"":{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingAssignment"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}}}]}";
-
- /// <summary>
- /// Gets the schema.
- /// </summary>
- public static string Schema
- {
- get
- {
- return JsonSchema;
- }
- }
-
- /// <summary>
- /// Gets or sets the tuples field.
- /// </summary>
- [DataMember]
- public List<AvroNamingAssignment> tuples { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingRegisterRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingRegisterRequest.cs
deleted file mode 100644
index 76f14be..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingRegisterRequest.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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 System.Runtime.Serialization;
-
-//---------- Auto-generated ------------
-namespace org.apache.reef.io.network.naming.avro
-{
- /// <summary>
- /// Used to serialize and deserialize Avro record org.apache.reef.io.network.naming.avro.AvroNamingRegisterRequest.
- /// </summary>
- [DataContract]
- public class AvroNamingRegisterRequest
- {
- private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingRegisterRequest"",""fields"":[{""name"":""id"",""type"":""string""},{""name"":""host"",""type"":""string""},{""name"":""port"",""type"":""int""}]}";
-
- /// <summary>
- /// Gets the schema.
- /// </summary>
- public static string Schema
- {
- get
- {
- return JsonSchema;
- }
- }
-
- /// <summary>
- /// Gets or sets the id field.
- /// </summary>
- [DataMember]
- public string id { get; set; }
-
- /// <summary>
- /// Gets or sets the host field.
- /// </summary>
- [DataMember]
- public string host { get; set; }
-
- /// <summary>
- /// Gets or sets the port field.
- /// </summary>
- [DataMember]
- public int port { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
deleted file mode 100644
index 299e940..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Contracts/AvroNamingUnRegisterRequest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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 System.Runtime.Serialization;
-
-//---------- Auto-generated ------------
-namespace org.apache.reef.io.network.naming.avro
-{
- /// <summary>
- /// Used to serialize and deserialize Avro record org.apache.reef.io.network.naming.avro.AvroNamingUnRegisterRequest.
- /// </summary>
- [DataContract]
- public class AvroNamingUnRegisterRequest
- {
- private const string JsonSchema = @"{""type"":""record"",""name"":""org.apache.reef.io.network.naming.avro.AvroNamingUnRegisterRequest"",""fields"":[{""name"":""id"",""type"":""string""}]}";
-
- /// <summary>
- /// Gets the schema.
- /// </summary>
- public static string Schema
- {
- get
- {
- return JsonSchema;
- }
- }
-
- /// <summary>
- /// Gets or sets the id field.
- /// </summary>
- [DataMember]
- public string id { get; set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingEvent.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingEvent.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingEvent.cs
deleted file mode 100644
index 8264322..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingEvent.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.Wake.Remote;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event representing a lookup, registering, or unregistering of
- /// an identifier with the Name Service.
- /// </summary>
- internal class NamingEvent
- {
- /// <summary>
- /// The link for communication between the NameClient and NameServer
- /// </summary>
- public ILink<NamingEvent> Link { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllRequest.cs
deleted file mode 100644
index 11068d4..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllRequest.cs
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.
- */
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event to request all registered identifiers and their mapped
- /// IPEndpoints
- /// </summary>
- internal class NamingGetAllRequest : NamingEvent
- {
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllResponse.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllResponse.cs
deleted file mode 100644
index c1ece31..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingGetAllResponse.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using Org.Apache.REEF.Common.io;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Response event for looking up all registered identifiers and their
- /// mapped IPEndpoints
- /// </summary>
- internal class NamingGetAllResponse : NamingEvent
- {
- public NamingGetAllResponse(List<NameAssignment> assignments)
- {
- Assignments = assignments;
- }
-
- public List<NameAssignment> Assignments { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupRequest.cs
deleted file mode 100644
index 09e82dd..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupRequest.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event to request look up of IPEndpoints in the Name Service
- /// </summary>
- internal class NamingLookupRequest : NamingEvent
- {
- public NamingLookupRequest(List<string> ids)
- {
- Identifiers = ids;
- }
-
- public List<string> Identifiers { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupResponse.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupResponse.cs
deleted file mode 100644
index 337f433..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingLookupResponse.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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 System.Collections.Generic;
-using Microsoft.Hadoop.Avro;
-using Org.Apache.REEF.Common.io;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event for lookup response in Name Service.
- /// </summary>
- internal class NamingLookupResponse : NamingEvent
- {
- public NamingLookupResponse(List<NameAssignment> nameAssignments)
- {
- NameAssignments = nameAssignments;
- }
-
- [NullableSchema]
- public List<NameAssignment> NameAssignments { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterRequest.cs
deleted file mode 100644
index 365ac04..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterRequest.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.io;
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event to request registering an identifier and endpoint with the Name Service
- /// </summary>
- internal class NamingRegisterRequest : NamingEvent
- {
- public NamingRegisterRequest(NameAssignment nameAssignment)
- {
- NameAssignment = nameAssignment;
- }
-
- public NameAssignment NameAssignment { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterResponse.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterResponse.cs
deleted file mode 100644
index d8e49be..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingRegisterResponse.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Response event for registering an IPEndpoint with the Name Service
- /// </summary>
- internal class NamingRegisterResponse : NamingEvent
- {
- public NamingRegisterResponse(NamingRegisterRequest request)
- {
- Request = request;
- }
-
- public NamingRegisterRequest Request { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterRequest.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterRequest.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterRequest.cs
deleted file mode 100644
index 0698de2..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterRequest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Event to request unregistering of an IPEndpoint with the Name Service
- /// </summary>
- internal class NamingUnregisterRequest : NamingEvent
- {
- public NamingUnregisterRequest(string identifier)
- {
- Identifier = identifier;
- }
-
- public string Identifier { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterResponse.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterResponse.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterResponse.cs
deleted file mode 100644
index 56268d8..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/Events/NamingUnregisterResponse.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.
- */
-
-namespace Org.Apache.REEF.IO.Network.Naming.Events
-{
- /// <summary>
- /// Response event for unregistering of an IPEndpoint with the Name Service
- /// </summary>
- internal class NamingUnregisterResponse : NamingEvent
- {
- public NamingUnregisterResponse(NamingUnregisterRequest request)
- {
- Request = request;
- }
-
- public NamingUnregisterRequest Request { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/b6c4e983/lang/cs/Source/REEF/reef-io/Network/Naming/INameServer.cs
----------------------------------------------------------------------
diff --git a/lang/cs/Source/REEF/reef-io/Network/Naming/INameServer.cs b/lang/cs/Source/REEF/reef-io/Network/Naming/INameServer.cs
deleted file mode 100644
index 5e7cffc..0000000
--- a/lang/cs/Source/REEF/reef-io/Network/Naming/INameServer.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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 System;
-using System.Collections.Generic;
-using System.Net;
-using Org.Apache.REEF.Common.io;
-using Org.Apache.REEF.IO.Network.Naming.Events;
-using Org.Apache.REEF.Tang.Annotations;
-
-namespace Org.Apache.REEF.IO.Network.Naming
-{
- /// <summary>
- /// Service that manages names and IPEndpoints for well known hosts.
- /// Can register, unregister, and look up IPAddresses using a string identifier.
- /// </summary>
- [DefaultImplementation(typeof(NameServer))]
- public interface INameServer : IDisposable
- {
- /// <summary>
- /// Listening endpoint for the NameServer
- /// </summary>
- IPEndPoint LocalEndpoint { get; }
-
- /// <summary>
- /// Looks up the IPEndpoints for each string identifier
- /// </summary>
- /// <param name="ids">The IDs to look up</param>
- /// <returns>A list of Name assignments representing the identifier
- /// that was searched for and the mapped IPEndpoint</returns>
- List<NameAssignment> Lookup(List<string> ids);
-
- /// <summary>
- /// Gets all of the registered identifier/endpoint pairs.
- /// </summary>
- /// <returns>A list of all of the registered identifiers and their
- /// mapped IPEndpoints</returns>
- List<NameAssignment> GetAll();
-
- /// <summary>
- /// Registers the string identifier with the given IPEndpoint
- /// </summary>
- /// <param name="id">The string ident</param>
- /// <param name="endpoint">The mapped endpoint</param>
- void Register(string id, IPEndPoint endpoint);
-
- /// <summary>
- /// Unregister the given identifier with the NameServer
- /// </summary>
- /// <param name="id">The identifier to unregister</param>
- void Unregister(string id);
- }
-}