ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From voze...@apache.org
Subject [46/67] [abbrv] ignite git commit: IGNITE-1847: Added typeId.
Date Wed, 11 Nov 2015 08:25:42 GMT
IGNITE-1847: Added typeId.


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

Branch: refs/heads/ignite-1816
Commit: 267046b058e6ed7ee62f00b93878176618d05b65
Parents: 52b57c7
Author: vozerov-gridgain <vozerov@gridgain.com>
Authored: Mon Nov 9 16:13:37 2015 +0300
Committer: vozerov-gridgain <vozerov@gridgain.com>
Committed: Mon Nov 9 16:13:37 2015 +0300

----------------------------------------------------------------------
 .../internal/portable/BinaryMetaDataImpl.java   | 30 +++++++++++++-------
 .../internal/portable/PortableContext.java      |  4 +--
 .../CacheObjectBinaryProcessorImpl.java         | 10 +++----
 3 files changed, 26 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/267046b0/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
index 7f2bdb9..68bc444 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/BinaryMetaDataImpl.java
@@ -27,13 +27,7 @@ import java.util.Map;
 import org.apache.ignite.internal.util.tostring.GridToStringInclude;
 import org.apache.ignite.internal.util.typedef.internal.S;
 import org.apache.ignite.internal.util.typedef.internal.U;
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.Binarylizable;
 import org.apache.ignite.binary.BinaryType;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
 import org.jetbrains.annotations.Nullable;
 
 /**
@@ -43,14 +37,17 @@ public class BinaryMetaDataImpl implements BinaryType, Externalizable
{
     /** */
     private static final long serialVersionUID = 0L;
 
-    /** */
+    /** Type ID. */
+    private int typeId;
+
+    /** Type name. */
     private String typeName;
 
-    /** */
+    /** Recorded object fields. */
     @GridToStringInclude
     private Map<String, String> fields;
 
-    /** */
+    /** Affinity key field name. */
     private String affKeyFieldName;
 
     /**
@@ -61,19 +58,30 @@ public class BinaryMetaDataImpl implements BinaryType, Externalizable
{
     }
 
     /**
+     * Constructor.
+     *
+     * @param typeId Type ID.
      * @param typeName Type name.
      * @param fields Fields map.
      * @param affKeyFieldName Affinity key field name.
      */
-    public BinaryMetaDataImpl(String typeName, @Nullable Map<String, String> fields,
+    public BinaryMetaDataImpl(int typeId, String typeName, @Nullable Map<String, String>
fields,
         @Nullable String affKeyFieldName) {
         assert typeName != null;
 
+        this.typeId = typeId;
         this.typeName = typeName;
         this.fields = fields;
         this.affKeyFieldName = affKeyFieldName;
     }
 
+    /**
+     * @return Type ID.
+     */
+    public int typeId() {
+        return typeId;
+    }
+
     /** {@inheritDoc} */
     @Override public String typeName() {
         return typeName;
@@ -103,6 +111,7 @@ public class BinaryMetaDataImpl implements BinaryType, Externalizable
{
 
     /** {@inheritDoc} */
     @Override public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(typeId);
         U.writeString(out, typeName);
         U.writeMap(out, fields);
         U.writeString(out, affKeyFieldName);
@@ -110,6 +119,7 @@ public class BinaryMetaDataImpl implements BinaryType, Externalizable
{
 
     /** {@inheritDoc} */
     @Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
+        typeId = in.readInt();
         typeName = U.readString(in);
         fields = U.readMap(in);
         affKeyFieldName = U.readString(in);

http://git-wip-us.apache.org/repos/asf/ignite/blob/267046b0/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
index 3c5633f..84cc748 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/portable/PortableContext.java
@@ -776,7 +776,7 @@ public class PortableContext implements Externalizable {
             descByCls.put(cls, desc);
         }
 
-        metaHnd.addMeta(id, new BinaryMetaDataImpl(typeName, fieldsMeta, affKeyFieldName));
+        metaHnd.addMeta(id, new BinaryMetaDataImpl(id, typeName, fieldsMeta, affKeyFieldName));
     }
 
     /**
@@ -816,7 +816,7 @@ public class PortableContext implements Externalizable {
      * @throws org.apache.ignite.binary.BinaryObjectException In case of error.
      */
     public void updateMetaData(int typeId, String typeName, Map<String, String> fields)
throws BinaryObjectException {
-        updateMetaData(typeId, new BinaryMetaDataImpl(typeName, fields, null));
+        updateMetaData(typeId, new BinaryMetaDataImpl(typeId, typeName, fields, null));
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/ignite/blob/267046b0/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
index 7c9b926..7e9a554 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/portable/CacheObjectBinaryProcessorImpl.java
@@ -292,8 +292,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
                                 Map<String, String> fields = new HashMap<>();
 
                                 if (checkMeta(typeId, oldMeta, newMeta, fields)) {
-                                    newMeta = new BinaryMetaDataImpl(newMeta.typeName(),
-                                        fields,
+                                    newMeta = new BinaryMetaDataImpl(typeId, newMeta.typeName(),
fields,
                                         newMeta.affinityKeyFieldName());
 
                                     metaBuf.put(typeId, newMeta);
@@ -564,8 +563,8 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
     /** {@inheritDoc} */
     @Override public void updateMetaData(int typeId, String typeName, @Nullable String affKeyFieldName,
         Map<String, Integer> fieldTypeIds) throws BinaryObjectException {
-        portableCtx.updateMetaData(typeId,
-            new BinaryMetaDataImpl(typeName, fieldTypeNames(fieldTypeIds), affKeyFieldName));
+        portableCtx.updateMetaData(typeId, new BinaryMetaDataImpl(typeId, typeName, fieldTypeNames(fieldTypeIds),
+            affKeyFieldName));
     }
 
     /** {@inheritDoc} */
@@ -942,8 +941,7 @@ public class CacheObjectBinaryProcessorImpl extends IgniteCacheObjectProcessorIm
                 Map<String, String> fields = new HashMap<>();
 
                 if (checkMeta(typeId, oldMeta, newMeta, fields)) {
-                    BinaryType res = new BinaryMetaDataImpl(newMeta.typeName(),
-                        fields,
+                    BinaryType res = new BinaryMetaDataImpl(typeId, newMeta.typeName(), fields,
                         newMeta.affinityKeyFieldName());
 
                     entry.setValue(res);


Mime
View raw message