ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ptupit...@apache.org
Subject [04/33] ignite git commit: Revert "IGNITE-4028 .NET: Get rid of OP_META in PlatformAbstractTarget"
Date Mon, 14 Nov 2016 09:26:16 GMT
Revert "IGNITE-4028 .NET: Get rid of OP_META in PlatformAbstractTarget"

This reverts commit 2a90fcaf8e46a829306ca92e226d984111b3aefe.

# Conflicts:
#	modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2e7f59bf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2e7f59bf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2e7f59bf

Branch: refs/heads/master
Commit: 2e7f59bf113bb76af0ddb5029b6af4900a6b1d54
Parents: 3e724fd
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Thu Oct 27 17:04:01 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Thu Oct 27 17:36:05 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, 89 insertions(+), 91 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/2e7f59bf/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 840c527..cba0031 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,6 +43,9 @@ 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;
 
@@ -75,7 +78,13 @@ public abstract class PlatformAbstractTarget implements PlatformTarget
{
         try (PlatformMemory mem = platformCtx.memory().get(memPtr)) {
             BinaryRawReaderEx reader = platformCtx.reader(mem);
 
-            return processInStreamOutLong(type, reader, mem);
+            if (type == OP_META) {
+                platformCtx.processMetadata(reader);
+
+                return TRUE;
+            }
+            else
+                return processInStreamOutLong(type, reader, mem);
         }
         catch (Exception e) {
             throw convertException(e);
@@ -338,7 +347,7 @@ public abstract class PlatformAbstractTarget implements PlatformTarget
{
      * @return Dummy value which is never returned.
      * @throws IgniteCheckedException Exception to be thrown.
      */
-    private <T> T throwUnsupported(int type) throws IgniteCheckedException {
+    protected <T> T throwUnsupported(int type) throws IgniteCheckedException {
         throw new IgniteCheckedException("Unsupported operation type: " + type);
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e7f59bf/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 5894ff8..dde98f5 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,22 +17,21 @@
 
 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.
  */
@@ -60,7 +59,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
     private static final int OP_FOR_NODE_IDS = 7;
 
     /** */
-    private static final int OP_GET_META = 8;
+    private static final int OP_METADATA = 8;
 
     /** */
     private static final int OP_METRICS = 9;
@@ -107,9 +106,6 @@ 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;
 
@@ -205,7 +201,7 @@ public class PlatformClusterGroup extends PlatformAbstractTarget {
                 break;
             }
 
-            case OP_GET_META: {
+            case OP_METADATA: {
                 int typeId = reader.readInt();
 
                 platformCtx.writeMetadata(writer, typeId);
@@ -241,11 +237,6 @@ 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/2e7f59bf/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 9a202e1..277d61f 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 OpGetMeta = 8;
+        private const int OpMetadata = 8;
 
         /** */
         private const int OpMetrics = 9;
@@ -103,7 +103,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
         private const int OpForRemotes = 17;
 
         /** */
-        private const int OpForDaemons = 18;
+        public const int OpForDaemons = 18;
 
         /** */
         private const int OpForRandom = 19;
@@ -115,13 +115,10 @@ namespace Apache.Ignite.Core.Impl.Cluster
         private const int OpForYoungest = 21;
         
         /** */
-        private const int OpResetMetrics = 22;
+        public const int OpResetMetrics = 22;
         
         /** */
-        private const int OpForServers = 23;
-        
-        /** */
-        private const int OpPutMeta = 24;
+        public const int OpForServers = 23;
         
         /** Initial Ignite instance. */
         private readonly Ignite _ignite;
@@ -560,7 +557,7 @@ namespace Apache.Ignite.Core.Impl.Cluster
         /** <inheritDoc /> */
         public IBinaryType GetBinaryType(int typeId)
         {
-            return DoOutInOp<IBinaryType>(OpGetMeta, 
+            return DoOutInOp<IBinaryType>(OpMetadata,
                 writer => writer.WriteInt(typeId),
                 stream =>
                 {
@@ -602,71 +599,5 @@ namespace Apache.Ignite.Core.Impl.Cluster
                 writer.WriteInt(schemaId);
             });
         }
-
-        /// <summary>
-        /// Resets local I/O, job, and task execution metrics.
-        /// </summary>
-        public void ResetMetrics()
-        {
-            DoOutInOp(OpResetMetrics);
-        }
-
-        /// <summary>
-        /// Put binary types to Grid.
-        /// </summary>
-        /// <param name="types">Binary types.</param>
-        public void PutBinaryTypes(ICollection<BinaryType> 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<string, int> 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/2e7f59bf/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 70a3311..79df470 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
         /** <inheritdoc /> */
         public void ResetMetrics()
         {
-            _prj.ResetMetrics();
+            UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics);
         }
 
         /** <inheritdoc /> */

http://git-wip-us.apache.org/repos/asf/ignite/blob/2e7f59bf/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 37c3373..f741389 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
@@ -26,6 +26,7 @@ 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;
@@ -49,6 +50,12 @@ namespace Apache.Ignite.Core.Impl
         protected const int Error = -1;
 
         /** */
+        private const int OpMeta = -1;
+
+        /** */
+        public const int OpNone = -2;
+
+        /** */
         private static readonly Dictionary<Type, FutureType> IgniteFutureTypeMap
             = new Dictionary<Type, FutureType>
             {
@@ -820,6 +827,66 @@ namespace Apache.Ignite.Core.Impl
         }
 
         /// <summary>
+        /// Put binary types to Grid.
+        /// </summary>
+        /// <param name="types">Binary types.</param>
+        internal void PutBinaryTypes(ICollection<BinaryType> 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<string, int> 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);
+        }
+
+        /// <summary>
         /// Unmarshal object using the given stream.
         /// </summary>
         /// <param name="stream">Stream.</param>


Mime
View raw message