You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/09/07 11:16:48 UTC
[03/50] [abbrv] ignite git commit: IGNITE-3511: .NET: Fixed
AffinityFunctionBase.cs placement, added missing Package-Info.cs files.
IGNITE-3511: .NET: Fixed AffinityFunctionBase.cs placement, added missing Package-Info.cs files.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/448571ba
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/448571ba
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/448571ba
Branch: refs/heads/ignite-2649
Commit: 448571ba2ca1b05197b17a38d157babf4cb4f203
Parents: 7364938
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Jul 19 16:11:23 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Jul 19 16:11:23 2016 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.csproj | 5 +-
.../Cache/Affinity/AffinityFunctionBase.cs | 139 ------------------
.../Cache/Affinity/Fair/FairAffinityFunction.cs | 1 +
.../Cache/Affinity/Fair/Package-Info.cs | 26 ++++
.../Cache/Affinity/Package-Info.cs | 26 ++++
.../Cache/Affinity/Rendezvous/Package-Info.cs | 26 ++++
.../Rendezvous/RendezvousAffinityFunction.cs | 1 +
.../Impl/Cache/Affinity/AffinityFunctionBase.cs | 140 +++++++++++++++++++
8 files changed, 224 insertions(+), 140 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 6793873..3736988 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -55,11 +55,13 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Binary\Package-Info.cs" />
- <Compile Include="Cache\Affinity\AffinityFunctionBase.cs" />
<Compile Include="Cache\Affinity\AffinityFunctionContext.cs" />
<Compile Include="Cache\Affinity\AffinityTopologyVersion.cs" />
<Compile Include="Cache\Affinity\Fair\FairAffinityFunction.cs" />
+ <Compile Include="Cache\Affinity\Fair\Package-Info.cs" />
+ <Compile Include="Cache\Affinity\Rendezvous\Package-Info.cs" />
<Compile Include="Cache\Affinity\IAffinityFunction.cs" />
+ <Compile Include="Cache\Affinity\Package-Info.cs" />
<Compile Include="Cache\Affinity\Rendezvous\RendezvousAffinityFunction.cs" />
<Compile Include="Cache\CacheAtomicUpdateTimeoutException.cs" />
<Compile Include="Cache\CacheEntryProcessorException.cs" />
@@ -114,6 +116,7 @@
<Compile Include="Common\IgniteFutureCancelledException.cs" />
<Compile Include="Common\IgniteGuid.cs" />
<Compile Include="Common\Package-Info.cs" />
+ <Compile Include="Impl\Cache\Affinity\AffinityFunctionBase.cs" />
<Compile Include="Impl\Cache\Affinity\AffinityFunctionSerializer.cs" />
<Compile Include="Impl\Cache\Affinity\PlatformAffinityFunction.cs" />
<Compile Include="Impl\Cache\Event\JavaCacheEntryEventFilter.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
deleted file mode 100644
index ce2e5e1..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/AffinityFunctionBase.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-\ufeff/*
- * 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 Apache.Ignite.Core.Cache.Affinity
-{
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Base class for predefined affinity functions.
- /// </summary>
- [Serializable]
- public abstract class AffinityFunctionBase : IAffinityFunction
- {
- /// <summary> The default value for <see cref="Partitions"/> property. </summary>
- public const int DefaultPartitions = 1024;
-
- /** */
- private int _partitions = DefaultPartitions;
-
- /** */
- private IAffinityFunction _baseFunction;
-
-
- /// <summary>
- /// Gets or sets the total number of partitions.
- /// </summary>
- [DefaultValue(DefaultPartitions)]
- public virtual int Partitions
- {
- get { return _partitions; }
- set { _partitions = value; }
- }
-
- /// <summary>
- /// Gets partition number for a given key starting from 0. Partitioned caches
- /// should make sure that keys are about evenly distributed across all partitions
- /// from 0 to <see cref="Partitions" /> for best performance.
- /// <para />
- /// Note that for fully replicated caches it is possible to segment key sets among different
- /// grid node groups. In that case each node group should return a unique partition
- /// number. However, unlike partitioned cache, mappings of keys to nodes in
- /// replicated caches are constant and a node cannot migrate from one partition
- /// to another.
- /// </summary>
- /// <param name="key">Key to get partition for.</param>
- /// <returns>
- /// Partition number for a given key.
- /// </returns>
- public virtual int GetPartition(object key)
- {
- ThrowIfUninitialized();
-
- return _baseFunction.GetPartition(key);
- }
-
- /// <summary>
- /// Removes node from affinity. This method is called when it is safe to remove
- /// disconnected node from affinity mapping.
- /// </summary>
- /// <param name="nodeId">The node identifier.</param>
- public virtual void RemoveNode(Guid nodeId)
- {
- ThrowIfUninitialized();
-
- _baseFunction.RemoveNode(nodeId);
- }
-
- /// <summary>
- /// Gets affinity nodes for a partition. In case of replicated cache, all returned
- /// nodes are updated in the same manner. In case of partitioned cache, the returned
- /// list should contain only the primary and back up nodes with primary node being
- /// always first.
- /// <pare />
- /// Note that partitioned affinity must obey the following contract: given that node
- /// <code>N</code> is primary for some key <code>K</code>, if any other node(s) leave
- /// grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>.
- /// </summary>
- /// <param name="context">The affinity function context.</param>
- /// <returns>
- /// A collection of partitions, where each partition is a collection of nodes,
- /// where first node is a primary node, and other nodes are backup nodes.
- /// </returns>
- public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
- {
- ThrowIfUninitialized();
-
- return _baseFunction.AssignPartitions(context);
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.
- /// </summary>
- public virtual bool ExcludeNeighbors { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class.
- /// </summary>
- internal AffinityFunctionBase()
- {
- // No-op.
- }
-
- /// <summary>
- /// Sets the base function.
- /// </summary>
- /// <param name="baseFunc">The base function.</param>
- internal void SetBaseFunction(IAffinityFunction baseFunc)
- {
- _baseFunction = baseFunc;
- }
-
- /// <summary>
- /// Gets the direct usage error.
- /// </summary>
- private void ThrowIfUninitialized()
- {
- if (_baseFunction == null)
- throw new IgniteException(GetType() + " has not yet been initialized.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
index 4a3885f..f06937d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/FairAffinityFunction.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Cache.Affinity.Fair
{
using System;
+ using Apache.Ignite.Core.Impl.Cache.Affinity;
/// <summary>
/// Fair affinity function which tries to ensure that all nodes get equal number of partitions with
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs
new file mode 100644
index 0000000..3bcaa59
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Fair/Package-Info.cs
@@ -0,0 +1,26 @@
+\ufeff/*
+* 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.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// Fair affinity functionality.
+/// </summary>
+namespace Apache.Ignite.Core.Cache.Affinity.Fair
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs
new file mode 100644
index 0000000..dfbdf08
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Package-Info.cs
@@ -0,0 +1,26 @@
+\ufeff/*
+* 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.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// Cache affinity API.
+/// </summary>
+namespace Apache.Ignite.Core.Cache.Affinity
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs
new file mode 100644
index 0000000..d3f5ef0
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/Package-Info.cs
@@ -0,0 +1,26 @@
+\ufeff/*
+* 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.
+*/
+
+#pragma warning disable 1587 // invalid XML comment
+
+/// <summary>
+/// Rendezvous affinity functionality.
+/// </summary>
+namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous
+{
+ // No-op.
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
index 98ec364..928324c 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cache/Affinity/Rendezvous/RendezvousAffinityFunction.cs
@@ -18,6 +18,7 @@
namespace Apache.Ignite.Core.Cache.Affinity.Rendezvous
{
using System;
+ using Apache.Ignite.Core.Impl.Cache.Affinity;
/// <summary>
/// Affinity function for partitioned cache based on Highest Random Weight algorithm.
http://git-wip-us.apache.org/repos/asf/ignite/blob/448571ba/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
new file mode 100644
index 0000000..8536e4c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/Affinity/AffinityFunctionBase.cs
@@ -0,0 +1,140 @@
+/*
+ * 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 Apache.Ignite.Core.Impl.Cache.Affinity
+{
+ using System;
+ using System.Collections.Generic;
+ using System.ComponentModel;
+ using Apache.Ignite.Core.Cache.Affinity;
+ using Apache.Ignite.Core.Cluster;
+ using Apache.Ignite.Core.Common;
+
+ /// <summary>
+ /// Base class for predefined affinity functions.
+ /// </summary>
+ [Serializable]
+ public abstract class AffinityFunctionBase : IAffinityFunction
+ {
+ /// <summary> The default value for <see cref="Partitions"/> property. </summary>
+ public const int DefaultPartitions = 1024;
+
+ /** */
+ private int _partitions = DefaultPartitions;
+
+ /** */
+ private IAffinityFunction _baseFunction;
+
+
+ /// <summary>
+ /// Gets or sets the total number of partitions.
+ /// </summary>
+ [DefaultValue(DefaultPartitions)]
+ public virtual int Partitions
+ {
+ get { return _partitions; }
+ set { _partitions = value; }
+ }
+
+ /// <summary>
+ /// Gets partition number for a given key starting from 0. Partitioned caches
+ /// should make sure that keys are about evenly distributed across all partitions
+ /// from 0 to <see cref="Partitions" /> for best performance.
+ /// <para />
+ /// Note that for fully replicated caches it is possible to segment key sets among different
+ /// grid node groups. In that case each node group should return a unique partition
+ /// number. However, unlike partitioned cache, mappings of keys to nodes in
+ /// replicated caches are constant and a node cannot migrate from one partition
+ /// to another.
+ /// </summary>
+ /// <param name="key">Key to get partition for.</param>
+ /// <returns>
+ /// Partition number for a given key.
+ /// </returns>
+ public virtual int GetPartition(object key)
+ {
+ ThrowIfUninitialized();
+
+ return _baseFunction.GetPartition(key);
+ }
+
+ /// <summary>
+ /// Removes node from affinity. This method is called when it is safe to remove
+ /// disconnected node from affinity mapping.
+ /// </summary>
+ /// <param name="nodeId">The node identifier.</param>
+ public virtual void RemoveNode(Guid nodeId)
+ {
+ ThrowIfUninitialized();
+
+ _baseFunction.RemoveNode(nodeId);
+ }
+
+ /// <summary>
+ /// Gets affinity nodes for a partition. In case of replicated cache, all returned
+ /// nodes are updated in the same manner. In case of partitioned cache, the returned
+ /// list should contain only the primary and back up nodes with primary node being
+ /// always first.
+ /// <pare />
+ /// Note that partitioned affinity must obey the following contract: given that node
+ /// <code>N</code> is primary for some key <code>K</code>, if any other node(s) leave
+ /// grid and no node joins grid, node <code>N</code> will remain primary for key <code>K</code>.
+ /// </summary>
+ /// <param name="context">The affinity function context.</param>
+ /// <returns>
+ /// A collection of partitions, where each partition is a collection of nodes,
+ /// where first node is a primary node, and other nodes are backup nodes.
+ /// </returns>
+ public virtual IEnumerable<IEnumerable<IClusterNode>> AssignPartitions(AffinityFunctionContext context)
+ {
+ ThrowIfUninitialized();
+
+ return _baseFunction.AssignPartitions(context);
+ }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether to exclude same-host-neighbors from being backups of each other.
+ /// </summary>
+ public virtual bool ExcludeNeighbors { get; set; }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="AffinityFunctionBase"/> class.
+ /// </summary>
+ internal AffinityFunctionBase()
+ {
+ // No-op.
+ }
+
+ /// <summary>
+ /// Sets the base function.
+ /// </summary>
+ /// <param name="baseFunc">The base function.</param>
+ internal void SetBaseFunction(IAffinityFunction baseFunc)
+ {
+ _baseFunction = baseFunc;
+ }
+
+ /// <summary>
+ /// Gets the direct usage error.
+ /// </summary>
+ private void ThrowIfUninitialized()
+ {
+ if (_baseFunction == null)
+ throw new IgniteException(GetType() + " has not yet been initialized.");
+ }
+ }
+}