ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vkuliche...@apache.org
Subject [42/50] [abbrv] ignite git commit: IGNITE-4028 .NET: Get rid of OP_META in PlatformAbstractTarget
Date Wed, 26 Oct 2016 22:55:34 GMT
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/ignite-4110
Commit: 2a90fcaf8e46a829306ca92e226d984111b3aefe
Parents: 02dd07a
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Tue Oct 25 15:15:55 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
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> T throwUnsupported(int type) throws IgniteCheckedException {
+    private <T> 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
         /** <inheritDoc /> */
         public IBinaryType GetBinaryType(int typeId)
         {
-            return DoOutInOp<IBinaryType>(OpMetadata, 
+            return DoOutInOp<IBinaryType>(OpGetMeta, 
                 writer => writer.WriteInt(typeId),
                 stream =>
                 {
@@ -599,5 +602,71 @@ namespace Apache.Ignite.Core.Impl.Cluster
                 writer.WriteInt(schemaId);
             });
         }
+
+        /// <summary>
+        /// Resets local I/O, job, and task execution metrics.
+        /// </summary>
+        public void ResetMetrics()
+        {
+            DoOutOp(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/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
         /** <inheritdoc /> */
         public void ResetMetrics()
         {
-            UU.TargetOutLong(_prj.Target, ClusterGroupImpl.OpResetMetrics);
+            _prj.ResetMetrics();
         }
 
         /** <inheritdoc /> */

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<Type, FutureType> IgniteFutureTypeMap
             = new Dictionary<Type, FutureType>
             {
@@ -866,66 +859,6 @@ 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