Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2447D200BCB for ; Wed, 9 Nov 2016 09:38:19 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 21986160B1A; Wed, 9 Nov 2016 08:38:19 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 177B9160B1E for ; Wed, 9 Nov 2016 09:38:16 +0100 (CET) Received: (qmail 23245 invoked by uid 500); 9 Nov 2016 08:38:16 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 22826 invoked by uid 99); 9 Nov 2016 08:38:16 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 08:38:16 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E694FE35EB; Wed, 9 Nov 2016 08:38:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vozerov@apache.org To: commits@ignite.apache.org Date: Wed, 09 Nov 2016 08:38:28 -0000 Message-Id: <3749eac996844222b57cd99b5e84232c@git.apache.org> In-Reply-To: <1dfc6b9b86bf4c25ba1c9c3614011467@git.apache.org> References: <1dfc6b9b86bf4c25ba1c9c3614011467@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [14/50] [abbrv] ignite git commit: IGNITE-4028 .NET: Get rid of OP_META in PlatformAbstractTarget archived-at: Wed, 09 Nov 2016 08:38:19 -0000 IGNITE-4028 .NET: Get rid of OP_META in PlatformAbstractTarget Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2a90fcaf Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2a90fcaf Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2a90fcaf Branch: refs/heads/master Commit: 2a90fcaf8e46a829306ca92e226d984111b3aefe Parents: 02dd07a Author: Pavel Tupitsyn Authored: Tue Oct 25 15:15:55 2016 +0300 Committer: Pavel Tupitsyn Committed: Tue Oct 25 15:15:55 2016 +0300 ---------------------------------------------------------------------- .../platform/PlatformAbstractTarget.java | 13 +--- .../platform/cluster/PlatformClusterGroup.java | 19 +++-- .../Impl/Cluster/ClusterGroupImpl.cs | 79 ++++++++++++++++++-- .../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 2 +- .../Apache.Ignite.Core/Impl/PlatformTarget.cs | 67 ----------------- 5 files changed, 91 insertions(+), 89 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/2a90fcaf/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java index 29b603a..5c7f260 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformAbstractTarget.java @@ -43,9 +43,6 @@ public abstract class PlatformAbstractTarget implements PlatformTarget { /** Constant: ERROR. */ protected static final int ERROR = -1; - /** */ - private static final int OP_META = -1; - /** Context. */ protected final PlatformContext platformCtx; @@ -78,13 +75,7 @@ public abstract class PlatformAbstractTarget implements PlatformTarget { try (PlatformMemory mem = platformCtx.memory().get(memPtr)) { BinaryRawReaderEx reader = platformCtx.reader(mem); - if (type == OP_META) { - platformCtx.processMetadata(reader); - - return TRUE; - } - else - return processInStreamOutLong(type, reader, mem); + return processInStreamOutLong(type, reader, mem); } catch (Exception e) { throw convertException(e); @@ -401,7 +392,7 @@ public abstract class PlatformAbstractTarget implements PlatformTarget { * @return Dummy value which is never returned. * @throws IgniteCheckedException Exception to be thrown. */ - protected T throwUnsupported(int type) throws IgniteCheckedException { + private T throwUnsupported(int type) throws IgniteCheckedException { throw new IgniteCheckedException("Unsupported operation type: " + type); } http://git-wip-us.apache.org/repos/asf/ignite/blob/2a90fcaf/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java index d09506b..04a1173 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup.java @@ -17,21 +17,22 @@ package org.apache.ignite.internal.processors.platform.cluster; -import java.util.Collection; -import java.util.UUID; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteCluster; import org.apache.ignite.cluster.ClusterMetrics; import org.apache.ignite.cluster.ClusterNode; -import org.apache.ignite.internal.cluster.ClusterGroupEx; import org.apache.ignite.internal.binary.BinaryRawReaderEx; import org.apache.ignite.internal.binary.BinaryRawWriterEx; +import org.apache.ignite.internal.cluster.ClusterGroupEx; import org.apache.ignite.internal.processors.platform.PlatformAbstractTarget; import org.apache.ignite.internal.processors.platform.PlatformContext; import org.apache.ignite.internal.processors.platform.utils.PlatformUtils; import org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi; import org.jetbrains.annotations.Nullable; +import java.util.Collection; +import java.util.UUID; + /** * Interop projection. */ @@ -59,7 +60,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget { private static final int OP_FOR_NODE_IDS = 7; /** */ - private static final int OP_METADATA = 8; + private static final int OP_GET_META = 8; /** */ private static final int OP_METRICS = 9; @@ -106,6 +107,9 @@ public class PlatformClusterGroup extends PlatformAbstractTarget { /** */ private static final int OP_FOR_SERVERS = 23; + /** */ + private static final int OP_PUT_META = 24; + /** Projection. */ private final ClusterGroupEx prj; @@ -201,7 +205,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget { break; } - case OP_METADATA: { + case OP_GET_META: { int typeId = reader.readInt(); platformCtx.writeMetadata(writer, typeId); @@ -237,6 +241,11 @@ public class PlatformClusterGroup extends PlatformAbstractTarget { case OP_PING_NODE: return pingNode(reader.readUuid()) ? TRUE : FALSE; + case OP_PUT_META: + platformCtx.processMetadata(reader); + + return TRUE; + default: return super.processInStreamOutLong(type, reader); } http://git-wip-us.apache.org/repos/asf/ignite/blob/2a90fcaf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs index 388be82..912d6ed 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs @@ -76,7 +76,7 @@ namespace Apache.Ignite.Core.Impl.Cluster private const int OpForNodeIds = 7; /** */ - private const int OpMetadata = 8; + private const int OpGetMeta = 8; /** */ private const int OpMetrics = 9; @@ -103,7 +103,7 @@ namespace Apache.Ignite.Core.Impl.Cluster private const int OpForRemotes = 17; /** */ - public const int OpForDaemons = 18; + private const int OpForDaemons = 18; /** */ private const int OpForRandom = 19; @@ -115,10 +115,13 @@ namespace Apache.Ignite.Core.Impl.Cluster private const int OpForYoungest = 21; /** */ - public const int OpResetMetrics = 22; + private const int OpResetMetrics = 22; /** */ - public const int OpForServers = 23; + private const int OpForServers = 23; + + /** */ + private const int OpPutMeta = 24; /** Initial Ignite instance. */ private readonly Ignite _ignite; @@ -557,7 +560,7 @@ namespace Apache.Ignite.Core.Impl.Cluster /** */ public IBinaryType GetBinaryType(int typeId) { - return DoOutInOp(OpMetadata, + return DoOutInOp(OpGetMeta, writer => writer.WriteInt(typeId), stream => { @@ -599,5 +602,71 @@ namespace Apache.Ignite.Core.Impl.Cluster writer.WriteInt(schemaId); }); } + + /// + /// Resets local I/O, job, and task execution metrics. + /// + public void ResetMetrics() + { + DoOutOp(OpResetMetrics); + } + + /// + /// Put binary types to Grid. + /// + /// Binary types. + public void PutBinaryTypes(ICollection types) + { + DoOutOp(OpPutMeta, w => + { + w.WriteInt(types.Count); + + foreach (var meta in types) + { + w.WriteInt(meta.TypeId); + w.WriteString(meta.TypeName); + w.WriteString(meta.AffinityKeyFieldName); + + IDictionary fields = meta.GetFieldsMap(); + + w.WriteInt(fields.Count); + + foreach (var field in fields) + { + w.WriteString(field.Key); + w.WriteInt(field.Value); + } + + w.WriteBoolean(meta.IsEnum); + + // Send schemas + var desc = meta.Descriptor; + Debug.Assert(desc != null); + + var count = 0; + var countPos = w.Stream.Position; + w.WriteInt(0); // Reserve for count + + foreach (var schema in desc.Schema.GetAll()) + { + w.WriteInt(schema.Key); + + var ids = schema.Value; + w.WriteInt(ids.Length); + + foreach (var id in ids) + w.WriteInt(id); + + count++; + } + + w.Stream.WriteInt(countPos, count); + } + + Marshaller.FinishMarshal(w); + }); + + Marshaller.OnBinaryTypesSent(types); + } } } http://git-wip-us.apache.org/repos/asf/ignite/blob/2a90fcaf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs index 79df470..70a3311 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Ignite.cs @@ -517,7 +517,7 @@ namespace Apache.Ignite.Core.Impl /** */ public void ResetMetrics() { - UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics); + _prj.ResetMetrics(); } /** */ http://git-wip-us.apache.org/repos/asf/ignite/blob/2a90fcaf/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs ---------------------------------------------------------------------- diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs index d5b69a4..9b80d8c 100644 --- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs +++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs @@ -26,7 +26,6 @@ namespace Apache.Ignite.Core.Impl using Apache.Ignite.Core.Binary; using Apache.Ignite.Core.Impl.Binary; using Apache.Ignite.Core.Impl.Binary.IO; - using Apache.Ignite.Core.Impl.Binary.Metadata; using Apache.Ignite.Core.Impl.Common; using Apache.Ignite.Core.Impl.Memory; using Apache.Ignite.Core.Impl.Unmanaged; @@ -50,12 +49,6 @@ namespace Apache.Ignite.Core.Impl protected const int Error = -1; /** */ - private const int OpMeta = -1; - - /** */ - public const int OpNone = -2; - - /** */ private static readonly Dictionary IgniteFutureTypeMap = new Dictionary { @@ -866,66 +859,6 @@ namespace Apache.Ignite.Core.Impl } /// - /// Put binary types to Grid. - /// - /// Binary types. - internal void PutBinaryTypes(ICollection types) - { - DoOutOp(OpMeta, stream => - { - BinaryWriter w = _marsh.StartMarshal(stream); - - w.WriteInt(types.Count); - - foreach (var meta in types) - { - w.WriteInt(meta.TypeId); - w.WriteString(meta.TypeName); - w.WriteString(meta.AffinityKeyFieldName); - - IDictionary fields = meta.GetFieldsMap(); - - w.WriteInt(fields.Count); - - foreach (var field in fields) - { - w.WriteString(field.Key); - w.WriteInt(field.Value); - } - - w.WriteBoolean(meta.IsEnum); - - // Send schemas - var desc = meta.Descriptor; - Debug.Assert(desc != null); - - var count = 0; - var countPos = stream.Position; - w.WriteInt(0); // Reserve for count - - foreach (var schema in desc.Schema.GetAll()) - { - w.WriteInt(schema.Key); - - var ids = schema.Value; - w.WriteInt(ids.Length); - - foreach (var id in ids) - w.WriteInt(id); - - count++; - } - - stream.WriteInt(countPos, count); - } - - _marsh.FinishMarshal(w); - }); - - _marsh.OnBinaryTypesSent(types); - } - - /// /// Unmarshal object using the given stream. /// /// Stream.