You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/09/04 18:27:21 UTC

[07/55] [abbrv] ignite git commit: IGNITE-1364: Moved CPP module to Ignite.

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
new file mode 100644
index 0000000..da4fdb9
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_INTEROP
+#define _IGNITE_IMPL_INTEROP
+
+#include "ignite/impl/interop/interop_memory.h"
+#include "ignite/impl/interop/interop_output_stream.h"
+#include "ignite/impl/interop/interop_input_stream.h"
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
new file mode 100644
index 0000000..d8fcfc3
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_INTEROP_INPUT_STREAM
+#define _IGNITE_IMPL_INTEROP_INPUT_STREAM
+
+#include "ignite/impl/interop/interop_memory.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace interop
+        {
+            /**
+             * Interop input stream implementation.
+             */
+            class IGNITE_IMPORT_EXPORT InteropInputStream {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param mem Memory.
+                 */
+                InteropInputStream(InteropMemory* mem);
+
+                /**
+                 * Read signed 8-byte int.
+                 *
+                 * @return Value.
+                 */
+                int8_t ReadInt8();
+                    
+                /**
+                 * Read signed 8-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.                 
+                 */
+                void ReadInt8Array(int8_t* const res, const int32_t len);
+
+                /**
+                 * Read bool.
+                 *
+                 * @return Value.
+                 */
+                bool ReadBool();
+
+                /**
+                 * Read bool array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadBoolArray(bool* const res, const int32_t len);
+
+                /**
+                 * Read signed 16-byte int.
+                 *
+                 * @return Value.
+                 */
+                int16_t ReadInt16();
+
+                /**
+                 * Read signed 16-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt16Array(int16_t* const res, const int32_t len);
+
+                /**
+                 * Read unsigned 16-byte int.
+                 *
+                 * @return Value.
+                 */
+                uint16_t ReadUInt16();
+
+                /**
+                 * Read unsigned 16-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadUInt16Array(uint16_t* const res, const int32_t len);
+
+                /**
+                 * Read signed 32-byte int.
+                 *
+                 * @return Value.
+                 */
+                int32_t ReadInt32();
+
+                /**
+                 * Read signed 32-byte int at the given position.
+                 *
+                 * @param pos Position.
+                 * @return Value.
+                 */
+                int32_t ReadInt32(int32_t pos);
+                    
+                /**
+                 * Read signed 32-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt32Array(int32_t* const res, const int32_t len);
+
+                /**
+                 * Read signed 64-byte int.
+                 *
+                 * @return Value.
+                 */
+                int64_t ReadInt64();
+
+                /**
+                 * Read signed 64-byte int array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadInt64Array(int64_t* const res, const int32_t len);
+
+                /**
+                 * Read float.
+                 *
+                 * @return Value.
+                 */
+                float ReadFloat();
+
+                /**
+                 * Read float array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadFloatArray(float* const res, const int32_t len);
+
+                /**
+                 * Read double.
+                 *
+                 * @return Value.
+                 */
+                double ReadDouble();
+
+                /**
+                 * Read double array.
+                 *
+                 * @param res Allocated array.
+                 * @param len Length.
+                 */
+                void ReadDoubleArray(double* const res, const int32_t len);
+
+                /**
+                 * Get remaining bytes.
+                 *
+                 * @return Remaining bytes.
+                 */
+                int32_t Remaining();
+
+                /**
+                 * Get position.
+                 *
+                 * @return Position.
+                 */
+                int32_t Position();
+
+                /**
+                 * Set position.
+                 *
+                 * @param Position.
+                 */
+                void Position(int32_t pos);
+
+                /**
+                 * Synchronize data from underlying memory.
+                 */
+                void Synchronize();
+            private:
+                /** Memory. */
+                InteropMemory* mem; 
+                
+                /** Pointer to data. */
+                int8_t* data;       
+                
+                /** Length. */
+                int len;            
+                
+                /** Current position. */
+                int pos;            
+                    
+                /**
+                 * Ensure there is enough data in the stream.
+                 *
+                 * @param cnt Amount of byte expected to be available.
+                 */
+                void EnsureEnoughData(int32_t cnt);
+
+                /**
+                 * Copy data from the stream shifting it along the way.
+                 *
+                 * @param ptr Pointer to data.
+                 * @param off Offset.
+                 * @param cnt Amount of data to copy.
+                 */
+                void CopyAndShift(int8_t* dest, int32_t off, int32_t cnt);
+
+                /**
+                 * Shift stream to the right.
+                 *
+                 * @param cnt Amount of bytes to shift the stream to.
+                 */
+                void Shift(int32_t cnt);
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h
new file mode 100644
index 0000000..00cba43
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h
@@ -0,0 +1,280 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_INTEROP_MEMORY
+#define _IGNITE_IMPL_INTEROP_MEMORY
+
+#include <stdint.h>
+
+#include <ignite/common/common.h>
+
+namespace ignite 
+{
+    namespace impl 
+    {
+        namespace interop 
+        {
+            /** Memory header length. */
+            const int IGNITE_MEM_HDR_LEN = 20;
+
+            /** Memory header offset: capacity. */
+            const int IGNITE_MEM_HDR_OFF_CAP = 8;
+
+            /** Memory header offset: length. */
+            const int IGNITE_MEM_HDR_OFF_LEN = 12;
+
+            /** Memory header offset: flags. */
+            const int IGNITE_MEM_HDR_OFF_FLAGS = 16;
+
+            /** Flag: external. */
+            const int IGNITE_MEM_FLAG_EXT = 0x1;
+
+            /** Flag: pooled. */
+            const int IGNITE_MEM_FLAG_POOLED = 0x2;
+
+            /** Flag: acquired. */
+            const int IGNITE_MEM_FLAG_ACQUIRED = 0x4;
+                
+            /**
+             * Interop memory.
+             */
+            class IGNITE_IMPORT_EXPORT InteropMemory
+            {
+            public:
+                /**
+                 * Get raw data pointer.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Raw data pointer.
+                 */
+                static int8_t* Data(int8_t* memPtr);
+
+                /**
+                 * Set raw data pointer.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @param ptr Raw data pointer.
+                 */
+                static void Data(int8_t* memPtr, void* ptr);
+
+                /**
+                 * Get capacity.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Capacity.
+                 */
+                static int32_t Capacity(int8_t* memPtr);
+
+                /**
+                 * Set capacity.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @param val Value.
+                 */
+                static void Capacity(int8_t* memPtr, int32_t val);
+
+                /**
+                 * Get length.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Length.
+                 */
+                static int32_t Length(int8_t* memPtr);
+
+                /**
+                 * Set length.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @param val Value.
+                 */
+                static void Length(int8_t* memPtr, int32_t val);
+
+                /**
+                 * Get flags.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Flags.
+                 */
+                static int32_t Flags(int8_t* memPtr);
+
+                /**
+                 * Set flags.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @param val Value.
+                 */
+                static void Flags(int8_t* memPtr, int32_t val);
+
+                /**
+                 * Get "external" flag state.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Flag state.
+                 */
+                static bool IsExternal(int8_t* memPtr);
+
+                /**
+                 * Get "external" flag state.
+                 *
+                 * @param flags Flags.
+                 * @return Flag state.
+                 */
+                static bool IsExternal(int32_t flags);
+
+                /**
+                 * Get "pooled" flag state.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Flag state.
+                 */
+                static bool IsPooled(int8_t* memPtr);
+
+                /**
+                 * Get "pooled" flag state.
+                 *
+                 * @param flags Flags.
+                 * @return Flag state.
+                 */
+                static bool IsPooled(int32_t flags);
+
+                /**
+                 * Get "acquired" flag state.
+                 *
+                 * @param memPtr Memory pointer.
+                 * @return Flag state.
+                 */
+                static bool IsAcquired(int8_t* memPtr);
+
+                /**
+                 * Get "acquired" flag state.
+                 *
+                 * @param flags Flags.
+                 * @return Flag state.
+                 */
+                static bool IsAcquired(int32_t flags);
+
+                /**
+                 * Destructor.
+                 */
+                virtual ~InteropMemory() { }
+                    
+                /**
+                 * Get cross-platform memory pointer.
+                 *
+                 * @return Memory pointer.
+                 */
+                int8_t* Pointer();
+
+                /**
+                 * Get cross-platform pointer in long form.
+                 */
+                int64_t PointerLong();
+
+                /**
+                 * Get raw data pointer.
+                 *
+                 * @return Data pointer.
+                 */
+                int8_t* Data();
+
+                /**
+                 * Get capacity.
+                 *
+                 * @return Capacity.
+                 */
+                int32_t Capacity();
+
+                /**
+                 * Get length.
+                 *
+                 * @return Length.
+                 */
+                int32_t Length();
+
+                /**
+                 * Set length.
+                 *
+                 * @param val Length.
+                 */
+                void Length(int32_t val);
+
+                /**
+                 * Reallocate memory.
+                 *
+                 * @param cap Desired capactiy.
+                 */
+                virtual void Reallocate(int32_t cap) = 0;
+            protected:
+                /** Memory pointer. */
+                int8_t* memPtr; 
+            };
+
+            /**
+             * Interop unpooled memory.
+             */
+            class IGNITE_IMPORT_EXPORT InteropUnpooledMemory : public InteropMemory
+            {
+            public:
+                /**
+                 * Constructor create new unpooled memory object from scratch.
+                 *
+                 * @param cap Capacity.
+                 */
+                explicit InteropUnpooledMemory(int32_t cap);
+
+                /**
+                 * Constructor creating unpooled memory object from existing memory pointer.
+                 *
+                 * @param memPtr Memory pointer.
+                 */
+                explicit InteropUnpooledMemory(int8_t* memPtr);
+
+                /**
+                 * Destructor.
+                 */
+                ~InteropUnpooledMemory();
+
+                virtual void Reallocate(int32_t cap);
+            private:
+                /** Whether this instance is owner of memory chunk. */
+                bool owning; 
+
+                IGNITE_NO_COPY_ASSIGNMENT(InteropUnpooledMemory)
+            };
+
+            /**
+             * Interop external memory.
+             */
+            class IGNITE_IMPORT_EXPORT InteropExternalMemory : public InteropMemory
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param memPtr External memory pointer.
+                 */
+                explicit InteropExternalMemory(int8_t* memPtr);
+
+                virtual void Reallocate(int32_t cap);
+            private:
+                IGNITE_NO_COPY_ASSIGNMENT(InteropExternalMemory)
+            };
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h
new file mode 100644
index 0000000..5a08aed
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h
@@ -0,0 +1,234 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_INTEROP_OUTPUT_STREAM
+#define _IGNITE_IMPL_INTEROP_OUTPUT_STREAM
+
+#include "ignite/impl/interop/interop_memory.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace interop
+        {
+            /**
+             * Interop output stream.
+             */
+            class IGNITE_IMPORT_EXPORT InteropOutputStream {
+            public:
+                /**
+                 * Create new output stream with the given capacity.
+                 *
+                 * @param mem Memory.
+                 */
+                InteropOutputStream(InteropMemory* mem);
+
+                /**
+                 * Write signed 8-byte integer.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt8(const int8_t val);
+
+                /**
+                 * Write signed 8-byte integer at the given position.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt8(const int8_t val, const int32_t pos);
+
+                /**
+                 * Write signed 8-byte integer array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteInt8Array(const int8_t* val, const int32_t len);
+
+                /**
+                 * Write bool.
+                 *
+                 * @param val Value.
+                 */
+                void WriteBool(const bool val);
+
+                /**
+                 * Write bool array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteBoolArray(const bool* val, const int32_t len);
+
+                /**
+                 * Write signed 16-byte integer.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt16(const int16_t val);
+
+                /**
+                 * Write signed 16-byte integer array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteInt16Array(const int16_t* val, const int32_t len);
+
+                /**
+                 * Write unsigned 16-byte integer.
+                 *
+                 * @param val Value.
+                 */
+                void WriteUInt16(const uint16_t val);
+
+                /**
+                 * Write unsigned 16-byte integer array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteUInt16Array(const uint16_t* val, const int32_t len);
+
+                /**
+                 * Write signed 32-byte integer.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt32(const int32_t val);
+
+                /**
+                 * Write signed 32-byte integer at the given position.
+                 *
+                 * @param pos Position.
+                 * @param val Value.
+                 */
+                void WriteInt32(const int32_t pos, const int32_t val);
+
+                /**
+                 * Write signed 32-byte integer array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteInt32Array(const int32_t* val, const int32_t len);
+
+                /**
+                 * Write signed 64-byte integer.
+                 *
+                 * @param val Value.
+                 */
+                void WriteInt64(const int64_t val);
+
+                /**
+                 * Write signed 64-byte integer array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteInt64Array(const int64_t* val, const int32_t len);
+
+                /**
+                 * Write float.
+                 *
+                 * @param val Value.
+                 */
+                void WriteFloat(const float val);
+
+                /**
+                 * Write float array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteFloatArray(const float* val, const int32_t len);
+
+                /**
+                 * Write double.
+                 *
+                 * @param val Value.
+                 */
+                void WriteDouble(const double val);
+
+                /**
+                 * Write double array.
+                 *
+                 * @param val Value.
+                 * @param len Length.
+                 */
+                void WriteDoubleArray(const double* val, const int32_t len);
+
+                /**
+                 * Get current stream position.
+                 */
+                int32_t Position();
+
+                /**
+                 * Set current stream position (absolute).
+                 *
+                 * @param val Position (absolute).
+                 */
+                void Position(const int32_t val);
+
+                /**
+                 * Synchronize data with underlying memory.
+                 */
+                void Synchronize();
+            private:
+                /** Memory. */
+                InteropMemory* mem; 
+
+                /** Pointer to data. */
+                int8_t* data;       
+
+                /** Capacity. */
+                int cap;            
+
+                /** Current position. */
+                int pos;            
+
+                IGNITE_NO_COPY_ASSIGNMENT(InteropOutputStream)
+
+                /**
+                 * Ensure that stream enough capacity optionally extending it.
+                 *
+                 * @param reqCap Requsted capacity.
+                 */
+                void EnsureCapacity(int32_t reqCap);
+
+                /**
+                 * Shift stream to the right.
+                 *
+                 * @param cnt Amount of bytes to shift the stream to.
+                 */
+                void Shift(int32_t cnt);
+
+                /**
+                 * Copy data to the stream shifting it along the way.
+                 *
+                 * @param ptr Pointer to data.
+                 * @param off Offset.
+                 * @param len Length.
+                 */
+                void CopyAndShift(const int8_t* src, int32_t off, int32_t len);
+            };
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/operations.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/operations.h b/modules/platform/src/main/cpp/core/include/ignite/impl/operations.h
new file mode 100644
index 0000000..8f32922
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/operations.h
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_OPERATION
+#define _IGNITE_IMPL_OPERATION
+
+#include <map>
+#include <set>
+#include <vector>
+
+#include <ignite/common/common.h>
+
+#include "ignite/cache/cache_entry.h"
+#include "ignite/impl/portable/portable_reader_impl.h"
+#include "ignite/impl/portable/portable_writer_impl.h"
+#include "ignite/portable/portable.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        /**
+         * Input operation.
+         */
+        class InputOperation
+        {
+        public:
+            /**
+             * Destructor.
+             */
+            virtual ~InputOperation()
+            {
+                // No-op.
+            }
+
+            /**
+             * Process input.
+             *
+             * @param writer Writer.
+             */
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer) = 0;
+        };
+
+        /**
+         * Input operation accepting a single argument.
+         */
+        template<typename T>
+        class In1Operation : public InputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             * 
+             * @param val Value.
+             */
+            In1Operation(const T* val) : val(val)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.WriteTopObject<T>(*val);
+            }
+        private:
+            /** Value. */
+            const T* val; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(In1Operation)
+        };
+
+        /**
+         * Input operation accepting two single objects.
+         */
+        template<typename T1, typename T2>
+        class In2Operation : public InputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             *
+             * @param val1 First value.
+             * @param val2 Second value.
+             */
+            In2Operation(const T1* val1, const T2* val2) : val1(val1), val2(val2)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.WriteTopObject<T1>(*val1);
+                writer.WriteTopObject<T2>(*val2);
+            }
+        private:
+            /** First value. */
+            const T1* val1; 
+
+            /** Second value. */
+            const T2* val2; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(In2Operation)
+        };
+
+        /**
+         * Input operation accepting three single objects.
+         */
+        template<typename T1, typename T2, typename T3>
+        class In3Operation : public InputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             *
+             * @param val1 First value.
+             * @param val2 Second value.
+             * @param val3 Third value.
+             */
+            In3Operation(const T1* val1, const T2* val2, const T3* val3) : val1(val1), val2(val2), val3(val3)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.WriteTopObject<T1>(*val1);
+                writer.WriteTopObject<T2>(*val2);
+                writer.WriteTopObject<T3>(*val3);
+            }
+        private:
+            /** First value. */
+            const T1* val1;
+
+            /** Second value. */
+            const T2* val2;
+
+            /** Third value. */
+            const T3* val3;
+
+            IGNITE_NO_COPY_ASSIGNMENT(In3Operation)
+        };
+
+        /*
+         * Input set operation.
+         */
+        template<typename T>
+        class InSetOperation : public InputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             *
+             * @param val Value.
+             */
+            InSetOperation(const std::set<T>* val) : val(val)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.GetStream()->WriteInt32(static_cast<int32_t>(val->size()));
+
+                for (typename std::set<T>::const_iterator it = val->begin(); it != val->end(); ++it)
+                    writer.WriteTopObject<T>(*it);
+            }
+        private:
+            /** Value. */
+            const std::set<T>* val; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(InSetOperation)
+        };
+
+        /**
+         * Input map operation.
+         */
+        template<typename K, typename V>
+        class InMapOperation : public InputOperation
+        {
+        public:
+            /*
+             * Constructor.
+             *
+             * @param val Value.
+             */
+            InMapOperation(const std::map<K, V>* val) : val(val)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.GetStream()->WriteInt32(static_cast<int32_t>(val->size()));
+
+                for (typename std::map<K, V>::const_iterator it = val->begin(); it != val->end(); ++it) {
+                    writer.WriteTopObject<K>(it->first);
+                    writer.WriteTopObject<V>(it->second);
+                }
+            }
+        private:
+            /** Value. */
+            const std::map<K, V>* val; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(InMapOperation)
+        };
+
+        /**
+         * Cache LocalPeek input operation.
+         */
+        template<typename T>
+        class InCacheLocalPeekOperation : public InputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             *
+             * @param key Key.
+             * @param peekModes Peek modes.
+             */
+            InCacheLocalPeekOperation(const T* key, int32_t peekModes) : key(key), peekModes(peekModes)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessInput(ignite::impl::portable::PortableWriterImpl& writer)
+            {
+                writer.WriteTopObject<T>(*key);
+                writer.GetStream()->WriteInt32(peekModes);
+            }
+        private:
+            /** Key. */
+            const T* key;   
+
+            /** Peek modes. */
+            int32_t peekModes; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(InCacheLocalPeekOperation)
+        };
+
+        /**
+         * Output operation.
+         */
+        class OutputOperation
+        {
+        public:
+            /**
+             * Destructor.
+             */
+            virtual ~OutputOperation()
+            {
+                // No-op.
+            }
+
+            /**
+             * Process output.
+             *
+             * @param reader Reader.
+             */
+            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader) = 0;
+        };
+
+        /**
+         * Output operation returning single object.
+         */
+        template<typename T>
+        class Out1Operation : public OutputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             */
+            Out1Operation()
+            {
+                // No-op.
+            }
+
+            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            {
+                val = reader.ReadTopObject<T>();
+            }
+
+            /**
+             * Get value.
+             *
+             * @param Value.
+             */
+            T GetResult()
+            {
+                return val;
+            }
+        private:
+            /** Value. */
+            T val; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(Out1Operation)
+        };
+
+        /**
+         * Output operation returning single object.
+         */
+        template<typename T1, typename T2>
+        class Out2Operation : public OutputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             */
+            Out2Operation()
+            {
+                // No-op.
+            }
+
+            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            {
+                val1 = reader.ReadTopObject<T1>();
+                val2 = reader.ReadTopObject<T2>();
+            }
+
+            /**
+             * Get value 1.
+             *
+             * @param Value 1.
+             */
+            T1& Get1()
+            {
+                return val1;
+            }
+
+            /**
+             * Get value 2.
+             *
+             * @param Value 2.
+             */
+            T2& Get2()
+            {
+                return val2;
+            }
+
+        private:
+            /** Value 1. */
+            T1 val1; 
+            
+            /** Value 2. */
+            T2 val2; 
+
+            IGNITE_NO_COPY_ASSIGNMENT(Out2Operation)
+        };
+        
+        /*
+         * Output map operation.
+         */
+        template<typename T1, typename T2>
+        class OutMapOperation :public OutputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             */
+            OutMapOperation()
+            {
+                // No-op.
+            }
+
+            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            {
+                bool exists = reader.GetStream()->ReadBool();
+
+                if (exists)
+                {
+                    int32_t cnt = reader.GetStream()->ReadInt32();
+
+                    std::map<T1, T2> val0;
+
+                    for (int i = 0; i < cnt; i++) {
+                        T1 t1 = reader.ReadTopObject<T1>();
+                        T2 t2 = reader.ReadTopObject<T2>();
+
+                        val0[t1] = t2;
+                    }
+
+                    val = val0;
+                }
+            }
+
+            /**
+             * Get value.
+             *
+             * @param Value.
+             */
+            std::map<T1, T2> GetResult()
+            {
+                return val;
+            }
+        private:
+            /** Value. */
+            std::map<T1, T2> val;
+
+            IGNITE_NO_COPY_ASSIGNMENT(OutMapOperation)
+        };
+
+        /*
+         * Output query GET ALL operation.
+         */
+        template<typename K, typename V>
+        class OutQueryGetAllOperation : public OutputOperation
+        {
+        public:
+            /**
+             * Constructor.
+             */
+            OutQueryGetAllOperation(std::vector<ignite::cache::CacheEntry<K, V>>* res) : res(res)
+            {
+                // No-op.
+            }
+
+            virtual void ProcessOutput(ignite::impl::portable::PortableReaderImpl& reader)
+            {
+                int32_t cnt = reader.ReadInt32();
+
+                for (int i = 0; i < cnt; i++) 
+                {
+                    K key = reader.ReadTopObject<K>();
+                    V val = reader.ReadTopObject<V>();
+
+                    res->push_back(ignite::cache::CacheEntry<K, V>(key, val));
+                }
+            }
+
+        private:
+            /** Entries. */
+            std::vector<ignite::cache::CacheEntry<K, V>>* res;
+            
+            IGNITE_NO_COPY_ASSIGNMENT(OutQueryGetAllOperation)
+        };
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
new file mode 100644
index 0000000..622cb54
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
@@ -0,0 +1,146 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_COMMON
+#define _IGNITE_IMPL_PORTABLE_COMMON
+
+#include <stdint.h>
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /** Header: null. */
+            const int8_t IGNITE_HDR_NULL = 101;
+
+            /** Header: handle. */
+            const int8_t IGNITE_HDR_HND = 102;
+
+            /** Header: fulle form. */
+            const int8_t IGNITE_HDR_FULL = 103;
+
+            /** Full header length. */
+            const int32_t IGNITE_FULL_HDR_LEN = 18;
+
+            /** Type: object. */
+            const int8_t IGNITE_TYPE_OBJECT = IGNITE_HDR_FULL;
+
+            /** Type: unsigned byte. */
+            const int8_t IGNITE_TYPE_BYTE = 1;
+
+            /** Type: short. */
+            const int8_t IGNITE_TYPE_SHORT = 2;
+
+            /** Type: int. */
+            const int8_t IGNITE_TYPE_INT = 3;
+
+            /** Type: long. */
+            const int8_t IGNITE_TYPE_LONG = 4;
+
+            /** Type: float. */
+            const int8_t IGNITE_TYPE_FLOAT = 5;
+
+            /** Type: double. */
+            const int8_t IGNITE_TYPE_DOUBLE = 6;
+
+            /** Type: char. */
+            const int8_t IGNITE_TYPE_CHAR = 7;
+
+            /** Type: boolean. */
+            const int8_t IGNITE_TYPE_BOOL = 8;
+
+            /** Type: decimal. */
+            const int8_t IGNITE_TYPE_DECIMAL = 30;
+
+            /** Type: string. */
+            const int8_t IGNITE_TYPE_STRING = 9;
+
+            /** Type: UUID. */
+            const int8_t IGNITE_TYPE_UUID = 10;
+
+            /** Type: date. */
+            const int8_t IGNITE_TYPE_DATE = 11;
+
+            /** Type: unsigned byte array. */
+            const int8_t IGNITE_TYPE_ARRAY_BYTE = 12;
+
+            /** Type: short array. */
+            const int8_t IGNITE_TYPE_ARRAY_SHORT = 13;
+
+            /** Type: int array. */
+            const int8_t IGNITE_TYPE_ARRAY_INT = 14;
+
+            /** Type: long array. */
+            const int8_t IGNITE_TYPE_ARRAY_LONG = 15;
+
+            /** Type: float array. */
+            const int8_t IGNITE_TYPE_ARRAY_FLOAT = 16;
+
+            /** Type: double array. */
+            const int8_t IGNITE_TYPE_ARRAY_DOUBLE = 17;
+
+            /** Type: char array. */
+            const int8_t IGNITE_TYPE_ARRAY_CHAR = 18;
+
+            /** Type: boolean array. */
+            const int8_t IGNITE_TYPE_ARRAY_BOOL = 19;
+
+            /** Type: decimal array. */
+            const int8_t IGNITE_TYPE_ARRAY_DECIMAL = 31;
+
+            /** Type: string array. */
+            const int8_t IGNITE_TYPE_ARRAY_STRING = 20;
+
+            /** Type: UUID array. */
+            const int8_t IGNITE_TYPE_ARRAY_UUID = 21;
+
+            /** Type: date array. */
+            const int8_t IGNITE_TYPE_ARRAY_DATE = 22;
+
+            /** Type: object array. */
+            const int8_t IGNITE_TYPE_ARRAY = 23;
+
+            /** Type: collection. */
+            const int8_t IGNITE_TYPE_COLLECTION = 24;
+
+            /** Type: map. */
+            const int8_t IGNITE_TYPE_MAP = 25;
+
+            /** Type: map entry. */
+            const int8_t IGNITE_TYPE_MAP_ENTRY = 26;
+
+            /** Type: portable object. */
+            const int8_t IGNITE_TYPE_PORTABLE = 27;
+
+            /** Read/write single object. */
+            const int32_t IGNITE_PORTABLE_MODE_SINGLE = 0;
+
+            /** Read/write array. */
+            const int32_t IGNITE_PORTABLE_MODE_ARRAY = 1;
+
+            /** Read/write collection. */
+            const int32_t IGNITE_PORTABLE_MODE_COL = 2;
+
+            /** Read/write map. */
+            const int32_t IGNITE_PORTABLE_MODE_MAP = 3;
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_id_resolver.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
new file mode 100644
index 0000000..d8f7883
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_ID_RESOLVER
+#define _IGNITE_IMPL_PORTABLE_ID_RESOLVER
+
+#include "ignite/portable/portable_type.h"
+
+namespace ignite
+{
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Portable type id resolver.
+             */
+            class PortableIdResolver
+            {
+            public:
+                /**
+                 * Destructor.
+                 */
+                virtual ~PortableIdResolver()
+                {
+                    // No-op.
+                }
+
+                /**
+                 * Get portable object type ID.
+                 *
+                 * @return Type ID.
+                 */
+                virtual int32_t GetTypeId() = 0;
+
+                /**
+                 * Get portable object field ID.
+                 *
+                 * @param typeId Type ID.
+                 * @param name Field name.
+                 * @return Field ID.
+                 */
+                virtual int32_t GetFieldId(const int32_t typeId, const char* name) = 0;
+            };
+
+            /**
+             * Templated portable type descriptor.
+             */
+            template<typename T>
+            class TemplatedPortableIdResolver : public PortableIdResolver
+            {
+            public:
+                /**
+                 * Constructor.
+                 */
+                TemplatedPortableIdResolver()
+                {
+                    type = ignite::portable::PortableType<T>();
+                }
+
+                /**
+                 * Constructor.
+                 *
+                 * @param type Portable type.
+                 */
+                TemplatedPortableIdResolver(ignite::portable::PortableType<T> type) : type(type)
+                {
+                    // No-op.
+                }
+
+                virtual int32_t GetTypeId()
+                {
+                    return type.GetTypeId();
+                }
+
+                virtual int32_t GetFieldId(const int32_t typeId, const char* name) {
+                    if (!name)
+                    {
+                        IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Field name cannot be NULL.");
+                    }
+
+                    return type.GetFieldId(name);
+                }
+            private:
+                /** Actual type.  */
+                ignite::portable::PortableType<T> type; 
+            };
+        }
+    }
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
new file mode 100644
index 0000000..a557129
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_METADATA_HANDLER
+#define _IGNITE_IMPL_PORTABLE_METADATA_HANDLER
+
+#include <ignite/common/concurrent.h>
+
+#include "ignite/impl/portable/portable_metadata_snapshot.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Metadata handler. Tracks all metadata updates during write session.
+             */
+            class PortableMetadataHandler 
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param snap Snapshot.
+                 */
+                PortableMetadataHandler(SPSnap snap);
+                
+                /**
+                 * Destructor.
+                 */
+                ~PortableMetadataHandler();
+
+                /**
+                 * Callback invoked when field is being written.
+                 *
+                 * @param fieldId Field ID.
+                 * @param fieldName Field name.
+                 * @param fieldTypeId Field type ID.
+                 */
+                void OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId);
+
+                /**
+                 * Get initial snapshot.
+                 *
+                 * @param Snapshot.
+                 */
+                SPSnap GetSnapshot();
+
+                /**
+                 * Whether any difference exists.
+                 *
+                 * @param True if difference exists.
+                 */
+                bool HasDifference();
+
+                /**
+                 * Get recorded field IDs difference.
+                 *
+                 * @param Recorded field IDs difference.
+                 */
+                std::set<int32_t>* GetFieldIds();
+
+                /**
+                 * Get recorded fields difference.
+                 *
+                 * @param Recorded fields difference.
+                 */
+                std::map<std::string, int32_t>* GetFields();
+
+            private:
+                /** Snapshot. */
+                SPSnap snap;                          
+
+                /** Recorded field IDs difference. */
+                std::set<int32_t>* fieldIds;           
+                
+                /** Recorded fields difference. */
+                std::map<std::string, int32_t>* fields; 
+
+                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataHandler)
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
new file mode 100644
index 0000000..3e2b770
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
@@ -0,0 +1,120 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_METADATA_MANAGER
+#define _IGNITE_IMPL_PORTABLE_METADATA_MANAGER
+
+#include <vector>
+
+#include "ignite/ignite_error.h"
+#include "ignite/impl/portable/portable_metadata_handler.h"
+#include "ignite/impl/portable/portable_metadata_updater.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Metadata manager.
+             */
+            class IGNITE_IMPORT_EXPORT PortableMetadataManager
+            {
+            public:
+                /**
+                 * Constructor.
+                 */
+                PortableMetadataManager();
+
+                /**
+                 * Destructor.
+                 */
+                ~PortableMetadataManager();
+
+                /**
+                 * Get handler.
+                 *
+                 * @param typeId Type ID.
+                 */
+                ignite::common::concurrent::SharedPointer<PortableMetadataHandler> GetHandler(int32_t typeId);
+
+                /**
+                 * Submit handler for processing.
+                 * 
+                 * @param typeName Type name.
+                 * @param typeId Type ID.
+                 * @param hnd Handler.
+                 */
+                void SubmitHandler(std::string typeName, int32_t typeId, PortableMetadataHandler* hnd);
+
+                /**
+                 * Get current metadata manager version.
+                 *
+                 * @param Version.
+                 */
+                int32_t GetVersion();
+
+                /**
+                 * Check whether something is updated since the given version.
+                 *
+                 * @param oldVer Old version.
+                 * @return True if updated and it is very likely that pending metadata exists.
+                 */
+                bool IsUpdatedSince(int32_t oldVer);
+
+                /**
+                 * Process pending updates.
+                 *
+                 * @param updated Updater.
+                 * @param err Error.
+                 * @return In case of success.
+                 */
+                bool ProcessPendingUpdates(PortableMetadataUpdater* updater, IgniteError* err);
+
+            private:
+                /** Current snapshots. */
+                ignite::common::concurrent::SharedPointer<std::map<int32_t, SPSnap>> snapshots;
+                
+                /** Pending snapshots. */
+                std::vector<SPSnap>* pending;                                          
+
+                /** Critical section. */
+                ignite::common::concurrent::CriticalSection* cs;
+
+                /** Version of pending changes. */
+                int32_t pendingVer;                                                    
+                
+                /** Latest version. */
+                int32_t ver;          
+
+                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataManager);
+
+                /**
+                 * Copy fields from a snapshot into relevant collections.
+                 *
+                 * @param snap Target snapshot.
+                 * @param fieldIds Field IDs.
+                 * @param fields Fields.
+                 */
+                void CopyFields(Snap* snap, std::set<int32_t>* fieldIds, std::map<std::string, int32_t>* fields);
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
new file mode 100644
index 0000000..1e000fc
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
@@ -0,0 +1,122 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_METADATA_SNAPSHOT
+#define _IGNITE_IMPL_PORTABLE_METADATA_SNAPSHOT
+
+#include <map>
+#include <set>
+#include <stdint.h>
+#include <string>
+
+#include <ignite/common/common.h>
+#include <ignite/common/concurrent.h>
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Metadata snapshot. 
+             */
+            class PortableMetadataSnapshot
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param typeName Type name.
+                 * @param typeId Type ID.
+                 * @param fieldIds Field IDs.
+                 * @param fields Fields.
+                 */
+                PortableMetadataSnapshot(std::string typeName, int32_t typeId, std::set<int32_t>* fieldIds, 
+                    std::map<std::string, int32_t>* fields);
+                
+                /**
+                 * Destructor.
+                 */
+                ~PortableMetadataSnapshot();
+
+                /**
+                 * Check whether snapshot contains a field with the given ID.
+                 *
+                 * @param fieldId Field ID.
+                 * @return True if contains, false otherwise.
+                 */
+                bool ContainsFieldId(int32_t fieldId);
+
+                /**
+                 * Get type name.
+                 *
+                 * @param Type name.
+                 */
+                std::string GetTypeName();
+
+                /**
+                 * Get type ID.
+                 *
+                 * @return Type ID.
+                 */
+                int32_t GetTypeId();
+
+                /**
+                 * Whether snapshot contains any fields.
+                 *
+                 * @param True if fields exist.
+                 */
+                bool HasFields();
+
+                /** 
+                 * Get field IDs.
+                 *
+                 * @param Field IDs.
+                 */
+                std::set<int32_t>* GetFieldIds();
+
+                /**
+                 * Get fields.
+                 *
+                 * @return Fields.
+                 */
+                std::map<std::string, int32_t>* GetFields();
+
+            private:
+                /** Type name. */
+                std::string typeName;                   
+                
+                /** Type ID. */
+                int32_t typeId;
+
+                /** Known field IDs. */
+                std::set<int32_t>* fieldIds;
+
+                /** Field name-type mappings. */
+                std::map<std::string, int32_t>* fields; 
+
+                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataSnapshot)
+            };
+
+            typedef PortableMetadataSnapshot Snap;
+            typedef ignite::common::concurrent::SharedPointer<Snap> SPSnap;
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
new file mode 100644
index 0000000..a734db7
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_METADATA_UPDATER
+#define _IGNITE_IMPL_PORTABLE_METADATA_UPDATER
+
+#include "ignite/ignite_error.h"
+#include "ignite/impl/portable/portable_metadata_snapshot.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Metadata updater interface.
+             */
+            class IGNITE_IMPORT_EXPORT PortableMetadataUpdater
+            {
+            public:
+                /**
+                 * Destructor.
+                 */
+                virtual ~PortableMetadataUpdater();
+
+                /**
+                 * Update metadata using provided snapshot.
+                 *
+                 * @param snapshot Snapshot.
+                 * @param err Error.
+                 */
+                virtual bool Update(Snap* snapshot, IgniteError* err) = 0;
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ignite/blob/58a665aa/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
new file mode 100644
index 0000000..832c2a3
--- /dev/null
+++ b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef _IGNITE_IMPL_PORTABLE_METADATA_UPDATER_IMPL
+#define _IGNITE_IMPL_PORTABLE_METADATA_UPDATER_IMPL
+
+#include <ignite/common/exports.h>
+
+#include "ignite/impl/ignite_environment.h"
+#include "ignite/impl/portable/portable_metadata_updater.h"
+
+namespace ignite
+{    
+    namespace impl
+    {
+        namespace portable
+        {
+            /**
+             * Metadata updater implementation.
+             */
+            class IGNITE_IMPORT_EXPORT PortableMetadataUpdaterImpl : public PortableMetadataUpdater
+            {
+            public:
+                /**
+                 * Constructor.
+                 *
+                 * @param env Environment.
+                 * @param javaRef Reference to Java object which is able to process metadata request.
+                 */
+                PortableMetadataUpdaterImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
+
+                /**
+                 * Destructor.
+                 */
+                ~PortableMetadataUpdaterImpl();
+
+                bool Update(Snap* snapshot, IgniteError* err);
+            private:
+                /** Environment. */
+                ignite::common::concurrent::SharedPointer<IgniteEnvironment> env;
+                
+                /** Handle to Java object. */
+                jobject javaRef;                 
+
+                IGNITE_NO_COPY_ASSIGNMENT(PortableMetadataUpdaterImpl)
+            };
+        }
+    }    
+}
+
+#endif
\ No newline at end of file