IGNITE-1480: Added "IsClient" flag to IClusterNode interface.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9879bed8 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9879bed8 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9879bed8 Branch: refs/heads/ignite-1655 Commit: 9879bed8026d2ac181d146e537de4ae407951fb5 Parents: 91eeab7 Author: Pavel Tupitsyn <[email protected]> Authored: Tue Oct 20 15:54:41 2015 +0300 Committer: thatcoach <[email protected]> Committed: Tue Oct 20 15:54:41 2015 +0300 ---------------------------------------------------------------------- .../platform/PlatformContextImpl.java | 1 + .../IgniteStartStopTest.cs | 6 ++- .../Apache.Ignite.Core/Cluster/IClusterNode.cs | 11 +++++ .../Impl/Cluster/ClusterNodeImpl.cs | 45 +++++++++----------- 4 files changed, 37 insertions(+), 26 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/9879bed8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java index 3895506..0999f6a 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformContextImpl.java @@ -221,6 +221,7 @@ public class PlatformContextImpl implements PlatformContext { w.writeLong(node.order()); w.writeBoolean(node.isLocal()); w.writeBoolean(node.isDaemon()); + w.writeBoolean(node.isClient()); writeClusterMetrics(w, node.metrics()); out.synchronize(); http://git-wip-us.apache.org/repos/asf/ignite/blob/9879bed8/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs index d16063f..d302046 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/IgniteStartStopTest.cs @@ -311,12 +311,16 @@ namespace Apache.Ignite.Core.Tests try { - using (Ignition.Start(servCfg)) // start server-mode ignite first + using (var serv = Ignition.Start(servCfg)) // start server-mode ignite first { + Assert.IsFalse(serv.GetCluster().GetLocalNode().IsClient); + Ignition.ClientMode = true; using (var grid = Ignition.Start(clientCfg)) { + Assert.IsTrue(grid.GetCluster().GetLocalNode().IsClient); + UseIgnite(grid); } } http://git-wip-us.apache.org/repos/asf/ignite/blob/9879bed8/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs index 8287821..ccb0e03 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs @@ -109,6 +109,17 @@ namespace Apache.Ignite.Core.Cluster bool IsDaemon { get; } /// <summary> + /// Gets a value indicating whether or not this node is connected to cluster as a client. + /// <para /> + /// Do not confuse client in terms of discovery and client in terms of cache. + /// Cache clients cannot carry data, while topology clients connect to the topology in a different way. + /// </summary> + /// <value> + /// <c>true</c> if this node is a client node, <c>false otherwise.</c>. + /// </value> + bool IsClient { get; } + + /// <summary> /// Gets metrics snapshot for this node. Note that node metrics are constantly updated /// and provide up to date information about nodes. For example, you can get /// an idea about CPU load on remote node via <see cref="IClusterMetrics.CurrentCpuLoad"/>. http://git-wip-us.apache.org/repos/asf/ignite/blob/9879bed8/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs index 1b6358a..1913cef 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs @@ -46,10 +46,13 @@ namespace Apache.Ignite.Core.Impl.Cluster private readonly long _order; /** Local flag. */ - private readonly bool _local; + private readonly bool _isLocal; /** Daemon flag. */ - private readonly bool _daemon; + private readonly bool _isDaemon; + + /** Client flag. */ + private readonly bool _isClient; /** Metrics. */ private volatile ClusterMetricsImpl _metrics; @@ -73,8 +76,9 @@ namespace Apache.Ignite.Core.Impl.Cluster _addrs = reader.ReadGenericCollection<string>().AsReadOnly(); _hosts = reader.ReadGenericCollection<string>().AsReadOnly(); _order = reader.ReadLong(); - _local = reader.ReadBoolean(); - _daemon = reader.ReadBoolean(); + _isLocal = reader.ReadBoolean(); + _isDaemon = reader.ReadBoolean(); + _isClient = reader.ReadBoolean(); _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null; } @@ -120,46 +124,31 @@ namespace Apache.Ignite.Core.Impl.Cluster /** <inheritDoc /> */ public ICollection<string> Addresses { - get - { - return _addrs; - } + get { return _addrs; } } /** <inheritDoc /> */ public ICollection<string> HostNames { - get - { - return _hosts; - } + get { return _hosts; } } /** <inheritDoc /> */ public long Order { - get - { - return _order; - } + get { return _order; } } /** <inheritDoc /> */ public bool IsLocal { - get - { - return _local; - } + get { return _isLocal; } } /** <inheritDoc /> */ public bool IsDaemon { - get - { - return _daemon; - } + get { return _isDaemon; } } /** <inheritDoc /> */ @@ -189,7 +178,13 @@ namespace Apache.Ignite.Core.Impl.Cluster return oldMetrics; } - + + /** <inheritDoc /> */ + public bool IsClient + { + get { return _isClient; } + } + /** <inheritDoc /> */ public override string ToString() {
