Repository: incubator-reef Updated Branches: refs/heads/master 528d8ebbc -> bbb78b769
[REEF-600] Added a ConfigurationModule for the TcpPortProvider This change also adds the new custom attribute `[Unstable]` which we use to mark the new configuration module as unstable. JIRA: [REEF-600](https://issues.apache.org/jira/browse/REEF-600) Pull Request: This closes #491 Author: Markus Weimer <wei...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/incubator-reef/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-reef/commit/bbb78b76 Tree: http://git-wip-us.apache.org/repos/asf/incubator-reef/tree/bbb78b76 Diff: http://git-wip-us.apache.org/repos/asf/incubator-reef/diff/bbb78b76 Branch: refs/heads/master Commit: bbb78b769efbfb2806ec03eef63a37ca93971765 Parents: 528d8eb Author: Markus Weimer <wei...@apache.org> Authored: Mon Sep 14 18:35:03 2015 -0700 Committer: Julia Wang <juw...@microsoft.com> Committed: Tue Sep 15 15:42:53 2015 -0700 ---------------------------------------------------------------------- .../API/TcpPortConfigurationModule.cs | 63 ++++++++++++++++++++ .../Org.Apache.REEF.Client.csproj | 1 + .../Attributes/UnstableAttribute.cs | 57 ++++++++++++++++++ .../Org.Apache.REEF.Common.csproj | 1 + 4 files changed, 122 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/bbb78b76/lang/cs/Org.Apache.REEF.Client/API/TcpPortConfigurationModule.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/API/TcpPortConfigurationModule.cs b/lang/cs/Org.Apache.REEF.Client/API/TcpPortConfigurationModule.cs new file mode 100644 index 0000000..b6fd4eb --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Client/API/TcpPortConfigurationModule.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 Org.Apache.REEF.Client.API.Parameters; +using Org.Apache.REEF.Common.Attributes; +using Org.Apache.REEF.Common.Io; +using Org.Apache.REEF.Tang.Formats; +using Org.Apache.REEF.Tang.Interface; +using Org.Apache.REEF.Tang.Util; +using Org.Apache.REEF.Wake.Remote.Parameters; + +namespace Org.Apache.REEF.Client.API +{ + /// <summary> + /// Configuration Module for the TCP port provider. + /// </summary> + [Unstable("0.13", "Move to another namespace.")] + public sealed class TcpPortConfigurationModule : ConfigurationModuleBuilder + { + /// <summary> + /// Port number range start for listening on tcp ports. + /// </summary> + public static readonly RequiredParameter<int> PortRangeStart = new RequiredParameter<int>(); + + /// <summary> + /// Seed for the random port number generator. + /// </summary> + public static readonly OptionalParameter<int> PortRangeSeed = new OptionalParameter<int>(); + + /// <summary> + /// Port number count in the range for listening on tcp ports. + /// </summary> + public static readonly RequiredParameter<int> PortRangeCount = new RequiredParameter<int>(); + + /// <summary> + /// Count of tries to get a tcp port in the port range. + /// </summary> + public static readonly OptionalParameter<int> PortRangeTryCount = new OptionalParameter<int>(); + + public static readonly ConfigurationModule ConfigurationModule = new TcpPortConfigurationModule() + .BindSetEntry<DriverConfigurationProviders, TcpPortConfigurationProvider, IConfigurationProvider>( + GenericType<DriverConfigurationProviders>.Class, GenericType<TcpPortConfigurationProvider>.Class) + .BindNamedParameter(GenericType<TcpPortRangeStart>.Class, PortRangeStart) + .BindNamedParameter(GenericType<TcpPortRangeSeed>.Class, PortRangeSeed) + .BindNamedParameter(GenericType<TcpPortRangeCount>.Class, PortRangeCount) + .BindNamedParameter(GenericType<TcpPortRangeTryCount>.Class, PortRangeTryCount) + .Build(); + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/bbb78b76/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj index 32861e1..ee19ca6 100644 --- a/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj +++ b/lang/cs/Org.Apache.REEF.Client/Org.Apache.REEF.Client.csproj @@ -53,6 +53,7 @@ under the License. <Compile Include="API\JobSubmissionBuilder.cs" /> <Compile Include="API\JobSubmissionBuilderFactory.cs" /> <Compile Include="API\Parameters\DriverConfigurationProviders.cs" /> + <Compile Include="API\TcpPortConfigurationModule.cs" /> <Compile Include="Common\ClientConstants.cs" /> <Compile Include="Common\ClrClient2JavaClientCuratedParameters.cs" /> <Compile Include="Common\DriverFolderPreparationHelper.cs" /> http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/bbb78b76/lang/cs/Org.Apache.REEF.Common/Attributes/UnstableAttribute.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Attributes/UnstableAttribute.cs b/lang/cs/Org.Apache.REEF.Common/Attributes/UnstableAttribute.cs new file mode 100644 index 0000000..bebf03c --- /dev/null +++ b/lang/cs/Org.Apache.REEF.Common/Attributes/UnstableAttribute.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; + +namespace Org.Apache.REEF.Common.Attributes +{ + /// <summary> + /// Signals that the API is NOT stabilized. + /// </summary> + [AttributeUsage(AttributeTargets.All)] + public sealed class UnstableAttribute : Attribute + { + private readonly string _descriptionOfLikelyChange; + private readonly string _versionIntroduced; + + /// <summary> + /// </summary> + /// <param name="versionIntroduced">The version in which this unstable API was introduced.</param> + /// <param name="descriptionOfLikelyChange">Description of the likely change in the future.</param> + public UnstableAttribute(string versionIntroduced, string descriptionOfLikelyChange = "") + { + _versionIntroduced = versionIntroduced; + _descriptionOfLikelyChange = descriptionOfLikelyChange; + } + + /// <summary> + /// The version in which this unstable API was introduced. + /// </summary> + public string VersionIntroduced + { + get { return _versionIntroduced; } + } + + /// <summary> + /// Description of the likely change in the future. + /// </summary> + public string DescriptionOfLikelyChange + { + get { return _descriptionOfLikelyChange; } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-reef/blob/bbb78b76/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj index 1db9d72..ed6ca7f 100644 --- a/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj +++ b/lang/cs/Org.Apache.REEF.Common/Org.Apache.REEF.Common.csproj @@ -54,6 +54,7 @@ under the License. <Compile Include="Api\AbstractFailure.cs" /> <Compile Include="Api\IAbstractFailure.cs" /> <Compile Include="Api\IFailure.cs" /> + <Compile Include="Attributes\UnstableAttribute.cs" /> <Compile Include="Avro\AvroDriverInfo.cs" /> <Compile Include="Avro\AvroHttpRequest.cs" /> <Compile Include="Avro\AvroHttpSerializer.cs" />