You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2015/09/22 17:01:35 UTC
[01/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Repository: ignite
Updated Branches:
refs/heads/ignite-1282 220ecb306 -> f0bac562c
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
deleted file mode 100644
index 0f4ba5e..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/ExamplesTest.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Examples
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using Apache.Ignite.Core.Tests.Process;
- using Apache.Ignite.ExamplesDll.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests all examples in various modes.
- /// </summary>
- [Category(TestUtils.CategoryIntensive)]
- public class ExamplesTest
- {
- /// <summary>
- /// Tests the example in a single node mode.
- /// </summary>
- /// <param name="example">The example to run.</param>
- [Test, TestCaseSource("TestCases")]
- public void TestLocalNode(Example example)
- {
- example.Run();
- }
-
- /// <summary>
- /// Tests the example with standalone Apache.Ignite.exe nodes.
- /// </summary>
- /// <param name="example">The example to run.</param>
- [Test, TestCaseSource("TestCases")]
- public void TestRemoteNodes(Example example)
- {
- TestRemoteNodes(example, false);
- }
-
- /// <summary>
- /// Tests the example with standalone Apache.Ignite.exe nodes while local node is in client mode.
- /// </summary>
- /// <param name="example">The example to run.</param>
- [Test, TestCaseSource("TestCases")]
- public void TestRemoteNodesClientMode(Example example)
- {
- TestRemoteNodes(example, true);
- }
-
- /// <summary>
- /// Tests the example with standalone Apache.Ignite.exe nodes.
- /// </summary>
- /// <param name="example">The example to run.</param>
- /// <param name="clientMode">Client mode flag.</param>
- private static void TestRemoteNodes(Example example, bool clientMode)
- {
- // Exclude CrossPlatformExample and LifecycleExample
- if (string.IsNullOrEmpty(example.SpringConfigUrl))
- {
- Assert.IsTrue(new[] {"CrossPlatformExample", "LifecycleExample"}.Contains(example.Name));
-
- return;
- }
-
- Assert.IsTrue(File.Exists(example.SpringConfigUrl));
-
- var gridConfig = new IgniteConfiguration {SpringConfigUrl = example.SpringConfigUrl};
-
- // Try with multiple standalone nodes
- for (var i = 0; i < 2; i++)
- {
- // Start a grid to monitor topology
- // Stop it after topology check so we don't interfere with example
- Ignition.ClientMode = false;
-
- using (var ignite = Ignition.Start(gridConfig))
- {
- var args = new List<string> {"-springConfigUrl=" + example.SpringConfigUrl};
-
- if (example.NeedsTestDll)
- args.Add(" -assembly=" + typeof(AverageSalaryJob).Assembly.Location);
-
- // ReSharper disable once UnusedVariable
- var proc = new IgniteProcess(args.ToArray());
-
- Assert.IsTrue(ignite.WaitTopology(i + 2, 30000));
- }
-
- Ignition.ClientMode = clientMode;
- example.Run();
- }
- }
-
- /// <summary>
- /// Fixture setup.
- /// </summary>
- [TestFixtureSetUp]
- public void FixtureSetUp()
- {
- Environment.SetEnvironmentVariable("IGNITE_NATIVE_TEST_CLASSPATH", "true");
-
- Directory.SetCurrentDirectory(PathUtil.IgniteHome);
- }
-
- /// <summary>
- /// Test teardown.
- /// </summary>
- [TearDown]
- public void TearDown()
- {
- Ignition.ClientMode = false;
- IgniteProcess.KillAll();
- }
-
- /// <summary>
- /// Gets the test cases.
- /// </summary>
- public IEnumerable<Example> TestCases
- {
- get { return Example.All; }
- }
- }
-}
[41/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_utils.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_utils.h
deleted file mode 100644
index dd16686..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_utils.h
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * 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_UTILS
-#define _IGNITE_IMPL_PORTABLE_UTILS
-
-#include <stdint.h>
-
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- class InteropInputStream;
- class InteropOutputStream;
- }
-
- namespace portable
- {
- /**
- * Portable uilts.
- */
- class IGNITE_IMPORT_EXPORT PortableUtils
- {
- public:
- /**
- * Utility method to read signed 8-bit integer from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static int8_t ReadInt8(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write signed 8-bit integer to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteInt8(interop::InteropOutputStream* stream, int8_t val);
-
- /**
- * Utility method to read signed 8-bit integer array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadInt8Array(interop::InteropInputStream* stream, int8_t* res, const int32_t len);
-
- /**
- * Utility method to write signed 8-bit integer array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteInt8Array(interop::InteropOutputStream* stream, const int8_t* val, const int32_t len);
-
- /**
- * Utility method to read boolean from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static bool ReadBool(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write bool to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteBool(interop::InteropOutputStream* stream, bool val);
-
- /**
- * Utility method to read bool array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadBoolArray(interop::InteropInputStream* stream, bool* res, const int32_t len);
-
- /**
- * Utility method to write bool array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteBoolArray(interop::InteropOutputStream* stream, const bool* val, const int32_t len);
-
- /**
- * Utility method to read signed 16-bit integer from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static int16_t ReadInt16(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write signed 16-bit integer to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteInt16(interop::InteropOutputStream* stream, int16_t val);
-
- /**
- * Utility method to read signed 16-bit integer array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadInt16Array(interop::InteropInputStream* stream, int16_t* res, const int32_t len);
-
- /**
- * Utility method to write signed 16-bit integer array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteInt16Array(interop::InteropOutputStream* stream, const int16_t* val, const int32_t len);
-
- /**
- * Utility method to read unsigned 16-bit integer from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static uint16_t ReadUInt16(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write unsigned 16-bit integer to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteUInt16(interop::InteropOutputStream* stream, uint16_t val);
-
- /**
- * Utility method to read unsigned 16-bit integer array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadUInt16Array(interop::InteropInputStream* stream, uint16_t* res, const int32_t len);
-
- /**
- * Utility method to write unsigned 16-bit integer array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteUInt16Array(interop::InteropOutputStream* stream, const uint16_t* val, const int32_t len);
-
- /**
- * Utility method to read signed 32-bit integer from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static int32_t ReadInt32(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write signed 32-bit integer to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteInt32(interop::InteropOutputStream* stream, int32_t val);
-
- /**
- * Utility method to read signed 32-bit integer array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadInt32Array(interop::InteropInputStream* stream, int32_t* res, const int32_t len);
-
- /**
- * Utility method to write signed 32-bit integer array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteInt32Array(interop::InteropOutputStream* stream, const int32_t* val, const int32_t len);
-
- /**
- * Utility method to read signed 64-bit integer from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static int64_t ReadInt64(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write signed 64-bit integer to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteInt64(interop::InteropOutputStream* stream, int64_t val);
-
- /**
- * Utility method to read signed 64-bit integer array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadInt64Array(interop::InteropInputStream* stream, int64_t* res, const int32_t len);
-
- /**
- * Utility method to write signed 64-bit integer array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteInt64Array(interop::InteropOutputStream* stream, const int64_t* val, const int32_t len);
-
- /**
- * Utility method to read float from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static float ReadFloat(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write float to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteFloat(interop::InteropOutputStream* stream, float val);
-
- /**
- * Utility method to read float array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadFloatArray(interop::InteropInputStream* stream, float* res, const int32_t len);
-
- /**
- * Utility method to write float array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteFloatArray(interop::InteropOutputStream* stream, const float* val, const int32_t len);
-
- /**
- * Utility method to read double from stream.
- *
- * @param stream Stream.
- * @return Value.
- */
- static double ReadDouble(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write double to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteDouble(interop::InteropOutputStream* stream, double val);
-
- /**
- * Utility method to read double array from stream.
- *
- * @param stream Stream.
- * @param res Target array.
- * @param len Array length.
- */
- static void ReadDoubleArray(interop::InteropInputStream* stream, double* res, const int32_t len);
-
- /**
- * Utility method to write double array to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Array length.
- */
- static void WriteDoubleArray(interop::InteropOutputStream* stream, const double* val, const int32_t len);
-
- /**
- * Utility method to read Guid from stream.
- *
- * @param stream Stream.
- * @param res Value.
- */
- static Guid ReadGuid(interop::InteropInputStream* stream);
-
- /**
- * Utility method to write Guid to stream.
- *
- * @param stream Stream.
- * @param val Value.
- */
- static void WriteGuid(interop::InteropOutputStream* stream, const Guid val);
-
- /**
- * Utility method to write string to stream.
- *
- * @param stream Stream.
- * @param val Value.
- * @param len Length.
- */
- static void WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len);
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
deleted file mode 100644
index b38dc1f..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_writer_impl.h
+++ /dev/null
@@ -1,859 +0,0 @@
-/*
- * 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_WRITER
-#define _IGNITE_IMPL_PORTABLE_WRITER
-
-#include <cstring>
-#include <string>
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-#include <ignite/common/concurrent.h>
-
-#include "ignite/impl/interop/interop_output_stream.h"
-#include "ignite/impl/portable/portable_common.h"
-#include "ignite/impl/portable/portable_id_resolver.h"
-#include "ignite/impl/portable/portable_metadata_manager.h"
-#include "ignite/impl/portable/portable_utils.h"
-#include "ignite/portable/portable_consts.h"
-#include "ignite/portable/portable_type.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- /**
- * Internal implementation of portable reader.
- */
- class IGNITE_IMPORT_EXPORT PortableWriterImpl
- {
- public:
- /**
- * Constructor.
- *
- * @param stream Interop stream.
- * @param idRslvr Portable ID resolver.
- * @param metaMgr Metadata manager.
- * @param metaHnd Metadata handler.
- */
- PortableWriterImpl(ignite::impl::interop::InteropOutputStream* stream, PortableIdResolver* idRslvr,
- PortableMetadataManager* metaMgr, PortableMetadataHandler* metaHnd);
-
- /**
- * Constructor used to construct light-weight writer allowing only raw operations
- * and primitive objects.
- *
- * @param stream Interop stream.
- * @param metaMgr Metadata manager.
- */
- PortableWriterImpl(ignite::impl::interop::InteropOutputStream* stream, PortableMetadataManager* metaMgr);
-
- /**
- * Write 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param val Value.
- */
- void WriteInt8(const int8_t val);
-
- /**
- * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt8Array(const int8_t* val, const int32_t len);
-
- /**
- * Write 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt8(const char* fieldName, const int8_t val);
-
- /**
- * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len);
-
- /**
- * Write bool. Maps to "short" type in Java.
- *
- * @param val Value.
- */
- void WriteBool(const bool val);
-
- /**
- * Write array of bools. Maps to "bool[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteBoolArray(const bool* val, const int32_t len);
-
- /**
- * Write bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteBool(const char* fieldName, const bool val);
-
- /**
- * Write array of bools. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteBoolArray(const char* fieldName, const bool* val, const int32_t len);
-
- /**
- * Write 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param val Value.
- */
- void WriteInt16(const int16_t val);
-
- /**
- * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt16Array(const int16_t* val, const int32_t len);
-
- /**
- * Write 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt16(const char* fieldName, const int16_t val);
-
- /**
- * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len);
-
- /**
- * Write 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param val Value.
- */
- void WriteUInt16(const uint16_t val);
-
- /**
- * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteUInt16Array(const uint16_t* val, const int32_t len);
-
- /**
- * Write 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteUInt16(const char* fieldName, const uint16_t val);
-
- /**
- * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len);
-
- /**
- * Write 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param val Value.
- */
- void WriteInt32(const int32_t val);
-
- /**
- * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt32Array(const int32_t* val, const int32_t len);
-
- /**
- * Write 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt32(const char* fieldName, const int32_t val);
-
- /**
- * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len);
-
- /**
- * Write 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param val Value.
- */
- void WriteInt64(const int64_t val);
-
- /**
- * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt64Array(const int64_t* val, const int32_t len);
-
- /**
- * Write 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt64(const char* fieldName, const int64_t val);
-
- /**
- * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len);
-
- /**
- * Write float. Maps to "float" type in Java.
- *
- * @param val Value.
- */
- void WriteFloat(const float val);
-
- /**
- * Write array of floats. Maps to "float[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteFloatArray(const float* val, const int32_t len);
-
- /**
- * Write float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteFloat(const char* fieldName, const float val);
-
- /**
- * Write array of floats. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteFloatArray(const char* fieldName, const float* val, const int32_t len);
-
- /**
- * Write double. Maps to "double" type in Java.
- *
- * @param val Value.
- */
- void WriteDouble(const double val);
-
- /**
- * Write array of doubles. Maps to "double[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteDoubleArray(const double* val, const int32_t len);
-
- /**
- * Write double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteDouble(const char* fieldName, const double val);
-
- /**
- * Write array of doubles. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteDoubleArray(const char* fieldName, const double* val, const int32_t len);
-
- /**
- * Write Guid. Maps to "UUID" type in Java.
- *
- * @param val Value.
- */
- void WriteGuid(const Guid val);
-
- /**
- * Write array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteGuidArray(const Guid* val, const int32_t len);
-
- /**
- * Write Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteGuid(const char* fieldName, const Guid val);
-
- /**
- * Write array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param val String.
- * @param len String length (characters).
- */
- void WriteString(const char* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val String.
- * @param len String length (characters).
- */
- void WriteString(const char* fieldName, const char* val, const int32_t len);
-
- /**
- * Start string array write.
- *
- * @param typ Collection type.
- * @return Session ID.
- */
- int32_t WriteStringArray();
-
- /**
- * Start string array write.
- *
- * @param fieldName Field name.
- * @return Session ID.
- */
- int32_t WriteStringArray(const char* fieldName);
-
- /**
- * Write string element.
- *
- * @param id Session ID.
- * @param val Value.
- * @param len Length.
- */
- void WriteStringElement(int32_t id, const char* val, int32_t len);
-
- /**
- * Write NULL value.
- */
- void WriteNull();
-
- /**
- * Write NULL value.
- *
- * @param fieldName Field name.
- */
- void WriteNull(const char* fieldName);
-
- /**
- * Start array write.
- *
- * @param typ Collection type.
- * @return Session ID.
- */
- int32_t WriteArray();
-
- /**
- * Start array write.
- *
- * @param fieldName Field name.
- * @return Session ID.
- */
- int32_t WriteArray(const char* fieldName);
-
- /**
- * Start collection write.
- *
- * @param typ Collection type.
- * @return Session ID.
- */
- int32_t WriteCollection(ignite::portable::CollectionType typ);
-
- /**
- * Start collection write.
- *
- * @param fieldName Field name.
- * @param typ Collection type.
- * @return Session ID.
- */
- int32_t WriteCollection(const char* fieldName, ignite::portable::CollectionType typ);
-
- /**
- * Start map write.
- *
- * @param typ Map type.
- * @return Session ID.
- */
- int32_t WriteMap(ignite::portable::MapType typ);
-
- /**
- * Start map write.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @return Session ID.
- */
- int32_t WriteMap(const char* fieldName, ignite::portable::MapType typ);
-
- /**
- * Write collection element.
- *
- * @param id Session ID.
- * @param val Value.
- */
- template<typename T>
- void WriteElement(int32_t id, T val)
- {
- CheckSession(id);
-
- WriteTopObject<T>(val);
-
- elemCnt++;
- }
-
- /**
- * Write map element.
- *
- * @param id Session ID.
- * @param key Key.
- * @param val Value.
- */
- template<typename K, typename V>
- void WriteElement(int32_t id, K key, V val)
- {
- CheckSession(id);
-
- WriteTopObject<K>(key);
- WriteTopObject<V>(val);
-
- elemCnt++;
- }
-
- /**
- * Commit container write session.
- *
- * @param id Session ID.
- */
- void CommitContainer(int32_t id);
-
- /**
- * Write object.
- *
- * @param val Object.
- */
- template<typename T>
- void WriteObject(T val)
- {
- CheckRawMode(true);
-
- WriteTopObject(val);
- }
-
- /**
- * Write object.
- *
- * @param fieldName Field name.
- * @param val Object.
- */
- template<typename T>
- void WriteObject(const char* fieldName, T val)
- {
- CheckRawMode(false);
-
- // 1. Write field ID.
- WriteFieldId(fieldName, IGNITE_TYPE_OBJECT);
-
- // 2. Preserve space for length.
- int32_t lenPos = stream->Position();
- stream->Position(lenPos + 4);
-
- // 3. Actual write.
- WriteTopObject(val);
-
- // 4. Write field length.
- int32_t len = stream->Position() - lenPos - 4;
- stream->WriteInt32(lenPos, len);
- }
-
- /**
- * Set raw mode.
- */
- void SetRawMode();
-
- /**
- * Get raw position.
- */
- int32_t GetRawPosition();
-
- /**
- * Write object.
- *
- * @param obj Object to write.
- */
- template<typename T>
- void WriteTopObject(const T& obj)
- {
- ignite::portable::PortableType<T> type;
-
- if (type.IsNull(obj))
- stream->WriteInt8(IGNITE_HDR_NULL);
- else
- {
- TemplatedPortableIdResolver<T> idRslvr(type);
- ignite::common::concurrent::SharedPointer<PortableMetadataHandler> metaHnd;
-
- if (metaMgr)
- metaHnd = metaMgr->GetHandler(idRslvr.GetTypeId());
-
- PortableWriterImpl writerImpl(stream, &idRslvr, metaMgr, metaHnd.Get());
- ignite::portable::PortableWriter writer(&writerImpl);
-
- int32_t pos = stream->Position();
-
- stream->WriteInt8(IGNITE_HDR_FULL);
- stream->WriteBool(true);
- stream->WriteInt32(idRslvr.GetTypeId());
- stream->WriteInt32(type.GetHashCode(obj));
-
- stream->Position(pos + IGNITE_FULL_HDR_LEN);
-
- type.Write(writer, obj);
-
- int32_t len = stream->Position() - pos;
-
- stream->WriteInt32(pos + 10, len);
- stream->WriteInt32(pos + 14, writerImpl.GetRawPosition() - pos);
-
- if (metaMgr)
- metaMgr->SubmitHandler(type.GetTypeName(), idRslvr.GetTypeId(), metaHnd.Get());
- }
- }
-
- /**
- * Get underlying stream.
- *
- * @return Stream.
- */
- impl::interop::InteropOutputStream* GetStream();
- private:
- /** Underlying stream. */
- ignite::impl::interop::InteropOutputStream* stream;
-
- /** ID resolver. */
- PortableIdResolver* idRslvr;
-
- /** Metadata manager. */
- PortableMetadataManager* metaMgr;
-
- /** Metadata handler. */
- PortableMetadataHandler* metaHnd;
-
- /** Type ID. */
- int32_t typeId;
-
- /** Elements write session ID generator. */
- int32_t elemIdGen;
-
- /** Elements write session ID. */
- int32_t elemId;
-
- /** Elements count. */
- int32_t elemCnt;
-
- /** Elements start position. */
- int32_t elemPos;
-
- /** Raw data offset. */
- int32_t rawPos;
-
- IGNITE_NO_COPY_ASSIGNMENT(PortableWriterImpl)
-
- /**
- * Write a primitive value to stream in raw mode.
- *
- * @param val Value.
- * @param func Stream function.
- */
- template<typename T>
- void WritePrimitiveRaw(
- const T val,
- void(*func)(interop::InteropOutputStream*, T)
- )
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- func(stream, val);
- }
-
- /**
- * Write a primitive array to stream in raw mode.
- *
- * @param val Value.
- * @param len Array length.
- * @param func Stream function.
- * @param hdr Header.
- */
- template<typename T>
- void WritePrimitiveArrayRaw(
- const T* val,
- const int32_t len,
- void(*func)(interop::InteropOutputStream*, const T*, const int32_t),
- const int8_t hdr
- )
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- if (val)
- {
- stream->WriteInt8(hdr);
- stream->WriteInt32(len);
- func(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- /**
- * Write a primitive value to stream.
- *
- * @param fieldName Field name.
- * @param val Value.
- * @param func Stream function.
- * @param typ Field type ID.
- * @param len Field length.
- */
- template<typename T>
- void WritePrimitive(
- const char* fieldName,
- const T val,
- void(*func)(interop::InteropOutputStream*, T),
- const int8_t typ,
- const int32_t len
- )
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, typ);
-
- stream->WriteInt32(1 + len);
- stream->WriteInt8(typ);
-
- func(stream, val);
- }
-
- /**
- * Write a primitive array to stream.
- *
- * @param fieldName Field name.
- * @param val Value.
- * @param len Array length.
- * @param func Stream function.
- * @param hdr Header.
- * @param lenShift Length shift.
- */
- template<typename T>
- void WritePrimitiveArray(
- const char* fieldName,
- const T* val,
- const int32_t len,
- void(*func)(interop::InteropOutputStream*, const T*, const int32_t),
- const int8_t hdr,
- const int32_t lenShift
- )
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, hdr);
-
- if (val)
- {
- stream->WriteInt32(5 + (len << lenShift));
- stream->WriteInt8(hdr);
- stream->WriteInt32(len);
- func(stream, val, len);
- }
- else
- {
- stream->WriteInt32(1);
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
- }
-
- /**
- * Check raw mode.
- *
- * @param expected Expected raw mode of the reader.
- */
- void CheckRawMode(bool expected);
-
- /**
- * Check whether writer is currently operating in single mode.
- *
- * @param expected Expected value.
- */
- void CheckSingleMode(bool expected);
-
- /**
- * Start new container writer session.
- *
- * @param expRawMode Expected raw mode.
- */
- void StartContainerSession(bool expRawMode);
-
- /**
- * Check whether session ID matches.
- *
- * @param ses Expected session ID.
- */
- void CheckSession(int32_t expSes);
-
- /**
- * Write field ID.
- *
- * @param fieldName Field name.
- * @param fieldTypeId Field type ID.
- */
- void WriteFieldId(const char* fieldName, int32_t fieldTypeId);
-
- /**
- * Write field ID and skip field length.
- *
- * @param fieldName Field name.
- * @param fieldTypeId Field type ID.
- */
- void WriteFieldIdSkipLength(const char* fieldName, int32_t fieldTypeId);
-
- /**
- * Write field ID and length.
- *
- * @param fieldName Field name.
- * @param fieldTypeId Field type ID.
- * @param len Length.
- */
- void WriteFieldIdAndLength(const char* fieldName, int32_t fieldTypeId, int32_t len);
-
- /**
- * Write primitive value.
- *
- * @param obj Value.
- * @param func Stream function.
- * @param hdr Header.
- */
- template<typename T>
- void WriteTopObject0(const T obj, void(*func)(impl::interop::InteropOutputStream*, T), const int8_t hdr)
- {
- stream->WriteInt8(hdr);
- func(stream, obj);
- }
- };
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const int8_t& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const bool& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const int16_t& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const uint16_t& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const int32_t& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const int64_t& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const float& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const double& obj);
-
- template<>
- void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const Guid& obj);
-
- template<>
- inline void IGNITE_IMPORT_EXPORT PortableWriterImpl::WriteTopObject(const std::string& obj)
- {
- const char* obj0 = obj.c_str();
-
- int32_t len = static_cast<int32_t>(strlen(obj0));
-
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- PortableUtils::WriteString(stream, obj0, len);
- }
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable.h
deleted file mode 100644
index 1a7c3dd..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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_PORTABLE
-#define _IGNITE_PORTABLE
-
-#include "ignite/portable/portable_consts.h"
-#include "ignite/portable/portable_containers.h"
-#include "ignite/portable/portable_type.h"
-#include "ignite/portable/portable_raw_reader.h"
-#include "ignite/portable/portable_raw_writer.h"
-#include "ignite/portable/portable_reader.h"
-#include "ignite/portable/portable_writer.h"
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_consts.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_consts.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_consts.h
deleted file mode 100644
index ef6db45..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_consts.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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_PORTABLE_CONSTS
-#define _IGNITE_PORTABLE_CONSTS
-
-#include <ignite/common/common.h>
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable collection types.
- */
- enum CollectionType
- {
- /**
- * Undefined. Maps to ArrayList in Java.
- */
- IGNITE_COLLECTION_UNDEFINED = 0,
-
- /**
- * Array list. Maps to ArrayList in Java.
- */
- IGNITE_COLLECTION_ARRAY_LIST = 1,
-
- /**
- * Linked list. Maps to LinkedList in Java.
- */
- IGNITE_COLLECTION_LINKED_LIST = 2,
-
- /**
- * Hash set. Maps to HashSet in Java.
- */
- IGNITE_COLLECTION_HASH_SET = 3,
-
- /**
- * Linked hash set. Maps to LinkedHashSet in Java.
- */
- IGNITE_COLLECTION_LINKED_HASH_SET = 4,
-
- /**
- * Tree set. Maps to TreeSet in Java.
- */
- IGNITE_COLLECTION_TREE_SET = 5,
-
- /**
- * Concurrent skip list set. Maps to ConcurrentSkipListSet in Java.
- */
- IGNITE_COLLECTION_CONCURRENT_SKIP_LIST_SET = 6
- };
-
- /**
- * Portable map types.
- */
- enum MapType
- {
- /**
- * Undefined. Maps to HashMap in Java.
- */
- IGNITE_MAP_UNDEFINED = 0,
-
- /**
- * Hash map. Maps to HashMap in Java.
- */
- IGNITE_MAP_HASH_MAP = 1,
-
- /**
- * Linked hash map. Maps to LinkedHashMap in Java.
- */
- IGNITE_MAP_LINKED_HASH_MAP = 2,
-
- /**
- * Tree map. Maps to TreeMap in Java.
- */
- IGNITE_MAP_TREE_MAP = 3,
-
- /**
- * Concurrent hash map. Maps to ConcurrentHashMap in Java.
- */
- IGNITE_MAP_CONCURRENT_HASH_MAP = 4,
-
- /**
- * Properties map. Maps to Properties in Java.
- */
- IGNITE_MAP_PROPERTIES_MAP = 5
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_containers.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_containers.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_containers.h
deleted file mode 100644
index f93a11a..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_containers.h
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * 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_PORTABLE_CONTAINERS
-#define _IGNITE_PORTABLE_CONTAINERS
-
-#include <stdint.h>
-
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/utils.h"
-#include "ignite/portable/portable_consts.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable string array writer.
- */
- class IGNITE_IMPORT_EXPORT PortableStringArrayWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param id Identifier.
- * @param impl Writer.
- */
- PortableStringArrayWriter(impl::portable::PortableWriterImpl* impl, const int32_t id);
-
- /**
- * Write string.
- *
- * @param val Null-terminated character sequence.
- */
- void Write(const char* val);
-
- /**
- * Write string.
- *
- * @param val String.
- * @param len String length (characters).
- */
- void Write(const char* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param val String.
- */
- void Write(const std::string& val)
- {
- Write(val.c_str());
- }
-
- /**
- * Close the writer.
- */
- void Close();
- private:
- /** Implementation delegate. */
- impl::portable::PortableWriterImpl* impl;
-
- /** Idnetifier. */
- const int32_t id;
- };
-
- /**
- * Portable collection writer.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT PortableArrayWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Writer.
- * @param id Identifier.
- */
- PortableArrayWriter(impl::portable::PortableWriterImpl* impl, const int32_t id) : impl(impl), id(id)
- {
- // No-op.
- }
-
- /**
- * Write a value.
- *
- * @param val Value.
- */
- void Write(const T& val)
- {
- impl->WriteElement<T>(id, val);
- }
-
- /**
- * Close the writer.
- */
- void Close()
- {
- impl->CommitContainer(id);
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableWriterImpl* impl;
-
- /** Idnetifier. */
- const int32_t id;
- };
-
- /**
- * Portable collection writer.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT PortableCollectionWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Writer.
- * @param id Identifier.
- */
- PortableCollectionWriter(impl::portable::PortableWriterImpl* impl, const int32_t id) : impl(impl), id(id)
- {
- // No-op.
- }
-
- /**
- * Write a value.
- *
- * @param val Value.
- */
- void Write(const T& val)
- {
- impl->WriteElement<T>(id, val);
- }
-
- /**
- * Close the writer.
- */
- void Close()
- {
- impl->CommitContainer(id);
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableWriterImpl* impl;
-
- /** Identifier. */
- const int32_t id;
- };
-
- /**
- * Portable map writer.
- */
- template<typename K, typename V>
- class IGNITE_IMPORT_EXPORT PortableMapWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Writer.
- */
- PortableMapWriter(impl::portable::PortableWriterImpl* impl, const int32_t id) : impl(impl), id(id)
- {
- // No-op.
- }
-
- /**
- * Write a value.
- *
- * @param key Key.
- * @param val Value.
- */
- void Write(const K& key, const V& val)
- {
- impl->WriteElement<K, V>(id, key, val);
- }
-
- /**
- * Close the writer.
- */
- void Close()
- {
- impl->CommitContainer(id);
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableWriterImpl* impl;
-
- /** Identifier. */
- const int32_t id;
- };
-
- /**
- * Portable string array reader.
- */
- class IGNITE_IMPORT_EXPORT PortableStringArrayReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Reader.
- * @param id Identifier.
- * @param size Array size.
- */
- PortableStringArrayReader(impl::portable::PortableReaderImpl* impl, const int32_t id, const int32_t size);
-
- /**
- * Check whether next element is available for read.
- *
- * @return True if available.
- */
- bool HasNext();
-
- /**
- * Get next element.
- *
- * @param res Array to store data to.
- * @param len Expected length of string. NULL terminator will be set in case len is
- * greater than real string length.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t GetNext(char* res, const int32_t len);
-
- /**
- * Get next element.
- *
- * @return String.
- */
- std::string GetNext()
- {
- int32_t len = GetNext(NULL, 0);
-
- if (len != -1)
- {
- impl::utils::SafeArray<char> arr(len + 1);
-
- GetNext(arr.target, len + 1);
-
- return std::string(arr.target);
- }
- else
- return std::string();
- }
-
- /**
- * Get array size.
- *
- * @return Size or -1 if array is NULL.
- */
- int32_t GetSize();
-
- /**
- * Whether array is NULL.
- */
- bool IsNull();
- private:
- /** Implementation delegate. */
- impl::portable::PortableReaderImpl* impl;
-
- /** Identifier. */
- const int32_t id;
-
- /** Size. */
- const int32_t size;
- };
-
- /**
- * Portable array reader.
- */
- template<typename T>
- class PortableArrayReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Reader.
- * @param id Identifier.
- * @param size Array size.
- */
- PortableArrayReader(impl::portable::PortableReaderImpl* impl, const int32_t id, const int32_t size) :
- impl(impl), id(id), size(size)
- {
- // No-op.
- }
-
- /**
- * Check whether next element is available for read.
- *
- * @return True if available.
- */
- bool HasNext()
- {
- return impl->HasNextElement(id);
- }
-
- /**
- * Read next element.
- *
- * @return Next element.
- */
- T GetNext()
- {
- return impl->ReadElement<T>(id);
- }
-
- /**
- * Get array size.
- *
- * @return Size or -1 if array is NULL.
- */
- int32_t GetSize()
- {
- return size;
- }
-
- /**
- * Whether array is NULL.
- */
- bool IsNull()
- {
- return size == -1;
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableReaderImpl* impl;
-
- /** Identifier. */
- const int32_t id;
-
- /** Size. */
- const int32_t size;
- };
-
- /**
- * Portable collection reader.
- */
- template<typename T>
- class PortableCollectionReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Reader.
- * @param id Identifier.
- * @param type Collection type.
- * @param size Collection size.
- */
- PortableCollectionReader(impl::portable::PortableReaderImpl* impl, const int32_t id,
- const CollectionType type, const int32_t size) : impl(impl), id(id), type(type), size(size)
- {
- // No-op.
- }
-
- /**
- * Check whether next element is available for read.
- *
- * @return True if available.
- */
- bool HasNext()
- {
- return impl->HasNextElement(id);
- }
-
- /**
- * Read next element.
- *
- * @return Next element.
- */
- T GetNext()
- {
- return impl->ReadElement<T>(id);
- }
-
- /**
- * Get collection type.
- *
- * @return Type.
- */
- CollectionType GetType()
- {
- return type;
- }
-
- /**
- * Get collection size.
- *
- * @return Size or -1 if collection is NULL.
- */
- int32_t GetSize()
- {
- return size;
- }
-
- /**
- * Whether collection is NULL.
- */
- bool IsNull()
- {
- return size == -1;
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableReaderImpl* impl;
-
- /** Identifier. */
- const int32_t id;
-
- /** Collection type. */
- const CollectionType type;
-
- /** Size. */
- const int32_t size;
- };
-
- /**
- * Portable map reader.
- */
- template<typename K, typename V>
- class PortableMapReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Reader.
- * @param id Identifier.
- * @param type Map type.
- * @param size Map size.
- */
- PortableMapReader(impl::portable::PortableReaderImpl* impl, const int32_t id, const MapType type,
- const int32_t size) : impl(impl), id(id), type(type), size(size)
- {
- // No-op.
- }
-
- /**
- * Check whether next element is available for read.
- *
- * @return True if available.
- */
- bool HasNext()
- {
- return impl->HasNextElement(id);
- }
-
- /**
- * Read next element.
- *
- * @param key Key.
- * @param val Value.
- */
- void GetNext(K* key, V* val)
- {
- return impl->ReadElement<K, V>(id, key, val);
- }
-
- /**
- * Get map type.
- *
- * @return Type.
- */
- MapType GetType()
- {
- return type;
- }
-
- /**
- * Get map size.
- *
- * @return Size or -1 if map is NULL.
- */
- int32_t GetSize()
- {
- return size;
- }
-
- /**
- * Whether map is NULL.
- */
- bool IsNull()
- {
- return size == -1;
- }
- private:
- /** Implementation delegate. */
- impl::portable::PortableReaderImpl* impl;
-
- /** Identifier. */
- const int32_t id;
-
- /** Map type. */
- const MapType type;
-
- /** Size. */
- const int32_t size;
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_reader.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_reader.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_reader.h
deleted file mode 100644
index 9f1d74c..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_reader.h
+++ /dev/null
@@ -1,324 +0,0 @@
-/*
- * 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_PORTABLE_RAW_READER
-#define _IGNITE_PORTABLE_RAW_READER
-
-#include <stdint.h>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/portable/portable_consts.h"
-#include "ignite/portable/portable_containers.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable raw reader.
- */
- class IGNITE_IMPORT_EXPORT PortableRawReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableRawReader(ignite::impl::portable::PortableReaderImpl* impl);
-
- /**
- * Read 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @return Result.
- */
- int8_t ReadInt8();
-
- /**
- * Read array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt8Array(int8_t* res, const int32_t len);
-
- /**
- * Read bool. Maps to "boolean" type in Java.
- *
- * @return Result.
- */
- bool ReadBool();
-
- /**
- * Read array of bools. Maps to "boolean[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadBoolArray(bool* res, const int32_t len);
-
- /**
- * Read 16-byte signed integer. Maps to "short" type in Java.
- *
- * @return Result.
- */
- int16_t ReadInt16();
-
- /**
- * Read array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt16Array(int16_t* res, const int32_t len);
-
- /**
- * Read 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @return Result.
- */
- uint16_t ReadUInt16();
-
- /**
- * Read array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadUInt16Array(uint16_t* res, const int32_t len);
-
- /**
- * Read 32-byte signed integer. Maps to "int" type in Java.
- *
- * @return Result.
- */
- int32_t ReadInt32();
-
- /**
- * Read array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt32Array(int32_t* res, const int32_t len);
-
- /**
- * Read 64-byte signed integer. Maps to "long" type in Java.
- *
- * @return Result.
- */
- int64_t ReadInt64();
-
- /**
- * Read array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt64Array(int64_t* res, const int32_t len);
-
- /**
- * Read float. Maps to "float" type in Java.
- *
- * @return Result.
- */
- float ReadFloat();
-
- /**
- * Read array of floats. Maps to "float[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadFloatArray(float* res, const int32_t len);
-
- /**
- * Read double. Maps to "double" type in Java.
- *
- * @return Result.
- */
- double ReadDouble();
-
- /**
- * Read array of doubles. Maps to "double[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadDoubleArray(double* res, const int32_t len);
-
- /**
- * Read Guid. Maps to "UUID" type in Java.
- *
- * @return Result.
- */
- Guid ReadGuid();
-
- /**
- * Read array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadGuidArray(Guid* res, const int32_t len);
-
- /**
- * Read string.
- *
- * @param res Array to store data to.
- * @param len Expected length of string. NULL terminator will be set in case len is
- * greater than real string length.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadString(char* res, const int32_t len);
-
- /**
- * Read string from the stream.
- *
- * @return String.
- */
- std::string ReadString()
- {
- int32_t len = ReadString(NULL, 0);
-
- if (len != -1)
- {
- ignite::impl::utils::SafeArray<char> arr(len + 1);
-
- ReadString(arr.target, len + 1);
-
- return std::string(arr.target);
- }
- else
- return std::string();
- }
-
- /**
- * Start string array read.
- *
- * @return String array reader.
- */
- PortableStringArrayReader ReadStringArray();
-
- /**
- * Start array read.
- *
- * @return Array reader.
- */
- template<typename T>
- PortableArrayReader<T> ReadArray()
- {
- int32_t size;
-
- int32_t id = impl->ReadArray(&size);
-
- return PortableArrayReader<T>(impl, id, size);
- }
-
- /**
- * Start collection read.
- *
- * @return Collection reader.
- */
- template<typename T>
- PortableCollectionReader<T> ReadCollection()
- {
- CollectionType typ;
- int32_t size;
-
- int32_t id = impl->ReadCollection(&typ, &size);
-
- return PortableCollectionReader<T>(impl, id, typ, size);
- }
-
- /**
- * Start map read.
- *
- * @return Map reader.
- */
- template<typename K, typename V>
- PortableMapReader<K, V> ReadMap()
- {
- MapType typ;
- int32_t size;
-
- int32_t id = impl->ReadMap(&typ, &size);
-
- return PortableMapReader<K, V>(impl, id, typ, size);
- }
-
- /**
- * Read object.
- *
- * @return Object.
- */
- template<typename T>
- T ReadObject()
- {
- return impl->ReadObject<T>();
- }
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableReaderImpl* impl;
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_writer.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_writer.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_writer.h
deleted file mode 100644
index 47b5880..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_raw_writer.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * 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_PORTABLE_RAW_WRITER
-#define _IGNITE_PORTABLE_RAW_WRITER
-
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/portable/portable_consts.h"
-#include "ignite/portable/portable_containers.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable raw writer.
- */
- class IGNITE_IMPORT_EXPORT PortableRawWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableRawWriter(ignite::impl::portable::PortableWriterImpl* impl);
-
- /**
- * Write 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param val Value.
- */
- void WriteInt8(const int8_t val);
-
- /**
- * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt8Array(const int8_t* val, const int32_t len);
-
- /**
- * Write bool. Maps to "short" type in Java.
- *
- * @param val Value.
- */
- void WriteBool(const bool val);
-
- /**
- * Write array of bools. Maps to "bool[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteBoolArray(const bool* val, const int32_t len);
-
- /**
- * Write 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param val Value.
- */
- void WriteInt16(const int16_t val);
-
- /**
- * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt16Array(const int16_t* val, const int32_t len);
-
- /**
- * Write 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param val Value.
- */
- void WriteUInt16(const uint16_t val);
-
- /**
- * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteUInt16Array(const uint16_t* val, const int32_t len);
-
- /**
- * Write 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param val Value.
- */
- void WriteInt32(const int32_t val);
-
- /**
- * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt32Array(const int32_t* val, const int32_t len);
-
- /**
- * Write 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param val Value.
- */
- void WriteInt64(const int64_t val);
-
- /**
- * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt64Array(const int64_t* val, const int32_t len);
-
- /**
- * Write float. Maps to "float" type in Java.
- *
- * @param val Value.
- */
- void WriteFloat(const float val);
-
- /**
- * Write array of floats. Maps to "float[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteFloatArray(const float* val, const int32_t len);
-
- /**
- * Write double. Maps to "double" type in Java.
- *
- * @param val Value.
- */
- void WriteDouble(const double val);
-
- /**
- * Write array of doubles. Maps to "double[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteDoubleArray(const double* val, const int32_t len);
-
- /**
- * Write Guid. Maps to "UUID" type in Java.
- *
- * @param val Value.
- */
- void WriteGuid(const Guid val);
-
- /**
- * Write array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param val Array.
- * @param len Array length.
- */
- void WriteGuidArray(const Guid* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param val Null-terminated character array.
- */
- void WriteString(const char* val);
-
- /**
- * Write string.
- *
- * @param val String.
- * @param len String length (characters).
- */
- void WriteString(const char* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param val String.
- */
- void WriteString(const std::string& val)
- {
- WriteString(val.c_str());
- }
-
- /**
- * Start string array write.
- *
- * @return String array writer.
- */
- PortableStringArrayWriter WriteStringArray();
-
- /**
- * Write NULL value.
- */
- void WriteNull();
-
- /**
- * Start array write.
- *
- * @return Array writer.
- */
- template<typename T>
- PortableArrayWriter<T> WriteArray()
- {
- int32_t id = impl->WriteArray();
-
- return PortableArrayWriter<T>(impl, id);
- }
-
- /**
- * Start collection write.
- *
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection()
- {
- return WriteCollection<T>(IGNITE_COLLECTION_UNDEFINED);
- }
-
- /**
- * Start collection write.
- *
- * @param type Collection type.
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection(ignite::portable::CollectionType typ)
- {
- int32_t id = impl->WriteCollection(typ);
-
- return PortableCollectionWriter<T>(impl, id);
- }
-
- /**
- * Start map write.
- *
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap()
- {
- return WriteMap<K, V>(IGNITE_MAP_UNDEFINED);
- }
-
- /**
- * Start map write.
- *
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap(ignite::portable::MapType typ)
- {
- int32_t id = impl->WriteMap(typ);
-
- return PortableMapWriter<K, V>(impl, id);
- }
-
- /**
- * Write object.
- *
- * @param val Object.
- */
- template<typename T>
- void WriteObject(T val)
- {
- impl->WriteObject<T>(val);
- }
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableWriterImpl* impl;
- };
- }
-}
-
-#endif
\ No newline at end of file
[40/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
deleted file mode 100644
index 5e4b7ad..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_reader.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/*
- * 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_PORTABLE_READER
-#define _IGNITE_PORTABLE_READER
-
-#include <stdint.h>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#include "ignite/portable/portable_raw_reader.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable reader.
- */
- class IGNITE_IMPORT_EXPORT PortableReader
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableReader(ignite::impl::portable::PortableReaderImpl* impl);
-
- /**
- * Read 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @param fieldName Field name.
- * @return Result.
- */
- int8_t ReadInt8(const char* fieldName);
-
- /**
- * Read array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len);
-
- /**
- * Read bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- bool ReadBool(const char* fieldName);
-
- /**
- * Read array of bools. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadBoolArray(const char* fieldName, bool* res, const int32_t len);
-
- /**
- * Read 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int16_t ReadInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len);
-
- /**
- * Read 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- uint16_t ReadUInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len);
-
- /**
- * Read 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int32_t ReadInt32(const char* fieldName);
-
- /**
- * Read array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len);
-
- /**
- * Read 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int64_t ReadInt64(const char* fieldName);
-
- /**
- * Read array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len);
-
- /**
- * Read float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- float ReadFloat(const char* fieldName);
-
- /**
- * Read array of floats. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadFloatArray(const char* fieldName, float* res, const int32_t len);
-
- /**
- * Read double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- double ReadDouble(const char* fieldName);
-
- /**
- * Read array of doubles. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadDoubleArray(const char* fieldName, double* res, const int32_t len);
-
- /**
- * Read Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- Guid ReadGuid(const char* fieldName);
-
- /**
- * Read array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadGuidArray(const char* fieldName, Guid* res, const int32_t len);
-
- /**
- * Read string.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of string. NULL terminator will be set in case len is
- * greater than real string length.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadString(const char* fieldName, char* res, const int32_t len);
-
- /**
- * Read string from the stream.
- *
- * @param fieldName Field name.
- * @return String.
- */
- std::string ReadString(const char* fieldName)
- {
- int32_t len = ReadString(fieldName, NULL, 0);
-
- if (len != -1)
- {
- ignite::impl::utils::SafeArray<char> arr(len + 1);
-
- ReadString(fieldName, arr.target, len + 1);
-
- return std::string(arr.target);
- }
- else
- return std::string();
- }
-
- /**
- * Start string array read.
- *
- * @param fieldName Field name.
- * @return String array reader.
- */
- PortableStringArrayReader ReadStringArray(const char* fieldName);
-
- /**
- * Start array read.
- *
- * @param fieldName Field name.
- * @return Array reader.
- */
- template<typename T>
- PortableArrayReader<T> ReadArray(const char* fieldName)
- {
- int32_t size;
-
- int32_t id = impl->ReadArray(fieldName, &size);
-
- return PortableArrayReader<T>(impl, id, size);
- }
-
- /**
- * Start collection read.
- *
- * @param fieldName Field name.
- * @return Collection reader.
- */
- template<typename T>
- PortableCollectionReader<T> ReadCollection(const char* fieldName)
- {
- CollectionType typ;
- int32_t size;
-
- int32_t id = impl->ReadCollection(fieldName, &typ, &size);
-
- return PortableCollectionReader<T>(impl, id, typ, size);
- }
-
- /**
- * Start map read.
- *
- * @param fieldName Field name.
- * @return Map reader.
- */
- template<typename K, typename V>
- PortableMapReader<K, V> ReadMap(const char* fieldName)
- {
- MapType typ;
- int32_t size;
-
- int32_t id = impl->ReadMap(fieldName, &typ, &size);
-
- return PortableMapReader<K, V>(impl, id, typ, size);
- }
-
- /**
- * Read object.
- *
- * @param fieldName Field name.
- * @return Object.
- */
- template<typename T>
- T ReadObject(const char* fieldName)
- {
- return impl->ReadObject<T>(fieldName);
- }
-
- /**
- * Get raw reader for this reader.
- *
- * @return Raw reader.
- */
- PortableRawReader RawReader();
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableReaderImpl* impl;
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h
deleted file mode 100644
index fb086ef..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_type.h
+++ /dev/null
@@ -1,293 +0,0 @@
-/*
- * 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_PORTABLE_TYPE
-#define _IGNITE_PORTABLE_TYPE
-
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/ignite_error.h"
-
-/**
- * Start portable type definition.
- */
-#define IGNITE_PORTABLE_TYPE_START(T) \
-template<> \
-struct PortableType<T> \
-{
-
-/**
- * End portable type definition.
- */
-#define IGNITE_PORTABLE_TYPE_END \
-};
-
-/**
- * Implementation of GetTypeId() which returns predefined constant.
- */
-#define IGNITE_PORTABLE_GET_TYPE_ID_AS_CONST(id) \
-int32_t GetTypeId() \
-{ \
- return id; \
-}
-
-/**
- * Implementation of GetTypeId() which returns hash of passed type name.
- */
-#define IGNITE_PORTABLE_GET_TYPE_ID_AS_HASH(typeName) \
-int32_t GetTypeId() \
-{ \
- return GetPortableStringHashCode(#typeName); \
-}
-
-/**
- * Implementation of GetTypeName() which returns type name as is.
- */
-#define IGNITE_PORTABLE_GET_TYPE_NAME_AS_IS(typeName) \
-std::string GetTypeName() \
-{ \
- return #typeName; \
-}
-
-/**
- * Default implementation of GetFieldId() function which returns Java-way hash code of the string.
- */
-#define IGNITE_PORTABLE_GET_FIELD_ID_AS_HASH \
-int32_t GetFieldId(const char* name) \
-{ \
- return GetPortableStringHashCode(name); \
-}
-
-/**
- * Implementation of GetHashCode() function which always returns 0.
- */
-#define IGNITE_PORTABLE_GET_HASH_CODE_ZERO(T) \
-int32_t GetHashCode(const T& obj) \
-{ \
- return 0; \
-}
-
-/**
- * Implementation of IsNull() function which always returns false.
- */
-#define IGNITE_PORTABLE_IS_NULL_FALSE(T) \
-bool IsNull(const T& obj) \
-{ \
- return false; \
-}
-
-/**
- * Implementation of IsNull() function which return true if passed object is null pointer.
- */
-#define IGNITE_PORTABLE_IS_NULL_IF_NULLPTR(T) \
-bool IsNull(const T& obj) \
-{ \
- return obj; \
-}
-
-/**
- * Implementation of GetNull() function which returns an instance created with defult constructor.
- */
-#define IGNITE_PORTABLE_GET_NULL_DEFAULT_CTOR(T) \
-T GetNull() \
-{ \
- return T(); \
-}
-
-/**
- * Implementation of GetNull() function which returns NULL pointer.
- */
-#define IGNITE_PORTABLE_GET_NULL_NULLPTR(T) \
-T GetNull() \
-{ \
- return NULL; \
-}
-
-namespace ignite
-{
- namespace portable
- {
- class PortableWriter;
- class PortableReader;
-
- /**
- * Get portable string hash code.
- *
- * @param val Value.
- * @return Hash code.
- */
- IGNITE_IMPORT_EXPORT int32_t GetPortableStringHashCode(const char* val);
-
- /**
- * Portable type structure. Defines a set of functions required for type to be serialized and deserialized.
- */
- template<typename T>
- struct IGNITE_IMPORT_EXPORT PortableType
- {
- /**
- * Get portable object type ID.
- *
- * @return Type ID.
- */
- int32_t GetTypeId()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetTypeId function is not defined for portable type.");
- }
-
- /**
- * Get portable object type name.
- *
- * @return Type name.
- */
- std::string GetTypeName()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetTypeName function is not defined for portable type.");
- }
-
- /**
- * Get portable object field ID.
- *
- * @param name Field name.
- * @return Field ID.
- */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /**
- * Get portable object hash code.
- *
- * @param obj Portable object.
- * @return Hash code.
- */
- int32_t GetHashCode(const T& obj)
- {
- return 0;
- }
-
- /**
- * Write portable object.
- *
- * @param writer Writer.
- * @param obj Object.
- */
- void Write(PortableWriter& writer, const T& obj)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Write function is not defined for portable type.");
- }
-
- /**
- * Read portable object.
- *
- * @param reader Reader.
- * @return Object.
- */
- T Read(PortableReader& reader)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Read function is not defined for portable type.");
- }
-
- /**
- * Check whether passed portable object should be interpreted as NULL.
- *
- * @param obj Portable object to test.
- * @return True if portable object should be interpreted as NULL.
- */
- bool IsNull(const T& obj)
- {
- return false;
- }
-
- /**
- * Get NULL value for the given portable type.
- *
- * @return NULL value.
- */
- T GetNull()
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "GetNull function is not defined for portable type.");
- }
- };
-
- /*
- * Templated portable type for pointers.
- */
- template <typename T>
- struct IGNITE_IMPORT_EXPORT PortableType<T*>
- {
- /** Actual type. */
- PortableType<T> typ;
-
- /**
- * Constructor.
- */
- PortableType()
- {
- typ = PortableType<T>();
- }
-
- int32_t GetTypeId()
- {
- return typ.GetTypeId();
- }
-
- std::string GetTypeName()
- {
- return typ.GetTypeName();
- }
-
- int32_t GetFieldId(const char* name)
- {
- return typ.GetFieldId(name);
- }
-
- int32_t GetHashCode(T* const& obj)
- {
- return typ.GetHashCode(*obj);
- }
-
- void Write(PortableWriter& writer, T* const& obj)
- {
- typ.Write(writer, *obj);
- }
-
- T* Read(PortableReader& reader)
- {
- T* res = new T();
-
- *res = typ.Read(reader);
-
- return res;
- }
-
- bool IsNull(T* const& obj)
- {
- return !obj || typ.IsNull(*obj);
- }
-
- T* GetNull()
- {
- return NULL;
- }
- };
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h b/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
deleted file mode 100644
index 5dc9494..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/portable/portable_writer.h
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * 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_PORTABLE_WRITER
-#define _IGNITE_PORTABLE_WRITER
-
-#include <string>
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable writer.
- */
- class IGNITE_IMPORT_EXPORT PortableWriter
- {
- public:
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- PortableWriter(ignite::impl::portable::PortableWriterImpl* impl);
-
- /**
- * Write 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt8(const char* fieldName, const int8_t val);
-
- /**
- * Write array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len);
-
- /**
- * Write bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteBool(const char* fieldName, const bool val);
-
- /**
- * Write array of bools. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteBoolArray(const char* fieldName, const bool* val, const int32_t len);
-
- /**
- * Write 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt16(const char* fieldName, const int16_t val);
-
- /**
- * Write array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len);
-
- /**
- * Write 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteUInt16(const char* fieldName, const uint16_t val);
-
- /**
- * Write array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len);
-
- /**
- * Write 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt32(const char* fieldName, const int32_t val);
-
- /**
- * Write array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len);
-
- /**
- * Write 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteInt64(const char* fieldName, const int64_t val);
-
- /**
- * Write array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len);
-
- /**
- * Write float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteFloat(const char* fieldName, const float val);
-
- /**
- * Write array of floats. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteFloatArray(const char* fieldName, const float* val, const int32_t len);
-
- /**
- * Write double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteDouble(const char* fieldName, const double val);
-
- /**
- * Write array of doubles. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteDoubleArray(const char* fieldName, const double* val, const int32_t len);
-
- /**
- * Write Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- void WriteGuid(const char* fieldName, const Guid val);
-
- /**
- * Write array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param val Array.
- * @param len Array length.
- */
- void WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val Null-terminated character sequence.
- */
- void WriteString(const char* fieldName, const char* val);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val String.
- * @param len String length (characters).
- */
- void WriteString(const char* fieldName, const char* val, const int32_t len);
-
- /**
- * Write string.
- *
- * @param fieldName Field name.
- * @param val String.
- */
- void WriteString(const char* fieldName, const std::string& val)
- {
- WriteString(fieldName, val.c_str());
- }
-
- /**
- * Start string array write.
- *
- * @param fieldName Field name.
- * @return String array writer.
- */
- PortableStringArrayWriter WriteStringArray(const char* fieldName);
-
- /**
- * Write NULL value.
- *
- * @param fieldName Field name.
- */
- void WriteNull(const char* fieldName);
-
- /**
- * Start array write.
- *
- * @param fieldName Field name.
- * @return Array writer.
- */
- template<typename T>
- PortableArrayWriter<T> WriteArray(const char* fieldName)
- {
- int32_t id = impl->WriteArray(fieldName);
-
- return PortableArrayWriter<T>(impl, id);
- }
-
- /**
- * Start collection write.
- *
- * @param fieldName Field name.
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection(const char* fieldName)
- {
- return WriteCollection<T>(fieldName, IGNITE_COLLECTION_UNDEFINED);
- }
-
- /**
- * Start collection write.
- *
- * @param fieldName Field name.
- * @param type Collection type.
- * @return Collection writer.
- */
- template<typename T>
- PortableCollectionWriter<T> WriteCollection(const char* fieldName, ignite::portable::CollectionType typ)
- {
- int32_t id = impl->WriteCollection(fieldName, typ);
-
- return PortableCollectionWriter<T>(impl, id);
- }
-
- /**
- * Start map write.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap(const char* fieldName)
- {
- return WriteMap<K, V>(fieldName, IGNITE_MAP_UNDEFINED);
- }
-
- /**
- * Start map write.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @return Map writer.
- */
- template<typename K, typename V>
- PortableMapWriter<K, V> WriteMap(const char* fieldName, ignite::portable::MapType typ)
- {
- int32_t id = impl->WriteMap(fieldName, typ);
-
- return PortableMapWriter<K, V>(impl, id);
- }
-
- /**
- * Write object.
- *
- * @param fieldName Field name.
- * @param val Value.
- */
- template<typename T>
- void WriteObject(const char* fieldName, T val)
- {
- impl->WriteObject<T>(fieldName, val);
- }
-
- /**
- * Get raw writer for this reader.
- *
- * @return Raw writer.
- */
- PortableRawWriter RawWriter();
- private:
- /** Implementation delegate. */
- ignite::impl::portable::PortableWriterImpl* impl;
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am b/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
deleted file mode 100644
index 2ee13eff..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/include/Makefile.am
+++ /dev/null
@@ -1,20 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/impl/utils.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h b/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
deleted file mode 100644
index 8bbd2f7..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/include/ignite/impl/utils.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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_UTILS
-#define _IGNITE_UTILS
-
-#include <cstring>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#ifdef IGNITE_FRIEND
- #define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
-#else
- #define IGNITE_FRIEND_EXPORT
-#endif
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- /**
- * Copy characters.
- *
- * @param val Value.
- * @return Result.
- */
- IGNITE_FRIEND_EXPORT char* CopyChars(const char* val);
-
- /**
- * Release characters.
- *
- * @param val Value.
- */
- IGNITE_FRIEND_EXPORT void ReleaseChars(char* val);
-
- /**
- * Read system environment variable taking thread-safety in count.
- *
- * @param name Environment variable name.
- * @param found Whether environment variable with such name was found.
- * @return Environment variable value.
- */
- IGNITE_FRIEND_EXPORT std::string GetEnv(const std::string& name, bool* found);
-
- /**
- * Ensure that file on the given path exists in the system.
- *
- * @param path Path.
- * @return True if file exists, false otherwise.
- */
- IGNITE_FRIEND_EXPORT bool FileExists(const std::string& path);
-
- /**
- * Attempts to find JVM library to load it into the process later.
- * First search is performed using the passed path argument (is not NULL).
- * Then JRE_HOME is evaluated. Last, JAVA_HOME is evaluated.
- *
- * @param Explicitly defined path (optional).
- * @param found Whether library was found.
- * @return Path to the file.
- */
- IGNITE_FRIEND_EXPORT std::string FindJvmLibrary(const std::string* path, bool* found);
-
- /**
- * Load JVM library into the process.
- *
- * @param path Optional path to the library.
- * @return Whether load was successful.
- */
- IGNITE_FRIEND_EXPORT bool LoadJvmLibrary(const std::string& path);
-
- /**
- * Resolve IGNITE_HOME directory. Resolution is performed in several
- * steps:
- * 1) Check for path provided as argument.
- * 2) Check for environment variable.
- * 3) Check for current working directory.
- * Result of these 3 checks are evaluated based on existence of certain
- * predefined folders inside possible GG home. If they are found,
- * IGNITE_HOME is considered resolved.
- *
- * @param path Optional path to evaluate.
- * @param found Whether IGNITE_HOME home was found.
- * @return Resolved GG home.
- */
- IGNITE_FRIEND_EXPORT std::string ResolveIgniteHome(const std::string* path, bool* found);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @param test Whether test classpath must be used.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool test);
-
- /**
- * Safe array which automatically reclaims occupied memory when out of scope.
- */
- template<typename T>
- struct IGNITE_FRIEND_EXPORT SafeArray
- {
- /**
- * Constructor.
- */
- SafeArray(int cap)
- {
- target = new T[cap];
- }
-
- /**
- * Destructor.
- */
- ~SafeArray()
- {
- delete[] target;
- }
-
- IGNITE_NO_COPY_ASSIGNMENT(SafeArray);
-
- /** Target array. */
- T* target;
- };
- }
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp b/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
deleted file mode 100644
index ec45eb6..0000000
--- a/modules/platform/src/main/cpp/core/os/linux/src/impl/utils.cpp
+++ /dev/null
@@ -1,439 +0,0 @@
-/*
- * 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.
- */
-#include <sys/stat.h>
-#include <dirent.h>
-#include <dlfcn.h>
-
-#include "ignite/impl/utils.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- const char* JAVA_HOME = "JAVA_HOME";
- const char* JAVA_DLL = "/jre/lib/amd64/server/libjvm.so";
-
- const char* IGNITE_HOME = "IGNITE_HOME";
-
- const char* PROBE_BIN = "/bin";
- const char* PROBE_EXAMPLES = "/examples";
-
- const char* IGNITE_NATIVE_TEST_CLASSPATH = "IGNITE_NATIVE_TEST_CLASSPATH";
-
- /**
- * Helper method to set boolean result to reference with proper NULL-check.
- *
- * @param res Result.
- * @param outRes Where to set the result.
- */
- inline void SetBoolResult(bool res, bool* outRes)
- {
- if (outRes)
- *outRes = res;
- }
-
- /**
- * Check if string ends with the given ending.
- *
- * @param str String to check.
- * @param ending Ending.
- * @return Result.
- */
- inline bool StringEndsWith(const std::string& str, const std::string& ending)
- {
- if (str.length() > ending.length())
- return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
- return false;
- }
-
- /**
- * Helper function for GG home resolution. Checks whether certain folders
- * exist in the path. Optionally goes upwards in directory hierarchy.
- *
- * @param path Path to evaluate.
- * @param up Whether to go upwards.
- * @res Resolution result.
- * @return Resolved directory.
- */
- std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res)
- {
- struct stat pathStat;
-
- if (stat(path.c_str(), &pathStat) != -1 && S_ISDIR(pathStat.st_mode))
- {
- // Remove trailing slashes, otherwise we will have an infinite loop.
- std::string path0 = path;
-
- while (true) {
- char lastChar = *path0.rbegin();
-
- if (lastChar == '/' || lastChar == ' ') {
- size_t off = path0.find_last_of(lastChar);
-
- path0.erase(off, 1);
- }
- else
- break;
- }
-
- std::string binStr = path0 + PROBE_BIN;
- struct stat binStat;
-
- std::string examplesStr = path0 + PROBE_EXAMPLES;
- struct stat examplesStat;
-
- if (stat(binStr.c_str(), &binStat) != -1 && S_ISDIR(binStat.st_mode) &&
- stat(examplesStr.c_str(), &examplesStat) != -1 && S_ISDIR(examplesStat.st_mode))
- {
- SetBoolResult(true, res);
-
- return std::string(path0);
- }
-
- if (up)
- {
- // Evaluate parent directory.
- size_t slashPos = path0.find_last_of("/");
-
- if (slashPos != std::string::npos)
- {
- std::string parent = path0.substr(0, slashPos);
-
- return ResolveIgniteHome0(parent, true, res);
- }
- }
-
- }
-
- SetBoolResult(false, res);
-
- return std::string();
- }
-
- /**
- * Create classpath picking JARs from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathJars(const std::string& path)
- {
- std::string res = std::string();
-
- DIR* dir = opendir(path.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- if (strstr(entry->d_name, ".jar"))
- {
- res.append(path);
- res.append("/");
- res.append(entry->d_name);
- res.append(":");
- }
- }
-
- closedir(dir);
- }
-
- return res;
- }
-
- /**
- * Create classpath picking compiled classes from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathExploded(const std::string& path, bool down)
- {
- std::string res = std::string();
-
- if (FileExists(path))
- {
- // 1. Append "target\classes".
- std::string classesPath = path + "/target/classes";
-
- if (FileExists(classesPath)) {
- res += classesPath;
- res += ":";
- }
-
- // 2. Append "target\test-classes"
- std::string testClassesPath = path + "/target/test-classes";
-
- if (FileExists(testClassesPath)) {
- res += testClassesPath;
- res += ":";
- }
-
- // 3. Append "target\libs"
- std::string libsPath = path + "/target/libs";
-
- if (FileExists(libsPath)) {
- std::string libsCp = ClasspathJars(libsPath);
- res += libsCp;
- }
-
- // 4. Do the same for child if needed.
- if (down)
- {
- DIR* dir = opendir(path.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- std::string entryPath = entry->d_name;
-
- if (entryPath.compare(".") != 0 && entryPath.compare("..") != 0)
- {
- std::string entryFullPath = path + "/" + entryPath;
-
- struct stat entryFullStat;
-
- if (stat(entryFullPath.c_str(), &entryFullStat) != -1 && S_ISDIR(entryFullStat.st_mode))
- {
- std::string childCp = ClasspathExploded(entryFullPath, false);
-
- res += childCp;
- }
- }
- }
-
- closedir(dir);
- }
- }
- }
-
- return res;
- }
-
- /**
- * Helper function to create classpath based on Ignite home directory.
- *
- * @param home Home directory; expected to be valid.
- * @param forceTest Force test classpath.
- */
- std::string CreateIgniteHomeClasspath(const std::string& home, bool forceTest)
- {
- std::string res = std::string();
-
- // 1. Add exploded test directories.
- if (forceTest)
- {
- std::string examplesPath = home + "/examples";
- std::string examplesCp = ClasspathExploded(examplesPath, true);
- res.append(examplesCp);
-
- std::string modulesPath = home + "/modules";
- std::string modulesCp = ClasspathExploded(modulesPath, true);
- res.append(modulesCp);
- }
-
- // 2. Add regular jars from "libs" folder excluding "optional".
- std::string libsPath = home + "/libs";
-
- if (FileExists(libsPath))
- {
- res.append(ClasspathJars(libsPath));
-
- // Append inner directories.
- DIR* dir = opendir(libsPath.c_str());
-
- if (dir)
- {
- struct dirent* entry;
-
- while ((entry = readdir(dir)) != NULL)
- {
- std::string entryPath = entry->d_name;
-
- if (entryPath.compare(".") != 0 && entryPath.compare("..") != 0 &&
- entryPath.compare("optional") != 0)
- {
- std::string entryFullPath = libsPath;
-
- entryFullPath.append("/");
- entryFullPath.append(entryPath);
-
- struct stat entryFullStat;
-
- if (stat(entryFullPath.c_str(), &entryFullStat) != -1 &&
- S_ISDIR(entryFullStat.st_mode))
- res.append(ClasspathJars(entryFullPath));
- }
- }
-
- closedir(dir);
- }
- }
-
- // 3. Return.
- return res;
- }
-
- char* CopyChars(const char* val)
- {
- if (val) {
- size_t len = strlen(val);
- char* dest = new char[len + 1];
- strcpy(dest, val);
- *(dest + len) = 0;
- return dest;
- }
- else
- return NULL;
- }
-
- void ReleaseChars(char* val)
- {
- if (val)
- delete[] val;
- }
-
- std::string GetEnv(const std::string& name, bool* found)
- {
- char* val = std::getenv(name.c_str());
-
- if (val) {
- SetBoolResult(true, found);
-
- return std::string(val);
- }
- else {
- SetBoolResult(false, found);
-
- return std::string();
- }
- }
-
- bool FileExists(const std::string& path)
- {
- struct stat s;
-
- int res = stat(path.c_str(), &s);
-
- return res != -1;
- }
-
- std::string FindJvmLibrary(const std::string* path, bool* found)
- {
- SetBoolResult(true, found); // Optimistically assume that we will find it.
-
- if (path) {
- // If path is provided explicitly, then check only it.
- if (FileExists(*path))
- return std::string(path->data());
- }
- else
- {
- bool javaEnvFound;
- std::string javaEnv = GetEnv(JAVA_HOME, &javaEnvFound);
-
- if (javaEnvFound)
- {
- std::string javaDll = javaEnv + JAVA_DLL;
-
- if (FileExists(javaDll))
- return std::string(javaDll);
- }
- }
-
- SetBoolResult(false, found);
-
- return std::string();
- }
-
- bool LoadJvmLibrary(const std::string& path)
- {
- void* hnd = dlopen(path.c_str(), RTLD_LAZY);
-
- return hnd != NULL;
- }
-
- std::string ResolveIgniteHome(const std::string* path, bool* found)
- {
- if (path)
- // 1. Check passed argument.
- return ResolveIgniteHome0(*path, false, found);
- else
- {
- // 2. Check environment variable.
- bool envFound;
- std::string env = GetEnv(IGNITE_HOME, &envFound);
-
- if (envFound)
- return ResolveIgniteHome0(env, false, found);
- }
-
- SetBoolResult(false, found);
-
- return std::string();
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home)
- {
- bool forceTest = false;
-
- if (home)
- {
- bool envFound;
- std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, &envFound);
-
- forceTest = envFound && env.compare("true") == 0;
- }
-
- return CreateIgniteClasspath(usrCp, home, forceTest);
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest)
- {
- // 1. Append user classpath if it exists.
- std::string cp = std::string();
-
- if (usrCp)
- {
- cp.append(*usrCp);
-
- if (*cp.rbegin() != ':')
- cp.append(":");
- }
-
- // 2. Append home classpath if home is defined.
- if (home)
- {
- std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest);
-
- cp.append(homeCp);
- }
-
- // 3. Return.
- return cp;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h b/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
deleted file mode 100644
index 08e76ee..0000000
--- a/modules/platform/src/main/cpp/core/os/win/include/ignite/impl/utils.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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_UTILS
-#define _IGNITE_UTILS
-
-#include <cstring>
-#include <string>
-
-#include <ignite/common/common.h>
-
-#ifdef IGNITE_FRIEND
- #define IGNITE_FRIEND_EXPORT IGNITE_EXPORT
-#else
- #define IGNITE_FRIEND_EXPORT
-#endif
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- /**
- * Copy characters.
- *
- * @param val Value.
- * @return Result.
- */
- IGNITE_FRIEND_EXPORT char* CopyChars(const char* val);
-
- /**
- * Release characters.
- *
- * @param val Value.
- */
- IGNITE_FRIEND_EXPORT void ReleaseChars(char* val);
-
- /**
- * Read system environment variable taking thread-safety in count.
- *
- * @param name Environment variable name.
- * @param found Whether environment variable with such name was found.
- * @return Environment variable value.
- */
- IGNITE_FRIEND_EXPORT std::string GetEnv(const std::string& name, bool* found);
-
- /**
- * Ensure that file on the given path exists in the system.
- *
- * @param path Path.
- * @return True if file exists, false otherwise.
- */
- IGNITE_FRIEND_EXPORT bool FileExists(const std::string& path);
-
- /**
- * Attempts to find JVM library to load it into the process later.
- * First search is performed using the passed path argument (is not NULL).
- * Then JRE_HOME is evaluated. Last, JAVA_HOME is evaluated.
- *
- * @param Explicitly defined path (optional).
- * @param found Whether library was found.
- * @return Path to the file.
- */
- IGNITE_FRIEND_EXPORT std::string FindJvmLibrary(const std::string* path, bool* found);
-
- /**
- * Load JVM library into the process.
- *
- * @param path Optional path to the library.
- * @return Whether load was successful.
- */
- IGNITE_FRIEND_EXPORT bool LoadJvmLibrary(const std::string& path);
-
- /**
- * Resolve IGNITE_HOME directory. Resolution is performed in several
- * steps:
- * 1) Check for path provided as argument.
- * 2) Check for environment variable.
- * 3) Check for current working directory.
- * Result of these 3 checks are evaluated based on existence of certain
- * predefined folders inside possible GG home. If they are found,
- * IGNITE_HOME is considered resolved.
- *
- * @param path Optional path to evaluate.
- * @param found Whether IGNITE_HOME home was found.
- * @return Resolved GG home.
- */
- IGNITE_FRIEND_EXPORT std::string ResolveIgniteHome(const std::string* path, bool* found);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home);
-
- /**
- * Create Ignite classpath based on user input and home directory.
- *
- * @param usrCp User's classpath.
- * @param home Ignite home directory.
- * @param test Whether test classpath must be used.
- * @return Classpath.
- */
- IGNITE_FRIEND_EXPORT std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool test);
-
- /**
- * Safe array which automatically reclaims occupied memory when out of scope.
- */
- template<typename T>
- struct IGNITE_FRIEND_EXPORT SafeArray
- {
- /** Target array. */
- T* target;
-
- /**
- * Constructor.
- */
- SafeArray(int cap)
- {
- target = new T[cap];
- }
-
- /**
- * Destructor.
- */
- ~SafeArray()
- {
- delete[] target;
- }
-
- IGNITE_NO_COPY_ASSIGNMENT(SafeArray);
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp b/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
deleted file mode 100644
index 5a450c3..0000000
--- a/modules/platform/src/main/cpp/core/os/win/src/impl/utils.cpp
+++ /dev/null
@@ -1,453 +0,0 @@
-/*
- * 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.
- */
-
-#include <windows.h>
-
-#include "ignite/impl/utils.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace utils
- {
- const char* JAVA_HOME = "JAVA_HOME";
- const char* JAVA_DLL = "\\jre\\bin\\server\\jvm.dll";
-
- const char* IGNITE_HOME = "IGNITE_HOME";
-
- const char* PROBE_BIN = "\\bin";
- const char* PROBE_EXAMPLES = "\\examples";
-
- const char* IGNITE_NATIVE_TEST_CLASSPATH = "IGNITE_NATIVE_TEST_CLASSPATH";
-
- /**
- * Helper method to set boolean result to reference with proper NULL-check.
- *
- * @param res Result.
- * @param outRes Where to set the result.
- */
- inline void SetBoolResult(bool res, bool* outRes)
- {
- if (outRes)
- *outRes = res;
- }
-
- /**
- * Check if string ends with the given ending.
- *
- * @param str String to check.
- * @param ending Ending.
- * @return Result.
- */
- inline bool StringEndsWith(const std::string& str, const std::string& ending)
- {
- if (str.length() > ending.length())
- return str.compare(str.length() - ending.length(), ending.length(), ending) == 0;
-
- return false;
- }
-
- /**
- * Helper function for GG home resolution. Checks whether certain folders
- * exist in the path. Optionally goes upwards in directory hierarchy.
- *
- * @param path Path to evaluate.
- * @param up Whether to go upwards.
- * @res Resolution result.
- * @return Resolved directory.
- */
- std::string ResolveIgniteHome0(const std::string& path, bool up, bool* res)
- {
- DWORD attrs = GetFileAttributesA(path.c_str());
-
- if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))
- {
- // Remove trailing slashes, otherwise we will have an infinite loop.
- std::string path0 = path;
-
- while (true) {
- char lastChar = *path0.rbegin();
-
- if (lastChar == '/' || lastChar == '\\' || lastChar == ' ') {
- size_t off = path0.find_last_of(lastChar);
-
- path0.erase(off, 1);
- }
- else
- break;
- }
-
- std::string binStr = path0 + PROBE_BIN;
- DWORD binAttrs = GetFileAttributesA(binStr.c_str());
-
- std::string examplesStr = path0 + PROBE_EXAMPLES;
- DWORD examplesAttrs = GetFileAttributesA(examplesStr.c_str());
-
- if (binAttrs != INVALID_FILE_ATTRIBUTES && (binAttrs & FILE_ATTRIBUTE_DIRECTORY) &&
- examplesAttrs != INVALID_FILE_ATTRIBUTES && (examplesAttrs & FILE_ATTRIBUTE_DIRECTORY))
- {
- SetBoolResult(true, res);
- return std::string(path0);
- }
-
- if (up)
- {
- // Evaluate parent directory.
- size_t slashPos = path0.find_last_of("/\\");
-
- if (slashPos != std::string::npos)
- {
- std::string parent = path0.substr(0, slashPos);
-
- return ResolveIgniteHome0(parent, true, res);
- }
- }
- }
-
- SetBoolResult(false, res);
-
- return std::string();
- }
-
- /**
- * Create classpath picking JARs from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathJars(const std::string& path)
- {
- std::string searchPath = path + "\\*.jar";
-
- std::string res = std::string();
-
- WIN32_FIND_DATAA findData;
-
- HANDLE hnd = FindFirstFileA(searchPath.c_str(), &findData);
-
- if (hnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- res.append(path);
- res.append("\\");
- res.append(findData.cFileName);
- res.append(";");
- } while (FindNextFileA(hnd, &findData) != 0);
-
- FindClose(hnd);
- }
-
- return res;
- }
-
- /**
- * Create classpath picking compiled classes from the given path.
- *
- * @path Path.
- * @return Classpath;
- */
- std::string ClasspathExploded(const std::string& path, bool down)
- {
- std::string res = std::string();
-
- if (FileExists(path))
- {
- // 1. Append "target\classes".
- std::string classesPath = path + "\\target\\classes";
-
- if (FileExists(classesPath)) {
- res.append(classesPath);
- res.append(";");
- }
-
- // 2. Append "target\test-classes"
- std::string testClassesPath = path + "\\target\\test-classes";
-
- if (FileExists(testClassesPath)) {
- res.append(testClassesPath);
- res.append(";");
- }
-
- // 3. Append "target\libs"
- std::string libsPath = path + "\\target\\libs";
-
- if (FileExists(libsPath)) {
- std::string libsCp = ClasspathJars(libsPath);
- res.append(libsCp);
- }
-
- // 4. Do the same for child if needed.
- if (down)
- {
- std::string searchPath = path + "\\*";
-
- WIN32_FIND_DATAA findData;
-
- HANDLE hnd = FindFirstFileA(searchPath.c_str(), &findData);
-
- if (hnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- std::string childPath = findData.cFileName;
-
- if (childPath.compare(".") != 0 &&
- childPath.compare("..") != 0)
- {
- std::string childCp =
- ClasspathExploded(path + "\\" + childPath, false);
-
- res.append(childCp);
- }
- }
- } while (FindNextFileA(hnd, &findData) != 0);
-
- FindClose(hnd);
- }
- }
- }
-
- return res;
- }
-
- /**
- * Helper function to create classpath based on Ignite home directory.
- *
- * @param home Home directory; expected to be valid.
- * @param forceTest Force test classpath.
- */
- std::string CreateIgniteHomeClasspath(const std::string& home, bool forceTest)
- {
- std::string res = std::string();
-
- // 1. Add exploded test directories.
- if (forceTest)
- {
- std::string examplesPath = home + "\\examples";
- std::string examplesCp = ClasspathExploded(examplesPath, true);
- res.append(examplesCp);
-
- std::string modulesPath = home + "\\modules";
- std::string modulesCp = ClasspathExploded(modulesPath, true);
- res.append(modulesCp);
- }
-
- // 2. Add regular jars from "libs" folder excluding "optional".
- std::string libsPath = home + "\\libs";
-
- if (FileExists(libsPath))
- {
- res.append(ClasspathJars(libsPath));
-
- // Append inner directories.
- std::string libsSearchPath = libsPath + "\\*";
-
- WIN32_FIND_DATAA libsFindData;
-
- HANDLE libsHnd = FindFirstFileA(libsSearchPath.c_str(), &libsFindData);
-
- if (libsHnd != INVALID_HANDLE_VALUE)
- {
- do
- {
- if (libsFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
- {
- std::string libsChildPath = libsFindData.cFileName;
-
- if (libsChildPath.compare(".") != 0 &&
- libsChildPath.compare("..") != 0 &&
- libsChildPath.compare("optional") != 0) {
- std::string libsFolder = libsPath + "\\" + libsChildPath;
-
- res.append(ClasspathJars(libsFolder));
- }
- }
- } while (FindNextFileA(libsHnd, &libsFindData) != 0);
-
- FindClose(libsHnd);
- }
- }
-
- // 3. Return.
- return res;
- }
-
- char* CopyChars(const char* val)
- {
- if (val) {
- size_t len = strlen(val);
- char* dest = new char[len + 1];
- strcpy(dest, val);
- *(dest + len) = 0;
- return dest;
- }
- else
- return NULL;
- }
-
- void ReleaseChars(char* val)
- {
- if (val)
- delete[] val;
- }
-
- std::string GetEnv(const std::string& name, bool* found)
- {
- char res0[32767];
-
- DWORD envRes = GetEnvironmentVariableA(name.c_str(), res0, 32767);
-
- if (envRes != 0)
- {
- SetBoolResult(true, found);
-
- return std::string(res0);
- }
- else
- {
- SetBoolResult(false, found);
-
- return std::string();
- }
- }
-
- bool FileExists(const std::string& path)
- {
- WIN32_FIND_DATAA findres;
-
- HANDLE hnd = FindFirstFileA(path.c_str(), &findres);
-
- if (hnd == INVALID_HANDLE_VALUE)
- return false;
- else
- {
- FindClose(hnd);
-
- return true;
- }
- }
-
- std::string FindJvmLibrary(const std::string* path, bool* found)
- {
- SetBoolResult(true, found); // Optimistically assume that we will find it.
-
- if (path) {
- // If path is provided explicitly, then check only it.
- if (FileExists(*path))
- return std::string(path->data());
- }
- else
- {
- bool javaEnvFound;
- std::string javaEnv = GetEnv(JAVA_HOME, &javaEnvFound);
-
- if (javaEnvFound)
- {
- std::string javaDll = javaEnv + JAVA_DLL;
-
- if (FileExists(javaDll))
- return std::string(javaDll);
- }
- }
-
- *found = false;
-
- return std::string();
- }
-
- bool LoadJvmLibrary(const std::string& path)
- {
- HMODULE mod = LoadLibraryA(path.c_str());
-
- return mod != NULL;
- }
-
- std::string ResolveIgniteHome(const std::string* path, bool* found)
- {
- if (path)
- // 1. Check passed argument.
- return ResolveIgniteHome0(*path, false, found);
- else
- {
- // 2. Check environment variable.
- bool envFound;
- std::string env = GetEnv(IGNITE_HOME, &envFound);
-
- if (envFound)
- return ResolveIgniteHome0(env, false, found);
-
- // 3. Check current work dir.
- const DWORD curDirLen = GetCurrentDirectory(0, NULL);
-
- char* curDir = new char[curDirLen];
-
- GetCurrentDirectoryA(curDirLen, curDir);
-
- std::string curDirStr = curDir;
-
- delete[] curDir;
-
- return ResolveIgniteHome0(curDirStr, true, found);
- }
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home)
- {
- bool forceTest = false;
-
- if (home)
- {
- bool envFound;
- std::string env = GetEnv(IGNITE_NATIVE_TEST_CLASSPATH, &envFound);
-
- forceTest = envFound && env.compare("true") == 0;
- }
-
- return CreateIgniteClasspath(usrCp, home, forceTest);
- }
-
- std::string CreateIgniteClasspath(const std::string* usrCp, const std::string* home, bool forceTest)
- {
- // 1. Append user classpath if it exists.
- std::string cp = std::string();
-
- if (usrCp)
- {
- cp.append(*usrCp);
-
- if (*cp.rbegin() != ';')
- cp.append(";");
- }
-
- // 2. Append home classpath if home is defined.
- if (home)
- {
- std::string homeCp = CreateIgniteHomeClasspath(*home, forceTest);
-
- cp.append(homeCp);
- }
-
- // 3. Return.
- return cp;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/README.TXT b/modules/platform/src/main/cpp/core/project/README.TXT
deleted file mode 100644
index 97f4c64..0000000
--- a/modules/platform/src/main/cpp/core/project/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains IDE projects artifacts.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/README.TXT b/modules/platform/src/main/cpp/core/project/vs/README.TXT
deleted file mode 100644
index f4fb456..0000000
--- a/modules/platform/src/main/cpp/core/project/vs/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains Visual Studio project artifacts.
\ No newline at end of file
[31/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Ignition.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Ignition.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Ignition.cs
deleted file mode 100644
index 96d002f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Ignition.cs
+++ /dev/null
@@ -1,662 +0,0 @@
-/*
- * 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.
- */
-
-using Apache.Ignite.Core.Portable;
-
-namespace Apache.Ignite.Core
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime;
- using System.Runtime.InteropServices;
- using System.Threading;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Lifecycle;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
- using PU = Apache.Ignite.Core.Impl.Portable.PortableUtils;
-
- /// <summary>
- /// This class defines a factory for the main Ignite API.
- /// <p/>
- /// Use <see cref="Ignition.Start()"/> method to start Ignite with default configuration.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// <example>
- /// You can also use <see cref="IgniteConfiguration"/> to override some default configuration.
- /// Below is an example on how to start Ignite with custom configuration for portable types and
- /// provide path to Spring XML configuration file:
- /// <code>
- /// IgniteConfiguration cfg = new IgniteConfiguration();
- ///
- /// // Create portable type configuration.
- /// PortableConfiguration portableCfg = new PortableConfiguration();
- ///
- /// cfg.SpringConfigUrl = "examples\\config\\example-cache.xml";
- ///
- /// portableCfg.TypeConfigurations = new List<PortableTypeConfiguration>
- /// {
- /// new PortableTypeConfiguration(typeof(Address)),
- /// new PortableTypeConfiguration(typeof(Organization))
- /// };
- ///
- /// cfg.PortableConfiguration = portableCfg;
- ///
- /// // Start Ignite node with Ignite configuration.
- /// var ignite = Ignition.Start(cfg);
- /// </code>
- /// </example>
- /// </summary>
- public static class Ignition
- {
- /** */
- private const string DefaultCfg = "config/default-config.xml";
-
- /** */
- private static readonly object SyncRoot = new object();
-
- /** GC warning flag. */
- private static int _gcWarn;
-
- /** */
- private static readonly IDictionary<NodeKey, Ignite> Nodes = new Dictionary<NodeKey, Ignite>();
-
- /** Current DLL name. */
- private static readonly string IgniteDllName = Path.GetFileName(Assembly.GetExecutingAssembly().Location);
-
- /** Startup info. */
- [ThreadStatic]
- private static Startup _startup;
-
- /** Client mode flag. */
- [ThreadStatic]
- private static bool _clientMode;
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- static Ignition()
- {
- AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
- }
-
- /// <summary>
- /// Gets or sets a value indicating whether Ignite should be started in client mode.
- /// Client nodes cannot hold data in caches.
- /// </summary>
- public static bool ClientMode
- {
- get { return _clientMode; }
- set { _clientMode = value; }
- }
-
- /// <summary>
- /// Starts Ignite with default configuration. By default this method will
- /// use Ignite configuration defined in <code>IGNITE/config/default-config.xml</code>
- /// configuration file. If such file is not found, then all system defaults will be used.
- /// </summary>
- /// <returns>Started Ignite.</returns>
- public static IIgnite Start()
- {
- return Start(new IgniteConfiguration());
- }
-
- /// <summary>
- /// Starts all grids specified within given Spring XML configuration file. If Ignite with given name
- /// is already started, then exception is thrown. In this case all instances that may
- /// have been started so far will be stopped too.
- /// </summary>
- /// <param name="springCfgPath">Spring XML configuration file path or URL. Note, that the path can be
- /// absolute or relative to IGNITE_HOME.</param>
- /// <returns>Started Ignite. If Spring configuration contains multiple Ignite instances, then the 1st
- /// found instance is returned.</returns>
- public static IIgnite Start(string springCfgPath)
- {
- return Start(new IgniteConfiguration {SpringConfigUrl = springCfgPath});
- }
-
- /// <summary>
- /// Starts Ignite with given configuration.
- /// </summary>
- /// <returns>Started Ignite.</returns>
- public unsafe static IIgnite Start(IgniteConfiguration cfg)
- {
- IgniteArgumentCheck.NotNull(cfg, "cfg");
-
- // Copy configuration to avoid changes to user-provided instance.
- IgniteConfigurationEx cfgEx = cfg as IgniteConfigurationEx;
-
- cfg = cfgEx == null ? new IgniteConfiguration(cfg) : new IgniteConfigurationEx(cfgEx);
-
- // Set default Spring config if needed.
- if (cfg.SpringConfigUrl == null)
- cfg.SpringConfigUrl = DefaultCfg;
-
- lock (SyncRoot)
- {
- // 1. Check GC settings.
- CheckServerGc(cfg);
-
- // 2. Create context.
- IgniteUtils.LoadDlls(cfg.JvmDllPath);
-
- var cbs = new UnmanagedCallbacks();
-
- void* ctx = IgniteManager.GetContext(cfg, cbs);
-
- sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfg.SpringConfigUrl ?? DefaultCfg);
-
- string gridName = cfgEx != null ? cfgEx.GridName : null;
- sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);
-
- // 3. Create startup object which will guide us through the rest of the process.
- _startup = new Startup(cfg, cbs) { Context = ctx };
-
- IUnmanagedTarget interopProc = null;
-
- try
- {
- // 4. Initiate Ignite start.
- UU.IgnitionStart(cbs.Context, cfg.SpringConfigUrl ?? DefaultCfg,
- cfgEx != null ? cfgEx.GridName : null, ClientMode);
-
- // 5. At this point start routine is finished. We expect STARTUP object to have all necessary data.
- var node = _startup.Ignite;
- interopProc = node.InteropProcessor;
-
- // 6. On-start callback (notify lifecycle components).
- node.OnStart();
-
- Nodes[new NodeKey(_startup.Name)] = node;
-
- return node;
- }
- catch (Exception)
- {
- // 1. Perform keys cleanup.
- string name = _startup.Name;
-
- if (name != null)
- {
- NodeKey key = new NodeKey(name);
-
- if (Nodes.ContainsKey(key))
- Nodes.Remove(key);
- }
-
- // 2. Stop Ignite node if it was started.
- if (interopProc != null)
- UU.IgnitionStop(interopProc.Context, gridName, true);
-
- // 3. Throw error further (use startup error if exists because it is more precise).
- if (_startup.Error != null)
- throw _startup.Error;
-
- throw;
- }
- finally
- {
- _startup = null;
-
- Marshal.FreeHGlobal((IntPtr)cfgPath0);
-
- if ((IntPtr)gridName0 != IntPtr.Zero)
- Marshal.FreeHGlobal((IntPtr)gridName0);
-
- if (interopProc != null)
- UU.ProcessorReleaseStart(interopProc);
- }
- }
- }
-
- /// <summary>
- /// Check whether GC is set to server mode.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- private static void CheckServerGc(IgniteConfiguration cfg)
- {
- if (!cfg.SuppressWarnings && !GCSettings.IsServerGC && Interlocked.CompareExchange(ref _gcWarn, 1, 0) == 0)
- Console.WriteLine("GC server mode is not enabled, this could lead to less " +
- "than optimal performance on multi-core machines (to enable see " +
- "http://msdn.microsoft.com/en-us/library/ms229357(v=vs.110).aspx).");
- }
-
- /// <summary>
- /// Prepare callback invoked from Java.
- /// </summary>
- /// <param name="inStream">Intput stream with data.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="handleRegistry">Handle registry.</param>
- internal static void OnPrepare(PlatformMemoryStream inStream, PlatformMemoryStream outStream,
- HandleRegistry handleRegistry)
- {
- try
- {
- PortableReaderImpl reader = PU.Marshaller.StartUnmarshal(inStream);
-
- PrepareConfiguration(reader);
-
- PrepareLifecycleBeans(reader, outStream, handleRegistry);
- }
- catch (Exception e)
- {
- _startup.Error = e;
-
- throw;
- }
- }
-
- /// <summary>
- /// Preapare configuration.
- /// </summary>
- /// <param name="reader">Reader.</param>
- private static void PrepareConfiguration(PortableReaderImpl reader)
- {
- // 1. Load assemblies.
- IgniteConfiguration cfg = _startup.Configuration;
-
- LoadAssemblies(cfg.Assemblies);
-
- ICollection<string> cfgAssembllies;
- PortableConfiguration portableCfg;
-
- PortableUtils.ReadConfiguration(reader, out cfgAssembllies, out portableCfg);
-
- LoadAssemblies(cfgAssembllies);
-
- // 2. Create marshaller only after assemblies are loaded.
- if (cfg.PortableConfiguration == null)
- cfg.PortableConfiguration = portableCfg;
-
- _startup.Marshaller = new PortableMarshaller(cfg.PortableConfiguration);
- }
-
- /// <summary>
- /// Prepare lifecycle beans.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="handleRegistry">Handle registry.</param>
- private static void PrepareLifecycleBeans(PortableReaderImpl reader, PlatformMemoryStream outStream,
- HandleRegistry handleRegistry)
- {
- IList<LifecycleBeanHolder> beans = new List<LifecycleBeanHolder>();
-
- // 1. Read beans defined in Java.
- int cnt = reader.ReadInt();
-
- for (int i = 0; i < cnt; i++)
- beans.Add(new LifecycleBeanHolder(CreateLifecycleBean(reader)));
-
- // 2. Append beans definied in local configuration.
- ICollection<ILifecycleBean> nativeBeans = _startup.Configuration.LifecycleBeans;
-
- if (nativeBeans != null)
- {
- foreach (ILifecycleBean nativeBean in nativeBeans)
- beans.Add(new LifecycleBeanHolder(nativeBean));
- }
-
- // 3. Write bean pointers to Java stream.
- outStream.WriteInt(beans.Count);
-
- foreach (LifecycleBeanHolder bean in beans)
- outStream.WriteLong(handleRegistry.AllocateCritical(bean));
-
- outStream.SynchronizeOutput();
-
- // 4. Set beans to STARTUP object.
- _startup.LifecycleBeans = beans;
- }
-
- /// <summary>
- /// Create lifecycle bean.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Lifecycle bean.</returns>
- internal static ILifecycleBean CreateLifecycleBean(PortableReaderImpl reader)
- {
- // 1. Instantiate.
- string assemblyName = reader.ReadString();
- string clsName = reader.ReadString();
-
- object bean = IgniteUtils.CreateInstance(assemblyName, clsName);
-
- // 2. Set properties.
- IDictionary<string, object> props = reader.ReadGenericDictionary<string, object>();
-
- IgniteUtils.SetProperties(bean, props);
-
- return bean as ILifecycleBean;
- }
-
- /// <summary>
- /// Kernal start callback.
- /// </summary>
- /// <param name="interopProc">Interop processor.</param>
- /// <param name="stream">Stream.</param>
- internal static void OnStart(IUnmanagedTarget interopProc, IPortableStream stream)
- {
- try
- {
- // 1. Read data and leave critical state ASAP.
- PortableReaderImpl reader = PU.Marshaller.StartUnmarshal(stream);
-
- // ReSharper disable once PossibleInvalidOperationException
- var name = reader.ReadString();
-
- // 2. Set ID and name so that Start() method can use them later.
- _startup.Name = name;
-
- if (Nodes.ContainsKey(new NodeKey(name)))
- throw new IgniteException("Ignite with the same name already started: " + name);
-
- _startup.Ignite = new Ignite(_startup.Configuration, _startup.Name, interopProc, _startup.Marshaller,
- _startup.LifecycleBeans, _startup.Callbacks);
- }
- catch (Exception e)
- {
- // 5. Preserve exception to throw it later in the "Start" method and throw it further
- // to abort startup in Java.
- _startup.Error = e;
-
- throw;
- }
- }
-
- /// <summary>
- /// Load assemblies.
- /// </summary>
- /// <param name="assemblies">Assemblies.</param>
- private static void LoadAssemblies(IEnumerable<string> assemblies)
- {
- if (assemblies != null)
- {
- foreach (string s in assemblies)
- {
- // 1. Try loading as directory.
- if (Directory.Exists(s))
- {
- string[] files = Directory.GetFiles(s, "*.dll");
-
-#pragma warning disable 0168
-
- foreach (string dllPath in files)
- {
- if (!SelfAssembly(dllPath))
- {
- try
- {
- Assembly.LoadFile(dllPath);
- }
-
- catch (BadImageFormatException)
- {
- // No-op.
- }
- }
- }
-
-#pragma warning restore 0168
-
- continue;
- }
-
- // 2. Try loading using full-name.
- try
- {
- Assembly assembly = Assembly.Load(s);
-
- if (assembly != null)
- continue;
- }
- catch (Exception e)
- {
- if (!(e is FileNotFoundException || e is FileLoadException))
- throw new IgniteException("Failed to load assembly: " + s, e);
- }
-
- // 3. Try loading using file path.
- try
- {
- Assembly assembly = Assembly.LoadFrom(s);
-
- if (assembly != null)
- continue;
- }
- catch (Exception e)
- {
- if (!(e is FileNotFoundException || e is FileLoadException))
- throw new IgniteException("Failed to load assembly: " + s, e);
- }
-
- // 4. Not found, exception.
- throw new IgniteException("Failed to load assembly: " + s);
- }
- }
- }
-
- /// <summary>
- /// Whether assembly points to Ignite binary.
- /// </summary>
- /// <param name="assembly">Assembly to check..</param>
- /// <returns><c>True</c> if this is one of GG assemblies.</returns>
- private static bool SelfAssembly(string assembly)
- {
- return assembly.EndsWith(IgniteDllName, StringComparison.OrdinalIgnoreCase);
- }
-
- /// <summary>
- /// Gets a named Ignite instance. If Ignite name is {@code null} or empty string,
- /// then default no-name Ignite will be returned. Note that caller of this method
- /// should not assume that it will return the same instance every time.
- /// <p/>
- /// Note that single process can run multiple Ignite instances and every Ignite instance (and its
- /// node) can belong to a different grid. Ignite name defines what grid a particular Ignite
- /// instance (and correspondingly its node) belongs to.
- /// </summary>
- /// <param name="name">Ignite name to which requested Ignite instance belongs. If <code>null</code>,
- /// then Ignite instance belonging to a default no-name Ignite will be returned.
- /// </param>
- /// <returns>An instance of named grid.</returns>
- public static IIgnite GetIgnite(string name)
- {
- lock (SyncRoot)
- {
- Ignite result;
-
- if (!Nodes.TryGetValue(new NodeKey(name), out result))
- throw new IgniteException("Ignite instance was not properly started or was already stopped: " + name);
-
- return result;
- }
- }
-
- /// <summary>
- /// Gets an instance of default no-name grid. Note that
- /// caller of this method should not assume that it will return the same
- /// instance every time.
- /// </summary>
- /// <returns>An instance of default no-name grid.</returns>
- public static IIgnite GetIgnite()
- {
- return GetIgnite(null);
- }
-
- /// <summary>
- /// Stops named grid. If <code>cancel</code> flag is set to <code>true</code> then
- /// all jobs currently executing on local node will be interrupted. If
- /// grid name is <code>null</code>, then default no-name Ignite will be stopped.
- /// </summary>
- /// <param name="name">Grid name. If <code>null</code>, then default no-name Ignite will be stopped.</param>
- /// <param name="cancel">If <code>true</code> then all jobs currently executing will be cancelled
- /// by calling <code>ComputeJob.cancel</code>method.</param>
- /// <returns><code>true</code> if named Ignite instance was indeed found and stopped, <code>false</code>
- /// othwerwise (the instance with given <code>name</code> was not found).</returns>
- public static bool Stop(string name, bool cancel)
- {
- lock (SyncRoot)
- {
- NodeKey key = new NodeKey(name);
-
- Ignite node;
-
- if (!Nodes.TryGetValue(key, out node))
- return false;
-
- node.Stop(cancel);
-
- Nodes.Remove(key);
-
- GC.Collect();
-
- return true;
- }
- }
-
- /// <summary>
- /// Stops <b>all</b> started grids. If <code>cancel</code> flag is set to <code>true</code> then
- /// all jobs currently executing on local node will be interrupted.
- /// </summary>
- /// <param name="cancel">If <code>true</code> then all jobs currently executing will be cancelled
- /// by calling <code>ComputeJob.cancel</code>method.</param>
- public static void StopAll(bool cancel)
- {
- lock (SyncRoot)
- {
- while (Nodes.Count > 0)
- {
- var entry = Nodes.First();
-
- entry.Value.Stop(cancel);
-
- Nodes.Remove(entry.Key);
- }
- }
-
- GC.Collect();
- }
-
- /// <summary>
- /// Handles the AssemblyResolve event of the CurrentDomain control.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="args">The <see cref="ResolveEventArgs"/> instance containing the event data.</param>
- /// <returns>Manually resolved assembly, or null.</returns>
- private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
- {
- return LoadedAssembliesResolver.Instance.GetAssembly(args.Name);
- }
-
- /// <summary>
- /// Grid key.
- /// </summary>
- private class NodeKey
- {
- /** */
- private readonly string _name;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="NodeKey"/> class.
- /// </summary>
- /// <param name="name">The name.</param>
- internal NodeKey(string name)
- {
- _name = name;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- var other = obj as NodeKey;
-
- return other != null && Equals(_name, other._name);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return _name == null ? 0 : _name.GetHashCode();
- }
- }
-
- /// <summary>
- /// Value object to pass data between .Net methods during startup bypassing Java.
- /// </summary>
- private unsafe class Startup
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <param name="cbs"></param>
- internal Startup(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
- {
- Configuration = cfg;
- Callbacks = cbs;
- }
- /// <summary>
- /// Configuration.
- /// </summary>
- internal IgniteConfiguration Configuration { get; private set; }
-
- /// <summary>
- /// Gets unmanaged callbacks.
- /// </summary>
- internal UnmanagedCallbacks Callbacks { get; private set; }
-
- /// <summary>
- /// Lifecycle beans.
- /// </summary>
- internal IList<LifecycleBeanHolder> LifecycleBeans { get; set; }
-
- /// <summary>
- /// Node name.
- /// </summary>
- internal string Name { get; set; }
-
- /// <summary>
- /// Marshaller.
- /// </summary>
- internal PortableMarshaller Marshaller { get; set; }
-
- /// <summary>
- /// Start error.
- /// </summary>
- internal Exception Error { get; set; }
-
- /// <summary>
- /// Gets or sets the context.
- /// </summary>
- internal void* Context { get; set; }
-
- /// <summary>
- /// Gets or sets the ignite.
- /// </summary>
- internal Ignite Ignite { get; set; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
deleted file mode 100644
index 37bf73a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheAffinityImpl.cs
+++ /dev/null
@@ -1,275 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Cache affinity implementation.
- /// </summary>
- internal class CacheAffinityImpl : PlatformTarget, ICacheAffinity
- {
- /** */
- private const int OpAffinityKey = 1;
-
- /** */
- private const int OpAllPartitions = 2;
-
- /** */
- private const int OpBackupPartitions = 3;
-
- /** */
- private const int OpIsBackup = 4;
-
- /** */
- private const int OpIsPrimary = 5;
-
- /** */
- private const int OpIsPrimaryOrBackup = 6;
-
- /** */
- private const int OpMapKeyToNode = 7;
-
- /** */
- private const int OpMapKeyToPrimaryAndBackups = 8;
-
- /** */
- private const int OpMapKeysToNodes = 9;
-
- /** */
- private const int OpMapPartitionToNode = 10;
-
- /** */
- private const int OpMapPartitionToPrimaryAndBackups = 11;
-
- /** */
- private const int OpMapPartitionsToNodes = 12;
-
- /** */
- private const int OpPartition = 13;
-
- /** */
- private const int OpPrimaryPartitions = 14;
-
- /** */
- private readonly bool _keepPortable;
-
- /** Grid. */
- private readonly Ignite _ignite;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheAffinityImpl" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- /// <param name="ignite">Grid.</param>
- public CacheAffinityImpl(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable,
- Ignite ignite) : base(target, marsh)
- {
- _keepPortable = keepPortable;
-
- Debug.Assert(ignite != null);
-
- _ignite = ignite;
- }
-
- /** <inheritDoc /> */
- public int Partitions
- {
- get { return UU.AffinityPartitions(Target); }
- }
-
- /** <inheritDoc /> */
- public int GetPartition<TK>(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return (int)DoOutOp(OpPartition, key);
- }
-
- /** <inheritDoc /> */
- public bool IsPrimary<TK>(IClusterNode n, TK key)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp(OpIsPrimary, n.Id, key) == True;
- }
-
- /** <inheritDoc /> */
- public bool IsBackup<TK>(IClusterNode n, TK key)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp(OpIsBackup, n.Id, key) == True;
- }
-
- /** <inheritDoc /> */
- public bool IsPrimaryOrBackup<TK>(IClusterNode n, TK key)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp(OpIsPrimaryOrBackup, n.Id, key) == True;
- }
-
- /** <inheritDoc /> */
- public int[] GetPrimaryPartitions(IClusterNode n)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- return DoOutInOp<Guid, int[]>(OpPrimaryPartitions, n.Id);
- }
-
- /** <inheritDoc /> */
- public int[] GetBackupPartitions(IClusterNode n)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- return DoOutInOp<Guid, int[]>(OpBackupPartitions, n.Id);
- }
-
- /** <inheritDoc /> */
- public int[] GetAllPartitions(IClusterNode n)
- {
- IgniteArgumentCheck.NotNull(n, "n");
-
- return DoOutInOp<Guid, int[]>(OpAllPartitions, n.Id);
- }
-
- /** <inheritDoc /> */
- public TR GetAffinityKey<TK, TR>(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp<TK, TR>(OpAffinityKey, key);
- }
-
- /** <inheritDoc /> */
- public IDictionary<IClusterNode, IList<TK>> MapKeysToNodes<TK>(IList<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- return DoOutInOp(OpMapKeysToNodes, w => w.WriteObject(keys),
- reader => ReadDictionary(reader, ReadNode, r => r.ReadObject<IList<TK>>()));
- }
-
- /** <inheritDoc /> */
- public IClusterNode MapKeyToNode<TK>(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return GetNode(DoOutInOp<TK, Guid?>(OpMapKeyToNode, key));
- }
-
- /** <inheritDoc /> */
- public IList<IClusterNode> MapKeyToPrimaryAndBackups<TK>(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp(OpMapKeyToPrimaryAndBackups, w => w.WriteObject(key), r => ReadNodes(r));
- }
-
- /** <inheritDoc /> */
- public IClusterNode MapPartitionToNode(int part)
- {
- return GetNode(DoOutInOp<int, Guid?>(OpMapPartitionToNode, part));
- }
-
- /** <inheritDoc /> */
- public IDictionary<int, IClusterNode> MapPartitionsToNodes(IList<int> parts)
- {
- IgniteArgumentCheck.NotNull(parts, "parts");
-
- return DoOutInOp(OpMapPartitionsToNodes,
- w => w.WriteObject(parts),
- reader => ReadDictionary(reader, r => r.ReadInt(), ReadNode));
- }
-
- /** <inheritDoc /> */
- public IList<IClusterNode> MapPartitionToPrimaryAndBackups(int part)
- {
- return DoOutInOp(OpMapPartitionToPrimaryAndBackups, w => w.WriteObject(part), r => ReadNodes(r));
- }
-
- /** <inheritDoc /> */
- protected override T Unmarshal<T>(IPortableStream stream)
- {
- return Marshaller.Unmarshal<T>(stream, _keepPortable);
- }
-
-
- /// <summary>
- /// Gets the node by id.
- /// </summary>
- /// <param name="id">The id.</param>
- /// <returns>Node.</returns>
- private IClusterNode GetNode(Guid? id)
- {
- return _ignite.GetNode(id);
- }
-
- /// <summary>
- /// Reads a node from stream.
- /// </summary>
- private IClusterNode ReadNode(PortableReaderImpl r)
- {
- return GetNode(r.ReadGuid());
- }
-
- /// <summary>
- /// Reads nodes from stream.
- /// </summary>
- private IList<IClusterNode> ReadNodes(IPortableStream reader)
- {
- return IgniteUtils.ReadNodes(Marshaller.StartUnmarshal(reader, _keepPortable));
- }
-
- /// <summary>
- /// Reads a dictionary from stream.
- /// </summary>
- private Dictionary<TK, TV> ReadDictionary<TK, TV>(IPortableStream reader, Func<PortableReaderImpl, TK> readKey,
- Func<PortableReaderImpl, TV> readVal)
- {
- var r = Marshaller.StartUnmarshal(reader, _keepPortable);
-
- var cnt = r.ReadInt();
-
- var dict = new Dictionary<TK, TV>(cnt);
-
- for (var i = 0; i < cnt; i++)
- dict[readKey(r)] = readVal(r);
-
- return dict;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntry.cs
deleted file mode 100644
index e28b3e2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntry.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
-
- /// <summary>
- /// Represents a cache entry.
- /// </summary>
- internal struct CacheEntry<TK, TV> : ICacheEntry<TK, TV>
- {
- /** Key. */
- private readonly TK _key;
-
- /** Value. */
- private readonly TV _val;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntry{K,V}"/> struct.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- public CacheEntry(TK key, TV val)
- {
- _key = key;
- _val = val;
- }
-
- /// <summary>
- /// Gets the key.
- /// </summary>
- public TK Key
- {
- get { return _key; }
- }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- public TV Value
- {
- get { return _val; }
- }
-
- /// <summary>
- /// Determines whether the specified <see cref="CacheEntry{K,V}"/>, is equal to this instance.
- /// </summary>
- /// <param name="other">The <see cref="CacheEntry{K,V}"/> to compare with this instance.</param>
- /// <returns>
- /// <c>true</c> if the specified <see cref="CacheEntry{K,V}"/> is equal to this instance;
- /// otherwise, <c>false</c>.
- /// </returns>
- public bool Equals(CacheEntry<TK, TV> other)
- {
- return EqualityComparer<TK>.Default.Equals(_key, other._key) &&
- EqualityComparer<TV>.Default.Equals(_val, other._val);
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj))
- return false;
-
- return obj is CacheEntry<TK, TV> && Equals((CacheEntry<TK, TV>) obj);
- }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- unchecked
- {
- return (EqualityComparer<TK>.Default.GetHashCode(_key) * 397) ^
- EqualityComparer<TV>.Default.GetHashCode(_val);
- }
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- return string.Format("CacheEntry [Key={0}, Value={1}]", _key, _val);
- }
-
- /// <summary>
- /// Implements the operator ==.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator ==(CacheEntry<TK, TV> a, CacheEntry<TK, TV> b)
- {
- return a.Equals(b);
- }
-
- /// <summary>
- /// Implements the operator !=.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator !=(CacheEntry<TK, TV> a, CacheEntry<TK, TV> b)
- {
- return !(a == b);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
deleted file mode 100644
index 1181645..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryFilterHolder.cs
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Non-generic portable filter wrapper.
- /// </summary>
- internal class CacheEntryFilterHolder : IPortableWriteAware
- {
- /** Wrapped ICacheEntryFilter */
- private readonly object _pred;
-
- /** Invoker function that takes key and value and invokes wrapped ICacheEntryFilter */
- private readonly Func<object, object, bool> _invoker;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Grid. */
- private readonly PortableMarshaller _marsh;
-
- /** Handle. */
- private readonly long _handle;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryFilterHolder" /> class.
- /// </summary>
- /// <param name="pred">The <see cref="ICacheEntryFilter{TK,TV}" /> to wrap.</param>
- /// <param name="invoker">The invoker func that takes key and value and invokes wrapped ICacheEntryFilter.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- public CacheEntryFilterHolder(object pred, Func<object, object, bool> invoker, PortableMarshaller marsh,
- bool keepPortable)
- {
- Debug.Assert(pred != null);
- Debug.Assert(invoker != null);
- Debug.Assert(marsh != null);
-
- _pred = pred;
- _invoker = invoker;
- _marsh = marsh;
- _keepPortable = keepPortable;
-
- _handle = marsh.Ignite.HandleRegistry.Allocate(this);
- }
-
- /// <summary>
- /// Gets the handle.
- /// </summary>
- public long Handle
- {
- get { return _handle; }
- }
-
- /// <summary>
- /// Invokes the cache filter.
- /// </summary>
- /// <param name="input">The input stream.</param>
- /// <returns>Invocation result.</returns>
- public int Invoke(IPortableStream input)
- {
- var rawReader = _marsh.StartUnmarshal(input, _keepPortable).RawReader();
-
- return _invoker(rawReader.ReadObject<object>(), rawReader.ReadObject<object>()) ? 1 : 0;
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _pred);
-
- writer0.WriteBoolean(_keepPortable);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryFilterHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public CacheEntryFilterHolder(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _pred = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- _keepPortable = reader0.ReadBoolean();
-
- _marsh = reader0.Marshaller;
-
- _invoker = GetInvoker(_pred);
-
- _handle = _marsh.Ignite.HandleRegistry.Allocate(this);
- }
-
- /// <summary>
- /// Gets the invoker func.
- /// </summary>
- private static Func<object, object, bool> GetInvoker(object pred)
- {
- var func = DelegateTypeDescriptor.GetCacheEntryFilter(pred.GetType());
-
- return (key, val) => func(pred, key, val);
- }
-
- /// <summary>
- /// Creates an instance of this class from a stream.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="grid">Grid.</param>
- /// <returns>Deserialized instance of <see cref="CacheEntryFilterHolder"/></returns>
- public static CacheEntryFilterHolder CreateInstance(long memPtr, Ignite grid)
- {
- var stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- Debug.Assert(grid != null);
-
- var marsh = grid.Marshaller;
-
- return marsh.Unmarshal<CacheEntryFilterHolder>(stream);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
deleted file mode 100644
index 4ec1e1e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorHolder.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Reflection;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable wrapper for the <see cref="ICacheEntryProcessor{TK,TV,TA,TR}"/> and it's argument.
- /// Marshals and executes wrapped processor with a non-generic interface.
- /// </summary>
- internal class CacheEntryProcessorHolder : IPortableWriteAware
- {
- // generic processor
- private readonly object _proc;
-
- // argument
- private readonly object _arg;
-
- // func to invoke Process method on ICacheEntryProcessor in form of object.
- private readonly Func<IMutableCacheEntryInternal, object, object> _processFunc;
-
- // entry creator delegate
- private readonly Func<object, object, bool, IMutableCacheEntryInternal> _entryCtor;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorHolder"/> class.
- /// </summary>
- /// <param name="proc">The processor to wrap.</param>
- /// <param name="arg">The argument.</param>
- /// <param name="processFunc">Delegate to call generic <see cref="ICacheEntryProcessor{K, V, A, R}.Process"/> on local node.</param>
- /// <param name="keyType">Type of the key.</param>
- /// <param name="valType">Type of the value.</param>
- public CacheEntryProcessorHolder(object proc, object arg,
- Func<IMutableCacheEntryInternal, object, object> processFunc, Type keyType, Type valType)
- {
- Debug.Assert(proc != null);
- Debug.Assert(processFunc != null);
-
- _proc = proc;
- _arg = arg;
- _processFunc = processFunc;
-
- _processFunc = GetProcessFunc(_proc);
-
- _entryCtor = MutableCacheEntry.GetCtor(keyType, valType);
- }
-
- /// <summary>
- /// Processes specified cache entry.
- /// </summary>
- /// <param name="key">The cache entry key.</param>
- /// <param name="value">The cache entry value.</param>
- /// <param name="exists">Indicates whether cache entry exists.</param>
- /// <param name="grid"></param>
- /// <returns>
- /// Pair of resulting cache entry and result of processing it.
- /// </returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User processor can throw any exception")]
- public CacheEntryProcessorResultHolder Process(object key, object value, bool exists, Ignite grid)
- {
- ResourceProcessor.Inject(_proc, grid);
-
- var entry = _entryCtor(key, value, exists);
-
- try
- {
- return new CacheEntryProcessorResultHolder(entry, _processFunc(entry, _arg), null);
- }
- catch (TargetInvocationException ex)
- {
- return new CacheEntryProcessorResultHolder(null, null, ex.InnerException);
- }
- catch (Exception ex)
- {
- return new CacheEntryProcessorResultHolder(null, null, ex);
- }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl) writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _proc);
- PortableUtils.WritePortableOrSerializable(writer0, _arg);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public CacheEntryProcessorHolder(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl) reader.RawReader();
-
- _proc = PortableUtils.ReadPortableOrSerializable<object>(reader0);
- _arg = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- _processFunc = GetProcessFunc(_proc);
-
- var kvTypes = DelegateTypeDescriptor.GetCacheEntryProcessorTypes(_proc.GetType());
-
- _entryCtor = MutableCacheEntry.GetCtor(kvTypes.Item1, kvTypes.Item2);
- }
-
- /// <summary>
- /// Gets a delegate to call generic <see cref="ICacheEntryProcessor{K, V, A, R}.Process"/>.
- /// </summary>
- /// <param name="proc">The processor instance.</param>
- /// <returns>
- /// Delegate to call generic <see cref="ICacheEntryProcessor{K, V, A, R}.Process"/>.
- /// </returns>
- private static Func<IMutableCacheEntryInternal, object, object> GetProcessFunc(object proc)
- {
- var func = DelegateTypeDescriptor.GetCacheEntryProcessor(proc.GetType());
-
- return (entry, arg) => func(proc, entry, arg);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResult.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResult.cs
deleted file mode 100644
index 9a0af4f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResult.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using Apache.Ignite.Core.Cache;
-
- /// <summary>
- /// Represents a result of <see cref="ICacheEntryProcessor{TK,TV,TA,TR}"/> invocation.
- /// </summary>
- /// <typeparam name="T">Result type.</typeparam>
- internal class CacheEntryProcessorResult<T> : ICacheEntryProcessorResult<T>
- {
- // Result
- private readonly T _res;
-
- // Error
- private readonly Exception _err;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorResult{T}"/> class.
- /// </summary>
- /// <param name="result">The result.</param>
- public CacheEntryProcessorResult(T result)
- {
- _res = result;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorResult{T}"/> class.
- /// </summary>
- /// <param name="error">The error.</param>
- public CacheEntryProcessorResult(Exception error)
- {
- _err = error;
- }
-
- /** <inheritdoc /> */
- public T Result
- {
- get
- {
- if (_err != null)
- throw _err as CacheEntryProcessorException ?? new CacheEntryProcessorException(_err);
-
- return _res;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
deleted file mode 100644
index 04cd557..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEntryProcessorResultHolder.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Manages cache entry processing result in non-generic form.
- /// </summary>
- internal class CacheEntryProcessorResultHolder
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorResultHolder"/> class.
- /// </summary>
- /// <param name="entry">Entry.</param>
- /// <param name="processResult">Process result.</param>
- /// <param name="error">Error.</param>
- public CacheEntryProcessorResultHolder(IMutableCacheEntryInternal entry, object processResult, Exception error)
- {
- Entry = entry;
- ProcessResult = processResult;
- Error = error;
- }
-
- /// <summary>
- /// Gets the entry.
- /// </summary>
- public IMutableCacheEntryInternal Entry { get; private set; }
-
- /// <summary>
- /// Gets the process result.
- /// </summary>
- public object ProcessResult { get; private set; }
-
- /// <summary>
- /// Gets the error.
- /// </summary>
- public Exception Error { get; private set; }
-
- /// <summary>
- /// Writes this instance to the stream.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="marsh">Marshaller.</param>
- public void Write(IPortableStream stream, PortableMarshaller marsh)
- {
- var writer = marsh.StartMarshal(stream);
-
- try
- {
- Marshal(writer);
- }
- finally
- {
- marsh.FinishMarshal(writer);
- }
- }
-
- /// <summary>
- /// Marshal this instance.
- /// </summary>
- /// <param name="writer">Writer.</param>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "Any kind of exception can be thrown during user type marshalling.")]
- private void Marshal(PortableWriterImpl writer)
- {
- var pos = writer.Stream.Position;
-
- try
- {
- if (Error == null)
- {
- writer.WriteByte((byte) Entry.State);
-
- if (Entry.State == MutableCacheEntryState.ValueSet)
- writer.Write(Entry.Value);
-
- writer.Write(ProcessResult);
- }
- else
- {
- writer.WriteByte((byte) MutableCacheEntryState.ErrPortable);
- writer.Write(new PortableResultWrapper(Error));
- }
- }
- catch (Exception marshErr)
- {
- writer.Stream.Seek(pos, SeekOrigin.Begin);
-
- writer.WriteByte((byte) MutableCacheEntryState.ErrString);
-
- if (Error == null)
- {
- writer.WriteString(string.Format(
- "CacheEntryProcessor completed with error, but result serialization failed [errType={0}, " +
- "err={1}, serializationErrMsg={2}]", marshErr.GetType().Name, marshErr, marshErr.Message));
- }
- else
- {
- writer.WriteString(string.Format(
- "CacheEntryProcessor completed with error, and error serialization failed [errType={0}, " +
- "err={1}, serializationErrMsg={2}]", marshErr.GetType().Name, marshErr, marshErr.Message));
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerable.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerable.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerable.cs
deleted file mode 100644
index 2dd03c9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerable.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System.Collections;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
-
- /// <summary>
- /// Cache enumerable.
- /// </summary>
- internal class CacheEnumerable<TK, TV> : IEnumerable<ICacheEntry<TK, TV>>
- {
- /** Target cache. */
- private readonly CacheImpl<TK, TV> _cache;
-
- /** Local flag. */
- private readonly bool _loc;
-
- /** Peek modes. */
- private readonly int _peekModes;
-
- /// <summary>
- /// Constructor for distributed iterator.
- /// </summary>
- /// <param name="cache">Target cache.</param>
- public CacheEnumerable(CacheImpl<TK, TV> cache) : this(cache, false, 0)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor for local iterator.
- /// </summary>
- /// <param name="cache">Target cache.</param>
- /// <param name="peekModes">Peek modes.</param>
- public CacheEnumerable(CacheImpl<TK, TV> cache, int peekModes) : this(cache, true, peekModes)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cache">Target cache.</param>
- /// <param name="loc">Local flag.</param>
- /// <param name="peekModes">Peek modes.</param>
- private CacheEnumerable(CacheImpl<TK, TV> cache, bool loc, int peekModes)
- {
- _cache = cache;
- _loc = loc;
- _peekModes = peekModes;
- }
-
- /** <inheritdoc /> */
- public IEnumerator<ICacheEntry<TK, TV>> GetEnumerator()
- {
- return new CacheEnumeratorProxy<TK, TV>(_cache, _loc, _peekModes);
- }
-
- /** <inheritdoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
deleted file mode 100644
index fd26558..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumerator.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
-
- /// <summary>
- /// Real cache enumerator communicating with Java.
- /// </summary>
- internal class CacheEnumerator<TK, TV> : PlatformDisposableTarget, IEnumerator<ICacheEntry<TK, TV>>
- {
- /** Operation: next value. */
- private const int OpNext = 1;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Current entry. */
- private CacheEntry<TK, TV>? _cur;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- public CacheEnumerator(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable) :
- base(target, marsh)
- {
- _keepPortable = keepPortable;
- }
-
- /** <inheritdoc /> */
- public bool MoveNext()
- {
- ThrowIfDisposed();
-
- return DoInOp(OpNext, stream =>
- {
- var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
-
- bool hasNext = reader.ReadBoolean();
-
- if (hasNext)
- {
- reader.DetachNext();
- TK key = reader.ReadObject<TK>();
-
- reader.DetachNext();
- TV val = reader.ReadObject<TV>();
-
- _cur = new CacheEntry<TK, TV>(key, val);
-
- return true;
- }
-
- _cur = null;
-
- return false;
- });
- }
-
- /** <inheritdoc /> */
- public ICacheEntry<TK, TV> Current
- {
- get
- {
- ThrowIfDisposed();
-
- if (_cur == null)
- throw new InvalidOperationException(
- "Invalid enumerator state, enumeration is either finished or not started");
-
- return _cur.Value;
- }
- }
-
- /** <inheritdoc /> */
- object IEnumerator.Current
- {
- get { return Current; }
- }
-
- /** <inheritdoc /> */
- public void Reset()
- {
- throw new NotSupportedException("Specified method is not supported.");
- }
-
- /** <inheritdoc /> */
- protected override T Unmarshal<T>(IPortableStream stream)
- {
- throw new InvalidOperationException("Should not be called.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumeratorProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumeratorProxy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumeratorProxy.cs
deleted file mode 100644
index cadc58d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheEnumeratorProxy.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
-
- /// <summary>
- /// Cache enumerator proxy. Required to support reset and early native iterator cleanup.
- /// </summary>
- internal class CacheEnumeratorProxy<TK, TV> : IEnumerator<ICacheEntry<TK, TV>>
- {
- /** Target cache. */
- private readonly CacheImpl<TK, TV> _cache;
-
- /** Local flag. */
- private readonly bool _loc;
-
- /** Peek modes. */
- private readonly int _peekModes;
-
- /** Target enumerator. */
- private CacheEnumerator<TK, TV> _target;
-
- /** Dispose flag. */
- private bool _disposed;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cache">Target cache.</param>
- /// <param name="loc">Local flag.</param>
- /// <param name="peekModes">Peek modes.</param>
- public CacheEnumeratorProxy(CacheImpl<TK, TV> cache, bool loc, int peekModes)
- {
- _cache = cache;
- _loc = loc;
- _peekModes = peekModes;
-
- CreateTarget();
- }
-
- /** <inheritdoc /> */
- public bool MoveNext()
- {
- CheckDisposed();
-
- // No target => closed or finished.
- if (_target == null)
- return false;
-
- if (!_target.MoveNext())
- {
- // Failed to advance => end is reached.
- CloseTarget();
-
- return false;
- }
-
- return true;
- }
-
- /** <inheritdoc /> */
- public ICacheEntry<TK, TV> Current
- {
- get
- {
- CheckDisposed();
-
- if (_target == null)
- throw new InvalidOperationException("Invalid enumerator state (did you call MoveNext()?)");
-
- return _target.Current;
- }
- }
-
- /** <inheritdoc /> */
- object IEnumerator.Current
- {
- get { return Current; }
- }
-
- /** <inheritdoc /> */
- public void Reset()
- {
- CheckDisposed();
-
- if (_target != null)
- CloseTarget();
-
- CreateTarget();
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- if (!_disposed)
- {
- if (_target != null)
- CloseTarget();
-
- _disposed = true;
- }
- }
-
- /// <summary>
- /// Get target enumerator.
- /// </summary>
- /// <returns>Target enumerator.</returns>
- private void CreateTarget()
- {
- Debug.Assert(_target == null, "Previous target is not cleaned.");
-
- _target = _cache.CreateEnumerator(_loc, _peekModes);
- }
-
- /// <summary>
- /// Close the target.
- /// </summary>
- private void CloseTarget()
- {
- Debug.Assert(_target != null);
-
- _target.Dispose();
-
- _target = null;
- }
-
- /// <summary>
- /// Check whether object is disposed.
- /// </summary>
- private void CheckDisposed()
- {
- if (_disposed)
- throw new ObjectDisposedException("Cache enumerator has been disposed.");
- }
- }
-}
[39/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
deleted file mode 100644
index 58fa283..0000000
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj
+++ /dev/null
@@ -1,272 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{E2DEA693-F2EA-43C2-A813-053378F6E4DB}</ProjectGuid>
- <RootNamespace>core</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <TargetName>ignite.core</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>ignite.core</TargetName>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <TargetName>ignite.core</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>ignite.core</TargetName>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
- <IntrinsicFunctions>false</IntrinsicFunctions>
- <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
- <OmitFramePointers>false</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <MinimalRebuild>false</MinimalRebuild>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WholeProgramOptimization>false</WholeProgramOptimization>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OptimizeReferences>false</OptimizeReferences>
- <EnableCOMDATFolding>false</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>Disabled</InlineFunctionExpansion>
- <IntrinsicFunctions>false</IntrinsicFunctions>
- <FavorSizeOrSpeed>Neither</FavorSizeOrSpeed>
- <OmitFramePointers>false</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <MinimalRebuild>false</MinimalRebuild>
- <BasicRuntimeChecks>Default</BasicRuntimeChecks>
- <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <WholeProgramOptimization>false</WholeProgramOptimization>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OptimizeReferences>false</OptimizeReferences>
- <EnableCOMDATFolding>false</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;IGNITE_FRIEND;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\cache\cache.h" />
- <ClInclude Include="..\..\include\ignite\cache\cache_entry.h" />
- <ClInclude Include="..\..\include\ignite\cache\cache_peek_mode.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_scan.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_sql.h" />
- <ClInclude Include="..\..\include\ignite\cache\query\query_text.h" />
- <ClInclude Include="..\..\include\ignite\ignite.h" />
- <ClInclude Include="..\..\include\ignite\ignite_configuration.h" />
- <ClInclude Include="..\..\include\ignite\ignite_error.h" />
- <ClInclude Include="..\..\include\ignite\ignition.h" />
- <ClInclude Include="..\..\include\ignite\guid.h" />
- <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h" />
- <ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h" />
- <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h" />
- <ClInclude Include="..\..\include\ignite\impl\ignite_impl.h" />
- <ClInclude Include="..\..\include\ignite\impl\handle_registry.h" />
- <ClInclude Include="..\..\include\ignite\impl\interop\interop.h" />
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h" />
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h" />
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h" />
- <ClInclude Include="..\..\include\ignite\impl\operations.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_common.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_id_resolver.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_handler.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_manager.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_snapshot.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater_impl.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_reader_impl.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_utils.h" />
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_writer_impl.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_consts.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_containers.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_type.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_raw_reader.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_raw_writer.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_reader.h" />
- <ClInclude Include="..\..\include\ignite\portable\portable_writer.h" />
- <ClInclude Include="..\..\os\win\include\ignite\impl\utils.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\os\win\src\impl\utils.cpp" />
- <ClCompile Include="..\..\src\ignite.cpp" />
- <ClCompile Include="..\..\src\ignite_error.cpp" />
- <ClCompile Include="..\..\src\ignition.cpp" />
- <ClCompile Include="..\..\src\guid.cpp" />
- <ClCompile Include="..\..\src\impl\cache\cache_impl.cpp" />
- <ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp" />
- <ClCompile Include="..\..\src\impl\ignite_environment.cpp" />
- <ClCompile Include="..\..\src\impl\ignite_impl.cpp" />
- <ClCompile Include="..\..\src\impl\handle_registry.cpp" />
- <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp" />
- <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp" />
- <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_handler.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_manager.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_snapshot.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater_impl.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_reader_impl.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_utils.cpp" />
- <ClCompile Include="..\..\src\impl\portable\portable_writer_impl.cpp" />
- <ClCompile Include="..\..\src\portable\portable_containers.cpp" />
- <ClCompile Include="..\..\src\portable\portable_type.cpp" />
- <ClCompile Include="..\..\src\portable\portable_raw_reader.cpp" />
- <ClCompile Include="..\..\src\portable\portable_raw_writer.cpp" />
- <ClCompile Include="..\..\src\portable\portable_reader.cpp" />
- <ClCompile Include="..\..\src\portable\portable_writer.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
- <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters b/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
deleted file mode 100644
index d18599d..0000000
--- a/modules/platform/src/main/cpp/core/project/vs/core.vcxproj.filters
+++ /dev/null
@@ -1,246 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClCompile Include="..\..\src\impl\cache\cache_impl.cpp">
- <Filter>Code\impl\cache</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\interop\interop_input_stream.cpp">
- <Filter>Code\impl\interop</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\interop\interop_memory.cpp">
- <Filter>Code\impl\interop</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\interop\interop_output_stream.cpp">
- <Filter>Code\impl\interop</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\ignite_environment.cpp">
- <Filter>Code\impl</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\ignite_impl.cpp">
- <Filter>Code\impl</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_containers.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_raw_reader.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_raw_writer.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_reader.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_writer.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_reader_impl.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_utils.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_writer_impl.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\os\win\src\impl\utils.cpp">
- <Filter>Code\impl</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\ignite.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\ignite_error.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\ignition.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\guid.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\handle_registry.cpp">
- <Filter>Code\impl</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\cache\query\query_impl.cpp">
- <Filter>Code\impl\cache\query</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_snapshot.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_handler.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable\portable_type.cpp">
- <Filter>Code\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_manager.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\impl\portable\portable_metadata_updater_impl.cpp">
- <Filter>Code\impl\portable</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\impl\cache\cache_impl.h">
- <Filter>Code\impl\cache</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\cache.h">
- <Filter>Code\cache</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\cache_peek_mode.h">
- <Filter>Code\cache</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\interop\interop.h">
- <Filter>Code\impl\interop</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_input_stream.h">
- <Filter>Code\impl\interop</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_memory.h">
- <Filter>Code\impl\interop</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\interop\interop_output_stream.h">
- <Filter>Code\impl\interop</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\ignite_environment.h">
- <Filter>Code\impl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\ignite_impl.h">
- <Filter>Code\impl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\operations.h">
- <Filter>Code\impl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_common.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_consts.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_containers.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_id_resolver.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_raw_reader.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_raw_writer.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_reader.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_writer.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_reader_impl.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_utils.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_writer_impl.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\os\win\include\ignite\impl\utils.h">
- <Filter>Code\impl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\ignite.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\ignite_configuration.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\ignite_error.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\ignition.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\guid.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\handle_registry.h">
- <Filter>Code\impl</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\cache_entry.h">
- <Filter>Code\cache</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\cache\query\query_impl.h">
- <Filter>Code\impl\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_snapshot.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_handler.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_manager.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable\portable_type.h">
- <Filter>Code\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\impl\portable\portable_metadata_updater_impl.h">
- <Filter>Code\impl\portable</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_argument.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_cursor.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_sql.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_text.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\cache\query\query_scan.h">
- <Filter>Code\cache\query</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <Filter Include="Code">
- <UniqueIdentifier>{91873c79-a64f-4786-ab25-d03ef2db9dc8}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\impl">
- <UniqueIdentifier>{9bede404-e1b1-44d6-b54d-e9b2441c5f13}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\impl\cache">
- <UniqueIdentifier>{b013b0f6-c4b8-4b88-89bc-8b394971788e}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\impl\portable">
- <UniqueIdentifier>{883773bd-085d-4eb5-81ee-f11188134faf}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\impl\interop">
- <UniqueIdentifier>{d4cc8aeb-6e7b-47e6-9b83-cba925844d96}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\cache">
- <UniqueIdentifier>{8b7e32c0-e222-4f3a-af31-19df380c369f}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\portable">
- <UniqueIdentifier>{24b7134c-9335-44e1-9604-4093d0e3bbf5}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\cache\query">
- <UniqueIdentifier>{4658a0ff-0d2d-45a6-b8de-93eeec0cc081}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code\impl\cache\query">
- <UniqueIdentifier>{b6e57294-120a-46f2-b0ad-c3595e2cf789}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/guid.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/guid.cpp b/modules/platform/src/main/cpp/core/src/guid.cpp
deleted file mode 100644
index 77997e4..0000000
--- a/modules/platform/src/main/cpp/core/src/guid.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/guid.h"
-
-namespace ignite
-{
- Guid::Guid() : most(0), least(0)
- {
- // No-op.
- }
-
- Guid::Guid(int64_t most, int64_t least) : most(most), least(least)
- {
- // No-op.
- }
-
- int64_t Guid::GetMostSignificantBits() const
- {
- return most;
- }
-
- int64_t Guid::GetLeastSignificantBits() const
- {
- return least;
- }
-
- int32_t Guid::GetVersion() const
- {
- return static_cast<int32_t>((most >> 12) & 0x0f);
- }
-
- int32_t Guid::GetVariant() const
- {
- uint64_t least0 = static_cast<uint64_t>(least);
-
- return static_cast<int32_t>((least0 >> (64 - (least0 >> 62))) & (least >> 63));
- }
-
- int32_t Guid::GetHashCode() const
- {
- int64_t hilo = most ^ least;
-
- return static_cast<int32_t>(hilo >> 32) ^ static_cast<int32_t>(hilo);
- }
-
- bool operator==(Guid& val1, Guid& val2)
- {
- return val1.least == val2.least && val1.most == val2.most;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/ignite.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/ignite.cpp b/modules/platform/src/main/cpp/core/src/ignite.cpp
deleted file mode 100644
index 665383b..0000000
--- a/modules/platform/src/main/cpp/core/src/ignite.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-#include <ignite/common/java.h>
-
-#include "ignite/impl/ignite_impl.h"
-#include "ignite/ignite.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::impl;
-
-namespace ignite
-{
- Ignite::Ignite() : impl(SharedPointer<IgniteImpl>())
- {
- // No-op.
- }
-
- Ignite::Ignite(IgniteImpl* impl) : impl(SharedPointer<IgniteImpl>(impl))
- {
- // No-op.
- }
-
- char* Ignite::GetName()
- {
- return impl.Get()->GetName();
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/ignite_error.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/ignite_error.cpp b/modules/platform/src/main/cpp/core/src/ignite_error.cpp
deleted file mode 100644
index 65cd291..0000000
--- a/modules/platform/src/main/cpp/core/src/ignite_error.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- * 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.
- */
-#include <ignite/common/java.h>
-
-#include "ignite/impl/utils.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::common::java;
-using namespace ignite::impl::utils;
-
-namespace ignite
-{
- void IgniteError::ThrowIfNeeded(IgniteError& err)
- {
- if (err.code != IGNITE_SUCCESS)
- throw err;
- }
-
- IgniteError::IgniteError() : code(IGNITE_SUCCESS), msg(NULL)
- {
- // No-op.
- }
-
- IgniteError::IgniteError(int32_t code) : code(code), msg(NULL)
- {
- // No-op.
- }
-
- IgniteError::IgniteError(int32_t code, const char* msg)
- {
- this->code = code;
- this->msg = CopyChars(msg);
- }
-
- IgniteError::IgniteError(const IgniteError& other)
- {
- this->code = other.code;
- this->msg = CopyChars(other.msg);
- }
-
- IgniteError& IgniteError::operator=(const IgniteError& other)
- {
- if (this != &other)
- {
- IgniteError tmp(other);
-
- int tmpCode = code;
- char* tmpMsg = msg;
-
- code = tmp.code;
- msg = tmp.msg;
-
- tmp.code = tmpCode;
- tmp.msg = tmpMsg;
- }
-
- return *this;
- }
-
- IgniteError::~IgniteError()
- {
- ReleaseChars(msg);
- }
-
- int32_t IgniteError::GetCode()
- {
- return code;
- }
-
- const char* IgniteError::GetText()
- {
- if (code == IGNITE_SUCCESS)
- return "Operation completed successfully.";
- else if (msg)
- return msg;
- else
- return "No additional information available.";
- }
-
- void IgniteError::SetError(const int jniCode, const char* jniCls, const char* jniMsg, IgniteError* err)
- {
- if (jniCode == IGNITE_JNI_ERR_SUCCESS)
- *err = IgniteError();
- else if (jniCode == IGNITE_JNI_ERR_GENERIC)
- {
- // The most common case when we have Java exception "in hands" and must map it to respective code.
- if (jniCls)
- {
- std::string jniCls0 = jniCls;
-
- if (jniCls0.compare("java.lang.NoClassDefFoundError") == 0)
- {
- std::stringstream stream;
-
- stream << "Java class is not found (did you set IGNITE_HOME environment variable?)";
-
- if (jniMsg)
- stream << ": " << jniMsg;
-
- *err = IgniteError(IGNITE_ERR_JVM_NO_CLASS_DEF_FOUND, stream.str().c_str());
- }
- else if (jniCls0.compare("java.lang.NoSuchMethodError") == 0)
- {
- std::stringstream stream;
-
- stream << "Java method is not found (did you set IGNITE_HOME environment variable?)";
-
- if (jniMsg)
- stream << ": " << jniMsg;
-
- *err = IgniteError(IGNITE_ERR_JVM_NO_SUCH_METHOD, stream.str().c_str());
- }
- else if (jniCls0.compare("java.lang.IllegalArgumentException") == 0)
- *err = IgniteError(IGNITE_ERR_ILLEGAL_ARGUMENT, jniMsg);
- else if (jniCls0.compare("java.lang.IllegalStateException") == 0)
- *err = IgniteError(IGNITE_ERR_ILLEGAL_STATE, jniMsg);
- else if (jniCls0.compare("java.lang.UnsupportedOperationException") == 0)
- *err = IgniteError(IGNITE_ERR_UNSUPPORTED_OPERATION, jniMsg);
- else if (jniCls0.compare("java.lang.InterruptedException") == 0)
- *err = IgniteError(IGNITE_ERR_INTERRUPTED, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.cluster.ClusterGroupEmptyException") == 0)
- *err = IgniteError(IGNITE_ERR_CLUSTER_GROUP_EMPTY, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.cluster.ClusterTopologyException") == 0)
- *err = IgniteError(IGNITE_ERR_CLUSTER_TOPOLOGY, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.compute.ComputeExecutionRejectedException") == 0)
- *err = IgniteError(IGNITE_ERR_COMPUTE_EXECUTION_REJECTED, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.compute.ComputeJobFailoverException") == 0)
- *err = IgniteError(IGNITE_ERR_COMPUTE_JOB_FAILOVER, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.compute.ComputeTaskCancelledException") == 0)
- *err = IgniteError(IGNITE_ERR_COMPUTE_TASK_CANCELLED, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.compute.ComputeTaskTimeoutException") == 0)
- *err = IgniteError(IGNITE_ERR_COMPUTE_TASK_TIMEOUT, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.compute.ComputeUserUndeclaredException") == 0)
- *err = IgniteError(IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION, jniMsg);
- else if (jniCls0.compare("javax.cache.CacheException") == 0)
- *err = IgniteError(IGNITE_ERR_CACHE, jniMsg);
- else if (jniCls0.compare("javax.cache.integration.CacheLoaderException") == 0)
- *err = IgniteError(IGNITE_ERR_CACHE_LOADER, jniMsg);
- else if (jniCls0.compare("javax.cache.integration.CacheWriterException") == 0)
- *err = IgniteError(IGNITE_ERR_CACHE_WRITER, jniMsg);
- else if (jniCls0.compare("javax.cache.processor.EntryProcessorException") == 0)
- *err = IgniteError(IGNITE_ERR_ENTRY_PROCESSOR, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.cache.CacheAtomicUpdateTimeoutException") == 0)
- *err = IgniteError(IGNITE_ERR_CACHE_ATOMIC_UPDATE_TIMEOUT, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.cache.CachePartialUpdateException") == 0)
- *err = IgniteError(IGNITE_ERR_CACHE_PARTIAL_UPDATE, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.transactions.TransactionOptimisticException") == 0)
- *err = IgniteError(IGNITE_ERR_TX_OPTIMISTIC, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.transactions.TransactionTimeoutException") == 0)
- *err = IgniteError(IGNITE_ERR_TX_TIMEOUT, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.transactions.TransactionRollbackException") == 0)
- *err = IgniteError(IGNITE_ERR_TX_ROLLBACK, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.transactions.TransactionHeuristicException") == 0)
- *err = IgniteError(IGNITE_ERR_TX_HEURISTIC, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.IgniteAuthenticationException") == 0)
- *err = IgniteError(IGNITE_ERR_AUTHENTICATION, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.plugin.security.GridSecurityException") == 0)
- *err = IgniteError(IGNITE_ERR_SECURITY, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.IgniteException") == 0)
- *err = IgniteError(IGNITE_ERR_GENERIC, jniMsg);
- else if (jniCls0.compare("org.apache.ignite.IgniteCheckedException") == 0)
- *err = IgniteError(IGNITE_ERR_GENERIC, jniMsg);
- else
- {
- std::stringstream stream;
-
- stream << "Java exception occurred [cls=" << jniCls0;
-
- if (jniMsg)
- stream << ", msg=" << jniMsg;
-
- stream << "]";
-
- *err = IgniteError(IGNITE_ERR_UNKNOWN, stream.str().c_str());
- }
- }
- else
- {
- // JNI class name is not available. Something really weird.
- *err = IgniteError(IGNITE_ERR_UNKNOWN);
- }
- }
- else if (jniCode == IGNITE_JNI_ERR_JVM_INIT)
- {
- std::stringstream stream;
-
- stream << "Failed to initialize JVM [errCls=";
-
- if (jniCls)
- stream << jniCls;
- else
- stream << "N/A";
-
- stream << ", errMsg=";
-
- if (jniMsg)
- stream << jniMsg;
- else
- stream << "N/A";
-
- stream << "]";
-
- *err = IgniteError(IGNITE_ERR_JVM_INIT, stream.str().c_str());
- }
- else if (jniCode == IGNITE_JNI_ERR_JVM_ATTACH)
- *err = IgniteError(IGNITE_ERR_JVM_ATTACH, "Failed to attach to JVM.");
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/ignition.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/ignition.cpp b/modules/platform/src/main/cpp/core/src/ignition.cpp
deleted file mode 100644
index a0e3367..0000000
--- a/modules/platform/src/main/cpp/core/src/ignition.cpp
+++ /dev/null
@@ -1,468 +0,0 @@
-/*
- * 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.
- */
-
-#include <sstream>
-
-#include <ignite/common/common.h>
-#include <ignite/common/concurrent.h>
-#include <ignite/common/exports.h>
-#include <ignite/common/java.h>
-
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/impl/ignite_impl.h"
-#include "ignite/impl/utils.h"
-#include "ignite/ignition.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::impl;
-using namespace ignite::impl::utils;
-
-namespace ignite
-{
- /** Default configuration. */
- const char* DFLT_CFG = "config/default-config.xml";
-
- /** Whether JVM library is loaded to the process. */
- bool JVM_LIB_LOADED;
-
- /** Critical section for factory methods. */
- CriticalSection factoryLock;
-
- /** Flag indicating that at least one Ignite instance has started. */
- bool started = false;
-
- /**
- * Convert integer value to string.
- */
- std::string JvmMemoryString(const std::string& prefix, int32_t val)
- {
- std::ostringstream ss;
- ss << val;
-
- std::string valStr = ss.str();
-
- std::string res = std::string(prefix);
- res.append(valStr);
- res.append("m");
-
- return res;
- }
-
- /**
- * Create JVM options.
- *
- * @param cfg Configuration.
- * @param home Optional GG home.
- * @param cp Classpath.
- * @param opts Options.
- * @param optsLen Options length.
- * @return Options.
- */
- char** CreateJvmOptions(const IgniteConfiguration& cfg, const std::string* home, const std::string& cp, int* optsLen)
- {
- *optsLen = 3 + (home ? 1 : 0) + cfg.jvmOptsLen;
- char** opts = new char*[*optsLen];
-
- int idx = 0;
-
- // 1. Set classpath.
- std::string cpFull = std::string("-Djava.class.path=") + cp;
-
- *(opts + idx++) = CopyChars(cpFull.c_str());
-
- // 2. Set home.
- if (home) {
- std::string homeFull = std::string("-DIGNITE_HOME=") + *home;
-
- *(opts + idx++) = CopyChars(homeFull.c_str());
- }
-
- // 3. Set Xms, Xmx.
- std::string xmsStr = JvmMemoryString(std::string("-Xms"), cfg.jvmInitMem);
- std::string xmxStr = JvmMemoryString(std::string("-Xmx"), cfg.jvmMaxMem);
-
- *(opts + idx++) = CopyChars(xmsStr.c_str());
- *(opts + idx++) = CopyChars(xmxStr.c_str());
-
- // 4. Set the rest options.
- for (int i = 0; i < cfg.jvmOptsLen; i++) {
- char* optCopy = CopyChars(cfg.jvmOpts[i].opt);
-
- opts[idx++] = optCopy;
- }
-
- return opts;
- }
-
- Ignite Ignition::Start(const IgniteConfiguration& cfg)
- {
- return Start(cfg, static_cast<const char*>(NULL));
- }
-
- Ignite Ignition::Start(const IgniteConfiguration& cfg, IgniteError* err)
- {
- return Start(cfg, NULL, err);
- }
-
- Ignite Ignition::Start(const IgniteConfiguration& cfg, const char* name)
- {
- IgniteError err;
-
- Ignite res = Start(cfg, name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- Ignite Ignition::Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err)
- {
- bool failed = false;
-
- SharedPointer<IgniteEnvironment> env;
- SharedPointer<IgniteEnvironment>* envTarget = NULL;
-
- jobject javaRef = NULL;
-
- factoryLock.Enter();
-
- // 1. Load JVM library if needed.
- if (!JVM_LIB_LOADED)
- {
- bool jvmLibFound;
- std::string jvmLib;
-
- if (cfg.jvmLibPath)
- {
- std::string jvmLibPath = std::string(cfg.jvmLibPath);
-
- jvmLib = FindJvmLibrary(&jvmLibPath, &jvmLibFound);
- }
- else
- jvmLib = FindJvmLibrary(NULL, &jvmLibFound);
-
- if (!jvmLibFound)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_NOT_FOUND,
- "JVM library is not found (did you set JAVA_HOME environment variable?)");
-
- failed = true;
- }
-
- if (!failed) {
- if (!LoadJvmLibrary(jvmLib))
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_LIB_LOAD_FAILED, "Failed to load JVM library.");
-
- failed = true;
- }
- }
-
- JVM_LIB_LOADED = true;
- }
-
- if (!failed)
- {
- // 2. Resolve IGNITE_HOME.
- bool homeFound;
- std::string home;
-
- if (cfg.igniteHome)
- {
- std::string homePath = std::string(cfg.igniteHome);
-
- home = ResolveIgniteHome(&homePath, &homeFound);
- }
- else
- home = ResolveIgniteHome(NULL, &homeFound);
-
- // 3. Create classpath.
- std::string cp;
-
- if (cfg.jvmClassPath)
- {
- std::string usrCp = cfg.jvmClassPath;
-
- cp = CreateIgniteClasspath(&usrCp, homeFound ? &home : NULL);
- }
- else
- cp = CreateIgniteClasspath(NULL, homeFound ? &home : NULL);
-
- if (!cp.empty())
- {
- // 4. Start JVM if needed.
- JniErrorInfo jniErr;
-
- env = SharedPointer<IgniteEnvironment>(new IgniteEnvironment());
-
- int optsLen;
- char** opts = CreateJvmOptions(cfg, homeFound ? &home : NULL, cp, &optsLen);
-
- envTarget = new SharedPointer<IgniteEnvironment>(env);
-
- SharedPointer<JniContext> ctx(
- JniContext::Create(opts, optsLen, env.Get()->GetJniHandlers(envTarget), &jniErr));
-
- for (int i = 0; i < optsLen; i++)
- ReleaseChars(*(opts + i));
-
- delete[] opts;
-
- if (!ctx.Get())
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- failed = true;
- }
-
- // 5. Start Ignite.
- if (!failed)
- {
- char* springCfgPath0 = CopyChars(cfg.springCfgPath);
-
- if (!springCfgPath0)
- springCfgPath0 = CopyChars(DFLT_CFG);
-
- char* name0 = CopyChars(name);
-
- interop::InteropUnpooledMemory mem(16);
- interop::InteropOutputStream stream(&mem);
- stream.WriteBool(false);
- stream.Synchronize();
-
- javaRef = ctx.Get()->IgnitionStart(springCfgPath0, name0, 2, mem.PointerLong(), &jniErr);
-
- ReleaseChars(springCfgPath0);
- ReleaseChars(name0);
-
- if (!javaRef) {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- failed = true;
- }
- else {
- // 6. Ignite is started at this point.
- env.Get()->Initialize(ctx);
-
- started = true;
- }
- }
- }
- else {
- *err = IgniteError(IgniteError::IGNITE_ERR_JVM_NO_CLASSPATH,
- "Java classpath is empty (did you set IGNITE_HOME environment variable?)");
-
- failed = true;
- }
- }
-
- factoryLock.Leave();
-
- if (failed)
- {
- if (envTarget)
- delete envTarget;
-
- return Ignite();
- }
- else
- {
- IgniteImpl* impl = new IgniteImpl(env, javaRef);
-
- return Ignite(impl);
- }
- }
-
- Ignite Ignition::Get()
- {
- return Get(static_cast<const char*>(NULL));
- }
-
- Ignite Ignition::Get(IgniteError* err)
- {
- return Get(NULL, err);
- }
-
- Ignite Ignition::Get(const char* name)
- {
- IgniteError err;
-
- Ignite res = Get(name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- Ignite Ignition::Get(const char* name, IgniteError* err)
- {
- Ignite res;
-
- factoryLock.Enter();
-
- if (started)
- {
- char* name0 = CopyChars(name);
-
- // 1. Create context for this operation.
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- // 2. Get environment pointer.
- long long ptr = ctx.Get()->IgnitionEnvironmentPointer(name0, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- if (ptr != 0)
- {
- // 3. Obtain real environment for this instance.
- JniHandlers* hnds = reinterpret_cast<JniHandlers*>(ptr);
-
- SharedPointer<IgniteEnvironment>* env =
- static_cast<SharedPointer<IgniteEnvironment>*>(hnds->target);
-
- // 4. Get fresh node reference.
- jobject ref = ctx.Get()->IgnitionInstance(name0, &jniErr);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS) {
- if (ref)
- {
- IgniteImpl* impl = new IgniteImpl(*env, ref);
-
- res = Ignite(impl);
- }
- else
- // Error: concurrent node stop.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get Ignite instance because it was stopped concurrently.");
-
- }
- }
- else
- // Error: no node with the given name.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get Ignite instance because it is either not started yet or already stopped.");
- }
- }
-
- ReleaseChars(name0);
- }
- else
- // Error: no node with the given name.
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Failed to get Ignite instance because it is either not started yet or already stopped.");
-
- factoryLock.Leave();
-
- return res;
- }
-
- bool Ignition::Stop(const bool cancel)
- {
- return Stop(NULL, cancel);
- }
-
- bool Ignition::Stop(const bool cancel, IgniteError* err)
- {
- return Stop(NULL, cancel, err);
- }
-
- bool Ignition::Stop(const char* name, const bool cancel)
- {
- IgniteError err;
-
- bool res = Stop(name, cancel, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- bool Ignition::Stop(const char* name, const bool cancel, IgniteError* err)
- {
- bool res = false;
-
- factoryLock.Enter();
-
- if (started)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- char* name0 = CopyChars(name);
-
- bool res0 = ctx.Get()->IgnitionStop(name0, cancel, &jniErr);
-
- ReleaseChars(name0);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- res = res0;
- }
- }
-
- factoryLock.Leave();
-
- return res;
- }
-
- void Ignition::StopAll(const bool cancel)
- {
- IgniteError err;
-
- StopAll(cancel, &err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- void Ignition::StopAll(const bool cancel, IgniteError* err)
- {
- factoryLock.Enter();
-
- if (started)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<JniContext> ctx(JniContext::Create(NULL, 0, JniHandlers(), &jniErr));
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- ctx.Get()->IgnitionStopAll(cancel, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- }
- }
-
- factoryLock.Leave();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/cache/cache_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/cache/cache_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/cache/cache_impl.cpp
deleted file mode 100644
index 2f211e7..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/cache/cache_impl.cpp
+++ /dev/null
@@ -1,388 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/cache/cache_peek_mode.h"
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/interop/interop.h"
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/utils.h"
-#include "ignite/impl/portable/portable_metadata_updater_impl.h"
-#include "ignite/portable/portable.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::cache;
-using namespace ignite::cache::query;
-using namespace ignite::impl;
-using namespace ignite::impl::cache::query;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::impl::utils;
-using namespace ignite::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace cache
- {
- /** Operation: Clear. */
- const int32_t OP_CLEAR = 1;
-
- /** Operation: ClearAll. */
- const int32_t OP_CLEAR_ALL = 2;
-
- /** Operation: ContainsKey. */
- const int32_t OP_CONTAINS_KEY = 3;
-
- /** Operation: ContainsKeys. */
- const int32_t OP_CONTAINS_KEYS = 4;
-
- /** Operation: Get. */
- const int32_t OP_GET = 5;
-
- /** Operation: GetAll. */
- const int32_t OP_GET_ALL = 6;
-
- /** Operation: GetAndPut. */
- const int32_t OP_GET_AND_PUT = 7;
-
- /** Operation: GetAndPutIfAbsent. */
- const int32_t OP_GET_AND_PUT_IF_ABSENT = 8;
-
- /** Operation: GetAndRemove. */
- const int32_t OP_GET_AND_REMOVE = 9;
-
- /** Operation: GetAndReplace. */
- const int32_t OP_GET_AND_REPLACE = 10;
-
- /** Operation: LocalEvict. */
- const int32_t OP_LOCAL_EVICT = 16;
-
- /** Operation: LocalClear. */
- const int32_t OP_LOCAL_CLEAR = 20;
-
- /** Operation: LocalClearAll. */
- const int32_t OP_LOCAL_CLEAR_ALL = 21;
-
- /** Operation: LocalPeek. */
- const int32_t OP_LOCAL_PEEK = 25;
-
- /** Operation: Put. */
- const int32_t OP_PUT = 26;
-
- /** Operation: PutAll. */
- const int32_t OP_PUT_ALL = 27;
-
- /** Operation: PutIfAbsent. */
- const int32_t OP_PUT_IF_ABSENT = 28;
-
- /** Operation: SCAN query. */
- const int32_t OP_QRY_SCAN = 30;
-
- /** Operation: SQL query. */
- const int32_t OP_QRY_SQL = 31;
-
- /** Operation: SQL fields query. */
- const int32_t OP_QRY_SQL_FIELDS = 32;
-
- /** Operation: TEXT query. */
- const int32_t OP_QRY_TEXT = 33;
-
- /** Operation: RemoveAll. */
- const int32_t OP_REMOVE_ALL = 34;
-
- /** Operation: Remove(K, V). */
- const int32_t OP_REMOVE_2 = 35;
-
- /** Operation: Remove(K). */
- const int32_t OP_REMOVE_1 = 36;
-
- /** Operation: Replace(K, V). */
- const int32_t OP_REPLACE_2 = 37;
-
- /** Operation: Replace(K, V, V). */
- const int32_t OP_REPLACE_3 = 38;
-
- CacheImpl::CacheImpl(char* name, SharedPointer<IgniteEnvironment> env, jobject javaRef) :
- name(name), env(env), javaRef(javaRef)
- {
- // No-op.
- }
-
- CacheImpl::~CacheImpl()
- {
- ReleaseChars(name);
-
- JniContext::Release(javaRef);
- }
-
- char* CacheImpl::GetName()
- {
- return name;
- }
-
- bool CacheImpl::IsEmpty(IgniteError* err)
- {
- return Size(IGNITE_PEEK_MODE_ALL, err) == 0;
- }
-
- bool CacheImpl::ContainsKey(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_CONTAINS_KEY, inOp, err);
- }
-
- bool CacheImpl::ContainsKeys(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_CONTAINS_KEYS, inOp, err);
- }
-
- void CacheImpl::LocalPeek(InputOperation& inOp, OutputOperation& outOp, int32_t peekModes, IgniteError* err)
- {
- OutInOpInternal(OP_LOCAL_PEEK, inOp, outOp, err);
- }
-
- void CacheImpl::Get(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET, inOp, outOp, err);
- }
-
- void CacheImpl::GetAll(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET_ALL, inOp, outOp, err);
- }
-
- void CacheImpl::Put(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_PUT, inOp, err);
- }
-
- void CacheImpl::PutAll(ignite::impl::InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_PUT_ALL, inOp, err);
- }
-
- void CacheImpl::GetAndPut(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET_AND_PUT, inOp, outOp, err);
- }
-
- void CacheImpl::GetAndReplace(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET_AND_REPLACE, inOp, outOp, err);
- }
-
- void CacheImpl::GetAndRemove(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET_AND_REMOVE, inOp, outOp, err);
- }
-
- bool CacheImpl::PutIfAbsent(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_PUT_IF_ABSENT, inOp, err);
- }
-
- void CacheImpl::GetAndPutIfAbsent(InputOperation& inOp, OutputOperation& outOp, IgniteError* err)
- {
- OutInOpInternal(OP_GET_AND_PUT_IF_ABSENT, inOp, outOp, err);
- }
-
- bool CacheImpl::Replace(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_REPLACE_2, inOp, err);
- }
-
- bool CacheImpl::ReplaceIfEqual(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_REPLACE_3, inOp, err);
- }
-
- void CacheImpl::LocalEvict(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_LOCAL_EVICT, inOp, err);
- }
-
- void CacheImpl::Clear(IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- env.Get()->Context()->CacheClear(javaRef, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- }
-
- void CacheImpl::Clear(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_CLEAR, inOp, err);
- }
-
- void CacheImpl::ClearAll(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_CLEAR_ALL, inOp, err);
- }
-
- void CacheImpl::LocalClear(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_LOCAL_CLEAR, inOp, err);
- }
-
- void CacheImpl::LocalClearAll(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_LOCAL_CLEAR_ALL, inOp, err);
- }
-
- bool CacheImpl::Remove(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_REMOVE_1, inOp, err);
- }
-
- bool CacheImpl::RemoveIfEqual(InputOperation& inOp, IgniteError* err)
- {
- return OutOpInternal(OP_REMOVE_2, inOp, err);
- }
-
- void CacheImpl::RemoveAll(InputOperation& inOp, IgniteError* err)
- {
- OutOpInternal(OP_REMOVE_ALL, inOp, err);
- }
-
- void CacheImpl::RemoveAll(IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- env.Get()->Context()->CacheRemoveAll(javaRef, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
- }
-
- int32_t CacheImpl::Size(const int32_t peekModes, IgniteError* err)
- {
- return SizeInternal(peekModes, false, err);
- }
-
- int32_t CacheImpl::LocalSize(const int32_t peekModes, IgniteError* err)
- {
- return SizeInternal(peekModes, true, err);
- }
-
- QueryCursorImpl* CacheImpl::QuerySql(const SqlQuery& qry, IgniteError* err)
- {
- return QueryInternal(qry, OP_QRY_SQL, err);
- }
-
- QueryCursorImpl* CacheImpl::QueryText(const TextQuery& qry, IgniteError* err)
- {
- return QueryInternal(qry, OP_QRY_TEXT, err);
- }
-
- QueryCursorImpl* CacheImpl::QueryScan(const ScanQuery& qry, IgniteError* err)
- {
- return QueryInternal(qry, OP_QRY_SCAN, err);
- }
-
- int64_t CacheImpl::WriteTo(InteropMemory* mem, InputOperation& inOp, IgniteError* err)
- {
- PortableMetadataManager* metaMgr = env.Get()->GetMetadataManager();
-
- int32_t metaVer = metaMgr->GetVersion();
-
- InteropOutputStream out(mem);
- PortableWriterImpl writer(&out, metaMgr);
-
- inOp.ProcessInput(writer);
-
- out.Synchronize();
-
- if (metaMgr->IsUpdatedSince(metaVer))
- {
- PortableMetadataUpdaterImpl metaUpdater(env, javaRef);
-
- if (!metaMgr->ProcessPendingUpdates(&metaUpdater, err))
- return 0;
- }
-
- return mem->PointerLong();
- }
-
- void CacheImpl::ReadFrom(InteropMemory* mem, OutputOperation& outOp)
- {
- InteropInputStream in(mem);
-
- PortableReaderImpl reader(&in);
-
- outOp.ProcessOutput(reader);
- }
-
- int CacheImpl::SizeInternal(const int32_t peekModes, const bool loc, IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- int res = env.Get()->Context()->CacheSize(javaRef, peekModes, loc, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- return res;
- else
- return -1;
- }
-
- bool CacheImpl::OutOpInternal(const int32_t opType, InputOperation& inOp, IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<InteropMemory> mem = env.Get()->AllocateMemory();
-
- int64_t outPtr = WriteTo(mem.Get(), inOp, err);
-
- if (outPtr)
- {
- long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, opType, outPtr, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- return res == 1;
- }
-
- return false;
- }
-
- void CacheImpl::OutInOpInternal(const int32_t opType, InputOperation& inOp, OutputOperation& outOp,
- IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<InteropMemory> outMem = env.Get()->AllocateMemory();
- SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
-
- int64_t outPtr = WriteTo(outMem.Get(), inOp, err);
-
- if (outPtr)
- {
- env.Get()->Context()->TargetInStreamOutStream(javaRef, opType, WriteTo(outMem.Get(), inOp, err),
- inMem.Get()->PointerLong(), &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- ReadFrom(inMem.Get(), outOp);
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/cache/query/query_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/cache/query/query_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/cache/query/query_impl.cpp
deleted file mode 100644
index 7d89321..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/cache/query/query_impl.cpp
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/cache/query/query_impl.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace cache
- {
- namespace query
- {
- /** Operation: get all entries. */
- const int32_t OP_GET_ALL = 1;
-
- /** Operation: get single entry. */
- const int32_t OP_GET_SINGLE = 3;
-
- QueryCursorImpl::QueryCursorImpl(SharedPointer<IgniteEnvironment> env, jobject javaRef) :
- env(env), javaRef(javaRef), iterCalled(false), getAllCalled(false), hasNext(false)
- {
- // No-op.
- }
-
- QueryCursorImpl::~QueryCursorImpl()
- {
- // 1. Close the cursor.
- env.Get()->Context()->QueryCursorClose(javaRef);
-
- // 2. Release Java reference.
- JniContext::Release(javaRef);
- }
-
- bool QueryCursorImpl::HasNext(IgniteError* err)
- {
- // Check whether GetAll() was called earlier.
- if (getAllCalled)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Cannot use HasNext() method because GetAll() was called.");
-
- return false;
- }
-
- // Create iterator in Java if needed.
- if (!CreateIteratorIfNeeded(err))
- return false;
-
- return hasNext;
- }
-
- void QueryCursorImpl::GetNext(OutputOperation& op, IgniteError* err)
- {
- // Check whether GetAll() was called earlier.
- if (getAllCalled)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Cannot use GetNext() method because GetAll() was called.");
-
- return;
- }
-
- // Create iterator in Java if needed.
- if (!CreateIteratorIfNeeded(err))
- return;
-
- if (hasNext)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
-
- env.Get()->Context()->TargetOutStream(javaRef, OP_GET_SINGLE, inMem.Get()->PointerLong(), &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- {
- InteropInputStream in(inMem.Get());
-
- portable::PortableReaderImpl reader(&in);
-
- op.ProcessOutput(reader);
-
- hasNext = IteratorHasNext(err);
- }
- }
- else
- {
- // Ensure we do not overwrite possible previous error.
- if (err->GetCode() == IgniteError::IGNITE_SUCCESS)
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC, "No more elements available.");
- }
- }
-
- void QueryCursorImpl::GetAll(OutputOperation& op, IgniteError* err)
- {
- // Check whether any of iterator methods were called.
- if (iterCalled)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Cannot use GetAll() method because an iteration method was called.");
-
- return;
- }
-
- // Check whether GetAll was called before.
- if (getAllCalled)
- {
- *err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Cannot use GetNext() method because GetAll() was called.");
-
- return;
- }
-
- // Get data.
- JniErrorInfo jniErr;
-
- SharedPointer<InteropMemory> inMem = env.Get()->AllocateMemory();
-
- env.Get()->Context()->TargetOutStream(javaRef, OP_GET_ALL, inMem.Get()->PointerLong(), &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- {
- getAllCalled = true;
-
- InteropInputStream in(inMem.Get());
-
- portable::PortableReaderImpl reader(&in);
-
- op.ProcessOutput(reader);
- }
- }
-
- bool QueryCursorImpl::CreateIteratorIfNeeded(IgniteError* err)
- {
- if (!iterCalled)
- {
- JniErrorInfo jniErr;
-
- env.Get()->Context()->QueryCursorIterator(javaRef, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- {
- iterCalled = true;
-
- hasNext = IteratorHasNext(err);
- }
- else
- return false;
- }
-
- return true;
- }
-
- bool QueryCursorImpl::IteratorHasNext(IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- bool res = env.Get()->Context()->QueryCursorIteratorHasNext(javaRef, &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return jniErr.code == IGNITE_JNI_ERR_SUCCESS && res;
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/handle_registry.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/handle_registry.cpp b/modules/platform/src/main/cpp/core/src/impl/handle_registry.cpp
deleted file mode 100644
index c447faa..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/handle_registry.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/handle_registry.h"
-
-using namespace ignite::common::concurrent;
-
-namespace ignite
-{
- namespace impl
- {
- HandleRegistryEntry::~HandleRegistryEntry()
- {
- // No-op.
- }
-
- HandleRegistrySegment::HandleRegistrySegment() :
- map(new std::map<int64_t, SharedPointer<HandleRegistryEntry>>()), mux(new CriticalSection())
- {
- // No-op.
- }
-
- HandleRegistrySegment::~HandleRegistrySegment()
- {
- delete map;
- delete mux;
- }
-
- SharedPointer<HandleRegistryEntry> HandleRegistrySegment::Get(int64_t hnd)
- {
- mux->Enter();
-
- SharedPointer<HandleRegistryEntry> res = (*map)[hnd];
-
- mux->Leave();
-
- return res;
- }
-
- void HandleRegistrySegment::Put(int64_t hnd, const SharedPointer<HandleRegistryEntry>& entry)
- {
- mux->Enter();
-
- (*map)[hnd] = entry;
-
- mux->Leave();
- }
-
- void HandleRegistrySegment::Remove(int64_t hnd)
- {
- mux->Enter();
-
- map->erase(hnd);
-
- mux->Leave();
- }
-
- void HandleRegistrySegment::Clear()
- {
- mux->Enter();
-
- map->erase(map->begin(), map->end());
-
- mux->Leave();
- }
-
- HandleRegistry::HandleRegistry(int32_t fastCap, int32_t slowSegmentCnt)
- {
- this->fastCap = fastCap;
-
- fastCtr = 0;
-
- fast = new SharedPointer<HandleRegistryEntry>[fastCap];
-
- for (int i = 0; i < fastCap; i++)
- fast[i] = SharedPointer<HandleRegistryEntry>();
-
- this->slowSegmentCnt = slowSegmentCnt;
-
- slowCtr = fastCap;
-
- slow = new HandleRegistrySegment*[slowSegmentCnt];
-
- for (int i = 0; i < slowSegmentCnt; i++)
- slow[i] = new HandleRegistrySegment();
-
- closed = 0;
-
- Memory::Fence();
- }
-
- HandleRegistry::~HandleRegistry()
- {
- Close();
-
- delete[] fast;
-
- for (int i = 0; i < slowSegmentCnt; i++)
- delete slow[i];
-
- delete[] slow;
- }
-
- int64_t HandleRegistry::Allocate(const SharedPointer<HandleRegistryEntry>& target)
- {
- return Allocate0(target, false, false);
- }
-
- int64_t HandleRegistry::AllocateCritical(const SharedPointer<HandleRegistryEntry>& target)
- {
- return Allocate0(target, true, false);
- }
-
- int64_t HandleRegistry::AllocateSafe(const SharedPointer<HandleRegistryEntry>& target)
- {
- return Allocate0(target, false, true);
- }
-
- int64_t HandleRegistry::AllocateCriticalSafe(const SharedPointer<HandleRegistryEntry>& target)
- {
- return Allocate0(target, true, true);
- }
-
- void HandleRegistry::Release(int64_t hnd)
- {
- if (hnd < fastCap)
- fast[static_cast<int32_t>(hnd)] = SharedPointer<HandleRegistryEntry>();
- else
- {
- HandleRegistrySegment* segment = *(slow + hnd % slowSegmentCnt);
-
- segment->Remove(hnd);
- }
-
- Memory::Fence();
- }
-
- SharedPointer<HandleRegistryEntry> HandleRegistry::Get(int64_t hnd)
- {
- Memory::Fence();
-
- if (hnd < fastCap)
- return fast[static_cast<int32_t>(hnd)];
- else
- {
- HandleRegistrySegment* segment = *(slow + hnd % slowSegmentCnt);
-
- return segment->Get(hnd);
- }
- }
-
- void HandleRegistry::Close()
- {
- if (Atomics::CompareAndSet32(&closed, 0, 1))
- {
- // Cleanup fast-path handles.
- for (int i = 0; i < fastCap; i++)
- fast[i] = SharedPointer<HandleRegistryEntry>();
-
- // Cleanup slow-path handles.
- for (int i = 0; i < slowSegmentCnt; i++)
- (*(slow + i))->Clear();
- }
- }
-
- int64_t HandleRegistry::Allocate0(const SharedPointer<HandleRegistryEntry>& target, bool critical, bool safe)
- {
- // Check closed state.
- Memory::Fence();
-
- if (closed == 1)
- return -1;
-
- // Try allocating entry on critical path.
- if (critical)
- {
- if (fastCtr < fastCap)
- {
- int32_t fastIdx = Atomics::IncrementAndGet32(&fastCtr) - 1;
-
- if (fastIdx < fastCap)
- {
- fast[fastIdx] = target;
-
- // Double-check for closed state if safe mode is on.
- Memory::Fence();
-
- if (safe && closed == 1)
- {
- fast[fastIdx] = SharedPointer<HandleRegistryEntry>();
-
- return -1;
- }
- else
- return fastIdx;
- }
- }
- }
-
- // Either allocating on slow-path, or fast-path can no longer accomodate more entries.
- int64_t slowIdx = Atomics::IncrementAndGet64(&slowCtr) - 1;
-
- HandleRegistrySegment* segment = *(slow + slowIdx % slowSegmentCnt);
-
- segment->Put(slowIdx, target);
-
- // Double-check for closed state if safe mode is on.
- Memory::Fence();
-
- if (safe && closed == 1)
- {
- segment->Remove(slowIdx);
-
- return -1;
- }
-
- return slowIdx;
- }
- }
-}
\ No newline at end of file
[09/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Account.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Account.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Account.cs
deleted file mode 100644
index 8e247e3..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Account.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Account object. Used in transaction example.
- /// </summary>
- [Serializable]
- public class Account
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">Account ID.</param>
- /// <param name="balance">Account balance.</param>
- public Account(int id, decimal balance)
- {
- Id = id;
- Balance = balance;
- }
-
- /// <summary>
- /// Account ID.
- /// </summary>
- public int Id { get; set; }
-
- /// <summary>
- /// Account balance.
- /// </summary>
- public decimal Balance { get; set; }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- override public String ToString()
- {
- return string.Format("{0} [id={1}, balance={2}]", typeof(Account).Name, Id, Balance);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Address.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Address.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Address.cs
deleted file mode 100644
index ca069cb..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Address.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core.Portable;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Address.
- /// </summary>
- [Serializable]
- public class Address : IPortableMarshalAware
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="street">Street.</param>
- /// <param name="zip">ZIP code.</param>
- public Address(string street, int zip)
- {
- Street = street;
- Zip = zip;
- }
-
- /// <summary>
- /// Street.
- /// </summary>
- public string Street { get; set; }
-
- /// <summary>
- /// ZIP code.
- /// </summary>
- public int Zip { get; set; }
-
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- public void WritePortable(IPortableWriter writer)
- {
- writer.WriteString("street", Street);
- writer.WriteInt("zip", Zip);
- }
-
- /// <summary>
- /// Reads this object from the given reader.
- /// </summary>
- /// <param name="reader">Reader.</param>
- public void ReadPortable(IPortableReader reader)
- {
- Street = reader.ReadString("street");
- Zip = reader.ReadInt("zip");
- }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- override public string ToString()
- {
- return string.Format("{0} [street={1}, zip={2}]", typeof(Address).Name, Street, Zip);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Employee.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Employee.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Employee.cs
deleted file mode 100644
index 7f4388d..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Employee.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Employee.
- /// </summary>
- [Serializable]
- public class Employee
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="name">Name.</param>
- /// <param name="salary">Salary.</param>
- /// <param name="address">Address.</param>
- /// <param name="departments">Departments.</param>
- public Employee(string name, long salary, Address address, ICollection<string> departments)
- {
- Name = name;
- Salary = salary;
- Address = address;
- Departments = departments;
- }
-
- /// <summary>
- /// Name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Salary.
- /// </summary>
- public long Salary { get; set; }
-
- /// <summary>
- /// Address.
- /// </summary>
- public Address Address { get; set; }
-
- /// <summary>
- /// Departments.
- /// </summary>
- public ICollection<string> Departments { get; set; }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- override public string ToString()
- {
- return string.Format("{0} [name={1}, salary={2}, address={3}, departments={4}]", typeof(Employee).Name,
- Name, Salary, Address, CollectionToString(Departments));
- }
-
- /// <summary>
- /// Get string representation of collection.
- /// </summary>
- /// <returns></returns>
- private static string CollectionToString<T>(ICollection<T> col)
- {
- if (col == null)
- return "null";
-
- var elements = col.Any()
- ? col.Select(x => x.ToString()).Aggregate((x, y) => x + ", " + y)
- : string.Empty;
-
- return string.Format("[{0}]", elements);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/EmployeeKey.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/EmployeeKey.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/EmployeeKey.cs
deleted file mode 100644
index 2267154..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/EmployeeKey.cs
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Employee key. Used in query example to co-locate employees with their organizations.
- /// </summary>
- [Serializable]
- public class EmployeeKey
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- /// <param name="orgId">Organization ID.</param>
- public EmployeeKey(int id, int orgId)
- {
- Id = id;
- OrganizationId = orgId;
- }
-
- /// <summary>
- /// ID.
- /// </summary>
- public int Id { get; private set; }
-
- /// <summary>
- /// Organization ID.
- /// </summary>
- public int OrganizationId { get; private set; }
-
- /// <summary>
- /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
- /// </summary>
- /// <returns>
- /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
- /// </returns>
- /// <param name="obj">The object to compare with the current object. </param><filterpriority>2</filterpriority>
- public override bool Equals(object obj)
- {
- EmployeeKey other = obj as EmployeeKey;
-
- return other != null && Id == other.Id && OrganizationId == other.OrganizationId;
- }
-
- /// <summary>
- /// Serves as a hash function for a particular type.
- /// </summary>
- /// <returns>
- /// A hash code for the current <see cref="T:System.Object"/>.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- public override int GetHashCode()
- {
- return 31 * Id + OrganizationId;
- }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- public override string ToString()
- {
- return string.Format("{0} [id={1}, organizationId={2}]", typeof (EmployeeKey).Name, Id, OrganizationId);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Organization.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Organization.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Organization.cs
deleted file mode 100644
index e23c3c1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/Organization.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Organization.
- /// </summary>
- [Serializable]
- public class Organization
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public Organization()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="name">Name.</param>
- /// <param name="address">Address.</param>
- /// <param name="type">Type.</param>
- /// <param name="lastUpdated">Last update time.</param>
- public Organization(string name, Address address, OrganizationType type, DateTime lastUpdated)
- {
- Name = name;
- Address = address;
- Type = type;
- LastUpdated = lastUpdated;
- }
-
- /// <summary>
- /// Name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Address.
- /// </summary>
- public Address Address { get; set; }
-
- /// <summary>
- /// Type.
- /// </summary>
- public OrganizationType Type { get; set; }
-
- /// <summary>
- /// Last update time.
- /// </summary>
- public DateTime LastUpdated { get; set; }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- /// <filterpriority>2</filterpriority>
- public override string ToString()
- {
- return string.Format("{0} [name={1}, address={2}, type={3}, lastUpdated={4}]", typeof (Organization).Name,
- Name, Address, Type, LastUpdated);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/OrganizationType.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/OrganizationType.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/OrganizationType.cs
deleted file mode 100644
index 198edb1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Portable/OrganizationType.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-
-namespace Apache.Ignite.ExamplesDll.Portable
-{
- /// <summary>
- /// Organization type.
- /// </summary>
- [Serializable]
- public enum OrganizationType
- {
- /// <summary>
- /// Non-profit organization.
- /// </summary>
- NonProfit,
-
- /// <summary>
- /// Private organization.
- /// </summary>
- Private,
-
- /// <summary>
- /// Government organization.
- /// </summary>
- Government
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
deleted file mode 100644
index f149d64..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Apache Ignite Examples Dll")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Apache Software Foundation")]
-[assembly: AssemblyProduct("Apache Ignite")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("ce65ec7c-d3cf-41ad-8f45-f90d5af68d77")]
-
-[assembly: AssemblyVersion("1.5.0")]
-[assembly: AssemblyFileVersion("1.5.0")]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Services/MapService.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
deleted file mode 100644
index d577ff7..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Services/MapService.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Cache;
-using Apache.Ignite.Core.Resource;
-using Apache.Ignite.Core.Services;
-
-namespace Apache.Ignite.ExamplesDll.Services
-{
- /// <summary>
- /// Service implementation.
- /// </summary>
- [Serializable]
- public class MapService<TK, TV> : IService
- {
- /** Injected Ignite instance. */
-#pragma warning disable 649
- [InstanceResource] private readonly IIgnite _ignite;
-#pragma warning restore 649
-
- /** Cache. */
- private ICache<TK, TV> _cache;
-
- /// <summary>
- /// Initializes this instance before execution.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- public void Init(IServiceContext context)
- {
- // Create a new cache for every service deployment.
- // Note that we use service name as cache name, which allows
- // for each service deployment to use its own isolated cache.
- _cache = _ignite.GetOrCreateCache<TK, TV>("MapService_" + context.Name);
-
- Console.WriteLine("Service initialized: " + context.Name);
- }
-
- /// <summary>
- /// Starts execution of this service. This method is automatically invoked whenever an instance of the service
- /// is deployed on an Ignite node. Note that service is considered deployed even after it exits the Execute
- /// method and can be cancelled (or undeployed) only by calling any of the Cancel methods on
- /// <see cref="IServices"/> API. Also note that service is not required to exit from Execute method until
- /// Cancel method was called.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- public void Execute(IServiceContext context)
- {
- Console.WriteLine("Service started: " + context.Name);
- }
-
- /// <summary>
- /// Cancels this instance.
- /// <para/>
- /// Note that Ignite cannot guarantee that the service exits from <see cref="IService.Execute"/>
- /// method whenever <see cref="IService.Cancel"/> is called. It is up to the user to
- /// make sure that the service code properly reacts to cancellations.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- public void Cancel(IServiceContext context)
- {
- Console.WriteLine("Service cancelled: " + context.Name);
- }
-
- /// <summary>
- /// Puts an entry to the map.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="value">The value.</param>
- public void Put(TK key, TV value)
- {
- _cache.Put(key, value);
- }
-
- /// <summary>
- /// Gets an entry from the map.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <returns>Entry value.</returns>
- public TV Get(TK key)
- {
- return _cache.Get(key);
- }
-
- /// <summary>
- /// Clears the map.
- /// </summary>
- public void Clear()
- {
- _cache.Clear();
- }
-
- /// <summary>
- /// Gets the size of the map.
- /// </summary>
- /// <value>
- /// The size.
- /// </value>
- public int Size
- {
- get { return _cache.GetSize(); }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Config/example-cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Config/example-cache-query.xml b/modules/platform/src/main/dotnet/Examples/Config/example-cache-query.xml
deleted file mode 100644
index c9ea7e1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Config/example-cache-query.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Examples.Dll.Portable.Account</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Address</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Employee</value>
- <value>Apache.Ignite.Examples.Dll.Portable.EmployeeKey</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Organization</value>
- <value>Apache.Ignite.Examples.Dll.Portable.OrganizationType</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <!-- Cache configurations (all properties are optional). -->
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="backups" value="1"/>
-
- <!-- Configure type metadata to enable queries. -->
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="keyType" value="java.lang.Integer"/>
- <property name="valueType" value="Organization"/>
- <property name="ascendingFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="keyType" value="EmployeeKey"/>
- <property name="valueType" value="Employee"/>
- <property name="ascendingFields">
- <map>
- <entry key="organizationId" value="java.lang.Integer"/>
- <entry key="address.zip" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- <entry key="salary" value="java.lang.Long"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>address.street</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Config/example-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Config/example-cache-store.xml b/modules/platform/src/main/dotnet/Examples/Config/example-cache-store.xml
deleted file mode 100644
index adc5f45..0000000
--- a/modules/platform/src/main/dotnet/Examples/Config/example-cache-store.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.ExamplesDll"/>
- <property name="className" value="Apache.Ignite.ExamplesDll.Datagrid.EmployeeStore"/>
- </bean>
- </property>
- </bean>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Config/example-cache.xml b/modules/platform/src/main/dotnet/Examples/Config/example-cache.xml
deleted file mode 100644
index a262ce1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Config/example-cache.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Examples.Dll.Portable.Account</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Address</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Employee</value>
- <value>Apache.Ignite.Examples.Dll.Portable.EmployeeKey</value>
- <value>Apache.Ignite.Examples.Dll.Portable.Organization</value>
- <value>Apache.Ignite.Examples.Dll.Portable.OrganizationType</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache*"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="backups" value="1"/>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="tx"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="backups" value="1"/>
- </bean>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Config/example-compute.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Config/example-compute.xml b/modules/platform/src/main/dotnet/Examples/Config/example-compute.xml
deleted file mode 100644
index bbc6550..0000000
--- a/modules/platform/src/main/dotnet/Examples/Config/example-compute.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <!-- Enable task execution events for examples. -->
- <property name="includeEventTypes">
- <list>
- <!-- Task execution events -->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_STARTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FINISHED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_FAILED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_TIMEDOUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_SESSION_ATTR_SET"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_TASK_REDUCED"/>
-
- <!-- Job execution events -->
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_MAPPED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_RESULTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED_OVER"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_STARTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FINISHED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_TIMEDOUT"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_REJECTED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_FAILED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_QUEUED"/>
- <util:constant static-field="org.apache.ignite.events.EventType.EVT_JOB_CANCELLED"/>
- </list>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/README.txt
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/README.txt b/modules/platform/src/main/dotnet/Examples/README.txt
deleted file mode 100644
index c49dc5a..0000000
--- a/modules/platform/src/main/dotnet/Examples/README.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-Apache Ignite .Net Examples
-==================================
-
-Common requirements
-----------------------------------
- * Apache Ignite .Net library must be built using instructions from %IGNITE_HOME%\platforms\dotnet\README.txt.
-
-
-Running examples
-----------------------------------
-
- * Open Visual Studio solution %IGNITE_HOME%\platforms\dotnet\examples\Apache.Ignite.Examples.sln
- * Build Apache.Ignite.ExamplesDll project.
- * Set desired example as startup object in Apache.Ignite.Examples project and run it.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/README.txt
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/README.txt b/modules/platform/src/main/dotnet/README.txt
deleted file mode 100644
index 18a9317..0000000
--- a/modules/platform/src/main/dotnet/README.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-Apache Ignite .Net
-==================================
-
-Apache Ignite .Net provides a full featured .NET data grid and .NET compute grid functionality.
-Using Apache Ignite .NET APIs you can execute any computation closure on the grid,
-perform concurrent operations on the data stored in cache, start ACID transactions,
-create distributed locks, subscribe for event listeners, etc.
-
-Full source code is provided. Users should build the library for intended platform.
-
-Common Requirements:
-
- * Microsoft Visual Studio (tm) 2010 or later
- * Microsoft Visual C++ 2010 Redistributable Package: http://www.microsoft.com/en-us/download/details.aspx?id=14632
- * Java Development Kit (JDK): https://java.com/en/download/index.jsp
- * JAVA_HOME environment variable must be set pointing to Java installation directory.
-
-Building the library:
- * Open and build %IGNITE_HOME%\platforms\dotnet\Apache.Ignite.sln (or Apache.Ignite_x86.sln if you are running
- 32-bit platform).
-
-Development:
- * Add the library Apache.Ignite.Core.dll to your project references.
- * To start Apache Ignite as a standalone node or Windows service use Apache.Ignite.exe.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
deleted file mode 100644
index f213b34..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Apache.Ignite.Core.Tests.TestDll.csproj
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{F4A69E2D-908E-4F0F-A794-84D508D60E5F}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.Core.Tests.TestDll</RootNamespace>
- <AssemblyName>Apache.Ignite.Core.Tests.TestDll</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="TestClass.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
deleted file mode 100644
index 22d74c9..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Apache.Ignite.Core.Tests.TestDll")]
-[assembly: AssemblyDescription("Apache Ignite .NET Core Tests Testing Library")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Apache Software Foundation")]
-[assembly: AssemblyProduct("Apache.Ignite.Core.Tests.TestDll")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("086e5873-013b-4ffb-93d2-d67881f75bc2")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.5.0")]
-[assembly: AssemblyFileVersion("1.5.0")]
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/TestClass.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/TestClass.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/TestClass.cs
deleted file mode 100644
index 1199f2c..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests.TestDll/TestClass.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.TestDll
-{
- /// <summary>
- /// Test class.
- /// </summary>
- public class TestClass
- {
- /// <summary>
- /// Gets or sets the Id.
- /// </summary>
- public int Id { get; set; }
-
- /// <summary>
- /// Gets or sets the Name.
- /// </summary>
- public string Name { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
deleted file mode 100644
index faa5a61..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ /dev/null
@@ -1,242 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.Core.Tests</RootNamespace>
- <AssemblyName>Apache.Ignite.Core.Tests</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject />
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants>DEBUG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants>DEBUG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Release\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="nunit-console-runner">
- <HintPath>..\libs\nunit-console-runner.dll</HintPath>
- </Reference>
- <Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
- <SpecificVersion>False</SpecificVersion>
- <HintPath>..\libs\nunit.framework.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Runtime.Serialization" />
- <Reference Include="System.XML" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Cache\CacheDynamicStartTest.cs" />
- <Compile Include="Cache\CacheTestAsyncWrapper.cs" />
- <Compile Include="Cache\CacheAbstractTest.cs" />
- <Compile Include="Cache\CacheAffinityTest.cs" />
- <Compile Include="Cache\CacheEntryTest.cs" />
- <Compile Include="Cache\CacheForkedTest.cs" />
- <Compile Include="Cache\CacheLocalAtomicTest.cs" />
- <Compile Include="Cache\CacheLocalTest.cs" />
- <Compile Include="Cache\CachePartitionedAtomicNearEnabledTest.cs" />
- <Compile Include="Cache\CachePartitionedAtomicTest.cs" />
- <Compile Include="Cache\CachePartitionedNearEnabledTest.cs" />
- <Compile Include="Cache\CachePartitionedTest.cs" />
- <Compile Include="Cache\CacheReplicatedAtomicTest.cs" />
- <Compile Include="Cache\CacheReplicatedTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryAbstractTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryAtomicBackupTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryAtomicNoBackupTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryNoBackupAbstractTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryTransactionalBackupTest.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQueryTransactionalNoBackupTest.cs" />
- <Compile Include="Cache\Query\CacheQueriesTest.cs" />
- <Compile Include="Cache\Store\CacheParallelLoadStoreTest.cs" />
- <Compile Include="Cache\Store\CacheStoreSessionTest.cs" />
- <Compile Include="Cache\Store\CacheStoreTest.cs" />
- <Compile Include="Cache\Store\CacheTestParallelLoadStore.cs" />
- <Compile Include="Cache\Store\CacheTestStore.cs" />
- <Compile Include="Compute\Forked\ForkedPortableClosureTaskTest.cs" />
- <Compile Include="Compute\Forked\ForkedResourceTaskTest.cs" />
- <Compile Include="Compute\Forked\ForkedSerializableClosureTaskTest.cs" />
- <Compile Include="Compute\Forked\ForkedTaskAdapterTest.cs" />
- <Compile Include="Compute\AbstractTaskTest.cs" />
- <Compile Include="Compute\ClosureTaskTest.cs" />
- <Compile Include="Compute\ComputeApiTest.cs" />
- <Compile Include="Compute\ComputeMultithreadedTest.cs" />
- <Compile Include="Compute\IgniteExceptionTaskSelfTest.cs" />
- <Compile Include="Compute\FailoverTaskSelfTest.cs" />
- <Compile Include="Compute\PortableClosureTaskTest.cs" />
- <Compile Include="Compute\PortableTaskTest.cs" />
- <Compile Include="Compute\ResourceTaskTest.cs" />
- <Compile Include="Compute\SerializableClosureTaskTest.cs" />
- <Compile Include="Compute\TaskAdapterTest.cs" />
- <Compile Include="Compute\TaskResultTest.cs" />
- <Compile Include="Dataload\DataStreamerTest.cs" />
- <Compile Include="EventsTest.cs" />
- <Compile Include="Examples\Example.cs" />
- <Compile Include="Examples\ExamplesTest.cs" />
- <Compile Include="Examples\PathUtil.cs" />
- <Compile Include="Examples\ProjectFilesTest.cs" />
- <Compile Include="ExceptionsTest.cs" />
- <Compile Include="ExecutableTest.cs" />
- <Compile Include="FutureTest.cs" />
- <Compile Include="LifecycleTest.cs" />
- <Compile Include="LoadDllTest.cs" />
- <Compile Include="IgniteManagerTest.cs" />
- <Compile Include="MarshallerTest.cs" />
- <Compile Include="MessagingTest.cs" />
- <Compile Include="PortableConfigurationTest.cs" />
- <Compile Include="SerializationTest.cs" />
- <Compile Include="IgniteStartStopTest.cs" />
- <Compile Include="TestUtils.cs" />
- <Compile Include="Memory\InteropMemoryTest.cs" />
- <Compile Include="Portable\PortableApiSelfTest.cs" />
- <Compile Include="Portable\PortableSelfTest.cs" />
- <Compile Include="Process\IgniteProcess.cs" />
- <Compile Include="Process\IgniteProcessConsoleOutputReader.cs" />
- <Compile Include="Process\IIgniteProcessOutputReader.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Query\ImplicitPortablePerson.cs" />
- <Compile Include="Query\NoDefPortablePerson.cs" />
- <Compile Include="Query\PortablePerson.cs" />
- <Compile Include="Services\ServicesTest.cs" />
- <Compile Include="Services\ServicesTestAsync.cs" />
- <Compile Include="Services\ServiceProxyTest.cs" />
- <Compile Include="Services\ServicesAsyncWrapper.cs" />
- <Compile Include="TestRunner.cs" />
- <Compile Include="TypeResolverTest.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\main\dotnet\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
- <Project>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</Project>
- <Name>Apache.Ignite.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\main\dotnet\Apache.Ignite\Apache.Ignite.csproj">
- <Project>{27F7F3C6-BDDE-43A9-B565-856F8395A04B}</Project>
- <Name>Apache.Ignite</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\main\dotnet\Examples\Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj">
- <Project>{dfb08363-202e-412d-8812-349ef10a8702}</Project>
- <Name>Apache.Ignite.ExamplesDll</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\..\main\dotnet\Examples\Apache.Ignite.Examples\Apache.Ignite.Examples.csproj">
- <Project>{069fa680-3c4d-43a9-b84f-e67513b87827}</Project>
- <Name>Apache.Ignite.Examples</Name>
- </ProjectReference>
- <ProjectReference Include="..\Apache.Ignite.Core.Tests.TestDll\Apache.Ignite.Core.Tests.TestDll.csproj">
- <Project>{F4A69E2D-908E-4F0F-A794-84D508D60E5F}</Project>
- <Name>Apache.Ignite.Core.Tests.TestDll</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <Content Include="Config\cache-portables.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\cache-query-continuous.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\cache-query.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- <SubType>Designer</SubType>
- </Content>
- <Content Include="Config\Cache\Store\cache-store-session.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Compute\compute-grid1.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Compute\compute-grid2.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Compute\compute-grid3.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Compute\compute-standalone.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Dynamic\dynamic-client.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Dynamic\dynamic-data-no-cfg.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Dynamic\dynamic-data.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Lifecycle\lifecycle-beans.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\Lifecycle\lifecycle-no-beans.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\marshaller-default.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\marshaller-invalid.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\marshaller-portable.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\native-client-test-cache-affinity.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\native-client-test-cache-parallel-store.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\native-client-test-cache-store.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\native-client-test-cache.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\portable.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\start-test-grid1.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\start-test-grid2.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- <Content Include="Config\start-test-grid3.xml">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <ItemGroup>
- <Content Include="Config\Apache.Ignite.exe.config.test">
- <CopyToOutputDirectory>Always</CopyToOutputDirectory>
- </Content>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
[46/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
deleted file mode 100644
index 3239d89..0000000
--- a/modules/platform/src/main/cpp/core-test/src/cache_test.cpp
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/cache/cache_peek_mode.h"
-#include "ignite/ignite.h"
-#include "ignite/ignition.h"
-
-using namespace ignite;
-using namespace boost::unit_test;
-
-/* Nodes started during the test. */
-Ignite grid0 = Ignite();
-Ignite grid1 = Ignite();
-
-/** Cache accessor. */
-cache::Cache<int, int> Cache()
-{
- return grid0.GetCache<int, int>("partitioned");
-}
-
-struct Person
-{
- std::string name;
- int age;
-
- Person() : name(""), age(0)
- {
- // No-op.
- }
-
- Person(std::string name, int age) : name(name), age(age)
- {
- // No-op.
- }
-};
-
-namespace ignite
-{
- namespace portable
- {
- IGNITE_PORTABLE_TYPE_START(Person)
- IGNITE_PORTABLE_GET_TYPE_ID_AS_HASH(Person)
- IGNITE_PORTABLE_GET_TYPE_NAME_AS_IS(Person)
- IGNITE_PORTABLE_GET_FIELD_ID_AS_HASH
- IGNITE_PORTABLE_GET_HASH_CODE_ZERO(Person)
- IGNITE_PORTABLE_IS_NULL_FALSE(Person)
- IGNITE_PORTABLE_GET_NULL_DEFAULT_CTOR(Person)
-
- void Write(PortableWriter& writer, Person obj)
- {
- writer.WriteString("name", obj.name);
- writer.WriteInt32("age", obj.age);
- }
-
- Person Read(PortableReader& reader)
- {
- std::string name = reader.ReadString("name");
- int age = reader.ReadInt32("age");
-
- return Person(name, age);
- }
-
- IGNITE_PORTABLE_TYPE_END
- }
-}
-
-/*
- * Test setup fixture.
- */
-struct CacheTestSuiteFixture {
- /*
- * Constructor.
- */
- CacheTestSuiteFixture()
- {
- IgniteConfiguration cfg;
-
- IgniteJvmOption opts[5];
-
- opts[0] = IgniteJvmOption("-Xdebug");
- opts[1] = IgniteJvmOption("-Xnoagent");
- opts[2] = IgniteJvmOption("-Djava.compiler=NONE");
- opts[3] = IgniteJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
- opts[4] = IgniteJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
-
- cfg.jvmOptsLen = 5;
- cfg.jvmOpts = opts;
-
-#ifdef IGNITE_TESTS_32
- cfg.jvmInitMem = 256;
- cfg.jvmMaxMem = 768;
-#else
- cfg.jvmInitMem = 1024;
- cfg.jvmMaxMem = 4096;
-#endif
-
- char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
- std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-test.xml");
-
- cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
-
- for (int i = 0; i < 2; i++)
- {
- std::stringstream stream;
-
- stream << "grid-" << i;
-
- IgniteError err;
-
- Ignite grid = Ignition::Start(cfg, stream.str().c_str(), &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_FAIL(err.GetText());
-
- if (i == 0)
- grid0 = grid;
- else
- grid1 = grid;
- }
- }
-
- /*
- * Destructor.
- */
- ~CacheTestSuiteFixture()
- {
- Ignition::Stop(grid0.GetName(), true);
- Ignition::Stop(grid1.GetName(), true);
-
- grid0 = Ignite();
- grid1 = Ignite();
- }
-};
-
-BOOST_FIXTURE_TEST_SUITE(CacheTestSuite, CacheTestSuiteFixture)
-
-BOOST_AUTO_TEST_CASE(TestRemoveAllKeys)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
-
- int size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY);
-
- BOOST_REQUIRE(3 == size);
-
- cache.RemoveAll();
-
- size = cache.Size(cache::IGNITE_PEEK_MODE_ALL);
-
- BOOST_REQUIRE(0 == size);
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
-
- int keys[] = { 1, 2, 4, 5 };
-
- std::set<int> keySet(keys, keys + 4);
-
- cache.RemoveAll(keySet);
-
- size = cache.Size(cache::IGNITE_PEEK_MODE_PRIMARY);
-
- BOOST_REQUIRE(1 == size);
-}
-
-BOOST_AUTO_TEST_CASE(TestPut)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 1);
-
- BOOST_REQUIRE(1 == cache.Get(1));
-}
-
-BOOST_AUTO_TEST_CASE(TestPutAll)
-{
- std::map<int, int> map;
-
- for (int i = 0; i < 100; i++)
- map[i] = i + 1;
-
- cache::Cache<int, int> cache = Cache();
-
- cache.PutAll(map);
-
- for (int i = 0; i < 100; i++)
- BOOST_REQUIRE(i + 1 == cache.Get(i));
-}
-
-BOOST_AUTO_TEST_CASE(TestPutIfAbsent)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(true == cache.PutIfAbsent(1, 3));
- BOOST_REQUIRE(false == cache.PutIfAbsent(1, 3));
-}
-
-BOOST_AUTO_TEST_CASE(TestGet)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
-
- BOOST_REQUIRE(1 == cache.Get(1));
- BOOST_REQUIRE(2 == cache.Get(2));
-
- BOOST_REQUIRE(0 == cache.Get(3));
-}
-
-BOOST_AUTO_TEST_CASE(TestGetAll)
-{
- cache::Cache<int, int> cache = Cache();
-
- int keys[] = { 1, 2, 3, 4, 5 };
-
- std::set<int> keySet (keys, keys + 5);
-
- for (int i = 0; i < keySet.size(); i++)
- cache.Put(i + 1, i + 1);
-
- std::map<int, int> map = cache.GetAll(keySet);
-
- for (int i = 0; i < keySet.size(); i++)
- BOOST_REQUIRE(i + 1 == map[i + 1]);
-}
-
-BOOST_AUTO_TEST_CASE(TestGetAndPut)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(0 == cache.GetAndPut(1, 3));
- BOOST_REQUIRE(3 == cache.GetAndPut(1, 1));
- BOOST_REQUIRE(1 == cache.GetAndPut(1, 0));
-}
-
-BOOST_AUTO_TEST_CASE(TestGetAndPutIfAbsent)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(0 == cache.GetAndPutIfAbsent(1, 3));
- BOOST_REQUIRE(3 == cache.GetAndPutIfAbsent(1, 1));
- BOOST_REQUIRE(3 == cache.GetAndPutIfAbsent(1, 1));
-}
-
-BOOST_AUTO_TEST_CASE(TestGetAndRemove)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 3);
-
- BOOST_REQUIRE(3 == cache.GetAndRemove(1));
- BOOST_REQUIRE(0 == cache.GetAndRemove(1));
-}
-
-BOOST_AUTO_TEST_CASE(TestGetAndReplace)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(0 == cache.GetAndReplace(1, 3));
- BOOST_REQUIRE(0 == cache.GetAndReplace(1, 3));
-
- cache.Put(1, 5);
-
- BOOST_REQUIRE(5 == cache.GetAndReplace(1, 3));
- BOOST_REQUIRE(3 == cache.GetAndReplace(1, 3));
-}
-
-BOOST_AUTO_TEST_CASE(TestContainsKey)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(false == cache.ContainsKey(1));
-
- cache.Put(1, 1);
-
- BOOST_REQUIRE(true == cache.ContainsKey(1));
-
- BOOST_REQUIRE(true == cache.Remove(1));
-
- BOOST_REQUIRE(false == cache.ContainsKey(1));
-}
-
-BOOST_AUTO_TEST_CASE(TestContainsKeys)
-{
- cache::Cache<int, int> cache = Cache();
-
- int keys[] = { 1, 2 };
-
- std::set<int> keySet(keys, keys + 2);
-
- BOOST_REQUIRE(false == cache.ContainsKeys(keySet));
-
- cache.Put(1, 1);
- cache.Put(2, 2);
-
- BOOST_REQUIRE(true == cache.ContainsKeys(keySet));
-
- cache.Remove(1);
-
- BOOST_REQUIRE(false == cache.ContainsKeys(keySet));
-}
-
-BOOST_AUTO_TEST_CASE(TestIsEmpty)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(true == cache.IsEmpty());
-
- cache.Put(1, 1);
-
- BOOST_REQUIRE(false == cache.IsEmpty());
-
- cache.Remove(1);
-
- BOOST_REQUIRE(true == cache.IsEmpty());
-}
-
-BOOST_AUTO_TEST_CASE(TestRemove)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(false == cache.Remove(1));
-
- cache.Put(1, 1);
-
- BOOST_REQUIRE(true == cache.Remove(1));
- BOOST_REQUIRE(false == cache.Remove(1));
- BOOST_REQUIRE(false == cache.ContainsKey(1));
-}
-
-BOOST_AUTO_TEST_CASE(TestClear)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 1);
-
- BOOST_REQUIRE(true == cache.ContainsKey(1));
-
- cache.Clear(1);
-
- BOOST_REQUIRE(false == cache.ContainsKey(1));
-}
-
-BOOST_AUTO_TEST_CASE(TestLocalClear)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(0, 2);
-
- BOOST_REQUIRE(2 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY));
-
- cache.LocalClear(0);
-
- BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY));
-}
-
-BOOST_AUTO_TEST_CASE(TestLocalClearAll)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(0, 3);
- cache.Put(1, 3);
-
- int keys[] = { 0, 1 };
-
- std::set<int> keySet(keys, keys + 2);
-
- BOOST_REQUIRE(3 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY));
- BOOST_REQUIRE(3 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY));
-
- cache.LocalClearAll(keySet);
-
- BOOST_REQUIRE(0 == cache.LocalPeek(0, cache::IGNITE_PEEK_MODE_PRIMARY));
- BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_PRIMARY));
-}
-
-BOOST_AUTO_TEST_CASE(TestSizes)
-{
- cache::Cache<int, int> cache = Cache();
-
- BOOST_REQUIRE(0 == cache.Size());
-
- cache.Put(1, 1);
- cache.Put(2, 2);
-
- BOOST_REQUIRE(2 <= cache.Size());
-
- BOOST_REQUIRE(1 <= cache.LocalSize(cache::IGNITE_PEEK_MODE_PRIMARY));
-}
-
-BOOST_AUTO_TEST_CASE(TestLocalEvict)
-{
- cache::Cache<int, int> cache = Cache();
-
- cache.Put(1, 5);
-
- BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP));
-
- int keys[] = { 0, 1 };
-
- std::set<int> keySet(keys, keys + 2);
-
- cache.LocalEvict(keySet);
-
- BOOST_REQUIRE(0 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP));
-
- BOOST_REQUIRE(5 == cache.Get(1));
-
- BOOST_REQUIRE(5 == cache.LocalPeek(1, cache::IGNITE_PEEK_MODE_ONHEAP));
-}
-
-BOOST_AUTO_TEST_CASE(TestPortable)
-{
- cache::Cache<int, Person> cache = grid0.GetCache<int, Person>("partitioned");
-
- Person person("John Johnson", 3);
-
- cache.Put(1, person);
-
- Person person0 = cache.Get(1);
-
- BOOST_REQUIRE(person.age == person0.age);
- BOOST_REQUIRE(person.name.compare(person0.name) == 0);
-}
-
-BOOST_AUTO_TEST_CASE(TestCreateCache)
-{
- // Create new cache
- cache::Cache<int, int> cache = grid0.CreateCache<int, int>("dynamic_cache");
-
- cache.Put(5, 7);
-
- BOOST_REQUIRE(7 == cache.Get(5));
-
- // Attempt to create cache with existing name
- IgniteError err;
-
- grid0.CreateCache<int, int>("dynamic_cache", &err);
-
- BOOST_REQUIRE(err.GetCode() != IgniteError::IGNITE_SUCCESS);
-}
-
-BOOST_AUTO_TEST_CASE(TestGetOrCreateCache)
-{
- // Get existing cache
- cache::Cache<int, int> cache = grid0.GetOrCreateCache<int, int>("partitioned");
-
- cache.Put(5, 7);
-
- BOOST_REQUIRE(7 == cache.Get(5));
-
- // Create new cache
- cache::Cache<int, int> cache2 = grid0.GetOrCreateCache<int, int>("partitioned_new");
-
- cache2.Put(5, 7);
-
- BOOST_REQUIRE(7 == cache2.Get(5));
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/concurrent_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/concurrent_test.cpp b/modules/platform/src/main/cpp/core-test/src/concurrent_test.cpp
deleted file mode 100644
index 2d89b7a..0000000
--- a/modules/platform/src/main/cpp/core-test/src/concurrent_test.cpp
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include <ignite/common/concurrent.h>
-
-using namespace ignite::common::concurrent;
-
-BOOST_AUTO_TEST_SUITE(ConcurrentTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestAtomic32)
-{
- int32_t val = 1;
-
- BOOST_REQUIRE(Atomics::CompareAndSet32(&val, 1, 2));
- BOOST_REQUIRE(val == 2);
-
- BOOST_REQUIRE(!Atomics::CompareAndSet32(&val, 3, 1));
- BOOST_REQUIRE(val == 2);
-
- BOOST_REQUIRE(Atomics::CompareAndSet32Val(&val, 2, 3) == 2);
- BOOST_REQUIRE(val == 3);
-
- BOOST_REQUIRE(Atomics::CompareAndSet32Val(&val, 4, 2) == 3);
- BOOST_REQUIRE(val == 3);
-
- BOOST_REQUIRE(Atomics::IncrementAndGet32(&val) == 4);
- BOOST_REQUIRE(val == 4);
-
- BOOST_REQUIRE(Atomics::DecrementAndGet32(&val) == 3);
- BOOST_REQUIRE(val == 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestAtomic64)
-{
- int64_t val = 1;
-
- BOOST_REQUIRE(Atomics::CompareAndSet64(&val, 1, 2));
- BOOST_REQUIRE(val == 2);
-
- BOOST_REQUIRE(!Atomics::CompareAndSet64(&val, 3, 1));
- BOOST_REQUIRE(val == 2);
-
- BOOST_REQUIRE(Atomics::CompareAndSet64Val(&val, 2, 3) == 2);
- BOOST_REQUIRE(val == 3);
-
- BOOST_REQUIRE(Atomics::CompareAndSet64Val(&val, 4, 2) == 3);
- BOOST_REQUIRE(val == 3);
-
- BOOST_REQUIRE(Atomics::IncrementAndGet64(&val) == 4);
- BOOST_REQUIRE(val == 4);
-
- BOOST_REQUIRE(Atomics::DecrementAndGet64(&val) == 3);
- BOOST_REQUIRE(val == 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestThreadLocal)
-{
- int32_t idx1 = ThreadLocal::NextIndex();
- int32_t idx2 = ThreadLocal::NextIndex();
- BOOST_REQUIRE(idx2 > idx1);
-
- BOOST_REQUIRE(ThreadLocal::Get<int32_t>(idx1) == 0);
-
- ThreadLocal::Set(idx1, 1);
- BOOST_REQUIRE(ThreadLocal::Get<int32_t>(idx1) == 1);
-
- ThreadLocal::Set(idx1, 2);
- BOOST_REQUIRE(ThreadLocal::Get<int32_t>(idx1) == 2);
-
- ThreadLocal::Remove(idx1);
- BOOST_REQUIRE(ThreadLocal::Get<int32_t>(idx1) == 0);
-
- ThreadLocal::Set(idx1, 1);
- BOOST_REQUIRE(ThreadLocal::Get<int32_t>(idx1) == 1);
-
- ThreadLocal::Remove(idx1);
-}
-
-BOOST_AUTO_TEST_CASE(TestThreadLocalInstance)
-{
- ThreadLocalInstance<int32_t> val;
-
- BOOST_REQUIRE(val.Get() == 0);
-
- val.Set(1);
- BOOST_REQUIRE(val.Get() == 1);
-
- val.Set(2);
- BOOST_REQUIRE(val.Get() == 2);
-
- val.Remove();
- BOOST_REQUIRE(val.Get() == 0);
-
- val.Set(1);
- BOOST_REQUIRE(val.Get() == 1);
-
- val.Remove();
-}
-
-struct SharedPointerTarget
-{
- bool deleted;
-
- SharedPointerTarget() : deleted(false)
- {
- // No-op.
- }
-};
-
-void DeleteSharedPointerTarget(SharedPointerTarget* ptr)
-{
- ptr->deleted = true;
-}
-
-BOOST_AUTO_TEST_CASE(TestSharedPointer)
-{
- // 1. Test the simples scenario.
- SharedPointerTarget* target = new SharedPointerTarget();
-
- SharedPointer<SharedPointerTarget>* ptr1 =
- new SharedPointer<SharedPointerTarget>(target, DeleteSharedPointerTarget);
-
- delete ptr1;
- BOOST_REQUIRE(target->deleted);
-
- target->deleted = false;
-
- // 2. Test copy ctor.
- ptr1 = new SharedPointer<SharedPointerTarget>(target, DeleteSharedPointerTarget);
- SharedPointer<SharedPointerTarget>* ptr2 = new SharedPointer<SharedPointerTarget>(*ptr1);
-
- delete ptr1;
- BOOST_REQUIRE(!target->deleted);
-
- delete ptr2;
- BOOST_REQUIRE(target->deleted);
-
- target->deleted = false;
-
- // 3. Test assignment logic.
- ptr1 = new SharedPointer<SharedPointerTarget>(target, DeleteSharedPointerTarget);
-
- SharedPointer<SharedPointerTarget> ptr3 = *ptr1;
-
- delete ptr1;
- BOOST_REQUIRE(!target->deleted);
-
- ptr3 = SharedPointer<SharedPointerTarget>();
- BOOST_REQUIRE(target->deleted);
-
- target->deleted = false;
-
- // 4. Test self-assignment.
- ptr1 = new SharedPointer<SharedPointerTarget>(target, DeleteSharedPointerTarget);
-
- *ptr1 = *ptr1;
-
- delete ptr1;
-
- BOOST_REQUIRE(target->deleted);
-
- // 5. Tear-down.
- delete target;
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/handle_registry_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/handle_registry_test.cpp b/modules/platform/src/main/cpp/core-test/src/handle_registry_test.cpp
deleted file mode 100644
index bc4a654..0000000
--- a/modules/platform/src/main/cpp/core-test/src/handle_registry_test.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/impl/handle_registry.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::impl;
-
-struct HandleRegistryTestProbe
-{
- bool deleted;
-
- HandleRegistryTestProbe()
- {
- deleted = false;
- }
-};
-
-class HandleRegistryTestEntry : public HandleRegistryEntry
-{
-public:
- HandleRegistryTestEntry(HandleRegistryTestProbe* probe) : probe(probe)
- {
- // No-op.
- }
-
- virtual ~HandleRegistryTestEntry()
- {
- probe->deleted = true;
- }
-
-private:
- HandleRegistryTestProbe* probe;
-};
-
-BOOST_AUTO_TEST_SUITE(HandleRegistryTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestCritical)
-{
- HandleRegistry reg(2, 1);
-
- HandleRegistryTestProbe probe0;
- HandleRegistryTestProbe probe1;
- HandleRegistryTestProbe probe2;
-
- HandleRegistryTestEntry* entry0 = new HandleRegistryTestEntry(&probe0);
- HandleRegistryTestEntry* entry1 = new HandleRegistryTestEntry(&probe1);
- HandleRegistryTestEntry* entry2 = new HandleRegistryTestEntry(&probe2);
-
- int64_t hnd0 = reg.AllocateCritical(SharedPointer<HandleRegistryEntry>(entry0));
- int64_t hnd1 = reg.AllocateCritical(SharedPointer<HandleRegistryEntry>(entry1));
- int64_t hnd2 = reg.AllocateCritical(SharedPointer<HandleRegistryEntry>(entry2));
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == entry0);
- BOOST_REQUIRE(!probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == entry1);
- BOOST_REQUIRE(!probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == entry2);
- BOOST_REQUIRE(!probe2.deleted);
-
- reg.Release(hnd0);
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == NULL);
- BOOST_REQUIRE(probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == entry1);
- BOOST_REQUIRE(!probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == entry2);
- BOOST_REQUIRE(!probe2.deleted);
-
- reg.Close();
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == NULL);
- BOOST_REQUIRE(probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == NULL);
- BOOST_REQUIRE(probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == NULL);
- BOOST_REQUIRE(probe2.deleted);
-
- HandleRegistry closedReg(2, 1);
-
- closedReg.Close();
-
- HandleRegistryTestProbe closedProbe;
- HandleRegistryTestEntry* closedEntry = new HandleRegistryTestEntry(&closedProbe);
-
- int64_t closedHnd = closedReg.AllocateCritical(SharedPointer<HandleRegistryEntry>(closedEntry));
- BOOST_REQUIRE(closedHnd == -1);
- BOOST_REQUIRE(closedProbe.deleted);
-}
-
-BOOST_AUTO_TEST_CASE(TestNonCritical)
-{
- HandleRegistry reg(0, 2);
-
- HandleRegistryTestProbe probe0;
- HandleRegistryTestProbe probe1;
- HandleRegistryTestProbe probe2;
-
- HandleRegistryTestEntry* entry0 = new HandleRegistryTestEntry(&probe0);
- HandleRegistryTestEntry* entry1 = new HandleRegistryTestEntry(&probe1);
- HandleRegistryTestEntry* entry2 = new HandleRegistryTestEntry(&probe2);
-
- int64_t hnd0 = reg.AllocateCritical(SharedPointer<HandleRegistryEntry>(entry0));
- int64_t hnd1 = reg.Allocate(SharedPointer<HandleRegistryEntry>(entry1));
- int64_t hnd2 = reg.Allocate(SharedPointer<HandleRegistryEntry>(entry2));
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == entry0);
- BOOST_REQUIRE(!probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == entry1);
- BOOST_REQUIRE(!probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == entry2);
- BOOST_REQUIRE(!probe2.deleted);
-
- reg.Release(hnd0);
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == NULL);
- BOOST_REQUIRE(probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == entry1);
- BOOST_REQUIRE(!probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == entry2);
- BOOST_REQUIRE(!probe2.deleted);
-
- reg.Close();
-
- BOOST_REQUIRE(reg.Get(hnd0).Get() == NULL);
- BOOST_REQUIRE(probe0.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd1).Get() == NULL);
- BOOST_REQUIRE(probe1.deleted);
-
- BOOST_REQUIRE(reg.Get(hnd2).Get() == NULL);
- BOOST_REQUIRE(probe2.deleted);
-
- HandleRegistry closedReg(0, 2);
-
- closedReg.Close();
-
- HandleRegistryTestProbe closedProbe;
- HandleRegistryTestEntry* closedEntry = new HandleRegistryTestEntry(&closedProbe);
-
- int64_t closedHnd = closedReg.Allocate(SharedPointer<HandleRegistryEntry>(closedEntry));
- BOOST_REQUIRE(closedHnd == -1);
- BOOST_REQUIRE(closedProbe.deleted);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp b/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
deleted file mode 100644
index e0e26d3..0000000
--- a/modules/platform/src/main/cpp/core-test/src/ignition_test.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/ignite.h"
-#include "ignite/ignition.h"
-
-using namespace ignite;
-using namespace boost::unit_test;
-
-BOOST_AUTO_TEST_SUITE(IgnitionTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestIgnition)
-{
- IgniteConfiguration cfg;
-
- IgniteJvmOption opts[5];
-
- opts[0] = IgniteJvmOption("-Xdebug");
- opts[1] = IgniteJvmOption("-Xnoagent");
- opts[2] = IgniteJvmOption("-Djava.compiler=NONE");
- opts[3] = IgniteJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
- opts[4] = IgniteJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
-
- cfg.jvmOptsLen = 5;
- cfg.jvmOpts = opts;
-
-#ifdef IGNITE_TESTS_32
- cfg.jvmInitMem = 256;
- cfg.jvmMaxMem = 768;
-#else
- cfg.jvmInitMem = 1024;
- cfg.jvmMaxMem = 4096;
-#endif
-
- char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
- std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-test.xml");
-
- cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
-
- IgniteError err;
-
- // Start two Ignite instances.
- Ignite grid1 = Ignition::Start(cfg, "ignitionTest-1", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid1.GetName(), "ignitionTest-1") == 0);
-
- Ignite grid2 = Ignition::Start(cfg, "ignitionTest-2", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid2.GetName(), "ignitionTest-2") == 0);
-
- // Test get
- Ignite grid0 = Ignition::Get("ignitionTest-1", &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- BOOST_REQUIRE(strcmp(grid0.GetName(), grid1.GetName()) == 0);
-
- // Stop one grid
- Ignition::Stop(grid1.GetName(), true);
-
- Ignition::Get("ignitionTest-1", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
-
- Ignition::Get("ignitionTest-2", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_SUCCESS);
-
- // Stop all
- Ignition::StopAll(true);
-
- Ignition::Get("ignitionTest-2", &err);
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_raw_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_raw_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_raw_test.cpp
deleted file mode 100644
index c3a98aa..0000000
--- a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_raw_test.cpp
+++ /dev/null
@@ -1,1532 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/portable/portable.h"
-
-#include "ignite/portable_test_defs.h"
-#include "ignite/portable_test_utils.h"
-
-using namespace ignite;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-using namespace ignite_test::core::portable;
-
-template<typename T>
-void CheckRawPrimitive(T val)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- Write<T>(rawWriter, val);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- T readVal = Read<T>(rawReader);
-
- BOOST_REQUIRE(readVal == val);
-}
-
-template<typename T>
-void CheckRawPrimitiveArray(T dflt, T val1, T val2)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- // 1. Write NULL and see what happens.
- WriteArray<T>(rawWriter, NULL, 0);
-
- out.Synchronize();
- in.Synchronize();
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 0) == -1);
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 2) == -1);
-
- T arr1[2];
- arr1[0] = dflt;
- arr1[1] = dflt;
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 1) == -1);
-
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- // 2. Write empty array.
- T arr2[2];
- arr2[0] = val1;
- arr2[1] = val2;
-
- out.Position(0);
- in.Position(0);
-
- WriteArray<T>(rawWriter, arr2, 0);
-
- out.Synchronize();
- in.Synchronize();
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 0) == 0);
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 2) == 0);
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 0) == 0);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 2) == 0);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- // 3. Partial array write.
- out.Position(0);
- in.Position(0);
-
- WriteArray<T>(rawWriter, arr2, 1);
-
- out.Synchronize();
- in.Synchronize();
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 0) == 1);
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 2) == 1);
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 0) == 1);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 1) == 1);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == dflt);
- arr1[0] = dflt;
-
- in.Position(0);
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 2) == 1);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == dflt);
- arr1[0] = dflt;
-
- // 4. Full array write.
- out.Position(0);
- in.Position(0);
-
- WriteArray<T>(rawWriter, arr2, 2);
-
- out.Synchronize();
- in.Synchronize();
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 0) == 2);
- BOOST_REQUIRE(ReadArray<T>(rawReader, NULL, 2) == 2);
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 0) == 2);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 1) == 2);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- BOOST_REQUIRE(ReadArray<T>(rawReader, arr1, 2) == 2);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == val2);
-}
-
-void CheckRawWritesRestricted(PortableRawWriter& writer)
-{
- try
- {
- writer.WriteInt8(1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- int8_t arr[1];
-
- writer.WriteInt8Array(arr, 1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- Guid val(1, 1);
-
- writer.WriteGuid(val);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteString("test");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteArray<int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteCollection<int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteMap<int8_t, int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-}
-
-void CheckRawReadsRestricted(PortableRawReader& reader)
-{
- try
- {
- reader.ReadInt8();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- int8_t arr[1];
-
- reader.ReadInt8Array(arr, 1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadGuid();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadString();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadArray<int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadCollection<int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadMap<int8_t, int8_t>();
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-}
-
-void CheckRawCollectionEmpty(CollectionType* colType)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableCollectionWriter<PortableInner> colWriter = colType ?
- rawWriter.WriteCollection<PortableInner>(*colType) : rawWriter.WriteCollection<PortableInner>();
-
- CheckRawWritesRestricted(rawWriter);
-
- colWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- colWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- colWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableCollectionReader<PortableInner> colReader = rawReader.ReadCollection<PortableInner>();
-
- if (colType)
- BOOST_REQUIRE(colReader.GetType() == *colType);
- else
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
-
- BOOST_REQUIRE(colReader.GetSize() == 0);
- BOOST_REQUIRE(!colReader.HasNext());
- BOOST_REQUIRE(!colReader.IsNull());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-void CheckRawCollection(CollectionType* colType)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableCollectionWriter<PortableInner> colWriter = colType ?
- rawWriter.WriteCollection<PortableInner>(*colType) : rawWriter.WriteCollection<PortableInner>();
-
- colWriter.Write(writeVal1);
- colWriter.Write(writeVal2);
- colWriter.Write(writeVal3);
-
- CheckRawWritesRestricted(rawWriter);
-
- colWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- colWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- colWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableCollectionReader<PortableInner> colReader = rawReader.ReadCollection<PortableInner>();
-
- CheckRawReadsRestricted(rawReader);
-
- if (colType)
- BOOST_REQUIRE(colReader.GetType() == *colType);
- else
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
-
- BOOST_REQUIRE(colReader.GetSize() == 3);
- BOOST_REQUIRE(!colReader.IsNull());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal1.GetValue());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal2.GetValue());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!colReader.HasNext());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-void CheckRawMapEmpty(MapType* mapType)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
- rawWriter.WriteMap<int8_t, PortableInner>(*mapType) : rawWriter.WriteMap<int8_t, PortableInner>();
-
- CheckRawWritesRestricted(rawWriter);
-
- mapWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- mapWriter.Write(1, PortableInner(1));
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- mapWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableMapReader<int8_t, PortableInner> mapReader = rawReader.ReadMap<int8_t, PortableInner>();
-
- if (mapType)
- BOOST_REQUIRE(mapReader.GetType() == *mapType);
- else
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
-
- BOOST_REQUIRE(mapReader.GetSize() == 0);
- BOOST_REQUIRE(!mapReader.HasNext());
- BOOST_REQUIRE(!mapReader.IsNull());
-
- try
- {
- int8_t key;
- PortableInner val;
-
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-void CheckRawMap(MapType* mapType)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
- rawWriter.WriteMap<int8_t, PortableInner>(*mapType) : rawWriter.WriteMap<int8_t, PortableInner>();
-
- mapWriter.Write(1, writeVal1);
- mapWriter.Write(2, writeVal2);
- mapWriter.Write(3, writeVal3);
-
- CheckRawWritesRestricted(rawWriter);
-
- mapWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- mapWriter.Write(4, PortableInner(4));
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- mapWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableMapReader<int8_t, PortableInner> mapReader = rawReader.ReadMap<int8_t, PortableInner>();
-
- CheckRawReadsRestricted(rawReader);
-
- if (mapType)
- BOOST_REQUIRE(mapReader.GetType() == *mapType);
- else
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
-
- BOOST_REQUIRE(mapReader.GetSize() == 3);
- BOOST_REQUIRE(!mapReader.IsNull());
-
- int8_t key;
- PortableInner val;
-
- BOOST_REQUIRE(mapReader.HasNext());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 1);
- BOOST_REQUIRE(val.GetValue() == writeVal1.GetValue());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 2);
- BOOST_REQUIRE(val.GetValue() == writeVal2.GetValue());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 3);
- BOOST_REQUIRE(val.GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!mapReader.HasNext());
-
- try
- {
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_SUITE(PortableReaderWriterRawTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt8)
-{
- CheckRawPrimitive<int8_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveBool)
-{
- CheckRawPrimitive<bool>(true);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt16)
-{
- CheckRawPrimitive<int16_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveUInt16)
-{
- CheckRawPrimitive<uint16_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt32)
-{
- CheckRawPrimitive<int32_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt64)
-{
- CheckRawPrimitive<int64_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveFloat)
-{
- CheckRawPrimitive<float>(1.1f);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveDouble)
-{
- CheckRawPrimitive<double>(1.1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveGuid)
-{
- Guid val(1, 2);
-
- CheckRawPrimitive<Guid>(val);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8)
-{
- CheckRawPrimitiveArray<int8_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayBool)
-{
- CheckRawPrimitiveArray<bool>(false, true, false);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt16)
-{
- CheckRawPrimitiveArray<int16_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayUInt16)
-{
- CheckRawPrimitiveArray<uint16_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt32)
-{
- CheckRawPrimitiveArray<int32_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt64)
-{
- CheckRawPrimitiveArray<int64_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayFloat)
-{
- CheckRawPrimitiveArray<float>(1.1f, 2.2f, 3.3f);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDouble)
-{
- CheckRawPrimitiveArray<double>(1.1, 2.2, 3.3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid)
-{
- Guid dflt(1, 2);
- Guid val1(3, 4);
- Guid val2(5, 6);
-
- CheckRawPrimitiveArray<Guid>(dflt, val1, val2);
-}
-
-BOOST_AUTO_TEST_CASE(TestGuidNull)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteNull();
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- Guid expVal;
- Guid actualVal = rawReader.ReadGuid();
-
- BOOST_REQUIRE(actualVal == expVal);
-}
-
-BOOST_AUTO_TEST_CASE(TestString) {
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- const char* writeVal1 = "testtest";
- const char* writeVal2 = "test";
- std::string writeVal3 = writeVal1;
-
- rawWriter.WriteString(writeVal1);
- rawWriter.WriteString(writeVal1, 4);
- rawWriter.WriteString(writeVal3);
- rawWriter.WriteString(NULL);
- rawWriter.WriteString(NULL, 4);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- char readVal1[9];
- char readVal2[5];
-
- BOOST_REQUIRE(rawReader.ReadString(NULL, 0) == 8);
- BOOST_REQUIRE(rawReader.ReadString(NULL, 8) == 8);
- BOOST_REQUIRE(rawReader.ReadString(readVal1, 0) == 8);
- BOOST_REQUIRE(rawReader.ReadString(readVal1, 4) == 8);
-
- BOOST_REQUIRE(rawReader.ReadString(readVal1, 9) == 8);
- std::string writeVal1Str = writeVal1;
- std::string readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- BOOST_REQUIRE(rawReader.ReadString(readVal2, 5) == 4);
- std::string writeVal2Str = writeVal2;
- std::string readVal2Str = readVal2;
- BOOST_REQUIRE(readVal2Str.compare(writeVal2Str) == 0);
-
- std::string readVal3 = rawReader.ReadString();
- BOOST_REQUIRE(readVal3.compare(writeVal3) == 0);
-
- BOOST_REQUIRE(rawReader.ReadString(readVal1, 9) == -1);
- BOOST_REQUIRE(rawReader.ReadString(readVal1, 9) == -1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArrayNull)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteNull();
- rawWriter.WriteInt8(1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableStringArrayReader arrReader = rawReader.ReadStringArray();
-
- BOOST_REQUIRE(arrReader.GetSize() == -1);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(arrReader.IsNull());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableStringArrayWriter arrWriter = rawWriter.WriteStringArray();
-
- CheckRawWritesRestricted(rawWriter);
-
- arrWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val, 4);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- std::string val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableStringArrayReader arrReader = rawReader.ReadStringArray();
-
- BOOST_REQUIRE(arrReader.GetSize() == 0);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(!arrReader.IsNull());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArray)
-{
- const char* writeVal1 = "testtest";
- const char* writeVal2 = "test";
- std::string writeVal3 = "test2";
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableStringArrayWriter arrWriter = rawWriter.WriteStringArray();
-
- arrWriter.Write(writeVal1);
- arrWriter.Write(writeVal1, 4);
- arrWriter.Write(NULL); // NULL value.
- arrWriter.Write(NULL, 100); // NULL value again.
- arrWriter.Write(writeVal3);
-
- CheckRawWritesRestricted(rawWriter);
-
- arrWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val, 4);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- std::string val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableStringArrayReader arrReader = rawReader.ReadStringArray();
-
- CheckRawReadsRestricted(rawReader);
-
- BOOST_REQUIRE(arrReader.GetSize() == 5);
- BOOST_REQUIRE(!arrReader.IsNull());
-
- // 1. Read first value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- char readVal1[9];
-
- BOOST_REQUIRE(arrReader.GetNext(NULL, 0) == 8);
- BOOST_REQUIRE(arrReader.GetNext(NULL, 8) == 8);
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 0) == 8);
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 4) == 8);
-
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 9) == 8);
- std::string writeVal1Str = writeVal1;
- std::string readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- // 2. Read second value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- char readVal2[5];
-
- BOOST_REQUIRE(arrReader.GetNext(readVal2, 5) == 4);
- std::string writeVal2Str = writeVal2;
- std::string readVal2Str = readVal2;
- BOOST_REQUIRE(readVal2Str.compare(writeVal2Str) == 0);
-
- // 3. Read NULL.
- BOOST_REQUIRE(arrReader.HasNext());
-
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 4) == -1);
- readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- // 4. Read NULL again, this time through another method.
- BOOST_REQUIRE(arrReader.HasNext());
-
- std::string readNullVal = arrReader.GetNext();
-
- BOOST_REQUIRE(readNullVal.length() == 0);
-
- // 5. Read third value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- std::string readVal3 = arrReader.GetNext();
- BOOST_REQUIRE(readVal3.compare(writeVal3) == 0);
-
- BOOST_REQUIRE(!arrReader.HasNext());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestObject)
-{
- PortableInner writeVal1(1);
- PortableInner writeVal2(0);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteObject(writeVal1);
- rawWriter.WriteObject(writeVal2);
- rawWriter.WriteNull();
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableInner readVal1 = rawReader.ReadObject<PortableInner>();
- BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
-
- PortableInner readVal2 = rawReader.ReadObject<PortableInner>();
- BOOST_REQUIRE(writeVal2.GetValue() == readVal2.GetValue());
-
- PortableInner readVal3 = rawReader.ReadObject<PortableInner>();
- BOOST_REQUIRE(0 == readVal3.GetValue());
-}
-
-BOOST_AUTO_TEST_CASE(TestNestedObject)
-{
- PortableOuter writeVal1(1, 2);
- PortableOuter writeVal2(0, 0);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteObject(writeVal1);
- rawWriter.WriteObject(writeVal2);
- rawWriter.WriteNull();
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableOuter readVal1 = rawReader.ReadObject<PortableOuter>();
- BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
- BOOST_REQUIRE(writeVal1.GetInner().GetValue() == readVal1.GetInner().GetValue());
-
- PortableOuter readVal2 = rawReader.ReadObject<PortableOuter>();
- BOOST_REQUIRE(writeVal2.GetValue() == readVal2.GetValue());
- BOOST_REQUIRE(writeVal2.GetInner().GetValue() == readVal2.GetInner().GetValue());
-
- PortableOuter readVal3 = rawReader.ReadObject<PortableOuter>();
- BOOST_REQUIRE(0 == readVal3.GetValue());
- BOOST_REQUIRE(0 == readVal3.GetInner().GetValue());
-}
-
-BOOST_AUTO_TEST_CASE(TestArrayNull)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteNull();
- rawWriter.WriteInt8(1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableArrayReader<PortableInner> arrReader = rawReader.ReadArray<PortableInner>();
-
- BOOST_REQUIRE(arrReader.GetSize() == -1);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(arrReader.IsNull());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestArrayEmpty)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableArrayWriter<PortableInner> arrWriter = rawWriter.WriteArray<PortableInner>();
-
- CheckRawWritesRestricted(rawWriter);
-
- arrWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- arrWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableArrayReader<PortableInner> arrReader = rawReader.ReadArray<PortableInner>();
-
- BOOST_REQUIRE(arrReader.GetSize() == 0);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(!arrReader.IsNull());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestArray)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- PortableArrayWriter<PortableInner> arrWriter = rawWriter.WriteArray<PortableInner>();
-
- arrWriter.Write(writeVal1);
- arrWriter.Write(writeVal2);
- arrWriter.Write(writeVal3);
-
- CheckRawWritesRestricted(rawWriter);
-
- arrWriter.Close();
-
- rawWriter.WriteInt8(1);
-
- try
- {
- arrWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableArrayReader<PortableInner> arrReader = rawReader.ReadArray<PortableInner>();
-
- CheckRawReadsRestricted(rawReader);
-
- BOOST_REQUIRE(arrReader.GetSize() == 3);
- BOOST_REQUIRE(!arrReader.IsNull());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal1.GetValue());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal2.GetValue());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!arrReader.HasNext());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionNull)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteNull();
- rawWriter.WriteInt8(1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableCollectionReader<PortableInner> colReader = rawReader.ReadCollection<PortableInner>();
-
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
- BOOST_REQUIRE(colReader.GetSize() == -1);
- BOOST_REQUIRE(!colReader.HasNext());
- BOOST_REQUIRE(colReader.IsNull());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionEmpty)
-{
- CheckRawCollectionEmpty(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionEmptyTyped)
-{
- CollectionType typ = IGNITE_COLLECTION_CONCURRENT_SKIP_LIST_SET;
-
- CheckRawCollectionEmpty(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollection)
-{
- CheckRawCollection(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(testCollectionTyped)
-{
- CollectionType typ = IGNITE_COLLECTION_CONCURRENT_SKIP_LIST_SET;
-
- CheckRawCollection(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapNull)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- rawWriter.WriteNull();
- rawWriter.WriteInt8(1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- PortableRawReader rawReader(&reader);
-
- PortableMapReader<int8_t, PortableInner> mapReader = rawReader.ReadMap<int8_t, PortableInner>();
-
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
- BOOST_REQUIRE(mapReader.GetSize() == -1);
- BOOST_REQUIRE(!mapReader.HasNext());
- BOOST_REQUIRE(mapReader.IsNull());
-
- try
- {
- int8_t key;
- PortableInner val;
-
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapEmpty)
-{
- CheckRawMapEmpty(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapEmptyTyped)
-{
- MapType typ = IGNITE_MAP_CONCURRENT_HASH_MAP;
-
- CheckRawMapEmpty(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestMap)
-{
- CheckRawMap(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapTyped)
-{
- MapType typ = IGNITE_MAP_CONCURRENT_HASH_MAP;
-
- CheckRawMap(&typ);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
[17/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
deleted file mode 100644
index c44a0a4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableWriterImpl.cs
+++ /dev/null
@@ -1,1305 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Portable.Metadata;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable writer implementation.
- /// </summary>
- internal class PortableWriterImpl : IPortableWriter, IPortableRawWriter
- {
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Stream. */
- private readonly IPortableStream _stream;
-
- /** Builder (used only during build). */
- private PortableBuilderImpl _builder;
-
- /** Handles. */
- private PortableHandleDictionary<object, long> _hnds;
-
- /** Metadatas collected during this write session. */
- private IDictionary<int, IPortableMetadata> _metas;
-
- /** Current type ID. */
- private int _curTypeId;
-
- /** Current name converter */
- private IPortableNameMapper _curConverter;
-
- /** Current mapper. */
- private IPortableIdMapper _curMapper;
-
- /** Current metadata handler. */
- private IPortableMetadataHandler _curMetaHnd;
-
- /** Current raw flag. */
- private bool _curRaw;
-
- /** Current raw position. */
- private long _curRawPos;
-
- /** Ignore handles flag. */
- private bool _detach;
-
- /** Object started ignore mode. */
- private bool _detachMode;
-
- /// <summary>
- /// Gets the marshaller.
- /// </summary>
- internal PortableMarshaller Marshaller
- {
- get { return _marsh; }
- }
-
- /// <summary>
- /// Write named boolean value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Boolean value.</param>
- public void WriteBoolean(string fieldName, bool val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeBool, val, PortableSystemHandlers.WriteHndBoolTyped, 1);
- }
-
- /// <summary>
- /// Write boolean value.
- /// </summary>
- /// <param name="val">Boolean value.</param>
- public void WriteBoolean(bool val)
- {
- _stream.WriteBool(val);
- }
-
- /// <summary>
- /// Write named boolean array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Boolean array.</param>
- public void WriteBooleanArray(string fieldName, bool[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayBool, val,
- PortableSystemHandlers.WriteHndBoolArrayTyped, val != null ? val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write boolean array.
- /// </summary>
- /// <param name="val">Boolean array.</param>
- public void WriteBooleanArray(bool[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndBoolArrayTyped);
- }
-
- /// <summary>
- /// Write named byte value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Byte value.</param>
- public void WriteByte(string fieldName, byte val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeByte, val, PortableSystemHandlers.WriteHndByteTyped, 1);
- }
-
- /// <summary>
- /// Write byte value.
- /// </summary>
- /// <param name="val">Byte value.</param>
- public void WriteByte(byte val)
- {
- _stream.WriteByte(val);
- }
-
- /// <summary>
- /// Write named byte array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Byte array.</param>
- public void WriteByteArray(string fieldName, byte[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayByte, val,
- PortableSystemHandlers.WriteHndByteArrayTyped, val != null ? val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write byte array.
- /// </summary>
- /// <param name="val">Byte array.</param>
- public void WriteByteArray(byte[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndByteArrayTyped);
- }
-
- /// <summary>
- /// Write named short value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Short value.</param>
- public void WriteShort(string fieldName, short val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeShort, val, PortableSystemHandlers.WriteHndShortTyped, 2);
- }
-
- /// <summary>
- /// Write short value.
- /// </summary>
- /// <param name="val">Short value.</param>
- public void WriteShort(short val)
- {
- _stream.WriteShort(val);
- }
-
- /// <summary>
- /// Write named short array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Short array.</param>
- public void WriteShortArray(string fieldName, short[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayShort, val,
- PortableSystemHandlers.WriteHndShortArrayTyped, val != null ? 2 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write short array.
- /// </summary>
- /// <param name="val">Short array.</param>
- public void WriteShortArray(short[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndShortArrayTyped);
- }
-
- /// <summary>
- /// Write named char value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Char value.</param>
- public void WriteChar(string fieldName, char val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeChar, val, PortableSystemHandlers.WriteHndCharTyped, 2);
- }
-
- /// <summary>
- /// Write char value.
- /// </summary>
- /// <param name="val">Char value.</param>
- public void WriteChar(char val)
- {
- _stream.WriteChar(val);
- }
-
- /// <summary>
- /// Write named char array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Char array.</param>
- public void WriteCharArray(string fieldName, char[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayChar, val,
- PortableSystemHandlers.WriteHndCharArrayTyped, val != null ? 2 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write char array.
- /// </summary>
- /// <param name="val">Char array.</param>
- public void WriteCharArray(char[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndCharArrayTyped);
- }
-
- /// <summary>
- /// Write named int value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Int value.</param>
- public void WriteInt(string fieldName, int val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeInt, val, PortableSystemHandlers.WriteHndIntTyped, 4);
- }
-
- /// <summary>
- /// Write int value.
- /// </summary>
- /// <param name="val">Int value.</param>
- public void WriteInt(int val)
- {
- _stream.WriteInt(val);
- }
-
- /// <summary>
- /// Write named int array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Int array.</param>
- public void WriteIntArray(string fieldName, int[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayInt, val,
- PortableSystemHandlers.WriteHndIntArrayTyped, val != null ? 4 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write int array.
- /// </summary>
- /// <param name="val">Int array.</param>
- public void WriteIntArray(int[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndIntArrayTyped);
- }
-
- /// <summary>
- /// Write named long value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Long value.</param>
- public void WriteLong(string fieldName, long val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeLong, val, PortableSystemHandlers.WriteHndLongTyped, 8);
- }
-
- /// <summary>
- /// Write long value.
- /// </summary>
- /// <param name="val">Long value.</param>
- public void WriteLong(long val)
- {
- _stream.WriteLong(val);
- }
-
- /// <summary>
- /// Write named long array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Long array.</param>
- public void WriteLongArray(string fieldName, long[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayLong, val,
- PortableSystemHandlers.WriteHndLongArrayTyped, val != null ? 8 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write long array.
- /// </summary>
- /// <param name="val">Long array.</param>
- public void WriteLongArray(long[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndLongArrayTyped);
- }
-
- /// <summary>
- /// Write named float value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Float value.</param>
- public void WriteFloat(string fieldName, float val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeFloat, val, PortableSystemHandlers.WriteHndFloatTyped, 4);
- }
-
- /// <summary>
- /// Write float value.
- /// </summary>
- /// <param name="val">Float value.</param>
- public void WriteFloat(float val)
- {
- _stream.WriteFloat(val);
- }
-
- /// <summary>
- /// Write named float array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Float array.</param>
- public void WriteFloatArray(string fieldName, float[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayFloat, val,
- PortableSystemHandlers.WriteHndFloatArrayTyped, val != null ? 4 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write float array.
- /// </summary>
- /// <param name="val">Float array.</param>
- public void WriteFloatArray(float[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndFloatArrayTyped);
- }
-
- /// <summary>
- /// Write named double value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Double value.</param>
- public void WriteDouble(string fieldName, double val)
- {
- WriteSimpleField(fieldName, PortableUtils.TypeDouble, val, PortableSystemHandlers.WriteHndDoubleTyped, 8);
- }
-
- /// <summary>
- /// Write double value.
- /// </summary>
- /// <param name="val">Double value.</param>
- public void WriteDouble(double val)
- {
- _stream.WriteDouble(val);
- }
-
- /// <summary>
- /// Write named double array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Double array.</param>
- public void WriteDoubleArray(string fieldName, double[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayDouble, val,
- PortableSystemHandlers.WriteHndDoubleArrayTyped, val != null ? 8 * val.Length + 4 : 0);
- }
-
- /// <summary>
- /// Write double array.
- /// </summary>
- /// <param name="val">Double array.</param>
- public void WriteDoubleArray(double[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndDoubleArrayTyped);
- }
-
- /// <summary>
- /// Write named decimal value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Decimal value.</param>
- public void WriteDecimal(string fieldName, decimal val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeDecimal, val, PortableSystemHandlers.WriteHndDecimalTyped);
- }
-
- /// <summary>
- /// Write decimal value.
- /// </summary>
- /// <param name="val">Decimal value.</param>
- public void WriteDecimal(decimal val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndDecimalTyped);
- }
-
- /// <summary>
- /// Write named decimal array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Decimal array.</param>
- public void WriteDecimalArray(string fieldName, decimal[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayDecimal, val,
- PortableSystemHandlers.WriteHndDecimalArrayTyped);
- }
-
- /// <summary>
- /// Write decimal array.
- /// </summary>
- /// <param name="val">Decimal array.</param>
- public void WriteDecimalArray(decimal[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndDecimalArrayTyped);
- }
-
- /// <summary>
- /// Write named date value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Date value.</param>
- public void WriteDate(string fieldName, DateTime? val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeDate, val, PortableSystemHandlers.WriteHndDateTyped,
- val.HasValue ? 12 : 0);
- }
-
- /// <summary>
- /// Write date value.
- /// </summary>
- /// <param name="val">Date value.</param>
- public void WriteDate(DateTime? val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndDateTyped);
- }
-
- /// <summary>
- /// Write named date array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Date array.</param>
- public void WriteDateArray(string fieldName, DateTime?[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayDate, val,
- PortableSystemHandlers.WriteHndDateArrayTyped);
- }
-
- /// <summary>
- /// Write date array.
- /// </summary>
- /// <param name="val">Date array.</param>
- public void WriteDateArray(DateTime?[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndDateArrayTyped);
- }
-
- /// <summary>
- /// Write named string value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">String value.</param>
- public void WriteString(string fieldName, string val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeString, val, PortableSystemHandlers.WriteHndStringTyped);
- }
-
- /// <summary>
- /// Write string value.
- /// </summary>
- /// <param name="val">String value.</param>
- public void WriteString(string val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndStringTyped);
- }
-
- /// <summary>
- /// Write named string array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">String array.</param>
- public void WriteStringArray(string fieldName, string[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayString, val,
- PortableSystemHandlers.WriteHndStringArrayTyped);
- }
-
- /// <summary>
- /// Write string array.
- /// </summary>
- /// <param name="val">String array.</param>
- public void WriteStringArray(string[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndStringArrayTyped);
- }
-
- /// <summary>
- /// Write named GUID value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">GUID value.</param>
- public void WriteGuid(string fieldName, Guid? val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeGuid, val, PortableSystemHandlers.WriteHndGuidTyped,
- val.HasValue ? 16 : 0);
- }
-
- /// <summary>
- /// Write GUID value.
- /// </summary>
- /// <param name="val">GUID value.</param>
- public void WriteGuid(Guid? val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndGuidTyped);
- }
-
- /// <summary>
- /// Write named GUID array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">GUID array.</param>
- public void WriteGuidArray(string fieldName, Guid?[] val)
- {
- WriteSimpleNullableField(fieldName, PortableUtils.TypeArrayGuid, val,
- PortableSystemHandlers.WriteHndGuidArrayTyped);
- }
-
- /// <summary>
- /// Write GUID array.
- /// </summary>
- /// <param name="val">GUID array.</param>
- public void WriteGuidArray(Guid?[] val)
- {
- WriteSimpleNullableRawField(val, PortableSystemHandlers.WriteHndGuidArrayTyped);
- }
-
- /// <summary>
- /// Write named enum value.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Enum value.</param>
- public void WriteEnum<T>(string fieldName, T val)
- {
- WriteField(fieldName, PortableUtils.TypeEnum, val, PortableSystemHandlers.WriteHndEnum);
- }
-
- /// <summary>
- /// Write enum value.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="val">Enum value.</param>
- public void WriteEnum<T>(T val)
- {
- Write(val, PortableSystemHandlers.WriteHndEnum);
- }
-
- /// <summary>
- /// Write named enum array.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Enum array.</param>
- public void WriteEnumArray<T>(string fieldName, T[] val)
- {
- WriteField(fieldName, PortableUtils.TypeArrayEnum, val, PortableSystemHandlers.WriteHndEnumArray);
- }
-
- /// <summary>
- /// Write enum array.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="val">Enum array.</param>
- public void WriteEnumArray<T>(T[] val)
- {
- Write(val, PortableSystemHandlers.WriteHndEnumArray);
- }
-
- /// <summary>
- /// Write named object value.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Object value.</param>
- public void WriteObject<T>(string fieldName, T val)
- {
- WriteField(fieldName, PortableUtils.TypeObject, val, null);
- }
-
- /// <summary>
- /// Write object value.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="val">Object value.</param>
- public void WriteObject<T>(T val)
- {
- Write(val);
- }
-
- /// <summary>
- /// Write named object array.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Object array.</param>
- public void WriteObjectArray<T>(string fieldName, T[] val)
- {
- WriteField(fieldName, PortableUtils.TypeArray, val, PortableSystemHandlers.WriteHndArray);
- }
-
- /// <summary>
- /// Write object array.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="val">Object array.</param>
- public void WriteObjectArray<T>(T[] val)
- {
- Write(val, PortableSystemHandlers.WriteHndArray);
- }
-
- /// <summary>
- /// Write named collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Collection.</param>
- public void WriteCollection(string fieldName, ICollection val)
- {
- WriteField(fieldName, PortableUtils.TypeCollection, val, null);
- }
-
- /// <summary>
- /// Write collection.
- /// </summary>
- /// <param name="val">Collection.</param>
- public void WriteCollection(ICollection val)
- {
- Write(val);
- }
-
- /// <summary>
- /// Write named generic collection.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Collection.</param>
- public void WriteGenericCollection<T>(string fieldName, ICollection<T> val)
- {
- WriteField(fieldName, PortableUtils.TypeCollection, val, null);
- }
-
- /// <summary>
- /// Write generic collection.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="val">Collection.</param>
- public void WriteGenericCollection<T>(ICollection<T> val)
- {
- Write(val);
- }
-
- /// <summary>
- /// Write named dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Dictionary.</param>
- public void WriteDictionary(string fieldName, IDictionary val)
- {
- WriteField(fieldName, PortableUtils.TypeDictionary, val, null);
- }
-
- /// <summary>
- /// Write dictionary.
- /// </summary>
- /// <param name="val">Dictionary.</param>
- public void WriteDictionary(IDictionary val)
- {
- Write(val);
- }
-
- /// <summary>
- /// Write named generic dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Dictionary.</param>
- public void WriteGenericDictionary<TK, TV>(string fieldName, IDictionary<TK, TV> val)
- {
- WriteField(fieldName, PortableUtils.TypeDictionary, val, null);
- }
-
- /// <summary>
- /// Write generic dictionary.
- /// </summary>
- /// <param name="val">Dictionary.</param>
- public void WriteGenericDictionary<TK, TV>(IDictionary<TK, TV> val)
- {
- Write(val);
- }
-
- /// <summary>
- /// Get raw writer.
- /// </summary>
- /// <returns>
- /// Raw writer.
- /// </returns>
- public IPortableRawWriter RawWriter()
- {
- if (!_curRaw)
- {
- _curRaw = true;
- _curRawPos = _stream.Position;
- }
-
- return this;
- }
-
- /// <summary>
- /// Set new builder.
- /// </summary>
- /// <param name="builder">Builder.</param>
- /// <returns>Previous builder.</returns>
- internal PortableBuilderImpl Builder(PortableBuilderImpl builder)
- {
- PortableBuilderImpl ret = _builder;
-
- _builder = builder;
-
- return ret;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="stream">Stream.</param>
- internal PortableWriterImpl(PortableMarshaller marsh, IPortableStream stream)
- {
- _marsh = marsh;
- _stream = stream;
- }
-
- /// <summary>
- /// Write object.
- /// </summary>
- /// <param name="obj">Object.</param>
- internal void Write<T>(T obj)
- {
- Write(obj, null);
- }
-
- /// <summary>
- /// Write object.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <param name="handler">Optional write handler.</param>
- [SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
- internal void Write<T>(T obj, object handler)
- {
- // Apply detach mode if needed.
- PortableHandleDictionary<object, long> oldHnds = null;
-
- bool resetDetach = false;
-
- if (_detach)
- {
- _detach = false;
- _detachMode = true;
- resetDetach = true;
-
- oldHnds = _hnds;
-
- _hnds = null;
- }
-
- try
- {
- // Write null.
- if (obj == null)
- {
- _stream.WriteByte(PortableUtils.HdrNull);
-
- return;
- }
-
- if (_builder != null)
- {
- // Special case for portable object during build.
- PortableUserObject portObj = obj as PortableUserObject;
-
- if (portObj != null)
- {
- if (!WriteHandle(_stream.Position, portObj))
- _builder.ProcessPortable(_stream, portObj);
-
- return;
- }
-
- // Special case for builder during build.
- PortableBuilderImpl portBuilder = obj as PortableBuilderImpl;
-
- if (portBuilder != null)
- {
- if (!WriteHandle(_stream.Position, portBuilder))
- _builder.ProcessBuilder(_stream, portBuilder);
-
- return;
- }
- }
-
- // Try writting as well-known type.
- if (InvokeHandler(handler, handler as PortableSystemWriteDelegate, obj))
- return;
-
- Type type = obj.GetType();
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(type);
-
- object typedHandler;
- PortableSystemWriteDelegate untypedHandler;
-
- if (desc == null)
- {
- typedHandler = null;
- untypedHandler = PortableSystemHandlers.WriteHandler(type);
- }
- else
- {
- typedHandler = desc.TypedHandler;
- untypedHandler = desc.UntypedHandler;
- }
-
- if (InvokeHandler(typedHandler, untypedHandler, obj))
- return;
-
- if (desc == null)
- {
- if (!type.IsSerializable)
- // If neither handler, nor descriptor exist, and not serializable, this is an exception.
- throw new PortableException("Unsupported object type [type=" + type +
- ", object=" + obj + ']');
-
- Write(new SerializableObjectHolder(obj));
-
- return;
- }
-
- int pos = _stream.Position;
-
- // Dealing with handles.
- if (!(desc.Serializer is IPortableSystemTypeSerializer) && WriteHandle(pos, obj))
- return;
-
- // Write header.
- _stream.WriteByte(PortableUtils.HdrFull);
-
- _stream.WriteBool(desc.UserType);
- _stream.WriteInt(desc.TypeId);
- _stream.WriteInt(obj.GetHashCode());
-
- // Skip length as it is not known in the first place.
- _stream.Seek(8, SeekOrigin.Current);
-
- // Preserve old frame.
- int oldTypeId = _curTypeId;
- IPortableNameMapper oldConverter = _curConverter;
- IPortableIdMapper oldMapper = _curMapper;
- IPortableMetadataHandler oldMetaHnd = _curMetaHnd;
- bool oldRaw = _curRaw;
- long oldRawPos = _curRawPos;
-
- // Push new frame.
- _curTypeId = desc.TypeId;
- _curConverter = desc.NameConverter;
- _curMapper = desc.Mapper;
- _curMetaHnd = desc.MetadataEnabled ? _marsh.MetadataHandler(desc) : null;
- _curRaw = false;
- _curRawPos = 0;
-
- // Write object fields.
- desc.Serializer.WritePortable(obj, this);
-
- // Calculate and write length.
- int retPos = _stream.Position;
-
- _stream.Seek(pos + 10, SeekOrigin.Begin);
-
- int len = retPos - pos;
-
- _stream.WriteInt(len);
-
- if (_curRawPos != 0)
- // When set, it is difference between object head and raw position.
- _stream.WriteInt((int)(_curRawPos - pos));
- else
- // When no set, it is equal to object length.
- _stream.WriteInt(len);
-
- _stream.Seek(retPos, SeekOrigin.Begin);
-
- // 13. Collect metadata.
- if (_curMetaHnd != null)
- {
- IDictionary<string, int> meta = _curMetaHnd.OnObjectWriteFinished();
-
- if (meta != null)
- SaveMetadata(_curTypeId, desc.TypeName, desc.AffinityKeyFieldName, meta);
- }
-
- // Restore old frame.
- _curTypeId = oldTypeId;
- _curConverter = oldConverter;
- _curMapper = oldMapper;
- _curMetaHnd = oldMetaHnd;
- _curRaw = oldRaw;
- _curRawPos = oldRawPos;
- }
- finally
- {
- // Restore handles if needed.
- if (resetDetach)
- {
- // Add newly recorded handles without overriding already existing ones.
- if (_hnds != null)
- {
- if (oldHnds == null)
- oldHnds = _hnds;
- else
- oldHnds.Merge(_hnds);
- }
-
- _hnds = oldHnds;
-
- _detachMode = false;
- }
- }
- }
-
- /// <summary>
- /// Add handle to handles map.
- /// </summary>
- /// <param name="pos">Position in stream.</param>
- /// <param name="obj">Object.</param>
- /// <returns><c>true</c> if object was written as handle.</returns>
- private bool WriteHandle(long pos, object obj)
- {
- if (_hnds == null)
- {
- // Cache absolute handle position.
- _hnds = new PortableHandleDictionary<object, long>(obj, pos);
-
- return false;
- }
-
- long hndPos;
-
- if (!_hnds.TryGetValue(obj, out hndPos))
- {
- // Cache absolute handle position.
- _hnds.Add(obj, pos);
-
- return false;
- }
-
- _stream.WriteByte(PortableUtils.HdrHnd);
-
- // Handle is written as difference between position before header and handle position.
- _stream.WriteInt((int)(pos - hndPos));
-
- return true;
- }
-
- /// <summary>
- /// Try invoking predefined handler on object.
- /// </summary>
- /// <param name="typedHandler">Handler</param>
- /// <param name="untypedHandler">Not typed handler.</param>
- /// <param name="obj">Object.</param>
- /// <returns>True if handler was called.</returns>
- private bool InvokeHandler<T>(object typedHandler, PortableSystemWriteDelegate untypedHandler, T obj)
- {
- var typedHandler0 = typedHandler as PortableSystemTypedWriteDelegate<T>;
-
- if (typedHandler0 != null)
- {
- typedHandler0.Invoke(_stream, obj);
-
- return true;
- }
-
- if (untypedHandler != null)
- {
- untypedHandler.Invoke(this, obj);
-
- return true;
- }
-
- return false;
- }
-
- /// <summary>
- /// Write simple field with known length.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- /// <param name="len">Length.</param>
- private void WriteSimpleField<T>(int fieldId, T val, PortableSystemTypedWriteDelegate<T> handler, int len)
- {
- CheckNotRaw();
-
- _stream.WriteInt(fieldId);
- _stream.WriteInt(1 + len); // Additional byte for field type.
-
- handler(_stream, val);
- }
-
- /// <summary>
- /// Write simple nullable field with unknown length.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- private void WriteSimpleNullableField<T>(int fieldId, T val, PortableSystemTypedWriteDelegate<T> handler)
- {
- CheckNotRaw();
-
- _stream.WriteInt(fieldId);
-
- if (val == null)
- {
- _stream.WriteInt(1);
-
- _stream.WriteByte(PortableUtils.HdrNull);
- }
- else
- {
- int pos = _stream.Position;
-
- _stream.Seek(4, SeekOrigin.Current);
-
- handler(_stream, val);
-
- WriteFieldLength(_stream, pos);
- }
- }
-
- /// <summary>
- /// Write simple nullable field with known length.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- /// <param name="len">Length.</param>
- private void WriteSimpleNullableField<T>(int fieldId, T val, PortableSystemTypedWriteDelegate<T> handler, int len)
- {
- CheckNotRaw();
-
- _stream.WriteInt(fieldId);
-
- if (val == null)
- {
- _stream.WriteInt(1);
-
- _stream.WriteByte(PortableUtils.HdrNull);
- }
- else
- {
- _stream.WriteInt(1 + len);
-
- handler(_stream, val);
- }
- }
-
- /// <summary>
- /// Write field.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- private void WriteField(int fieldId, object val, PortableSystemWriteDelegate handler)
- {
- CheckNotRaw();
-
- _stream.WriteInt(fieldId);
-
- int pos = _stream.Position;
-
- _stream.Seek(4, SeekOrigin.Current);
-
- Write(val, handler);
-
- WriteFieldLength(_stream, pos);
- }
-
- /// <summary>
- /// Enable detach mode for the next object.
- /// </summary>
- internal void DetachNext()
- {
- if (!_detachMode)
- _detach = true;
- }
-
- /// <summary>
- /// Stream.
- /// </summary>
- internal IPortableStream Stream
- {
- get { return _stream; }
- }
-
- /// <summary>
- /// Gets collected metadatas.
- /// </summary>
- /// <returns>Collected metadatas (if any).</returns>
- internal IDictionary<int, IPortableMetadata> Metadata()
- {
- return _metas;
- }
-
- /// <summary>
- /// Check whether the given object is portable, i.e. it can be
- /// serialized with portable marshaller.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <returns>True if portable.</returns>
- internal bool IsPortable(object obj)
- {
- if (obj != null)
- {
- Type type = obj.GetType();
-
- // We assume object as portable only in case it has descriptor.
- // Collections, Enums and non-primitive arrays do not have descriptors
- // and this is fine here because we cannot know whether their members
- // are portable.
- return _marsh.Descriptor(type) != null;
- }
-
- return true;
- }
-
- /// <summary>
- /// Write simple field with known length.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- /// <param name="len">Length.</param>
- private void WriteSimpleField<T>(string fieldName, byte typeId, T val,
- PortableSystemTypedWriteDelegate<T> handler, int len)
- {
- int fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- WriteSimpleField(fieldId, val, handler, len);
-
- if (_curMetaHnd != null)
- _curMetaHnd.OnFieldWrite(fieldId, fieldName, typeId);
- }
-
- /// <summary>
- /// Write simple nullable field with unknown length.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- private void WriteSimpleNullableField<T>(string fieldName, byte typeId, T val,
- PortableSystemTypedWriteDelegate<T> handler)
- {
- int fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- WriteSimpleNullableField(fieldId, val, handler);
-
- if (_curMetaHnd != null)
- _curMetaHnd.OnFieldWrite(fieldId, fieldName, typeId);
- }
-
- /// <summary>
- /// Write simple nullable field with known length.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- /// <param name="len">Length.</param>
- private void WriteSimpleNullableField<T>(string fieldName, byte typeId, T val,
- PortableSystemTypedWriteDelegate<T> handler, int len)
- {
- int fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- WriteSimpleNullableField(fieldId, val, handler, len);
-
- if (_curMetaHnd != null)
- _curMetaHnd.OnFieldWrite(fieldId, fieldName, typeId);
- }
-
- /// <summary>
- /// Write nullable raw field.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- private void WriteSimpleNullableRawField<T>(T val, PortableSystemTypedWriteDelegate<T> handler)
- {
- if (val == null)
- _stream.WriteByte(PortableUtils.HdrNull);
- else
- handler(_stream, val);
- }
-
- /// <summary>
- /// Write field.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="val">Value.</param>
- /// <param name="handler">Handler.</param>
- private void WriteField(string fieldName, byte typeId, object val,
- PortableSystemWriteDelegate handler)
- {
- int fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- WriteField(fieldId, val, handler);
-
- if (_curMetaHnd != null)
- _curMetaHnd.OnFieldWrite(fieldId, fieldName, typeId);
- }
-
- /// <summary>
- /// Write field length.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="pos">Position where length should reside</param>
- private static void WriteFieldLength(IPortableStream stream, int pos)
- {
- int retPos = stream.Position;
-
- stream.Seek(pos, SeekOrigin.Begin);
-
- stream.WriteInt(retPos - pos - 4);
-
- stream.Seek(retPos, SeekOrigin.Begin);
- }
-
- /// <summary>
- /// Ensure that we are not in raw mode.
- /// </summary>
- private void CheckNotRaw()
- {
- if (_curRaw)
- throw new PortableException("Cannot write named fields after raw data is written.");
- }
-
- /// <summary>
- /// Saves metadata for this session.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="affKeyFieldName">Affinity key field name.</param>
- /// <param name="fields">Fields metadata.</param>
- internal void SaveMetadata(int typeId, string typeName, string affKeyFieldName, IDictionary<string, int> fields)
- {
- if (_metas == null)
- {
- PortableMetadataImpl meta =
- new PortableMetadataImpl(typeId, typeName, fields, affKeyFieldName);
-
- _metas = new Dictionary<int, IPortableMetadata>(1);
-
- _metas[typeId] = meta;
- }
- else
- {
- IPortableMetadata meta;
-
- if (_metas.TryGetValue(typeId, out meta))
- {
- IDictionary<string, int> existingFields = ((PortableMetadataImpl)meta).FieldsMap();
-
- foreach (KeyValuePair<string, int> field in fields)
- {
- if (!existingFields.ContainsKey(field.Key))
- existingFields[field.Key] = field.Value;
- }
- }
- else
- _metas[typeId] = new PortableMetadataImpl(typeId, typeName, fields, affKeyFieldName);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortablesImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortablesImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortablesImpl.cs
deleted file mode 100644
index f769e3f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortablesImpl.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portables implementation.
- /// </summary>
- internal class PortablesImpl : IPortables
- {
- /** Owning grid. */
- private readonly PortableMarshaller _marsh;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- internal PortablesImpl(PortableMarshaller marsh)
- {
- _marsh = marsh;
- }
-
- /** <inheritDoc /> */
- public T ToPortable<T>(object obj)
- {
- if (obj is IPortableObject)
- return (T)obj;
-
- IPortableStream stream = new PortableHeapStream(1024);
-
- // Serialize.
- PortableWriterImpl writer = _marsh.StartMarshal(stream);
-
- try
- {
- writer.Write(obj);
- }
- finally
- {
- // Save metadata.
- _marsh.FinishMarshal(writer);
- }
-
- // Deserialize.
- stream.Seek(0, SeekOrigin.Begin);
-
- return _marsh.Unmarshal<T>(stream, PortableMode.ForcePortable);
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder GetBuilder(Type type)
- {
- IgniteArgumentCheck.NotNull(type, "type");
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(type);
-
- if (desc == null)
- throw new IgniteException("Type is not portable (add it to PortableConfiguration): " +
- type.FullName);
-
- return Builder0(null, PortableFromDescriptor(desc), desc);
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder GetBuilder(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(typeName);
-
- return Builder0(null, PortableFromDescriptor(desc), desc);
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder GetBuilder(IPortableObject obj)
- {
- IgniteArgumentCheck.NotNull(obj, "obj");
-
- PortableUserObject obj0 = obj as PortableUserObject;
-
- if (obj0 == null)
- throw new ArgumentException("Unsupported object type: " + obj.GetType());
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(true, obj0.TypeId);
-
- return Builder0(null, obj0, desc);
- }
-
- /** <inheritDoc /> */
- public int GetTypeId(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- return Marshaller.Descriptor(typeName).TypeId;
- }
-
- /** <inheritDoc /> */
- public ICollection<IPortableMetadata> GetMetadata()
- {
- return Marshaller.Ignite.ClusterGroup.Metadata();
- }
-
- /** <inheritDoc /> */
- public IPortableMetadata GetMetadata(int typeId)
- {
- return Marshaller.Metadata(typeId);
- }
-
- /** <inheritDoc /> */
- public IPortableMetadata GetMetadata(string typeName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(typeName, "typeName");
-
- return GetMetadata(GetTypeId(typeName));
- }
-
- /** <inheritDoc /> */
- public IPortableMetadata GetMetadata(Type type)
- {
- IgniteArgumentCheck.NotNull(type, "type");
-
- var desc = Marshaller.Descriptor(type);
-
- return desc == null ? null : Marshaller.Metadata(desc.TypeId);
- }
-
- /// <summary>
- /// Create child builder.
- /// </summary>
- /// <param name="parent">Parent builder.</param>
- /// <param name="obj">Portable object.</param>
- /// <returns></returns>
- internal PortableBuilderImpl ChildBuilder(PortableBuilderImpl parent, PortableUserObject obj)
- {
- IPortableTypeDescriptor desc = _marsh.Descriptor(true, obj.TypeId);
-
- return Builder0(null, obj, desc);
- }
-
- /// <summary>
- /// Marshaller.
- /// </summary>
- internal PortableMarshaller Marshaller
- {
- get
- {
- return _marsh;
- }
- }
-
- /// <summary>
- /// Create empty portable object from descriptor.
- /// </summary>
- /// <param name="desc">Descriptor.</param>
- /// <returns>Empty portable object.</returns>
- private PortableUserObject PortableFromDescriptor(IPortableTypeDescriptor desc)
- {
- PortableHeapStream stream = new PortableHeapStream(18);
-
- stream.WriteByte(PortableUtils.HdrFull);
- stream.WriteBool(true);
- stream.WriteInt(desc.TypeId);
- stream.WriteInt(0); // Hash.
- stream.WriteInt(PortableUtils.FullHdrLen); // Length.
- stream.WriteInt(PortableUtils.FullHdrLen); // Raw data offset.
-
- return new PortableUserObject(_marsh, stream.InternalArray, 0, desc.TypeId, 0);
- }
-
- /// <summary>
- /// Internal builder creation routine.
- /// </summary>
- /// <param name="parent">Parent builder.</param>
- /// <param name="obj">Portable object.</param>
- /// <param name="desc">Type descriptor.</param>
- /// <returns>Builder.</returns>
- private PortableBuilderImpl Builder0(PortableBuilderImpl parent, PortableUserObject obj,
- IPortableTypeDescriptor desc)
- {
- return new PortableBuilderImpl(this, parent, obj, desc);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/SerializableObjectHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/SerializableObjectHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/SerializableObjectHolder.cs
deleted file mode 100644
index a3a9fe7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/SerializableObjectHolder.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Wraps Serializable item in a portable.
- /// </summary>
- internal class SerializableObjectHolder : IPortableWriteAware
- {
- /** */
- private readonly object _item;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
- /// </summary>
- /// <param name="item">The item to wrap.</param>
- public SerializableObjectHolder(object item)
- {
- _item = item;
- }
-
- /// <summary>
- /// Gets the item to wrap.
- /// </summary>
- public object Item
- {
- get { return _item; }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
-
- PortableUtils.WriteSerializable(writer0, Item);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public SerializableObjectHolder(IPortableReader reader)
- {
- _item = PortableUtils.ReadSerializable<object>((PortableReaderImpl)reader.RawReader());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/TypeResolver.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/TypeResolver.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/TypeResolver.cs
deleted file mode 100644
index 0785f4a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/TypeResolver.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Reflection;
- using System.Text.RegularExpressions;
-
- /// <summary>
- /// Resolves types by name.
- /// </summary>
- internal class TypeResolver
- {
- /** Regex to parse generic types from portable configuration. Allows nested generics in type arguments. */
- private static readonly Regex GenericTypeRegex =
- new Regex(@"([^`,\[\]]*)(?:`[0-9]+)?(?:\[((?:(?<br>\[)|(?<-br>\])|[^\[\]]*)+)\])?", RegexOptions.Compiled);
-
- /** Assemblies loaded in ReflectionOnly mode. */
- private readonly Dictionary<string, Assembly> _reflectionOnlyAssemblies = new Dictionary<string, Assembly>();
-
- /// <summary>
- /// Resolve type by name.
- /// </summary>
- /// <param name="typeName">Name of the type.</param>
- /// <param name="assemblyName">Optional, name of the assembly.</param>
- /// <returns>
- /// Resolved type.
- /// </returns>
- public Type ResolveType(string typeName, string assemblyName = null)
- {
- Debug.Assert(!string.IsNullOrEmpty(typeName));
-
- return ResolveType(assemblyName, typeName, AppDomain.CurrentDomain.GetAssemblies())
- ?? ResolveTypeInReferencedAssemblies(assemblyName, typeName);
- }
-
- /// <summary>
- /// Resolve type by name in specified assembly set.
- /// </summary>
- /// <param name="assemblyName">Name of the assembly.</param>
- /// <param name="typeName">Name of the type.</param>
- /// <param name="assemblies">Assemblies to look in.</param>
- /// <returns>
- /// Resolved type.
- /// </returns>
- private static Type ResolveType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
- {
- return ResolveGenericType(assemblyName, typeName, assemblies) ??
- ResolveNonGenericType(assemblyName, typeName, assemblies);
- }
-
- /// <summary>
- /// Resolves non-generic type by searching provided assemblies.
- /// </summary>
- /// <param name="assemblyName">Name of the assembly.</param>
- /// <param name="typeName">Name of the type.</param>
- /// <param name="assemblies">The assemblies.</param>
- /// <returns>Resolved type, or null.</returns>
- private static Type ResolveNonGenericType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
- {
- if (!string.IsNullOrEmpty(assemblyName))
- assemblies = assemblies
- .Where(x => x.FullName == assemblyName || x.GetName().Name == assemblyName).ToArray();
-
- if (!assemblies.Any())
- return null;
-
- // Trim assembly qualification
- var commaIdx = typeName.IndexOf(',');
-
- if (commaIdx > 0)
- typeName = typeName.Substring(0, commaIdx);
-
- return assemblies.Select(a => a.GetType(typeName, false, false)).FirstOrDefault(type => type != null);
- }
-
- /// <summary>
- /// Resolves the name of the generic type by resolving each generic arg separately
- /// and substituting it's fully qualified name.
- /// (Assembly.GetType finds generic types only when arguments are fully qualified).
- /// </summary>
- /// <param name="assemblyName">Name of the assembly.</param>
- /// <param name="typeName">Name of the type.</param>
- /// <param name="assemblies">Assemblies</param>
- /// <returns>Fully qualified generic type name, or null if argument(s) could not be resolved.</returns>
- private static Type ResolveGenericType(string assemblyName, string typeName, ICollection<Assembly> assemblies)
- {
- var match = GenericTypeRegex.Match(typeName);
-
- if (!match.Success || !match.Groups[2].Success)
- return null;
-
- // Try to construct generic type; each generic arg can also be a generic type.
- var genericArgs = GenericTypeRegex.Matches(match.Groups[2].Value)
- .OfType<Match>().Select(m => m.Value).Where(v => !string.IsNullOrWhiteSpace(v))
- .Select(v => ResolveType(null, TrimBrackets(v), assemblies)).ToArray();
-
- if (genericArgs.Any(x => x == null))
- return null;
-
- var genericType = ResolveNonGenericType(assemblyName,
- string.Format("{0}`{1}", match.Groups[1].Value, genericArgs.Length), assemblies);
-
- if (genericType == null)
- return null;
-
- return genericType.MakeGenericType(genericArgs);
- }
-
- /// <summary>
- /// Trims the brackets from generic type arg.
- /// </summary>
- private static string TrimBrackets(string s)
- {
- return s.StartsWith("[") && s.EndsWith("]") ? s.Substring(1, s.Length - 2) : s;
- }
-
- /// <summary>
- /// Resolve type by name in non-loaded referenced assemblies.
- /// </summary>
- /// <param name="assemblyName">Name of the assembly.</param>
- /// <param name="typeName">Name of the type.</param>
- /// <returns>
- /// Resolved type.
- /// </returns>
- private Type ResolveTypeInReferencedAssemblies(string assemblyName, string typeName)
- {
- ResolveEventHandler resolver = (sender, args) => GetReflectionOnlyAssembly(args.Name);
-
- AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += resolver;
-
- try
- {
- var result = ResolveType(assemblyName, typeName, GetNotLoadedReferencedAssemblies().ToArray());
-
- if (result == null)
- return null;
-
- // result is from ReflectionOnly assembly, load it properly into current domain
- var asm = AppDomain.CurrentDomain.Load(result.Assembly.GetName());
-
- return asm.GetType(result.FullName);
- }
- finally
- {
- AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= resolver;
- }
- }
-
- /// <summary>
- /// Gets the reflection only assembly.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
- private Assembly GetReflectionOnlyAssembly(string fullName)
- {
- Assembly result;
-
- if (!_reflectionOnlyAssemblies.TryGetValue(fullName, out result))
- {
- try
- {
- result = Assembly.ReflectionOnlyLoad(fullName);
- }
- catch (Exception)
- {
- // Some assemblies may fail to load
- result = null;
- }
-
- _reflectionOnlyAssemblies[fullName] = result;
- }
-
- return result;
- }
-
- /// <summary>
- /// Recursively gets all referenced assemblies for current app domain, excluding those that are loaded.
- /// </summary>
- private IEnumerable<Assembly> GetNotLoadedReferencedAssemblies()
- {
- var roots = new Stack<Assembly>(AppDomain.CurrentDomain.GetAssemblies());
-
- var visited = new HashSet<string>();
-
- var loaded = new HashSet<string>(roots.Select(x => x.FullName));
-
- while (roots.Any())
- {
- var asm = roots.Pop();
-
- if (visited.Contains(asm.FullName))
- continue;
-
- if (!loaded.Contains(asm.FullName))
- yield return asm;
-
- visited.Add(asm.FullName);
-
- foreach (var refAsm in asm.GetReferencedAssemblies()
- .Where(x => !visited.Contains(x.FullName))
- .Where(x => !loaded.Contains(x.FullName))
- .Select(x => GetReflectionOnlyAssembly(x.FullName))
- .Where(x => x != null))
- roots.Push(refAsm);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/IResourceInjector.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/IResourceInjector.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/IResourceInjector.cs
deleted file mode 100644
index b751680..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/IResourceInjector.cs
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- /// <summary>
- /// Resource injector interface.
- /// </summary>
- internal interface IResourceInjector
- {
- void Inject(object target, object val);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceFieldInjector.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceFieldInjector.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceFieldInjector.cs
deleted file mode 100644
index d48db1f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceFieldInjector.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- using System;
- using System.Reflection;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Field resource injector.
- /// </summary>
- internal class ResourceFieldInjector : IResourceInjector
- {
- /** */
- private readonly Action<object, object> _inject;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="field">Field.</param>
- public ResourceFieldInjector(FieldInfo field)
- {
- _inject = DelegateConverter.CompileFieldSetter(field);
- }
-
- /** <inheritDoc /> */
- public void Inject(object target, object val)
- {
- _inject(target, val);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceMethodInjector.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceMethodInjector.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceMethodInjector.cs
deleted file mode 100644
index 9a7d9d3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceMethodInjector.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- using System;
- using System.Reflection;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Method resource injector.
- /// </summary>
- internal class ResourceMethodInjector : IResourceInjector
- {
- /** */
- private readonly Action<object, object> _inject;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="mthd">Method.</param>
- public ResourceMethodInjector(MethodInfo mthd)
- {
- _inject = DelegateConverter.CompileFunc<Action<object, object>>(mthd.DeclaringType, mthd,
- new[] {mthd.GetParameters()[0].ParameterType}, new[] {true, false});
- }
-
- /** <inheritDoc /> */
- public void Inject(object target, object val)
- {
- _inject(target, val);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs
deleted file mode 100644
index 0a41d8c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceProcessor.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache.Store;
-
- /// <summary>
- /// Resource processor.
- /// </summary>
- internal class ResourceProcessor
- {
- /** Mutex. */
- private static readonly object Mux = new object();
-
- /** Cached descriptors. */
- private static volatile IDictionary<Type, ResourceTypeDescriptor> _descs =
- new Dictionary<Type, ResourceTypeDescriptor>();
-
- /// <summary>
- /// Get descriptor for the given type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns></returns>
- public static ResourceTypeDescriptor Descriptor(Type type)
- {
- IDictionary<Type, ResourceTypeDescriptor> descs0 = _descs;
-
- ResourceTypeDescriptor desc;
-
- if (!descs0.TryGetValue(type, out desc))
- {
- lock (Mux)
- {
- if (!_descs.TryGetValue(type, out desc))
- {
- // Create descriptor from scratch.
- desc = new ResourceTypeDescriptor(type);
-
- descs0 = new Dictionary<Type, ResourceTypeDescriptor>(_descs);
-
- descs0[type] = desc;
-
- _descs = descs0;
- }
- }
- }
-
- return desc;
- }
-
- /// <summary>
- /// Inject resources to the given target.
- /// </summary>
- /// <param name="target">Target object.</param>
- /// <param name="grid">Grid.</param>
- public static void Inject(object target, Ignite grid)
- {
- Inject(target, grid.Proxy);
- }
-
- /// <summary>
- /// Inject resources to the given target.
- /// </summary>
- /// <param name="target">Target object.</param>
- /// <param name="grid">Grid.</param>
- public static void Inject(object target, IgniteProxy grid)
- {
- if (target != null) {
- var desc = Descriptor(target.GetType());
-
- desc.InjectIgnite(target, grid);
- }
- }
-
- /// <summary>
- /// Inject cache store session.
- /// </summary>
- /// <param name="store">Store.</param>
- /// <param name="ses">Store session.</param>
- public static void InjectStoreSession(ICacheStore store, ICacheStoreSession ses)
- {
- Debug.Assert(store != null);
-
- Descriptor(store.GetType()).InjectStoreSession(store, ses);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourcePropertyInjector.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourcePropertyInjector.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourcePropertyInjector.cs
deleted file mode 100644
index 05e2c2d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourcePropertyInjector.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- using System;
- using System.Reflection;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Property resource injector.
- /// </summary>
- internal class ResourcePropertyInjector : IResourceInjector
- {
- /** */
- private readonly Action<object, object> _inject;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="prop">Property.</param>
- public ResourcePropertyInjector(PropertyInfo prop)
- {
- _inject = DelegateConverter.CompilePropertySetter(prop);
- }
-
- /** <inheritDoc /> */
- public void Inject(object target, object val)
- {
- _inject(target, val);
- }
- }
-}
[07/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
deleted file mode 100644
index 469887d..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAffinityTest.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using NUnit.Framework;
-
- /// <summary>
- /// Affinity key tests.
- /// </summary>
- public class CacheAffinityTest
- {
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public virtual void StartGrids()
- {
- TestUtils.KillProcesses();
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = "config\\native-client-test-cache-affinity.xml";
-
- for (int i = 0; i < 3; i++)
- {
- cfg.GridName = "grid-" + i;
-
- Ignition.Start(cfg);
- }
- }
-
- /// <summary>
- /// Tear-down routine.
- /// </summary>
- [TestFixtureTearDown]
- public virtual void StopGrids()
- {
- for (int i = 0; i < 3; i++)
- Ignition.Stop("grid-" + i, true);
- }
-
- /// <summary>
- /// Test affinity key.
- /// </summary>
- [Test]
- public void TestAffinity()
- {
- IIgnite g = Ignition.GetIgnite("grid-0");
-
- ICacheAffinity aff = g.GetAffinity(null);
-
- IClusterNode node = aff.MapKeyToNode(new AffinityTestKey(0, 1));
-
- for (int i = 0; i < 10; i++)
- Assert.AreEqual(node.Id, aff.MapKeyToNode(new AffinityTestKey(i, 1)).Id);
- }
-
- /// <summary>
- /// Test affinity with portable flag.
- /// </summary>
- [Test]
- public void TestAffinityPortable()
- {
- IIgnite g = Ignition.GetIgnite("grid-0");
-
- ICacheAffinity aff = g.GetAffinity(null);
-
- IPortableObject affKey = g.GetPortables().ToPortable<IPortableObject>(new AffinityTestKey(0, 1));
-
- IClusterNode node = aff.MapKeyToNode(affKey);
-
- for (int i = 0; i < 10; i++)
- {
- IPortableObject otherAffKey =
- g.GetPortables().ToPortable<IPortableObject>(new AffinityTestKey(i, 1));
-
- Assert.AreEqual(node.Id, aff.MapKeyToNode(otherAffKey).Id);
- }
- }
-
- /// <summary>
- /// Affinity key.
- /// </summary>
- public class AffinityTestKey
- {
- /** ID. */
- private int _id;
-
- /** Affinity key. */
- private int _affKey;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- /// <param name="affKey">Affinity key.</param>
- public AffinityTestKey(int id, int affKey)
- {
- _id = id;
- _affKey = affKey;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- AffinityTestKey other = obj as AffinityTestKey;
-
- return other != null && _id == other._id;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return _id;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
deleted file mode 100644
index abef473..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheDynamicStartTest.cs
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Tests.Query;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for dynamic a cache start.
- /// </summary>
- public class CacheDynamicStartTest
- {
- /** Grid name: data. */
- private const string GridData = "d";
-
- /** Grid name: data, no configuration. */
- private const string GridDataNoCfg = "dnc";
-
- /** Grid name: client. */
- private const string GridClient = "c";
-
- /** Cache name: partitioned, transactional. */
- private const string CacheTx = "p";
-
- /** Cache name: atomic. */
- private const string CacheAtomic = "pa";
-
- /** Cache name: dummy. */
- private const string CacheDummy = "dummy";
-
- /// <summary>
- /// Set up routine.
- /// </summary>
- [SetUp]
- public void SetUp()
- {
- TestUtils.KillProcesses();
-
- Ignition.Start(CreateConfiguration(GridData, @"config/dynamic/dynamic-data.xml"));
- Ignition.Start(CreateConfiguration(GridDataNoCfg, @"config/dynamic/dynamic-data-no-cfg.xml"));
- Ignition.Start(CreateConfiguration(GridClient, @"config/dynamic/dynamic-client.xml"));
- }
-
- /// <summary>
- /// Tear down routine.
- /// </summary>
- [TearDown]
- public void StopGrids()
- {
- Ignition.Stop(GridData, true);
- Ignition.Stop(GridDataNoCfg, true);
- Ignition.Stop(GridClient, true);
- }
-
- /// <summary>
- /// Create configuration.
- /// </summary>
- /// <param name="name">Grid name.</param>
- /// <param name="springCfg">Spring configuration.</param>
- /// <returns>Configuration.</returns>
- private static IgniteConfigurationEx CreateConfiguration(string name, string springCfg)
- {
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- PortableConfiguration portCfg = new PortableConfiguration();
-
- ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>();
-
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(DynamicTestKey)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(DynamicTestValue)));
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.GridName = name;
- cfg.PortableConfiguration = portCfg;
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = springCfg;
-
- return cfg;
- }
-
- /// <summary>
- /// Try getting not configured cache.
- /// </summary>
- [Test]
- public void TestNoStarted()
- {
- Assert.Throws<ArgumentException>(() =>
- {
- Ignition.GetIgnite(GridData).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
- });
-
- Assert.Throws<ArgumentException>(() =>
- {
- Ignition.GetIgnite(GridDataNoCfg).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
- });
-
- Assert.Throws<ArgumentException>(() =>
- {
- Ignition.GetIgnite(GridClient).GetCache<CacheTestKey, PortablePerson>(CacheDummy);
- });
- }
-
- /// <summary>
- /// Test TX cache.
- /// </summary>
- [Test]
- public void TestTransactional()
- {
- Check(CacheTx);
- }
-
- /// <summary>
- /// Test ATOMIC cache.
- /// </summary>
- [Test]
- public void TestAtomic()
- {
- Check(CacheAtomic);
- }
-
- /// <summary>
- /// Check routine.
- /// </summary>
- /// <param name="cacheName">Cache name.</param>
- private void Check(string cacheName)
- {
- ICache<DynamicTestKey, DynamicTestValue> cacheData =
- Ignition.GetIgnite(GridData).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
-
- ICache<DynamicTestKey, DynamicTestValue> cacheDataNoCfg =
- Ignition.GetIgnite(GridDataNoCfg).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
-
- ICache<DynamicTestKey, DynamicTestValue> cacheClient =
- Ignition.GetIgnite(GridClient).GetCache<DynamicTestKey, DynamicTestValue>(cacheName);
-
- DynamicTestKey key1 = new DynamicTestKey(1);
- DynamicTestKey key2 = new DynamicTestKey(2);
- DynamicTestKey key3 = new DynamicTestKey(3);
-
- DynamicTestValue val1 = new DynamicTestValue(1);
- DynamicTestValue val2 = new DynamicTestValue(2);
- DynamicTestValue val3 = new DynamicTestValue(3);
-
- cacheData.Put(key1, val1);
- Assert.AreEqual(val1, cacheData.Get(key1));
- Assert.AreEqual(val1, cacheDataNoCfg.Get(key1));
- Assert.AreEqual(val1, cacheClient.Get(key1));
-
- cacheDataNoCfg.Put(key2, val2);
- Assert.AreEqual(val2, cacheData.Get(key2));
- Assert.AreEqual(val2, cacheDataNoCfg.Get(key2));
- Assert.AreEqual(val2, cacheClient.Get(key2));
-
- cacheClient.Put(key3, val3);
- Assert.AreEqual(val3, cacheData.Get(key3));
- Assert.AreEqual(val3, cacheDataNoCfg.Get(key3));
- Assert.AreEqual(val3, cacheClient.Get(key3));
-
- for (int i = 0; i < 10000; i++)
- cacheClient.Put(new DynamicTestKey(i), new DynamicTestValue(1));
-
- int sizeClient = cacheClient.GetLocalSize();
-
- Assert.AreEqual(0, sizeClient);
- }
- }
-
- /// <summary>
- /// Key for dynamic cache start tests.
- /// </summary>
- class DynamicTestKey
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public DynamicTestKey()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- public DynamicTestKey(int id)
- {
- Id = id;
- }
-
- /// <summary>
- /// ID.
- /// </summary>
- public int Id
- {
- get;
- set;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- DynamicTestKey other = obj as DynamicTestKey;
-
- return other != null && Id == other.Id;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
- }
- }
-
- /// <summary>
- /// Value for dynamic cache start tests.
- /// </summary>
- class DynamicTestValue
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public DynamicTestValue()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- public DynamicTestValue(int id)
- {
- Id = id;
- }
-
- /// <summary>
- /// ID.
- /// </summary>
- public int Id
- {
- get;
- set;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- DynamicTestValue other = obj as DynamicTestValue;
-
- return other != null && Id == other.Id;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheEntryTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheEntryTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheEntryTest.cs
deleted file mode 100644
index 8464b8e..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheEntryTest.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Impl.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// <see cref="CacheEntry{TK,TV}"/> tests.
- /// </summary>
- public class CacheEntryTest
- {
- /// <summary>
- /// Tests equality members.
- /// </summary>
- [Test]
- public void TestEquality()
- {
- var entry1 = new CacheEntry<int, int>(1, 2);
- var entry2 = new CacheEntry<int, int>(1, 2);
- var entry3 = new CacheEntry<int, int>(1, 3);
-
- Assert.AreEqual(entry1, entry2);
- Assert.AreNotEqual(entry1, entry3);
-
- var boxedEntry1 = (object) entry1;
- var boxedEntry2 = (object) entry2;
- var boxedEntry3 = (object) entry3;
-
- Assert.IsFalse(ReferenceEquals(boxedEntry1, boxedEntry2));
-
- Assert.AreEqual(boxedEntry1, boxedEntry2);
- Assert.AreNotEqual(boxedEntry1, boxedEntry3);
- }
-
- /// <summary>
- /// Tests with hash data structures.
- /// </summary>
- [Test]
- public void TestHashCode()
- {
- var entry1 = new CacheEntry<int, int>(1, 2);
- var entry2 = new CacheEntry<int, int>(1, 2);
- var entry3 = new CacheEntry<int, int>(1, 3);
-
- var set = new HashSet<object> {entry1};
-
- Assert.IsTrue(set.Contains(entry1));
- Assert.IsTrue(set.Contains(entry2));
- Assert.IsFalse(set.Contains(entry3));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
deleted file mode 100644
index 46c54e6..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheForkedTest.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using System.IO;
- using Apache.Ignite.Core.Tests.Process;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests cache with a standalone process.
- /// </summary>
- public class CacheForkedTest
- {
- /** */
- private IIgnite _grid;
-
- /// <summary>
- /// Set up.
- /// </summary>
- [TestFixtureSetUp]
- public void SetUp()
- {
- const string springConfigUrl = "config\\compute\\compute-grid1.xml";
-
- // ReSharper disable once UnusedVariable
- var proc = new IgniteProcess(
- "-jvmClasspath=" + TestUtils.CreateTestClasspath(),
- "-springConfigUrl=" + Path.GetFullPath(springConfigUrl),
- "-J-ea",
- "-J-Xcheck:jni",
- "-J-Xms512m",
- "-J-Xmx512m",
- "-J-DIGNITE_QUIET=false"
- );
-
- _grid = Ignition.Start(new IgniteConfiguration
- {
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- SpringConfigUrl = springConfigUrl
- });
-
- Assert.IsTrue(_grid.WaitTopology(2, 30000));
- }
-
- /// <summary>
- /// Tear down.
- /// </summary>
- [TestFixtureTearDown]
- public void TearDown()
- {
- IgniteProcess.KillAll();
-
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Tests cache clear.
- /// </summary>
- [Test]
- public void TestClearCache()
- {
- _grid.GetCache<object, object>(null).Clear();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
deleted file mode 100644
index b60c254..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalAtomicTest.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- public class CacheLocalAtomicTest : CacheAbstractTest
- {
- protected override int CachePartitions()
- {
- return 1;
- }
-
- protected override int GridCount()
- {
- return 1;
- }
-
- protected override string CacheName()
- {
- return "local_atomic";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return false;
- }
-
- protected override bool LocalCache()
- {
- return true;
- }
-
- protected override int Backups()
- {
- return 0;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
deleted file mode 100644
index 02cb987..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheLocalTest.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- public class CacheLocalTest : CacheAbstractTest
- {
- protected override int CachePartitions()
- {
- return 1;
- }
-
- protected override int GridCount()
- {
- return 1;
- }
-
- protected override string CacheName()
- {
- return "local";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return true;
- }
- protected override bool LocalCache()
- {
- return true;
- }
-
- protected override int Backups()
- {
- return 0;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
deleted file mode 100644
index 4f6e7a0..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicNearEnabledTest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedAtomicNearEnabledTest : CacheAbstractTest
- {
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "partitioned_atomic_near";
- }
-
- protected override bool NearEnabled()
- {
- return true;
- }
-
- protected override bool TxEnabled()
- {
- return false;
- }
-
- protected override int Backups()
- {
- return 1;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
deleted file mode 100644
index ab59c64..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedAtomicTest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedAtomicTest : CacheAbstractTest
- {
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "partitioned_atomic";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return false;
- }
-
- protected override int Backups()
- {
- return 1;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
deleted file mode 100644
index 830698b..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedNearEnabledTest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedNearEnabledTest : CacheAbstractTest
- {
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "partitioned_near";
- }
-
- protected override bool NearEnabled()
- {
- return true;
- }
-
- protected override bool TxEnabled()
- {
- return true;
- }
-
- protected override int Backups()
- {
- return 1;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
deleted file mode 100644
index 02d3208..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CachePartitionedTest.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CachePartitionedTest : CacheAbstractTest
- {
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "partitioned";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return true;
- }
-
- protected override int Backups()
- {
- return 1;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
deleted file mode 100644
index db6f5a5..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedAtomicTest.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CacheReplicatedAtomicTest : CacheAbstractTest
- {
- protected override int CachePartitions()
- {
- return 512;
- }
-
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "replicated_atomic";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return false;
- }
-
- protected override int Backups()
- {
- return GridCount() - 1;
- }
-
- protected override bool ReplicatedCache()
- {
- return true;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
deleted file mode 100644
index 7c70222..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheReplicatedTest.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using NUnit.Framework;
-
- [Category(TestUtils.CategoryIntensive)]
- public class CacheReplicatedTest : CacheAbstractTest
- {
- protected override int CachePartitions()
- {
- return 512;
- }
-
- protected override int GridCount()
- {
- return 3;
- }
-
- protected override string CacheName()
- {
- return "replicated";
- }
-
- protected override bool NearEnabled()
- {
- return false;
- }
-
- protected override bool TxEnabled()
- {
- return true;
- }
-
- protected override int Backups()
- {
- return GridCount() - 1;
- }
-
- protected override bool ReplicatedCache()
- {
- return true;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
deleted file mode 100644
index 52a856a..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheTestAsyncWrapper.cs
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Expiry;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Wraps IGridCache implementation to simplify async mode testing.
- /// </summary>
- internal class CacheTestAsyncWrapper<TK, TV> : ICache<TK, TV>
- {
- private readonly ICache<TK, TV> _cache;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheTestAsyncWrapper{K, V}"/> class.
- /// </summary>
- /// <param name="cache">The cache to be wrapped.</param>
- public CacheTestAsyncWrapper(ICache<TK, TV> cache)
- {
- Debug.Assert(cache.IsAsync, "GridCacheTestAsyncWrapper only works with async caches.");
-
- _cache = cache;
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithAsync()
- {
- return this;
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- Debug.Fail("GridCacheTestAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- Debug.Fail("GridCacheTestAsyncWrapper.Future() should not be called. It always returns null.");
- return null;
- }
-
- /** <inheritDoc /> */
- public string Name
- {
- get { return _cache.Name; }
- }
-
- /** <inheritDoc /> */
- public IIgnite Ignite
- {
- get { return _cache.Ignite; }
- }
-
- /** <inheritDoc /> */
-
- public bool IsEmpty()
- {
- return _cache.IsEmpty();
- }
-
- /** <inheritDoc /> */
- public bool IsKeepPortable
- {
- get { return _cache.IsKeepPortable; }
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithSkipStore()
- {
- return _cache.WithSkipStore().WrapAsync();
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithExpiryPolicy(IExpiryPolicy plc)
- {
- return _cache.WithExpiryPolicy(plc).WrapAsync();
- }
-
- /** <inheritDoc /> */
- public ICache<TK1, TV1> WithKeepPortable<TK1, TV1>()
- {
- return _cache.WithKeepPortable<TK1, TV1>().WrapAsync();
- }
-
- /** <inheritDoc /> */
- public void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- _cache.LoadCache(p, args);
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- _cache.LocalLoadCache(p, args);
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public bool ContainsKey(TK key)
- {
- _cache.ContainsKey(key);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public bool ContainsKeys(IEnumerable<TK> keys)
- {
- _cache.ContainsKeys(keys);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public TV LocalPeek(TK key, params CachePeekMode[] modes)
- {
- _cache.LocalPeek(key, modes);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public TV Get(TK key)
- {
- _cache.Get(key);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public IDictionary<TK, TV> GetAll(IEnumerable<TK> keys)
- {
- _cache.GetAll(keys);
- return GetResult<IDictionary<TK, TV>>();
- }
-
- /** <inheritDoc /> */
- public void Put(TK key, TV val)
- {
- _cache.Put(key, val);
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public TV GetAndPut(TK key, TV val)
- {
- _cache.GetAndPut(key, val);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public TV GetAndReplace(TK key, TV val)
- {
- _cache.GetAndReplace(key, val);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public TV GetAndRemove(TK key)
- {
- _cache.GetAndRemove(key);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public bool PutIfAbsent(TK key, TV val)
- {
- _cache.PutIfAbsent(key, val);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public TV GetAndPutIfAbsent(TK key, TV val)
- {
- _cache.GetAndPutIfAbsent(key, val);
- return GetResult<TV>();
- }
-
- /** <inheritDoc /> */
- public bool Replace(TK key, TV val)
- {
- _cache.Replace(key, val);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public bool Replace(TK key, TV oldVal, TV newVal)
- {
- _cache.Replace(key, oldVal, newVal);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public void PutAll(IDictionary<TK, TV> vals)
- {
- _cache.PutAll(vals);
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public void LocalEvict(IEnumerable<TK> keys)
- {
- _cache.LocalEvict(keys);
- }
-
- /** <inheritDoc /> */
- public void Clear()
- {
- _cache.Clear();
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public void Clear(TK key)
- {
- _cache.Clear(key);
- }
-
- /** <inheritDoc /> */
- public void ClearAll(IEnumerable<TK> keys)
- {
- _cache.ClearAll(keys);
- }
-
- /** <inheritDoc /> */
- public void LocalClear(TK key)
- {
- _cache.LocalClear(key);
- }
-
- /** <inheritDoc /> */
- public void LocalClearAll(IEnumerable<TK> keys)
- {
- _cache.LocalClearAll(keys);
- }
-
- /** <inheritDoc /> */
- public bool Remove(TK key)
- {
- _cache.Remove(key);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public bool Remove(TK key, TV val)
- {
- _cache.Remove(key, val);
- return GetResult<bool>();
- }
-
- /** <inheritDoc /> */
- public void RemoveAll(IEnumerable<TK> keys)
- {
- _cache.RemoveAll(keys);
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public void RemoveAll()
- {
- _cache.RemoveAll();
- WaitResult();
- }
-
- /** <inheritDoc /> */
- public int GetLocalSize(params CachePeekMode[] modes)
- {
- return _cache.GetLocalSize(modes);
- }
-
- /** <inheritDoc /> */
- public int GetSize(params CachePeekMode[] modes)
- {
- _cache.GetSize(modes);
- return GetResult<int>();
- }
-
- /** <inheritDoc /> */
- public void LocalPromote(IEnumerable<TK> keys)
- {
- _cache.LocalPromote(keys);
- }
-
- /** <inheritDoc /> */
- public IQueryCursor<ICacheEntry<TK, TV>> Query(QueryBase qry)
- {
- return _cache.Query(qry);
- }
-
- /** <inheritDoc /> */
- public IQueryCursor<IList> QueryFields(SqlFieldsQuery qry)
- {
- return _cache.QueryFields(qry);
- }
-
- /** <inheritDoc /> */
- IContinuousQueryHandle ICache<TK, TV>.QueryContinuous(ContinuousQuery<TK, TV> qry)
- {
- return _cache.QueryContinuous(qry);
- }
-
- /** <inheritDoc /> */
- public IContinuousQueryHandle<ICacheEntry<TK, TV>> QueryContinuous(ContinuousQuery<TK, TV> qry, QueryBase initialQry)
- {
- return _cache.QueryContinuous(qry, initialQry);
- }
-
- /** <inheritDoc /> */
- public IEnumerable<ICacheEntry<TK, TV>> GetLocalEntries(params CachePeekMode[] peekModes)
- {
- return _cache.GetLocalEntries(peekModes);
- }
-
- /** <inheritDoc /> */
- public TR Invoke<TR, TA>(TK key, ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- _cache.Invoke(key, processor, arg);
-
- return GetResult<TR>();
- }
-
- /** <inheritDoc /> */
- public IDictionary<TK, ICacheEntryProcessorResult<TR>> InvokeAll<TR, TA>(IEnumerable<TK> keys,
- ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- _cache.InvokeAll(keys, processor, arg);
-
- return GetResult<IDictionary<TK, ICacheEntryProcessorResult<TR>>>();
- }
-
- /** <inheritDoc /> */
- public ICacheLock Lock(TK key)
- {
- return _cache.Lock(key);
- }
-
- /** <inheritDoc /> */
- public ICacheLock LockAll(IEnumerable<TK> keys)
- {
- return _cache.LockAll(keys);
- }
-
- /** <inheritDoc /> */
- public bool IsLocalLocked(TK key, bool byCurrentThread)
- {
- return _cache.IsLocalLocked(key, byCurrentThread);
- }
-
- /** <inheritDoc /> */
- public ICacheMetrics GetMetrics()
- {
- return _cache.GetMetrics();
- }
-
- /** <inheritDoc /> */
- public IFuture Rebalance()
- {
- return _cache.Rebalance();
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithNoRetries()
- {
- return _cache.WithNoRetries();
- }
-
- /** <inheritDoc /> */
- public IEnumerator<ICacheEntry<TK, TV>> GetEnumerator()
- {
- return _cache.GetEnumerator();
- }
-
- /** <inheritDoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- /// <summary>
- /// Waits for the async result.
- /// </summary>
- private void WaitResult()
- {
- GetResult<object>();
- }
-
- /// <summary>
- /// Gets the async result.
- /// </summary>
- private T GetResult<T>()
- {
- return _cache.GetFuture<T>().Get();
- }
- }
-
- /// <summary>
- /// Extension methods for IGridCache.
- /// </summary>
- public static class CacheExtensions
- {
- /// <summary>
- /// Wraps specified instance into GridCacheTestAsyncWrapper.
- /// </summary>
- public static ICache<TK, TV> WrapAsync<TK, TV>(this ICache<TK, TV> cache)
- {
- return new CacheTestAsyncWrapper<TK, TV>(cache);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
deleted file mode 100644
index 18f04ef..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/CacheQueriesTest.cs
+++ /dev/null
@@ -1,928 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Text;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Portable;
- using NUnit.Framework;
-
- /// <summary>
- /// Queries tests.
- /// </summary>
- public class CacheQueriesTest
- {
- /** Grid count. */
- private const int GridCnt = 2;
-
- /** Cache name. */
- private const string CacheName = "cache";
-
- /** Path to XML configuration. */
- private const string CfgPath = "config\\cache-query.xml";
-
- /** Maximum amount of items in cache. */
- private const int MaxItemCnt = 100;
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public virtual void StartGrids()
- {
- TestUtils.JvmDebug = true;
- TestUtils.KillProcesses();
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx
- {
- PortableConfiguration = new PortableConfiguration
- {
- TypeConfigurations = new[]
- {
- new PortableTypeConfiguration(typeof (QueryPerson)),
- new PortableTypeConfiguration(typeof (PortableScanQueryFilter<QueryPerson>)),
- new PortableTypeConfiguration(typeof (PortableScanQueryFilter<PortableUserObject>))
- }
- },
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- SpringConfigUrl = CfgPath
- };
-
- for (int i = 0; i < GridCnt; i++)
- {
- cfg.GridName = "grid-" + i;
-
- Ignition.Start(cfg);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureTearDown]
- public virtual void StopGrids()
- {
- for (int i = 0; i < GridCnt; i++)
- Ignition.Stop("grid-" + i, true);
- }
-
- /// <summary>
- ///
- /// </summary>
- [SetUp]
- public virtual void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- ///
- /// </summary>
- [TearDown]
- public virtual void AfterTest()
- {
- var cache = Cache();
-
- for (int i = 0; i < GridCnt; i++)
- {
- for (int j = 0; j < MaxItemCnt; j++)
- cache.Remove(j);
-
- Assert.IsTrue(cache.IsEmpty());
- }
-
- Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="idx"></param>
- /// <returns></returns>
- public IIgnite GetIgnite(int idx)
- {
- return Ignition.GetIgnite("grid-" + idx);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="idx"></param>
- /// <returns></returns>
- public ICache<int, QueryPerson> Cache(int idx)
- {
- return GetIgnite(idx).GetCache<int, QueryPerson>(CacheName);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <returns></returns>
- public ICache<int, QueryPerson> Cache()
- {
- return Cache(0);
- }
-
- /// <summary>
- /// Test arguments validation for SQL queries.
- /// </summary>
- [Test]
- public void TestValidationSql()
- {
- // 1. No sql.
- Assert.Throws<ArgumentException>(() =>
- { Cache().Query(new SqlQuery(typeof(QueryPerson), null)); });
-
- // 2. No type.
- Assert.Throws<ArgumentException>(() =>
- { Cache().Query(new SqlQuery((string)null, "age >= 50")); });
- }
-
- /// <summary>
- /// Test arguments validation for SQL fields queries.
- /// </summary>
- [Test]
- public void TestValidationSqlFields()
- {
- // 1. No sql.
- Assert.Throws<ArgumentException>(() => { Cache().QueryFields(new SqlFieldsQuery(null)); });
- }
-
- /// <summary>
- /// Test arguments validation for TEXT queries.
- /// </summary>
- [Test]
- public void TestValidationText()
- {
- // 1. No text.
- Assert.Throws<ArgumentException>(() =>
- { Cache().Query(new TextQuery(typeof(QueryPerson), null)); });
-
- // 2. No type.
- Assert.Throws<ArgumentException>(() =>
- { Cache().Query(new TextQuery((string)null, "Ivanov")); });
- }
-
- /// <summary>
- /// Cursor tests.
- /// </summary>
- [Test]
- [SuppressMessage("ReSharper", "ReturnValueOfPureMethodIsNotUsed")]
- public void TestCursor()
- {
- var cache0 = Cache().WithAsync();
-
- cache0.WithAsync().Put(1, new QueryPerson("Ivanov", 30));
-
- IFuture<object> res = cache0.GetFuture<object>();
-
- res.Get();
-
- Cache().Put(1, new QueryPerson("Ivanov", 30));
- Cache().Put(1, new QueryPerson("Petrov", 40));
- Cache().Put(1, new QueryPerson("Sidorov", 50));
-
- SqlQuery qry = new SqlQuery(typeof(QueryPerson), "age >= 20");
-
- // 1. Test GetAll().
- using (IQueryCursor<ICacheEntry<int, QueryPerson>> cursor = Cache().Query(qry))
- {
- cursor.GetAll();
-
- Assert.Throws<InvalidOperationException>(() => { cursor.GetAll(); });
- Assert.Throws<InvalidOperationException>(() => { cursor.GetEnumerator(); });
- }
-
- // 2. Test GetEnumerator.
- using (IQueryCursor<ICacheEntry<int, QueryPerson>> cursor = Cache().Query(qry))
- {
- cursor.GetEnumerator();
-
- Assert.Throws<InvalidOperationException>(() => { cursor.GetAll(); });
- Assert.Throws<InvalidOperationException>(() => { cursor.GetEnumerator(); });
- }
- }
-
- /// <summary>
- /// Test enumerator.
- /// </summary>
- [Test]
- [SuppressMessage("ReSharper", "UnusedVariable")]
- public void TestEnumerator()
- {
- Cache().Put(1, new QueryPerson("Ivanov", 30));
- Cache().Put(2, new QueryPerson("Petrov", 40));
- Cache().Put(3, new QueryPerson("Sidorov", 50));
- Cache().Put(4, new QueryPerson("Unknown", 60));
-
- // 1. Empty result set.
- using (
- IQueryCursor<ICacheEntry<int, QueryPerson>> cursor =
- Cache().Query(new SqlQuery(typeof(QueryPerson), "age = 100")))
- {
- IEnumerator<ICacheEntry<int, QueryPerson>> e = cursor.GetEnumerator();
-
- Assert.Throws<InvalidOperationException>(() =>
- { ICacheEntry<int, QueryPerson> entry = e.Current; });
-
- Assert.IsFalse(e.MoveNext());
-
- Assert.Throws<InvalidOperationException>(() =>
- { ICacheEntry<int, QueryPerson> entry = e.Current; });
-
- Assert.Throws<NotSupportedException>(() => e.Reset());
- }
-
- SqlQuery qry = new SqlQuery(typeof (QueryPerson), "age < 60");
-
- // 2. Page size is bigger than result set.
- qry.PageSize = 4;
- CheckEnumeratorQuery(qry);
-
- // 3. Page size equal to result set.
- qry.PageSize = 3;
- CheckEnumeratorQuery(qry);
-
- // 4. Page size if less than result set.
- qry.PageSize = 2;
- CheckEnumeratorQuery(qry);
- }
-
- /// <summary>
- /// Test SQL query arguments passing.
- /// </summary>
- public void TestSqlQueryArguments()
- {
- Cache().Put(1, new QueryPerson("Ivanov", 30));
- Cache().Put(2, new QueryPerson("Petrov", 40));
- Cache().Put(3, new QueryPerson("Sidorov", 50));
-
- // 1. Empty result set.
- using (
- IQueryCursor<ICacheEntry<int, QueryPerson>> cursor =
- Cache().Query(new SqlQuery(typeof(QueryPerson), "age < ?", 50)))
- {
- foreach (ICacheEntry<int, QueryPerson> entry in cursor.GetAll())
- Assert.IsTrue(entry.Key == 1 || entry.Key == 2);
- }
- }
-
- /// <summary>
- /// Test SQL fields query arguments passing.
- /// </summary>
- public void TestSqlFieldsQueryArguments()
- {
- Cache().Put(1, new QueryPerson("Ivanov", 30));
- Cache().Put(2, new QueryPerson("Petrov", 40));
- Cache().Put(3, new QueryPerson("Sidorov", 50));
-
- // 1. Empty result set.
- using (
- IQueryCursor<IList> cursor = Cache().QueryFields(
- new SqlFieldsQuery("SELECT age FROM QueryPerson WHERE age < ?", 50)))
- {
- foreach (IList entry in cursor.GetAll())
- Assert.IsTrue((int) entry[0] < 50);
- }
- }
-
- /// <summary>
- /// Check query result for enumerator test.
- /// </summary>
- /// <param name="qry">QUery.</param>
- private void CheckEnumeratorQuery(SqlQuery qry)
- {
- using (IQueryCursor<ICacheEntry<int, QueryPerson>> cursor = Cache().Query(qry))
- {
- bool first = false;
- bool second = false;
- bool third = false;
-
- foreach (var entry in cursor)
- {
- if (entry.Key == 1)
- {
- first = true;
-
- Assert.AreEqual("Ivanov", entry.Value.Name);
- Assert.AreEqual(30, entry.Value.Age);
- }
- else if (entry.Key == 2)
- {
- second = true;
-
- Assert.AreEqual("Petrov", entry.Value.Name);
- Assert.AreEqual(40, entry.Value.Age);
- }
- else if (entry.Key == 3)
- {
- third = true;
-
- Assert.AreEqual("Sidorov", entry.Value.Name);
- Assert.AreEqual(50, entry.Value.Age);
- }
- else
- Assert.Fail("Unexpected value: " + entry);
- }
-
- Assert.IsTrue(first && second && third);
- }
- }
-
- /// <summary>
- /// Check SQL query.
- /// </summary>
- [Test]
- public void TestSqlQuery()
- {
- CheckSqlQuery(MaxItemCnt, false, false);
- }
-
- /// <summary>
- /// Check SQL query in portable mode.
- /// </summary>
- [Test]
- public void TestSqlQueryPortable()
- {
- CheckSqlQuery(MaxItemCnt, false, true);
- }
-
- /// <summary>
- /// Check local SQL query.
- /// </summary>
- [Test]
- public void TestSqlQueryLocal()
- {
- CheckSqlQuery(MaxItemCnt, true, false);
- }
-
- /// <summary>
- /// Check local SQL query in portable mode.
- /// </summary>
- [Test]
- public void TestSqlQueryLocalPortable()
- {
- CheckSqlQuery(MaxItemCnt, true, true);
- }
-
- /// <summary>
- /// Check SQL query.
- /// </summary>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- private void CheckSqlQuery(int cnt, bool loc, bool keepPortable)
- {
- var cache = Cache();
-
- // 1. Populate cache with data, calculating expected count in parallel.
- var exp = PopulateCache(cache, loc, cnt, x => x < 50);
-
- // 2. Validate results.
- SqlQuery qry = loc ? new SqlQuery(typeof(QueryPerson), "age < 50", true) :
- new SqlQuery(typeof(QueryPerson), "age < 50");
-
- ValidateQueryResults(cache, qry, exp, keepPortable);
- }
-
- /// <summary>
- /// Check SQL fields query.
- /// </summary>
- [Test]
- public void TestSqlFieldsQuery()
- {
- CheckSqlFieldsQuery(MaxItemCnt, false);
- }
-
- /// <summary>
- /// Check local SQL fields query.
- /// </summary>
- [Test]
- public void TestSqlFieldsQueryLocal()
- {
- CheckSqlFieldsQuery(MaxItemCnt, true);
- }
-
- /// <summary>
- /// Check SQL fields query.
- /// </summary>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- private void CheckSqlFieldsQuery(int cnt, bool loc)
- {
- var cache = Cache();
-
- // 1. Populate cache with data, calculating expected count in parallel.
- var exp = PopulateCache(cache, loc, cnt, x => x < 50);
-
- // 2. Vlaidate results.
- SqlFieldsQuery qry = loc ? new SqlFieldsQuery("SELECT name, age FROM QueryPerson WHERE age < 50", true) :
- new SqlFieldsQuery("SELECT name, age FROM QueryPerson WHERE age < 50");
-
- using (IQueryCursor<IList> cursor = cache.QueryFields(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
-
- foreach (var entry in cursor.GetAll())
- {
- Assert.AreEqual(2, entry.Count);
- Assert.AreEqual(entry[0].ToString(), entry[1].ToString());
-
- exp0.Remove((int)entry[1]);
- }
-
- Assert.AreEqual(0, exp0.Count);
- }
-
- using (IQueryCursor<IList> cursor = cache.QueryFields(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
-
- foreach (var entry in cursor)
- {
- Assert.AreEqual(entry[0].ToString(), entry[1].ToString());
-
- exp0.Remove((int)entry[1]);
- }
-
- Assert.AreEqual(0, exp0.Count);
- }
- }
-
- /// <summary>
- /// Check text query.
- /// </summary>
- [Test]
- public void TestTextQuery()
- {
- CheckTextQuery(MaxItemCnt, false, false);
- }
-
- /// <summary>
- /// Check SQL query in portable mode.
- /// </summary>
- [Test]
- public void TestTextQueryPortable()
- {
- CheckTextQuery(MaxItemCnt, false, true);
- }
-
- /// <summary>
- /// Check local SQL query.
- /// </summary>
- [Test]
- public void TestTextQueryLocal()
- {
- CheckTextQuery(MaxItemCnt, true, false);
- }
-
- /// <summary>
- /// Check local SQL query in portable mode.
- /// </summary>
- [Test]
- public void TestTextQueryLocalPortable()
- {
- CheckTextQuery(MaxItemCnt, true, true);
- }
-
- /// <summary>
- /// Check text query.
- /// </summary>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- private void CheckTextQuery(int cnt, bool loc, bool keepPortable)
- {
- var cache = Cache();
-
- // 1. Populate cache with data, calculating expected count in parallel.
- var exp = PopulateCache(cache, loc, cnt, x => x.ToString().StartsWith("1"));
-
- // 2. Validate results.
- TextQuery qry = loc ? new TextQuery(typeof(QueryPerson), "1*", true) :
- new TextQuery(typeof(QueryPerson), "1*");
-
- ValidateQueryResults(cache, qry, exp, keepPortable);
- }
-
- /// <summary>
- /// Check scan query.
- /// </summary>
- [Test]
- public void TestScanQuery()
- {
- CheckScanQuery<QueryPerson>(MaxItemCnt, false, false);
- }
-
- /// <summary>
- /// Check scan query in portable mode.
- /// </summary>
- [Test]
- public void TestScanQueryPortable()
- {
- CheckScanQuery<PortableUserObject>(MaxItemCnt, false, true);
- }
-
- /// <summary>
- /// Check local scan query.
- /// </summary>
- [Test]
- public void TestScanQueryLocal()
- {
- CheckScanQuery<QueryPerson>(MaxItemCnt, true, false);
- }
-
- /// <summary>
- /// Check local scan query in portable mode.
- /// </summary>
- [Test]
- public void TestScanQueryLocalPortable()
- {
- CheckScanQuery<PortableUserObject>(MaxItemCnt, true, true);
- }
-
- /// <summary>
- /// Check scan query with partitions.
- /// </summary>
- [Test]
- [Ignore("IGNITE-1012")]
- public void TestScanQueryPartitions([Values(true, false)] bool loc)
- {
- CheckScanQueryPartitions<QueryPerson>(MaxItemCnt, loc, false);
- }
-
- /// <summary>
- /// Check scan query with partitions in portable mode.
- /// </summary>
- [Test]
- [Ignore("IGNITE-1012")]
- public void TestScanQueryPartitionsPortable([Values(true, false)] bool loc)
- {
- CheckScanQueryPartitions<PortableUserObject>(MaxItemCnt, loc, true);
- }
-
- /// <summary>
- /// Tests that query attempt on non-indexed cache causes an exception.
- /// </summary>
- [Test]
- public void TestIndexingDisabledError()
- {
- var cache = GetIgnite(0).GetOrCreateCache<int, QueryPerson>("nonindexed_cache");
-
- var queries = new QueryBase[]
- {
- new TextQuery(typeof (QueryPerson), "1*"),
- new SqlQuery(typeof (QueryPerson), "age < 50")
- };
-
- foreach (var qry in queries)
- {
- var err = Assert.Throws<IgniteException>(() => cache.Query(qry));
-
- Assert.AreEqual("Indexing is disabled for cache: nonindexed_cache. " +
- "Use setIndexedTypes or setTypeMetadata methods on CacheConfiguration to enable.", err.Message);
- }
- }
-
- /// <summary>
- /// Check scan query.
- /// </summary>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- private void CheckScanQuery<TV>(int cnt, bool loc, bool keepPortable)
- {
- var cache = Cache();
-
- // No predicate
- var exp = PopulateCache(cache, loc, cnt, x => true);
- var qry = new ScanQuery<int, TV>();
- ValidateQueryResults(cache, qry, exp, keepPortable);
-
- // Serializable
- exp = PopulateCache(cache, loc, cnt, x => x < 50);
- qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
-
- // Portable
- exp = PopulateCache(cache, loc, cnt, x => x < 50);
- qry = new ScanQuery<int, TV>(new PortableScanQueryFilter<TV>());
- ValidateQueryResults(cache, qry, exp, keepPortable);
-
- // Exception
- exp = PopulateCache(cache, loc, cnt, x => x < 50);
- qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV> {ThrowErr = true});
-
- var ex = Assert.Throws<IgniteException>(() => ValidateQueryResults(cache, qry, exp, keepPortable));
- Assert.AreEqual(ScanQueryFilter<TV>.ErrMessage, ex.Message);
- }
-
- /// <summary>
- /// Checks scan query with partitions.
- /// </summary>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- private void CheckScanQueryPartitions<TV>(int cnt, bool loc, bool keepPortable)
- {
- StopGrids();
- StartGrids();
-
- var cache = Cache();
-
- var aff = cache.Ignite.GetAffinity(CacheName);
- var exp = PopulateCache(cache, loc, cnt, x => true); // populate outside the loop (slow)
-
- for (var part = 0; part < aff.Partitions; part++)
- {
- //var exp0 = new HashSet<int>(exp.Where(x => aff.Partition(x) == part)); // filter expected keys
- var exp0 = new HashSet<int>();
- foreach (var x in exp)
- if (aff.GetPartition(x) == part)
- exp0.Add(x);
-
- var qry = new ScanQuery<int, TV> { Partition = part };
-
- Console.WriteLine("Checking query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
- }
-
- // Partitions with predicate
- exp = PopulateCache(cache, loc, cnt, x => x < 50); // populate outside the loop (slow)
-
- for (var part = 0; part < aff.Partitions; part++)
- {
- //var exp0 = new HashSet<int>(exp.Where(x => aff.Partition(x) == part)); // filter expected keys
- var exp0 = new HashSet<int>();
- foreach (var x in exp)
- if (aff.GetPartition(x) == part)
- exp0.Add(x);
-
- var qry = new ScanQuery<int, TV>(new ScanQueryFilter<TV>()) { Partition = part };
-
- Console.WriteLine("Checking predicate query on partition " + part);
- ValidateQueryResults(cache, qry, exp0, keepPortable);
- }
-
- }
-
- /// <summary>
- /// Validates the query results.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <param name="qry">Query.</param>
- /// <param name="exp">Expected keys.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- private static void ValidateQueryResults(ICache<int, QueryPerson> cache, QueryBase qry, HashSet<int> exp,
- bool keepPortable)
- {
- if (keepPortable)
- {
- var cache0 = cache.WithKeepPortable<int, IPortableObject>();
-
- using (var cursor = cache0.Query(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
- var all = new List<ICacheEntry<int, object>>();
-
- foreach (var entry in cursor.GetAll())
- {
- all.Add(entry);
-
- Assert.AreEqual(entry.Key.ToString(), entry.Value.GetField<string>("name"));
- Assert.AreEqual(entry.Key, entry.Value.GetField<int>("age"));
-
- exp0.Remove(entry.Key);
- }
-
- AssertMissingExpectedKeys(exp0, cache, all);
- }
-
- using (var cursor = cache0.Query(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
- var all = new List<ICacheEntry<int, object>>();
-
- foreach (var entry in cursor)
- {
- all.Add(entry);
-
- Assert.AreEqual(entry.Key.ToString(), entry.Value.GetField<string>("name"));
- Assert.AreEqual(entry.Key, entry.Value.GetField<int>("age"));
-
- exp0.Remove(entry.Key);
- }
-
- AssertMissingExpectedKeys(exp0, cache, all);
- }
- }
- else
- {
- using (var cursor = cache.Query(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
- var all = new List<ICacheEntry<int, object>>();
-
- foreach (var entry in cursor.GetAll())
- {
- all.Add(entry);
-
- Assert.AreEqual(entry.Key.ToString(), entry.Value.Name);
- Assert.AreEqual(entry.Key, entry.Value.Age);
-
- exp0.Remove(entry.Key);
- }
-
- AssertMissingExpectedKeys(exp0, cache, all);
- }
-
- using (var cursor = cache.Query(qry))
- {
- HashSet<int> exp0 = new HashSet<int>(exp);
- var all = new List<ICacheEntry<int, object>>();
-
- foreach (var entry in cursor)
- {
- all.Add(entry);
-
- Assert.AreEqual(entry.Key.ToString(), entry.Value.Name);
- Assert.AreEqual(entry.Key, entry.Value.Age);
-
- exp0.Remove(entry.Key);
- }
-
- AssertMissingExpectedKeys(exp0, cache, all);
- }
- }
- }
-
- /// <summary>
- /// Asserts that all expected entries have been received.
- /// </summary>
- private static void AssertMissingExpectedKeys(ICollection<int> exp, ICache<int, QueryPerson> cache,
- IList<ICacheEntry<int, object>> all)
- {
- if (exp.Count == 0)
- return;
-
- var sb = new StringBuilder();
- var aff = cache.Ignite.GetAffinity(cache.Name);
-
- foreach (var key in exp)
- {
- var part = aff.GetPartition(key);
- sb.AppendFormat(
- "Query did not return expected key '{0}' (exists: {1}), partition '{2}', partition nodes: ",
- key, cache.Get(key) != null, part);
-
- var partNodes = aff.MapPartitionToPrimaryAndBackups(part);
-
- foreach (var node in partNodes)
- sb.Append(node).Append(" ");
-
- sb.AppendLine(";");
- }
-
- sb.Append("Returned keys: ");
-
- foreach (var e in all)
- sb.Append(e.Key).Append(" ");
-
- sb.AppendLine(";");
-
- Assert.Fail(sb.ToString());
- }
-
- /// <summary>
- /// Populates the cache with random entries and returns expected results set according to filter.
- /// </summary>
- /// <param name="cache">The cache.</param>
- /// <param name="cnt">Amount of cache entries to create.</param>
- /// <param name="loc">Local query flag.</param>
- /// <param name="expectedEntryFilter">The expected entry filter.</param>
- /// <returns>Expected results set.</returns>
- private static HashSet<int> PopulateCache(ICache<int, QueryPerson> cache, bool loc, int cnt,
- Func<int, bool> expectedEntryFilter)
- {
- var rand = new Random();
-
- var exp = new HashSet<int>();
-
- for (var i = 0; i < cnt; i++)
- {
- var val = rand.Next(100);
-
- cache.Put(val, new QueryPerson(val.ToString(), val));
-
- if (expectedEntryFilter(val) && (!loc || cache.Ignite.GetAffinity(cache.Name)
- .IsPrimary(cache.Ignite.GetCluster().GetLocalNode(), val)))
- exp.Add(val);
- }
-
- return exp;
- }
- }
-
- /// <summary>
- /// Person.
- /// </summary>
- public class QueryPerson
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public QueryPerson()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="name">Name.</param>
- /// <param name="age">Age.</param>
- public QueryPerson(string name, int age)
- {
- Name = name;
- Age = age;
- }
-
- /// <summary>
- /// Name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Age.
- /// </summary>
- public int Age { get; set; }
- }
-
- /// <summary>
- /// Query filter.
- /// </summary>
- [Serializable]
- public class ScanQueryFilter<TV> : ICacheEntryFilter<int, TV>
- {
- // Error message
- public const string ErrMessage = "Error in ScanQueryFilter.Invoke";
-
- // Error flag
- public bool ThrowErr { get; set; }
-
- /** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, TV> entry)
- {
- if (ThrowErr)
- throw new Exception(ErrMessage);
-
- return entry.Key < 50;
- }
- }
-
- /// <summary>
- /// Portable query filter.
- /// </summary>
- public class PortableScanQueryFilter<TV> : ScanQueryFilter<TV>, IPortableMarshalAware
- {
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var w = writer.RawWriter();
-
- w.WriteBoolean(ThrowErr);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- var r = reader.RawReader();
-
- ThrowErr = r.ReadBoolean();
- }
- }
-}
[43/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite.h b/modules/platform/src/main/cpp/core/include/ignite/ignite.h
deleted file mode 100644
index 6c1263e..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/ignite.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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
-#define _IGNITE
-
-#include "ignite/cache/cache.h"
-#include "ignite/impl/ignite_impl.h"
-#include "ignite/ignite_configuration.h"
-
-namespace ignite
-{
- /**
- * Main interface to operate with Ignite.
- */
- class IGNITE_IMPORT_EXPORT Ignite
- {
- public:
- /**
- * Default constructor.
- */
- Ignite();
-
- /**
- * Constructor.
- */
- Ignite(impl::IgniteImpl* impl);
-
- /**
- * Get Ignite instance name.
- *
- * @return Name.
- */
- char* GetName();
-
- /**
- * Get cache.
- *
- * @param name Cache name.
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> GetCache(const char* name)
- {
- IgniteError err;
-
- cache::Cache<K, V> res = GetCache<K, V>(name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Get cache.
- *
- * @param name Cache name.
- * @param err Error;
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> GetCache(const char* name, IgniteError* err)
- {
- impl::cache::CacheImpl* cacheImpl = impl.Get()->GetCache<K, V>(name, err);
-
- return cache::Cache<K, V>(cacheImpl);
- }
-
- /**
- * Get or create cache.
- *
- * @param name Cache name.
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> GetOrCreateCache(const char* name)
- {
- IgniteError err;
-
- cache::Cache<K, V> res = GetOrCreateCache<K, V>(name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Get or create cache.
- *
- * @param name Cache name.
- * @param err Error;
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> GetOrCreateCache(const char* name, IgniteError* err)
- {
- impl::cache::CacheImpl* cacheImpl = impl.Get()->GetOrCreateCache<K, V>(name, err);
-
- return cache::Cache<K, V>(cacheImpl);
- }
-
- /**
- * Create cache.
- *
- * @param name Cache name.
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> CreateCache(const char* name)
- {
- IgniteError err;
-
- cache::Cache<K, V> res = CreateCache<K, V>(name, &err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Create cache.
- *
- * @param name Cache name.
- * @param err Error;
- * @return Cache.
- */
- template<typename K, typename V>
- cache::Cache<K, V> CreateCache(const char* name, IgniteError* err)
- {
- impl::cache::CacheImpl* cacheImpl = impl.Get()->CreateCache<K, V>(name, err);
-
- return cache::Cache<K, V>(cacheImpl);
- }
- private:
- /** Implementation delegate. */
- ignite::common::concurrent::SharedPointer<impl::IgniteImpl> impl;
- };
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h b/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
deleted file mode 100644
index ce2d730..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/ignite_configuration.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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_CONFIGURATION
-#define _IGNITE_CONFIGURATION
-
-#include <stdint.h>
-
-namespace ignite
-{
- /**
- * Single JVM option.
- */
- struct IgniteJvmOption
- {
- /** Option. */
- char* opt;
-
- /**
- * Default constructor.
- */
- IgniteJvmOption() : opt(NULL)
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param opt Option.
- */
- IgniteJvmOption(char* opt) : opt(opt)
- {
- // No-op.
- }
- };
-
- /**
- * Ignite configuration.
- */
- struct IgniteConfiguration
- {
- /** Path to Ignite home. */
- char* igniteHome;
-
- /** Path to Spring configuration file. */
- char* springCfgPath;
-
- /** Path ot JVM libbrary. */
- char* jvmLibPath;
-
- /** JVM classpath. */
- char* jvmClassPath;
-
- /** Initial amount of JVM memory. */
- int32_t jvmInitMem;
-
- /** Maximum amount of JVM memory. */
- int32_t jvmMaxMem;
-
- /** Additional JVM options. */
- IgniteJvmOption* jvmOpts;
-
- /** Additional JVM options count. */
- int32_t jvmOptsLen;
-
- /**
- * Constructor.
- */
- IgniteConfiguration() : igniteHome(NULL), springCfgPath(NULL), jvmLibPath(NULL), jvmClassPath(NULL),
- jvmInitMem(512), jvmMaxMem(1024), jvmOpts(NULL), jvmOptsLen(0)
- {
- // No-op.
- }
- };
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h b/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h
deleted file mode 100644
index 4438a0e..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/ignite_error.h
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * 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_ERROR
-#define _IGNITE_ERROR
-
-#include <sstream>
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#define IGNITE_ERROR_1(code, part1) { \
- std::stringstream stream; \
- stream << (part1); \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_2(code, part1, part2) { \
- std::stringstream stream; \
- stream << (part1) << (part2); \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_3(code, part1, part2, part3) { \
- std::stringstream stream; \
- stream << (part1) << (part2) << (part3); \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_FORMATTED_1(code, msg, key1, val1) { \
- std::stringstream stream; \
- stream << msg << " [" << key1 << "=" << (val1) << "]"; \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_FORMATTED_2(code, msg, key1, val1, key2, val2) { \
- std::stringstream stream; \
- stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << "]"; \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_FORMATTED_3(code, msg, key1, val1, key2, val2, key3, val3) { \
- std::stringstream stream; \
- stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << "]"; \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-#define IGNITE_ERROR_FORMATTED_4(code, msg, key1, val1, key2, val2, key3, val3, key4, val4) { \
- std::stringstream stream; \
- stream << msg << " [" << key1 << "=" << (val1) << ", " << key2 << "=" << (val2) << ", " << key3 << "=" << (val3) << ", " << key4 << "=" << (val4) << "]"; \
- throw ignite::IgniteError(code, stream.str().c_str()); \
-}
-
-namespace ignite
-{
- /**
- * Ignite error information.
- */
- class IGNITE_IMPORT_EXPORT IgniteError
- {
- public:
- /** Success. */
- static const int IGNITE_SUCCESS = 0;
-
- /** Failed to initialize JVM. */
- static const int IGNITE_ERR_JVM_INIT = 1;
-
- /** Failed to attach to JVM. */
- static const int IGNITE_ERR_JVM_ATTACH = 2;
-
- /** JVM library is not found. */
- static const int IGNITE_ERR_JVM_LIB_NOT_FOUND = 3;
-
- /** Failed to load JVM library. */
- static const int IGNITE_ERR_JVM_LIB_LOAD_FAILED = 4;
-
- /** JVM classpath is not provided. */
- static const int IGNITE_ERR_JVM_NO_CLASSPATH = 5;
-
- /** JVM error: no class definition found. */
- static const int IGNITE_ERR_JVM_NO_CLASS_DEF_FOUND = 6;
-
- /** JVM error: no such method. */
- static const int IGNITE_ERR_JVM_NO_SUCH_METHOD = 7;
-
- /** Memory operation error. */
- static const int IGNITE_ERR_MEMORY = 1001;
-
- /** Portable error. */
- static const int IGNITE_ERR_PORTABLE = 1002;
-
- /** Generic Ignite error. */
- static const int IGNITE_ERR_GENERIC = 2000;
-
- /** Illegal argument passed. */
- static const int IGNITE_ERR_ILLEGAL_ARGUMENT = 2001;
-
- /** Illegal state. */
- static const int IGNITE_ERR_ILLEGAL_STATE = 2002;
-
- /** Unsupported operation. */
- static const int IGNITE_ERR_UNSUPPORTED_OPERATION = 2003;
-
- /** Thread has been interrup. */
- static const int IGNITE_ERR_INTERRUPTED = 2004;
-
- /** Cluster group is empty. */
- static const int IGNITE_ERR_CLUSTER_GROUP_EMPTY = 2005;
-
- /** Cluster topology problem. */
- static const int IGNITE_ERR_CLUSTER_TOPOLOGY = 2006;
-
- /** Compute execution rejected. */
- static const int IGNITE_ERR_COMPUTE_EXECUTION_REJECTED = 2007;
-
- /** Compute job failover. */
- static const int IGNITE_ERR_COMPUTE_JOB_FAILOVER = 2008;
-
- /** Compute task cancelled. */
- static const int IGNITE_ERR_COMPUTE_TASK_CANCELLED = 2009;
-
- /** Compute task timeout. */
- static const int IGNITE_ERR_COMPUTE_TASK_TIMEOUT = 2010;
-
- /** Compute user undeclared exception. */
- static const int IGNITE_ERR_COMPUTE_USER_UNDECLARED_EXCEPTION = 2011;
-
- /** Generic cache error. */
- static const int IGNITE_ERR_CACHE = 2012;
-
- /** Generic cache loader error. */
- static const int IGNITE_ERR_CACHE_LOADER = 2013;
-
- /** Generic cache writer error. */
- static const int IGNITE_ERR_CACHE_WRITER = 2014;
-
- /** Generic cache entry processor error. */
- static const int IGNITE_ERR_ENTRY_PROCESSOR = 2015;
-
- /** Cache atomic update timeout. */
- static const int IGNITE_ERR_CACHE_ATOMIC_UPDATE_TIMEOUT = 2016;
-
- /** Cache partial update. */
- static const int IGNITE_ERR_CACHE_PARTIAL_UPDATE = 2017;
-
- /** Transaction optimisitc exception. */
- static const int IGNITE_ERR_TX_OPTIMISTIC = 2018;
-
- /** Transaction timeout. */
- static const int IGNITE_ERR_TX_TIMEOUT = 2019;
-
- /** Transaction rollback. */
- static const int IGNITE_ERR_TX_ROLLBACK = 2020;
-
- /** Transaction heuristic exception. */
- static const int IGNITE_ERR_TX_HEURISTIC = 2021;
-
- /** Authentication error. */
- static const int IGNITE_ERR_AUTHENTICATION = 2022;
-
- /** Security error. */
- static const int IGNITE_ERR_SECURITY = 2023;
-
- /** Unknown error. */
- static const int IGNITE_ERR_UNKNOWN = -1;
-
- /**
- * Throw an error if code is not IGNITE_SUCCESS.
- *
- * @param err Error.
- */
- static void ThrowIfNeeded(IgniteError& err);
-
- /**
- * Create empty error.
- */
- IgniteError();
-
- /**
- * Create error with specific code.
- *
- * @param code Error code.
- */
- IgniteError(const int32_t code);
-
- /**
- * Create error with specific code and message.
- *
- * @param code Error code.
- * @param msg Message.
- */
- IgniteError(const int32_t code, const char* msg);
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- IgniteError(const IgniteError& other);
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- * @return Assignment result.
- */
- IgniteError& operator=(const IgniteError& other);
-
- /**
- * Destructor.
- */
- ~IgniteError();
-
- /**
- * Get error code.
- *
- * @return Error code.
- */
- int32_t GetCode();
-
- /**
- * Get error message.
- *
- * @return Error message.
- */
- const char* GetText();
-
- /**
- * Set error.
- *
- * @param jniCode Error code.
- * @param jniCls Error class.
- * @param jniMsg Error message.
- * @param err Error.
- */
- static void SetError(const int jniCode, const char* jniCls, const char* jniMsg, IgniteError* err);
- private:
- /** Error code. */
- int32_t code;
-
- /** Error message. */
- char* msg;
- };
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/ignition.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/ignition.h b/modules/platform/src/main/cpp/core/include/ignite/ignition.h
deleted file mode 100644
index 8d32448..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/ignition.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * 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.
- */
-
-/**
- * \mainpage Apache Ignite C++ Library
- *
- * The Apache Ignite is a proven software solution, which delivers unprecedented speed
- * and unlimited scale to accelerate your business and time to insights. It enables high-performance transactions,
- * real-time streaming and fast analytics in a single, comprehensive data access and processing layer. The In-Memory
- * Data Fabric is designed to easily power both existing and new applications in a distributed, massively
- * parallel architecture on affordable, industry-standard hardware.
- * <p>
- * The Apache Ignite provides a unified API that spans all key types of applications
- * (Java, .NET, C++) and connects them with multiple data stores containing structured, semi-structured and
- * unstructured data (SQL, NoSQL, Hadoop). It offers a secure, highly available and manageable data environment
- * that allows companies to process full ACID transactions and generate valuable insights from real-time,
- * interactive and batch queries.
- * <p>
- * The In-Memory Data Fabric offers a strategic approach to in-memory computing that delivers performance,
- * scale and comprehensive capabilities far above and beyond what traditional in-memory databases,
- * data grids or other in-memory-based point solutions can offer by themselves.
- *
- * \section ultimate_speed_and_scale Ultimate Speed and Scale
- *
- * The Apache Ignite accesses and processes data from distributed enterprise and
- * cloud-based data stores orders of magnitudes faster, and shares them with today's most demanding transactional,
- * analytical and hybrid applications. The In-Memory Data Fabric delivers unprecedented throughput
- * and low latency performance in a virtually unlimited, global scale-out architecture for both new and
- * existing applications.
- *
- * \section comprehensive_and_proven Comprehensive and Proven
- *
- * The Apache Ignite is the product of seven years of meticulous research and development,
- * built from the ground up (i.e. no bolt-on's), and run successfully by hundreds of organizations worldwide.
- * It is a comprehensive in-memory solution that includes a clustering and compute grid, a database-agnostic data grid,
- * a real-time streaming engine as well as plug-and-play Hadoop acceleration. The In-Memory Data Fabric
- * connects multiple data sources (relational, NoSQL, Hadoop) with Java, .NET and C++ applications, and offers
- * a secure and highly available architecture; it also provides a fully-featured, graphical management interface.
- * <p>
- * The Apache Ignite is used today by Fortune 500 companies, top government agencies as well as
- * innovative mobile and web companies in a broad range of business scenarios, such as automated trading systems,
- * fraud detection, big data analytics, social networks, online gaming, and bioinformatics.
- */
-
-#ifndef _IGNITE_IGNITION
-#define _IGNITE_IGNITION
-
-#include "ignite/ignite.h"
-#include "ignite/ignite_configuration.h"
-#include "ignite/ignite_error.h"
-
-namespace ignite
-{
- /**
- * This class defines a factory for the main Ignite API.
- */
- class IGNITE_IMPORT_EXPORT Ignition
- {
- public:
- /**
- * Start Ignite instance.
- *
- * @param cfg Configuration.
- * @return Ignite instance or null in case of error.
- */
- static Ignite Start(const IgniteConfiguration& cfg);
-
- /*
- * Start Ignite instance.
- *
- * @param cfg Configuration.
- * @param err Error.
- * @return Ignite instance or null in case of error.
- */
- static Ignite Start(const IgniteConfiguration& cfg, IgniteError* err);
-
- /**
- * Start Ignite instance with specific name.
- *
- * @param cfg Configuration.
- * @param name Ignite name.
- * @return Ignite instance or null in case of error.
- */
- static Ignite Start(const IgniteConfiguration& cfg, const char* name);
-
- /**
- * Start Ignite instance with specific name.
- *
- * @param cfg Configuration.
- * @param name Ignite name.
- * @param err Error.
- * @return Ignite instance or null in case of error.
- */
- static Ignite Start(const IgniteConfiguration& cfg, const char* name, IgniteError* err);
-
- /**
- * Get default Ignite instance.
- *
- * @return Default Ignite instance.
- */
- static Ignite Get();
-
- /**
- * Get default Ignite instance.
- *
- * @param err Error.
- * @return Default Ignite instance.
- */
- static Ignite Get(IgniteError* err);
-
- /**
- * Get Ignite instance with the given name.
- *
- * @param name Ignite name.
- * @return Ignite instance.
- */
- static Ignite Get(const char* name);
-
- /**
- * Get Ignite instance with the given name.
- *
- * @param name Ignite name.
- * @param err Error.
- * @return Ignite instance.
- */
- static Ignite Get(const char* name, IgniteError* err);
-
- /**
- * Stop default Ignite instance.
- *
- * @param cancel Cancel flag.
- * @return True if default Ignite instance was stopped by this call.
- */
- static bool Stop(const bool cancel);
-
- /**
- * Stop default Ignite instance.
- *
- * @param cancel Cancel flag.
- * @param err Error.
- * @return True if Ignite instance was stopped by this call.
- */
- static bool Stop(const bool cancel, IgniteError* err);
-
- /**
- * Stop Ignite instance with the given name.
- *
- * @param name Ignite name.
- * @param cancel Cancel flag.
- * @return True if Ignite instance was stopped by this call.
- */
- static bool Stop(const char* name, const bool cancel);
-
- /**
- * Stop Ignite instance with the given name.
- *
- * @param name Ignite name.
- * @param cancel Cancel flag.
- * @param err Error.
- * @return True if Ignite instance was stopped by this call.
- */
- static bool Stop(const char* name, const bool cancel, IgniteError* err);
-
- /**
- * Stop all running Ignite instances.
- *
- * @param cancel Cancel flag.
- */
- static void StopAll(const bool cancel);
-
- /**
- * Stop all running Ignite instances.
- *
- * @param cancel Cancel flag.
- * @param err Error.
- */
- static void StopAll(const bool cancel, IgniteError* err);
- };
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
deleted file mode 100644
index 8c744e0..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/cache_impl.h
+++ /dev/null
@@ -1,418 +0,0 @@
-/*
- * 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_CACHE_IMPL
-#define _IGNITE_CACHE_IMPL
-
-#include "ignite/cache/query/query_scan.h"
-#include "ignite/cache/query/query_sql.h"
-#include "ignite/cache/query/query_text.h"
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/impl/cache/query/query_impl.h"
-#include "ignite/impl/operations.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace cache
- {
- /**
- * Cache implementation.
- */
- class IGNITE_IMPORT_EXPORT CacheImpl
- {
- public:
- /**
- * Constructor used to create new instance.
- *
- * @param name Name.
- * @param env Environment.
- * @param javaRef Reference to java object.
- */
- CacheImpl(char* name, ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
-
- /**
- * Destructor.
- */
- ~CacheImpl();
-
- /**
- * Get name.
- *
- * @return Cache name.
- */
- char* GetName();
-
- /**
- * Perform IsEmpty.
- *
- * @param err Error.
- * @return Result.
- */
- bool IsEmpty(IgniteError* err);
-
- /**
- * Perform ContainsKey.
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result.
- */
- bool ContainsKey(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform ContainsKeys.
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result.
- */
- bool ContainsKeys(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform LocalPeek.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param peekModes Peek modes.
- * @param err Error.
- */
- void LocalPeek(InputOperation& inOp, OutputOperation& outOp,
- int32_t peekModes, IgniteError* err);
-
- /**
- * Perform Get.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void Get(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform GetAll.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void GetAll(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform Put.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void Put(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform PutAll.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void PutAll(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform GetAndPut.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void GetAndPut(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform GetAndReplace.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void GetAndReplace(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform GetAndRemove.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void GetAndRemove(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform PutIfAbsent.
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result
- */
- bool PutIfAbsent(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform GetAndPutIfAbsent.
- *
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void GetAndPutIfAbsent(InputOperation& inOp, OutputOperation& outOp, IgniteError* err);
-
- /**
- * Perform Replace(K, V).
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result
- */
- bool Replace(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform Replace(K, V, V).
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result
- */
- bool ReplaceIfEqual(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform LocalEvict.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void LocalEvict(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform Clear.
- *
- * @param err Error.
- */
- void Clear(IgniteError* err);
-
- /**
- * Perform Clear.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void Clear(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform ClearAll.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void ClearAll(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform LocalClear.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void LocalClear(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform LocalClearAll.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void LocalClearAll(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform Remove(K).
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result
- */
- bool Remove(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform Remove(K, V).
- *
- * @param inOp Input.
- * @param err Error.
- * @return Result
- */
- bool RemoveIfEqual(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform RemoveAll.
- *
- * @param inOp Input.
- * @param err Error.
- */
- void RemoveAll(InputOperation& inOp, IgniteError* err);
-
- /**
- * Perform RemoveAll.
- *
- * @param err Error.
- */
- void RemoveAll(IgniteError* err);
-
- /**
- * Perform Size.
- *
- * @param peekModes Peek modes.
- * @param err Error.
- * @return Result.
- */
- int32_t Size(const int32_t peekModes, IgniteError* err);
-
- /**
- * Perform LocalSize.
- *
- * @param peekModes Peek modes.
- * @param err Error.
- * @return Result.
- */
- int32_t LocalSize(const int32_t peekModes, IgniteError* err);
-
- /**
- * Invoke query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursorImpl* QuerySql(const ignite::cache::query::SqlQuery& qry, IgniteError* err);
-
- /*
- * Invoke text query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursorImpl* QueryText(const ignite::cache::query::TextQuery& qry, IgniteError* err);
-
- /*
- * Invoke scan query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursorImpl* QueryScan(const ignite::cache::query::ScanQuery& qry, IgniteError* err);
-
- private:
- /** Name. */
- char* name;
-
- /** Environment. */
- ignite::common::concurrent::SharedPointer<IgniteEnvironment> env;
-
- /** Handle to Java object. */
- jobject javaRef;
-
- IGNITE_NO_COPY_ASSIGNMENT(CacheImpl)
-
- /**
- * Write data to memory.
- *
- * @param mem Memory.
- * @param inOp Input opeartion.
- * @param err Error.
- * @return Memory pointer.
- */
- int64_t WriteTo(interop::InteropMemory* mem, InputOperation& inOp, IgniteError* err);
-
- /**
- * Read data from memory.
- *
- * @param mem Memory.
- * @param outOp Output operation.
- */
- void ReadFrom(interop::InteropMemory* mem, OutputOperation& outOp);
-
- /**
- * Internal cache size routine.
- *
- * @param peekModes Peek modes.
- * @param loc Local flag.
- * @param err Error.
- * @return Size.
- */
- int SizeInternal(const int32_t peekModes, const bool loc, IgniteError* err);
-
- /**
- * Internal out operation.
- *
- * @param opType Operation type.
- * @param inOp Input.
- * @param err Error.
- * @return Result.
- */
- bool OutOpInternal(const int32_t opType, InputOperation& inOp, IgniteError* err);
-
- /**
- * Internal out-in operation.
- *
- * @param opType Operation type.
- * @param inOp Input.
- * @param outOp Output.
- * @param err Error.
- */
- void OutInOpInternal(const int32_t opType, InputOperation& inOp, OutputOperation& outOp,
- IgniteError* err);
-
- /**
- * Internal query execution routine.
- *
- * @param qry Query.
- * @param typ Query type.
- * @param err Error.
- */
- template<typename T>
- query::QueryCursorImpl* QueryInternal(const T& qry, int32_t typ, IgniteError* err)
- {
- ignite::common::java::JniErrorInfo jniErr;
-
- ignite::common::concurrent::SharedPointer<interop::InteropMemory> mem = env.Get()->AllocateMemory();
- interop::InteropMemory* mem0 = mem.Get();
- interop::InteropOutputStream out(mem0);
- portable::PortableWriterImpl writer(&out, env.Get()->GetMetadataManager());
- ignite::portable::PortableRawWriter rawWriter(&writer);
-
- qry.Write(rawWriter);
-
- out.Synchronize();
-
- jobject qryJavaRef = env.Get()->Context()->CacheOutOpQueryCursor(javaRef, typ, mem.Get()->PointerLong(),
- &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == ignite::common::java::IGNITE_JNI_ERR_SUCCESS)
- return new query::QueryCursorImpl(env, qryJavaRef);
- else
- return NULL;
- }
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
deleted file mode 100644
index e65eeb6..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/cache/query/query_impl.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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_CACHE_QUERY_IMPL
-#define _IGNITE_CACHE_QUERY_IMPL
-
-#include "ignite/ignite_error.h"
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/impl/operations.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace cache
- {
- namespace query
- {
- /**
- * Query cursor implementation.
- */
- class IGNITE_IMPORT_EXPORT QueryCursorImpl
- {
- public:
- /**
- * Constructor.
- *
- * @param env Environment.
- * @param javaRef Java reference.
- */
- QueryCursorImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
-
- /**
- * Destructor.
- */
- ~QueryCursorImpl();
-
- /**
- * Check whether next result exists.
- *
- * @param err Error.
- * @return True if exists.
- */
- bool HasNext(IgniteError* err);
-
- /**
- * Get next object.
- *
- * @param op Operation.
- * @param err Error.
- */
- void GetNext(OutputOperation& op, IgniteError* err);
-
- /**
- * Get all cursor entries.
- *
- * @param op Operation.
- * @param err Error.
- */
- void GetAll(OutputOperation& op, IgniteError* err);
-
- private:
- /** Environment. */
- ignite::common::concurrent::SharedPointer<impl::IgniteEnvironment> env;
-
- /** Handle to Java object. */
- jobject javaRef;
-
- /** Whether iteration methods were called. */
- bool iterCalled;
-
- /** Whether GetAll() method was called. */
- bool getAllCalled;
-
- /** Whether next entry is available. */
- bool hasNext;
-
- IGNITE_NO_COPY_ASSIGNMENT(QueryCursorImpl);
-
- /**
- * Create Java-side iterator if needed.
- *
- * @param err Error.
- * @return True in case of success, false if an error is thrown.
- */
- bool CreateIteratorIfNeeded(IgniteError* err);
-
- /**
- * Check whether Java-side iterator has next element.
- *
- * @param err Error.
- * @return True if the next element is available.
- */
- bool IteratorHasNext(IgniteError* err);
- };
- }
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h b/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
deleted file mode 100644
index 5e1b60a..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/handle_registry.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- * 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_HANDLE_REGISTRY
-#define _IGNITE_HANDLE_REGISTRY
-
-#include <map>
-#include <stdint.h>
-
-#include <ignite/common/concurrent.h>
-
-namespace ignite
-{
- namespace impl
- {
- /**
- * Something what can be registered inside handle registry.
- */
- class IGNITE_IMPORT_EXPORT HandleRegistryEntry
- {
- public:
- /**
- * Destructor.
- */
- virtual ~HandleRegistryEntry();
- };
-
- /**
- * Handle registry segment containing thread-specific data for slow-path access.
- */
- class IGNITE_IMPORT_EXPORT HandleRegistrySegment
- {
- public:
- /**
- * Constructor.
- */
- HandleRegistrySegment();
-
- /**
- * Destructor.
- */
- ~HandleRegistrySegment();
-
- /**
- * Get entry from segment.
- *
- * @param hnd Handle.
- * @return Associated entry or NULL if it doesn't exists.
- */
- ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd);
-
- /**
- * Put entry into segment.
- *
- * @param hnd Handle.
- * @param entry Associated entry (cannot be NULL).
- */
- void Put(int64_t hnd, const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& entry);
-
- /**
- * Remove entry from the segment.
- *
- * @param hnd Handle.
- */
- void Remove(int64_t hnd);
-
- /**
- * Clear all entries from the segment.
- */
- void Clear();
- private:
- /** Map with data. */
- std::map<int64_t, ignite::common::concurrent::SharedPointer<HandleRegistryEntry>>* map;
-
- /** Mutex. */
- ignite::common::concurrent::CriticalSection* mux;
-
- IGNITE_NO_COPY_ASSIGNMENT(HandleRegistrySegment);
- };
-
- /**
- * Handle registry.
- */
- class IGNITE_IMPORT_EXPORT HandleRegistry
- {
- public:
- /**
- * Constructor.
- *
- * @param fastCap Fast-path capacity.
- * @param segmentCnt Slow-path segments count.
- */
- HandleRegistry(int32_t fastCap, int32_t slowSegmentCnt);
-
- /**
- * Destructor.
- */
- ~HandleRegistry();
-
- /**
- * Allocate handle.
- *
- * @param target Target.
- * @return Handle.
- */
- int64_t Allocate(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
-
- /**
- * Allocate handle in critical mode.
- *
- * @param target Target.
- * @return Handle.
- */
- int64_t AllocateCritical(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
-
- /**
- * Allocate handle in safe mode.
- *
- * @param target Target.
- * @return Handle.
- */
- int64_t AllocateSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
-
- /**
- * Allocate handle in critical and safe modes.
- *
- * @param target Target.
- * @return Handle.
- */
- int64_t AllocateCriticalSafe(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target);
-
- /**
- * Release handle.
- *
- * @param hnd Handle.
- */
- void Release(int64_t hnd);
-
- /**
- * Get target.
- *
- * @param hnd Handle.
- * @param Target.
- */
- ignite::common::concurrent::SharedPointer<HandleRegistryEntry> Get(int64_t hnd);
-
- /**
- * Close the registry.
- */
- void Close();
- private:
- /** Fast-path container capacity. */
- int32_t fastCap;
-
- /** Fast-path counter. */
- int32_t fastCtr;
-
- /** Fast-path container. */
- ignite::common::concurrent::SharedPointer<HandleRegistryEntry>* fast;
-
- /** Amount of slow-path segments. */
- int32_t slowSegmentCnt;
-
- /** Slow-path counter. */
- int64_t slowCtr;
-
- /** Slow-path segments. */
- HandleRegistrySegment** slow;
-
- /** Close flag. */
- int32_t closed;
-
- IGNITE_NO_COPY_ASSIGNMENT(HandleRegistry);
-
- /**
- * Internal allocation routine.
- *
- * @param target Target.
- * @param Critical mode flag.
- * @param Safe mode flag.
- */
- int64_t Allocate0(const ignite::common::concurrent::SharedPointer<HandleRegistryEntry>& target,
- bool critical, bool safe);
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h b/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h
deleted file mode 100644
index 2f195b2..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_environment.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * 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_ENVIRONMENT
-#define _IGNITE_ENVIRONMENT
-
-#include <ignite/common/concurrent.h>
-#include <ignite/common/java.h>
-
-#include "ignite/impl/interop/interop_memory.h"
-#include "portable/portable_metadata_manager.h"
-
-namespace ignite
-{
- namespace impl
- {
- /**
- * Defines environment in which Ignite operates.
- */
- class IGNITE_IMPORT_EXPORT IgniteEnvironment
- {
- public:
- /**
- * Default constructor.
- */
- IgniteEnvironment();
-
- /**
- * Destructor.
- */
- ~IgniteEnvironment();
-
- /**
- * Populate callback handlers.
- *
- * @param Target (current env wrapped into a shared pointer).
- * @return JNI handlers.
- */
- ignite::common::java::JniHandlers GetJniHandlers(ignite::common::concurrent::SharedPointer<IgniteEnvironment>* target);
-
- /**
- * Perform initialization on successful start.
- *
- * @param ctx Context.
- */
- void Initialize(ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx);
-
- /**
- * Start callback.
- *
- * @param memPtr Memory pointer.
- */
- void OnStartCallback(long long memPtr);
-
- /**
- * Get name of Ignite instance.
- *
- * @return Name.
- */
- char* InstanceName();
-
- /**
- * Get JNI context.
- *
- * @return Context.
- */
- ignite::common::java::JniContext* Context();
-
- /**
- * Get memory for interop operations.
- *
- * @return Memory.
- */
- ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory();
-
- /**
- * Get memory chunk for interop operations with desired capacity.
- *
- * @param cap Capacity.
- * @return Memory.
- */
- ignite::common::concurrent::SharedPointer<interop::InteropMemory> AllocateMemory(int32_t cap);
-
- /**
- * Get memory chunk located at the given pointer.
- *
- * @param memPtr Memory pointer.
- * @retrun Memory.
- */
- ignite::common::concurrent::SharedPointer<interop::InteropMemory> GetMemory(int64_t memPtr);
-
- /**
- * Get metadata manager.
- *
- * @param Metadata manager.
- */
- portable::PortableMetadataManager* GetMetadataManager();
- private:
- /** Context to access Java. */
- ignite::common::concurrent::SharedPointer<ignite::common::java::JniContext> ctx;
-
- /** Startup latch. */
- ignite::common::concurrent::SingleLatch* latch;
-
- /** Ignite name. */
- char* name;
-
- /** Metadata manager. */
- portable::PortableMetadataManager* metaMgr;
-
- IGNITE_NO_COPY_ASSIGNMENT(IgniteEnvironment);
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h
deleted file mode 100644
index 52472c6..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/ignite_impl.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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
-#define _IGNITE_IMPL
-
-#include <ignite/common/concurrent.h>
-#include <ignite/common/java.h>
-
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/impl/utils.h"
-
-namespace ignite
-{
- namespace impl
- {
- /**
- * Ignite implementation.
- */
- class IgniteImpl
- {
- friend class Ignite;
- public:
- /**
- * Constructor used to create new instance.
- *
- * @param env Environment.
- * @param javaRef Reference to java object.
- */
- IgniteImpl(ignite::common::concurrent::SharedPointer<IgniteEnvironment> env, jobject javaRef);
-
- /**
- * Destructor.
- */
- ~IgniteImpl();
-
- /**
- * Get name of the Ignite.
- *
- * @param Name.
- */
- char* GetName();
-
- /**
- * Get cache.
- *
- * @param name Cache name.
- * @param err Error.
- */
- template<typename K, typename V>
- cache::CacheImpl* GetCache(const char* name, IgniteError* err)
- {
- ignite::common::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = utils::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
- }
-
- /**
- * Get or create cache.
- *
- * @param name Cache name.
- * @param err Error.
- */
- template<typename K, typename V>
- cache::CacheImpl* GetOrCreateCache(const char* name, IgniteError* err)
- {
- ignite::common::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorGetOrCreateCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = utils::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
- }
-
- /**
- * Create cache.
- *
- * @param name Cache name.
- * @param err Error.
- */
- template<typename K, typename V>
- cache::CacheImpl* CreateCache(const char* name, IgniteError* err)
- {
- ignite::common::java::JniErrorInfo jniErr;
-
- jobject cacheJavaRef = env.Get()->Context()->ProcessorCreateCache(javaRef, name, &jniErr);
-
- if (!cacheJavaRef)
- {
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- return NULL;
- }
-
- char* name0 = utils::CopyChars(name);
-
- return new cache::CacheImpl(name0, env, cacheJavaRef);
- }
- private:
- /** Environment. */
- ignite::common::concurrent::SharedPointer<IgniteEnvironment> env;
-
- /** Native Java counterpart. */
- jobject javaRef;
-
- IGNITE_NO_COPY_ASSIGNMENT(IgniteImpl)
- };
- }
-
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/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
deleted file mode 100644
index da4fdb9..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index d8fcfc3..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_input_stream.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 00cba43..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_memory.h
+++ /dev/null
@@ -1,280 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 5a08aed..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/interop/interop_output_stream.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * 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
[38/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/ignite_environment.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/ignite_environment.cpp b/modules/platform/src/main/cpp/core/src/impl/ignite_environment.cpp
deleted file mode 100644
index 8fb1a02..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/ignite_environment.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/ignite_environment.h"
-#include "ignite/portable/portable.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-
-namespace ignite
-{
- namespace impl
- {
- /**
- * OnStart callback.
- *
- * @param target Target environment.
- * @param proc Processor instance (not used for now).
- * @param memPtr Memory pointer.
- */
- void IGNITE_CALL OnStart(void* target, void* proc, long long memPtr)
- {
- SharedPointer<IgniteEnvironment>* ptr = static_cast<SharedPointer<IgniteEnvironment>*>(target);
-
- ptr->Get()->OnStartCallback(memPtr);
- }
-
- /**
- * OnStop callback.
- *
- * @param target Target environment.
- */
- void IGNITE_CALL OnStop(void* target)
- {
- SharedPointer<IgniteEnvironment>* ptr = static_cast<SharedPointer<IgniteEnvironment>*>(target);
-
- delete ptr;
- }
-
- IgniteEnvironment::IgniteEnvironment() : ctx(SharedPointer<JniContext>()), latch(new SingleLatch), name(NULL),
- metaMgr(new PortableMetadataManager())
- {
- // No-op.
- }
-
- IgniteEnvironment::~IgniteEnvironment()
- {
- delete latch;
-
- if (name)
- delete name;
-
- delete metaMgr;
- }
-
- JniHandlers IgniteEnvironment::GetJniHandlers(SharedPointer<IgniteEnvironment>* target)
- {
- JniHandlers hnds = JniHandlers();
-
- hnds.target = target;
-
- hnds.onStart = OnStart;
- hnds.onStop = OnStop;
-
- hnds.error = NULL;
-
- return hnds;
- }
-
- void IgniteEnvironment::Initialize(SharedPointer<JniContext> ctx)
- {
- this->ctx = ctx;
-
- latch->CountDown();
- }
-
- char* IgniteEnvironment::InstanceName()
- {
- return name;
- }
-
- JniContext* IgniteEnvironment::Context()
- {
- return ctx.Get();
- }
-
- SharedPointer<InteropMemory> IgniteEnvironment::AllocateMemory()
- {
- SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(1024));
-
- return ptr;
- }
-
- SharedPointer<InteropMemory> IgniteEnvironment::AllocateMemory(int32_t cap)
- {
- SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(cap));
-
- return ptr;
- }
-
- SharedPointer<InteropMemory> IgniteEnvironment::GetMemory(int64_t memPtr)
- {
- int8_t* memPtr0 = reinterpret_cast<int8_t*>(memPtr);
-
- int32_t flags = InteropMemory::Flags(memPtr0);
-
- if (InteropMemory::IsExternal(flags))
- {
- SharedPointer<InteropMemory> ptr(new InteropExternalMemory(memPtr0));
-
- return ptr;
- }
- else
- {
- SharedPointer<InteropMemory> ptr(new InteropUnpooledMemory(memPtr0));
-
- return ptr;
- }
- }
-
- PortableMetadataManager* IgniteEnvironment::GetMetadataManager()
- {
- return metaMgr;
- }
-
- void IgniteEnvironment::OnStartCallback(long long memPtr)
- {
- InteropExternalMemory mem(reinterpret_cast<int8_t*>(memPtr));
- InteropInputStream stream(&mem);
-
- PortableReaderImpl reader(&stream);
-
- int32_t nameLen = reader.ReadString(NULL, 0);
-
- if (nameLen >= 0)
- {
- name = new char[nameLen + 1];
- reader.ReadString(name, nameLen + 1);
- }
- else
- name = NULL;
- }
- }
-}
-
-
-
-
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/ignite_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/ignite_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/ignite_impl.cpp
deleted file mode 100644
index 1aad309..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/ignite_impl.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/ignite_impl.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-
-namespace ignite
-{
- namespace impl
- {
- IgniteImpl::IgniteImpl(SharedPointer<IgniteEnvironment> env, jobject javaRef) : env(env), javaRef(javaRef)
- {
- // No-op.
- }
-
- IgniteImpl::~IgniteImpl()
- {
- JniContext::Release(javaRef);
- }
-
- char* IgniteImpl::GetName()
- {
- return env.Get()->InstanceName();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/interop/interop_input_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/interop/interop_input_stream.cpp b/modules/platform/src/main/cpp/core/src/impl/interop/interop_input_stream.cpp
deleted file mode 100644
index 72340ee..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/interop/interop_input_stream.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.
- */
-
-#include <cstring>
-
-#include "ignite/impl/interop/interop_input_stream.h"
-#include "ignite/ignite_error.h"
-
-/**
- * Common macro to read a single value.
- */
-#define IGNITE_INTEROP_IN_READ(type, len) { \
- EnsureEnoughData(len); \
- type res = *reinterpret_cast<type*>(data + pos); \
- Shift(len); \
- return res; \
-}
-
-/**
- * Common macro to read an array.
- */
-#define IGNITE_INTEROP_IN_READ_ARRAY(len, shift) { \
- CopyAndShift(reinterpret_cast<int8_t*>(res), 0, len << shift); \
-}
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- union PortableInt32Float
- {
- int32_t i;
- float f;
- };
-
- union PortableInt64Double
- {
- int64_t i;
- double d;
- };
-
- InteropInputStream::InteropInputStream(InteropMemory* mem)
- {
- this->mem = mem;
-
- data = mem->Data();
- len = mem->Length();
- pos = 0;
- }
-
- int8_t InteropInputStream::ReadInt8()
- {
- IGNITE_INTEROP_IN_READ(int8_t, 1);
- }
-
- void InteropInputStream::ReadInt8Array(int8_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 0);
- }
-
- bool InteropInputStream::ReadBool()
- {
- return ReadInt8() == 1;
- }
-
- void InteropInputStream::ReadBoolArray(bool* const res, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- *(res + i) = ReadBool();
- }
-
- int16_t InteropInputStream::ReadInt16()
- {
- IGNITE_INTEROP_IN_READ(int16_t, 2);
- }
-
- void InteropInputStream::ReadInt16Array(int16_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 1);
- }
-
- uint16_t InteropInputStream::ReadUInt16()
- {
- IGNITE_INTEROP_IN_READ(uint16_t, 2);
- }
-
- void InteropInputStream::ReadUInt16Array(uint16_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 1);
- }
-
- int32_t InteropInputStream::ReadInt32()
- {
- IGNITE_INTEROP_IN_READ(int32_t, 4);
- }
-
- int32_t InteropInputStream::ReadInt32(int32_t pos)
- {
- int delta = pos + 4 - this->pos;
-
- if (delta > 0)
- EnsureEnoughData(delta);
-
- return *reinterpret_cast<int32_t*>(data + pos);
- }
-
- void InteropInputStream::ReadInt32Array(int32_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 2);
- }
-
- int64_t InteropInputStream::ReadInt64()
- {
- IGNITE_INTEROP_IN_READ(int64_t, 8);
- }
-
- void InteropInputStream::ReadInt64Array(int64_t* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 3);
- }
-
- float InteropInputStream::ReadFloat()
- {
- PortableInt32Float u;
-
- u.i = ReadInt32();
-
- return u.f;
- }
-
- void InteropInputStream::ReadFloatArray(float* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 2);
- }
-
- double InteropInputStream::ReadDouble()
- {
- PortableInt64Double u;
-
- u.i = ReadInt64();
-
- return u.d;
- }
-
- void InteropInputStream::ReadDoubleArray(double* const res, const int32_t len)
- {
- IGNITE_INTEROP_IN_READ_ARRAY(len, 3);
- }
-
- int32_t InteropInputStream::Remaining()
- {
- return len - pos;
- }
-
- int32_t InteropInputStream::Position()
- {
- return pos;
- }
-
- void InteropInputStream::Position(int32_t pos)
- {
- if (pos > len) {
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_MEMORY, "Requested input stream position is out of bounds",
- "memPtr", mem->PointerLong(), "len", len, "pos", pos);
- }
-
- this->pos = pos;
- }
-
- void InteropInputStream::Synchronize()
- {
- data = mem->Data();
- len = mem->Length();
- }
-
- void InteropInputStream::EnsureEnoughData(int32_t cnt)
- {
- if (len - pos < cnt) {
- IGNITE_ERROR_FORMATTED_4(IgniteError::IGNITE_ERR_MEMORY, "Not enough data in the stream",
- "memPtr", mem->PointerLong(), "len", len, "pos", pos, "requested", cnt);
- }
- }
-
- void InteropInputStream::CopyAndShift(int8_t* dest, int32_t off, int32_t cnt)
- {
- EnsureEnoughData(cnt);
-
- memcpy(dest + off, data + pos, cnt);
-
- Shift(cnt);
- }
-
- void InteropInputStream::Shift(int32_t cnt)
- {
- pos += cnt;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/interop/interop_memory.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/interop/interop_memory.cpp b/modules/platform/src/main/cpp/core/src/impl/interop/interop_memory.cpp
deleted file mode 100644
index 05ba8b6..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/interop/interop_memory.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.
- */
-
-#include <ignite/common/java.h>
-
-#include "ignite/impl/interop/interop_memory.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::common::java;
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- int8_t* InteropMemory::Data(int8_t* memPtr)
- {
- return reinterpret_cast<int8_t*>(*reinterpret_cast<int64_t*>(memPtr));
- }
-
- void InteropMemory::Data(int8_t* memPtr, void* ptr)
- {
- *reinterpret_cast<int64_t*>(memPtr) = reinterpret_cast<int64_t>(ptr);
- }
-
- int32_t InteropMemory::Capacity(int8_t* memPtr)
- {
- return *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_CAP);
- }
-
- void InteropMemory::Capacity(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_CAP) = val;
- }
-
- int32_t InteropMemory::Length(int8_t* memPtr)
- {
- return *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_LEN);
- }
-
- void InteropMemory::Length(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_LEN) = val;
- }
-
- int32_t InteropMemory::Flags(int8_t* memPtr)
- {
- return *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_FLAGS);
- }
-
- void InteropMemory::Flags(int8_t* memPtr, int32_t val)
- {
- *reinterpret_cast<int32_t*>(memPtr + IGNITE_MEM_HDR_OFF_FLAGS) = val;
- }
-
- bool InteropMemory::IsExternal(int8_t* memPtr)
- {
- return IsExternal(Flags(memPtr));
- }
-
- bool InteropMemory::IsExternal(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_EXT) != IGNITE_MEM_FLAG_EXT;
- }
-
- bool InteropMemory::IsPooled(int8_t* memPtr)
- {
- return IsPooled(Flags(memPtr));
- }
-
- bool InteropMemory::IsPooled(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_POOLED) != 0;
- }
-
- bool InteropMemory::IsAcquired(int8_t* memPtr)
- {
- return IsAcquired(Flags(memPtr));
- }
-
- bool InteropMemory::IsAcquired(int32_t flags)
- {
- return (flags & IGNITE_MEM_FLAG_ACQUIRED) != 0;
- }
-
- int8_t* InteropMemory::Pointer()
- {
- return memPtr;
- }
-
- int64_t InteropMemory::PointerLong()
- {
- return reinterpret_cast<int64_t>(memPtr);
- }
-
- int8_t* InteropMemory::Data()
- {
- return Data(memPtr);
- }
-
- int32_t InteropMemory::Capacity()
- {
- return Capacity(memPtr);
- }
-
- int32_t InteropMemory::Length()
- {
- return Length(memPtr);
- }
-
- void InteropMemory::Length(int32_t val)
- {
- Length(memPtr, val);
- }
-
- InteropUnpooledMemory::InteropUnpooledMemory(int32_t cap)
- {
- memPtr = static_cast<int8_t*>(malloc(IGNITE_MEM_HDR_LEN));
-
- Data(memPtr, malloc(cap));
- Capacity(memPtr, cap);
- Length(memPtr, 0);
- Flags(memPtr, IGNITE_MEM_FLAG_EXT);
-
- owning = true;
- }
-
- InteropUnpooledMemory::InteropUnpooledMemory(int8_t* memPtr)
- {
- this->memPtr = memPtr;
- this->owning = false;
- }
-
- InteropUnpooledMemory::~InteropUnpooledMemory()
- {
- if (owning) {
- free(Data());
- free(memPtr);
- }
- }
-
- void InteropUnpooledMemory::Reallocate(int32_t cap)
- {
- int doubledCap = Capacity() << 1;
-
- if (doubledCap > cap)
- cap = doubledCap;
-
- Data(memPtr, realloc(Data(memPtr), cap));
- Capacity(memPtr, cap);
- }
-
- InteropExternalMemory::InteropExternalMemory(int8_t* memPtr)
- {
- this->memPtr = memPtr;
- }
-
- void InteropExternalMemory::Reallocate(int32_t cap)
- {
- if (JniContext::Reallocate(reinterpret_cast<int64_t>(memPtr), cap) == -1) {
- IGNITE_ERROR_FORMATTED_2(IgniteError::IGNITE_ERR_MEMORY, "Failed to reallocate external memory",
- "memPtr", PointerLong(), "requestedCapacity", cap)
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/interop/interop_output_stream.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/interop/interop_output_stream.cpp b/modules/platform/src/main/cpp/core/src/impl/interop/interop_output_stream.cpp
deleted file mode 100644
index ecdfd42..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/interop/interop_output_stream.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * 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.
- */
-
-#include <cstring>
-
-#include "ignite/impl/interop/interop_output_stream.h"
-#include "ignite/ignite_error.h"
-
-/**
- * Common macro to write a single value.
- */
-#define IGNITE_INTEROP_OUT_WRITE(val, type, len) { \
- EnsureCapacity(pos + len); \
- *reinterpret_cast<type*>(data + pos) = val; \
- Shift(len); \
-}
-
-/**
- * Common macro to write an array.
- */
-#define IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len) { \
- CopyAndShift(reinterpret_cast<const int8_t*>(val), 0, len); \
-}
-
-namespace ignite
-{
- namespace impl
- {
- namespace interop
- {
- union PortableFloatInt32
- {
- float f;
- int32_t i;
- };
-
- union PortableDoubleInt64
- {
- double d;
- int64_t i;
- };
-
- InteropOutputStream::InteropOutputStream(InteropMemory* mem)
- {
- this->mem = mem;
-
- data = mem->Data();
- cap = mem->Capacity();
- pos = 0;
- }
-
- void InteropOutputStream::WriteInt8(const int8_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int8_t, 1);
- }
-
- void InteropOutputStream::WriteInt8(const int8_t val, const int32_t pos)
- {
- EnsureCapacity(pos + 1);
-
- *(data + pos) = val;
- }
-
- void InteropOutputStream::WriteInt8Array(const int8_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len);
- }
-
- void InteropOutputStream::WriteBool(const bool val)
- {
- WriteInt8(val ? 1 : 0);
- }
-
- void InteropOutputStream::WriteBoolArray(const bool* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteBool(*(val + i));
- }
-
- void InteropOutputStream::WriteInt16(const int16_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int16_t, 2);
- }
-
- void InteropOutputStream::WriteInt16Array(const int16_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 1);
- }
-
- void InteropOutputStream::WriteUInt16(const uint16_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, uint16_t, 2);
- }
-
- void InteropOutputStream::WriteUInt16Array(const uint16_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 1);
- }
-
- void InteropOutputStream::WriteInt32(const int32_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int32_t, 4);
- }
-
- void InteropOutputStream::WriteInt32(const int32_t pos, const int32_t val)
- {
- EnsureCapacity(pos + 4);
-
- *reinterpret_cast<int32_t*>(data + pos) = val;
- }
-
- void InteropOutputStream::WriteInt32Array(const int32_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 2);
- }
-
- void InteropOutputStream::WriteInt64(const int64_t val)
- {
- IGNITE_INTEROP_OUT_WRITE(val, int64_t, 8);
- }
-
- void InteropOutputStream::WriteInt64Array(const int64_t* val, const int32_t len)
- {
- IGNITE_INTEROP_OUT_WRITE_ARRAY(val, len << 3);
- }
-
- void InteropOutputStream::WriteFloat(const float val)
- {
- PortableFloatInt32 u;
-
- u.f = val;
-
- WriteInt32(u.i);
- }
-
- void InteropOutputStream::WriteFloatArray(const float* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteFloat(*(val + i));
- }
-
- void InteropOutputStream::WriteDouble(const double val)
- {
- PortableDoubleInt64 u;
-
- u.d = val;
-
- WriteInt64(u.i);
- }
-
- void InteropOutputStream::WriteDoubleArray(const double* val, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- WriteDouble(*(val + i));
- }
-
- int32_t InteropOutputStream::Position()
- {
- return pos;
- }
-
- void InteropOutputStream::Position(const int32_t val)
- {
- EnsureCapacity(val);
-
- pos = val;
- }
-
- void InteropOutputStream::Synchronize()
- {
- mem->Length(pos);
- }
-
- void InteropOutputStream::EnsureCapacity(int32_t reqCap) {
- if (reqCap > cap) {
- int newCap = cap << 1;
-
- if (newCap < reqCap)
- newCap = reqCap;
-
- mem->Reallocate(newCap);
- data = mem->Data();
- cap = newCap;
- }
- }
-
- void InteropOutputStream::Shift(int32_t cnt) {
- pos += cnt;
- }
-
- void InteropOutputStream::CopyAndShift(const int8_t* src, int32_t off, int32_t len) {
- EnsureCapacity(pos + len);
-
- memcpy(data + pos, src + off, len);
-
- Shift(len);
- }
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_handler.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_handler.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_handler.cpp
deleted file mode 100644
index 5ca91dc..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_handler.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_metadata_handler.h"
-
-using namespace ignite::common::concurrent;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableMetadataHandler::PortableMetadataHandler(SPSnap snap) : snap(snap), fieldIds(NULL), fields(NULL)
- {
- // No-op.
- }
-
- PortableMetadataHandler::~PortableMetadataHandler()
- {
- if (fieldIds)
- delete fieldIds;
-
- if (fields)
- delete fields;
- }
-
- void PortableMetadataHandler::OnFieldWritten(int32_t fieldId, std::string fieldName, int32_t fieldTypeId)
- {
- if (!snap.Get() || !snap.Get()->ContainsFieldId(fieldId))
- {
- if (!HasDifference())
- {
- fieldIds = new std::set<int32_t>();
- fields = new std::map<std::string, int32_t>();
- }
-
- fieldIds->insert(fieldId);
- (*fields)[fieldName] = fieldTypeId;
- }
- }
-
- SPSnap PortableMetadataHandler::GetSnapshot()
- {
- return snap;
- }
-
- bool PortableMetadataHandler::HasDifference()
- {
- return fieldIds ? true : false;
- }
-
- std::set<int32_t>* PortableMetadataHandler::GetFieldIds()
- {
- return fieldIds;
- }
-
- std::map<std::string, int32_t>* PortableMetadataHandler::GetFields()
- {
- return fields;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_manager.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_manager.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_manager.cpp
deleted file mode 100644
index 63e92a9..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_manager.cpp
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.
- */
-
-#include <ignite/common/concurrent.h>
-
-#include "ignite/impl/portable/portable_metadata_manager.h"
-
-using namespace ignite::common::concurrent;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableMetadataManager::PortableMetadataManager() :
- snapshots(SharedPointer<std::map<int32_t, SPSnap>>(new std::map<int32_t, SPSnap>)),
- pending(new std::vector<SPSnap>()),
- cs(new CriticalSection()),
- pendingVer(0), ver(0)
- {
- // No-op.
- }
-
- PortableMetadataManager::~PortableMetadataManager()
- {
- pending->erase(pending->begin(), pending->end());
-
- delete pending;
- delete cs;
- }
-
- SharedPointer<PortableMetadataHandler> PortableMetadataManager::GetHandler(int32_t typeId)
- {
- SharedPointer<std::map<int32_t, SPSnap>> snapshots0 = snapshots;
-
- SPSnap snapshot = (*snapshots0.Get())[typeId];
-
- return SharedPointer<PortableMetadataHandler>(new PortableMetadataHandler(snapshot));
- }
-
- void PortableMetadataManager::SubmitHandler(std::string typeName, int32_t typeId,
- PortableMetadataHandler* hnd)
- {
- Snap* snap = hnd->GetSnapshot().Get();
-
- // If this is the very first write of a class or difference exists,
- // we need to enqueue it for write.
- if (!snap || hnd->HasDifference())
- {
- std::set<int32_t>* newFieldIds = new std::set<int32_t>();
- std::map<std::string, int32_t>* newFields = new std::map<std::string, int32_t>();
-
- CopyFields(snap, newFieldIds, newFields);
-
- if (hnd->HasDifference())
- {
- std::set<int32_t>* diffFieldIds = hnd->GetFieldIds();
- std::map<std::string, int32_t>* diffFields = hnd->GetFields();
-
- for (std::set<int32_t>::iterator it = diffFieldIds->begin(); it != diffFieldIds->end(); ++it)
- newFieldIds->insert(*it);
-
- for (std::map<std::string, int32_t>::iterator it = diffFields->begin(); it != diffFields->end(); ++it)
- (*newFields)[it->first] = it->second;
- }
-
- Snap* diffSnap = new Snap(typeName, typeId, newFieldIds, newFields);
-
- cs->Enter();
-
- pending->push_back(SPSnap(diffSnap));
-
- pendingVer++;
-
- cs->Leave();
- }
- }
-
- int32_t PortableMetadataManager::GetVersion()
- {
- Memory::Fence();
-
- return ver;
- }
-
- bool PortableMetadataManager::IsUpdatedSince(int32_t oldVer)
- {
- Memory::Fence();
-
- return pendingVer > oldVer;
- }
-
- bool PortableMetadataManager::ProcessPendingUpdates(PortableMetadataUpdater* updater, IgniteError* err)
- {
- bool success = true; // Optimistically assume that all will be fine.
-
- cs->Enter();
-
- for (std::vector<SPSnap>::iterator it = pending->begin(); it != pending->end(); ++it)
- {
- Snap* pendingSnap = (*it).Get();
-
- if (updater->Update(pendingSnap, err))
- {
- // Perform copy-on-write update of snapshot collection.
- std::map<int32_t, SPSnap>* newSnapshots = new std::map<int32_t, SPSnap>();
-
- bool snapshotFound = false;
-
- for (std::map<int32_t, SPSnap>::iterator snapIt = snapshots.Get()->begin();
- snapIt != snapshots.Get()->end(); ++snapIt)
- {
- int32_t curTypeId = snapIt->first;
- Snap* curSnap = snapIt->second.Get();
-
- if (pendingSnap->GetTypeId() == curTypeId)
- {
- // Have to create snapshot with updated fields.
- std::set<int32_t>* newFieldIds = new std::set<int32_t>();
- std::map<std::string, int32_t>* newFields = new std::map<std::string, int32_t>();
-
- // Add old fields.
- CopyFields(curSnap, newFieldIds, newFields);
-
- // Add new fields.
- CopyFields(pendingSnap, newFieldIds, newFields);
-
- // Create new snapshot.
- Snap* newSnap = new Snap(pendingSnap->GetTypeName(), pendingSnap->GetTypeId(),
- newFieldIds, newFields);
-
- (*newSnapshots)[curTypeId] = SPSnap(newSnap);
-
- snapshotFound = true;
- }
- else
- (*newSnapshots)[curTypeId] = snapIt->second; // Just transfer exising snapshot.
- }
-
- // Handle situation when completely new snapshot is found.
- if (!snapshotFound)
- (*newSnapshots)[pendingSnap->GetTypeId()] = *it;
-
- snapshots = SharedPointer<std::map<int32_t, SPSnap>>(newSnapshots);
- }
- else
- {
- // Stop as we cannot move further.
- success = false;
-
- break;
- }
- }
-
- if (success)
- {
- pending->erase(pending->begin(), pending->end());
-
- ver = pendingVer;
- }
-
- cs->Leave();
-
- return success;
- }
-
- void PortableMetadataManager::CopyFields(Snap* snap, std::set<int32_t>* fieldIds,
- std::map<std::string, int32_t>* fields)
- {
- if (snap && snap->HasFields())
- {
- std::set<int32_t>* snapFieldIds = snap->GetFieldIds();
- std::map<std::string, int32_t>* snapFields = snap->GetFields();
-
- for (std::set<int32_t>::iterator oldIt = snapFieldIds->begin();
- oldIt != snapFieldIds->end(); ++oldIt)
- fieldIds->insert(*oldIt);
-
- for (std::map<std::string, int32_t>::iterator newFieldsIt = snapFields->begin();
- newFieldsIt != snapFields->end(); ++newFieldsIt)
- (*fields)[newFieldsIt->first] = newFieldsIt->second;
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_snapshot.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_snapshot.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_snapshot.cpp
deleted file mode 100644
index 6ce5ab5..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_snapshot.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_metadata_snapshot.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableMetadataSnapshot::PortableMetadataSnapshot(std::string typeName, int32_t typeId,
- std::set<int32_t>* fieldIds, std::map<std::string, int32_t>* fields) :
- typeName(typeName), typeId(typeId), fieldIds(fieldIds), fields(fields)
- {
- // No-op.
- }
-
- PortableMetadataSnapshot::~PortableMetadataSnapshot()
- {
- delete fieldIds;
- delete fields;
- }
-
- bool PortableMetadataSnapshot::ContainsFieldId(int32_t fieldId)
- {
- return fieldIds && fieldIds->count(fieldId) == 1;
- }
-
- std::string PortableMetadataSnapshot::GetTypeName()
- {
- return typeName;
- }
-
- int32_t PortableMetadataSnapshot::GetTypeId()
- {
- return typeId;
- }
-
- bool PortableMetadataSnapshot::HasFields()
- {
- return !fieldIds->empty();
- }
-
- std::set<int32_t>* PortableMetadataSnapshot::GetFieldIds()
- {
- return fieldIds;
- }
-
- std::map<std::string, int32_t>* PortableMetadataSnapshot::GetFields()
- {
- return fields;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater.cpp
deleted file mode 100644
index 81c96d7..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_metadata_updater.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableMetadataUpdater::~PortableMetadataUpdater()
- {
- // No-op.
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater_impl.cpp
deleted file mode 100644
index 07a1758..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_metadata_updater_impl.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_metadata_updater_impl.h"
-#include "ignite/impl/interop/interop_output_stream.h"
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/portable/portable_raw_writer.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-using namespace ignite::impl;
-using namespace ignite::impl::interop;
-using namespace ignite::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- /** Operation: Clear. */
- const int32_t OP_METADATA = -1;
-
- PortableMetadataUpdaterImpl::PortableMetadataUpdaterImpl(SharedPointer<IgniteEnvironment> env,
- jobject javaRef) : env(env), javaRef(javaRef)
- {
- // No-op.
- }
-
- PortableMetadataUpdaterImpl::~PortableMetadataUpdaterImpl()
- {
- // No-op.
- }
-
- bool PortableMetadataUpdaterImpl::Update(Snap* snap, IgniteError* err)
- {
- JniErrorInfo jniErr;
-
- SharedPointer<InteropMemory> mem = env.Get()->AllocateMemory();
-
- InteropOutputStream out(mem.Get());
- PortableWriterImpl writer(&out, NULL);
- PortableRawWriter rawWriter(&writer);
-
- // We always pass only one meta at a time in current implementation for simplicity.
- rawWriter.WriteInt32(1);
-
- rawWriter.WriteInt32(snap->GetTypeId());
- rawWriter.WriteString(snap->GetTypeName());
- rawWriter.WriteString(NULL); // Affinity key is not supported for now.
-
- if (snap->HasFields())
- {
- std::map<std::string, int32_t>* fields = snap->GetFields();
-
- rawWriter.WriteInt32(static_cast<int32_t>(fields->size()));
-
- for (std::map<std::string, int32_t>::iterator it = fields->begin(); it != fields->end(); ++it)
- {
- rawWriter.WriteString(it->first);
- rawWriter.WriteInt32(it->second);
- }
- }
- else
- rawWriter.WriteInt32(0);
-
- out.Synchronize();
-
- long long res = env.Get()->Context()->TargetInStreamOutLong(javaRef, OP_METADATA, mem.Get()->PointerLong(), &jniErr);
-
- IgniteError::SetError(jniErr.code, jniErr.errCls, jniErr.errMsg, err);
-
- if (jniErr.code == IGNITE_JNI_ERR_SUCCESS)
- return res == 1;
- else
- return false;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_reader_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_reader_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_reader_impl.cpp
deleted file mode 100644
index 753ec25..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_reader_impl.cpp
+++ /dev/null
@@ -1,683 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/impl/portable/portable_common.h"
-#include "ignite/impl/portable/portable_id_resolver.h"
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/portable/portable_utils.h"
-#include "ignite/portable/portable_type.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableReaderImpl::PortableReaderImpl(InteropInputStream* stream, PortableIdResolver* idRslvr,
- int32_t pos, bool usrType, int32_t typeId, int32_t hashCode, int32_t len, int32_t rawOff) :
- stream(stream), idRslvr(idRslvr), pos(pos), usrType(usrType), typeId(typeId),
- hashCode(hashCode), len(len), rawOff(rawOff), rawMode(false),
- elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0)
- {
- // No-op.
- }
-
- PortableReaderImpl::PortableReaderImpl(InteropInputStream* stream) :
- stream(stream), idRslvr(NULL), pos(0), usrType(false), typeId(0), hashCode(0),
- len(0), rawOff(0), rawMode(true),
- elemIdGen(0), elemId(0), elemCnt(-1), elemRead(0)
- {
- // No-op.
- }
-
- int8_t PortableReaderImpl::ReadInt8()
- {
- return ReadRaw<int8_t>(PortableUtils::ReadInt8);
- }
-
- int32_t PortableReaderImpl::ReadInt8Array(int8_t* res, const int32_t len)
- {
- return ReadRawArray<int8_t>(res, len, PortableUtils::ReadInt8Array, IGNITE_TYPE_ARRAY_BYTE);
- }
-
- int8_t PortableReaderImpl::ReadInt8(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadInt8, IGNITE_TYPE_BYTE, static_cast<int8_t>(0));
- }
-
- int32_t PortableReaderImpl::ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len)
- {
- return ReadArray<int8_t>(fieldName, res, len,PortableUtils::ReadInt8Array, IGNITE_TYPE_ARRAY_BYTE);
- }
-
- bool PortableReaderImpl::ReadBool()
- {
- return ReadRaw<bool>(PortableUtils::ReadBool);
- }
-
- int32_t PortableReaderImpl::ReadBoolArray(bool* res, const int32_t len)
- {
- return ReadRawArray<bool>(res, len, PortableUtils::ReadBoolArray, IGNITE_TYPE_ARRAY_BOOL);
- }
-
- bool PortableReaderImpl::ReadBool(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadBool, IGNITE_TYPE_BOOL, static_cast<bool>(0));
- }
-
- int32_t PortableReaderImpl::ReadBoolArray(const char* fieldName, bool* res, const int32_t len)
- {
- return ReadArray<bool>(fieldName, res, len,PortableUtils::ReadBoolArray, IGNITE_TYPE_ARRAY_BOOL);
- }
-
- int16_t PortableReaderImpl::ReadInt16()
- {
- return ReadRaw<int16_t>(PortableUtils::ReadInt16);
- }
-
- int32_t PortableReaderImpl::ReadInt16Array(int16_t* res, const int32_t len)
- {
- return ReadRawArray<int16_t>(res, len, PortableUtils::ReadInt16Array, IGNITE_TYPE_ARRAY_SHORT);
- }
-
- int16_t PortableReaderImpl::ReadInt16(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadInt16, IGNITE_TYPE_SHORT, static_cast<int16_t>(0));
- }
-
- int32_t PortableReaderImpl::ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len)
- {
- return ReadArray<int16_t>(fieldName, res, len, PortableUtils::ReadInt16Array, IGNITE_TYPE_ARRAY_SHORT);
- }
-
- uint16_t PortableReaderImpl::ReadUInt16()
- {
- return ReadRaw<uint16_t>(PortableUtils::ReadUInt16);
- }
-
- int32_t PortableReaderImpl::ReadUInt16Array(uint16_t* res, const int32_t len)
- {
- return ReadRawArray<uint16_t>(res, len, PortableUtils::ReadUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
- }
-
- uint16_t PortableReaderImpl::ReadUInt16(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadUInt16, IGNITE_TYPE_CHAR, static_cast<uint16_t>(0));
- }
-
- int32_t PortableReaderImpl::ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len)
- {
- return ReadArray<uint16_t>(fieldName, res, len,PortableUtils::ReadUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
- }
-
- int32_t PortableReaderImpl::ReadInt32()
- {
- return ReadRaw<int32_t>(PortableUtils::ReadInt32);
- }
-
- int32_t PortableReaderImpl::ReadInt32Array(int32_t* res, const int32_t len)
- {
- return ReadRawArray<int32_t>(res, len, PortableUtils::ReadInt32Array, IGNITE_TYPE_ARRAY_INT);
- }
-
- int32_t PortableReaderImpl::ReadInt32(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadInt32, IGNITE_TYPE_INT, static_cast<int32_t>(0));
- }
-
- int32_t PortableReaderImpl::ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len)
- {
- return ReadArray<int32_t>(fieldName, res, len,PortableUtils::ReadInt32Array, IGNITE_TYPE_ARRAY_INT);
- }
-
- int64_t PortableReaderImpl::ReadInt64()
- {
- return ReadRaw<int64_t>(PortableUtils::ReadInt64);
- }
-
- int32_t PortableReaderImpl::ReadInt64Array(int64_t* res, const int32_t len)
- {
- return ReadRawArray<int64_t>(res, len, PortableUtils::ReadInt64Array, IGNITE_TYPE_ARRAY_LONG);
- }
-
- int64_t PortableReaderImpl::ReadInt64(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadInt64, IGNITE_TYPE_LONG, static_cast<int64_t>(0));
- }
-
- int32_t PortableReaderImpl::ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len)
- {
- return ReadArray<int64_t>(fieldName, res, len,PortableUtils::ReadInt64Array, IGNITE_TYPE_ARRAY_LONG);
- }
-
- float PortableReaderImpl::ReadFloat()
- {
- return ReadRaw<float>(PortableUtils::ReadFloat);
- }
-
- int32_t PortableReaderImpl::ReadFloatArray(float* res, const int32_t len)
- {
- return ReadRawArray<float>(res, len, PortableUtils::ReadFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
- }
-
- float PortableReaderImpl::ReadFloat(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadFloat, IGNITE_TYPE_FLOAT, static_cast<float>(0));
- }
-
- int32_t PortableReaderImpl::ReadFloatArray(const char* fieldName, float* res, const int32_t len)
- {
- return ReadArray<float>(fieldName, res, len,PortableUtils::ReadFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
- }
-
- double PortableReaderImpl::ReadDouble()
- {
- return ReadRaw<double>(PortableUtils::ReadDouble);
- }
-
- int32_t PortableReaderImpl::ReadDoubleArray(double* res, const int32_t len)
- {
- return ReadRawArray<double>(res, len, PortableUtils::ReadDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
- }
-
- double PortableReaderImpl::ReadDouble(const char* fieldName)
- {
- return Read(fieldName, PortableUtils::ReadDouble, IGNITE_TYPE_DOUBLE, static_cast<double>(0));
- }
-
- int32_t PortableReaderImpl::ReadDoubleArray(const char* fieldName, double* res, const int32_t len)
- {
- return ReadArray<double>(fieldName, res, len,PortableUtils::ReadDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
- }
-
- Guid PortableReaderImpl::ReadGuid()
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- return ReadNullable(stream, PortableUtils::ReadGuid, IGNITE_TYPE_UUID);
- }
-
- int32_t PortableReaderImpl::ReadGuidArray(Guid* res, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- return ReadArrayInternal<Guid>(res, len, stream, ReadGuidArrayInternal, IGNITE_TYPE_ARRAY_UUID);
- }
-
- Guid PortableReaderImpl::ReadGuid(const char* fieldName)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- return ReadNullable(stream, PortableUtils::ReadGuid, IGNITE_TYPE_UUID);
-
- return Guid();
- }
-
- int32_t PortableReaderImpl::ReadGuidArray(const char* fieldName, Guid* res, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t pos = stream->Position();
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0) {
- int32_t realLen = ReadArrayInternal<Guid>(res, len, stream, ReadGuidArrayInternal, IGNITE_TYPE_ARRAY_UUID);
-
- // If actual read didn't occur return to initial position so that we do not perform
- // N jumps to find the field again, where N is total amount of fields.
- if (realLen != -1 && (!res || realLen > len))
- stream->Position(pos);
-
- return realLen;
- }
-
- return -1;
- }
-
- void PortableReaderImpl::ReadGuidArrayInternal(InteropInputStream* stream, Guid* res, const int32_t len)
- {
- for (int i = 0; i < len; i++)
- *(res + i) = ReadNullable<Guid>(stream, PortableUtils::ReadGuid, IGNITE_TYPE_UUID);
- }
-
- int32_t PortableReaderImpl::ReadString(char* res, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- return ReadStringInternal(res, len);
- }
-
- int32_t PortableReaderImpl::ReadString(const char* fieldName, char* res, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t pos = stream->Position();
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0) {
- int32_t realLen = ReadStringInternal(res, len);
-
- // If actual read didn't occur return to initial position so that we do not perform
- // N jumps to find the field again, where N is total amount of fields.
- if (realLen != -1 && (!res || realLen > len))
- stream->Position(pos);
-
- return realLen;
- }
-
- return -1;
- }
-
- int32_t PortableReaderImpl::ReadStringArray(int32_t* size)
- {
- return StartContainerSession(true, IGNITE_TYPE_ARRAY_STRING, size);
- }
-
- int32_t PortableReaderImpl::ReadStringArray(const char* fieldName, int32_t* size)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- return StartContainerSession(false, IGNITE_TYPE_ARRAY_STRING, size);
- else {
- *size = -1;
-
- return ++elemIdGen;
- }
- }
-
- int32_t PortableReaderImpl::ReadStringElement(int32_t id, char* res, const int32_t len)
- {
- CheckSession(id);
-
- int32_t posBefore = stream->Position();
-
- int32_t realLen = ReadStringInternal(res, len);
-
- int32_t posAfter = stream->Position();
-
- if (posAfter > posBefore && ++elemRead == elemCnt) {
- elemId = 0;
- elemCnt = -1;
- elemRead = 0;
- }
-
- return realLen;
- }
-
- int32_t PortableReaderImpl::ReadStringInternal(char* res, const int32_t len)
- {
- int8_t hdr = stream->ReadInt8();
-
- if (hdr == IGNITE_TYPE_STRING) {
- bool utf8Mode = stream->ReadBool();
- int32_t realLen = stream->ReadInt32();
-
- if (res && len >= realLen) {
- if (utf8Mode)
- {
- for (int i = 0; i < realLen; i++)
- *(res + i) = static_cast<char>(stream->ReadInt8());
- }
- else
- {
- for (int i = 0; i < realLen; i++)
- *(res + i) = static_cast<char>(stream->ReadUInt16());
- }
-
- if (len > realLen)
- *(res + realLen) = 0; // Set NULL terminator if possible.
- }
- else
- stream->Position(stream->Position() - 6);
-
- return realLen;
- }
- else if (hdr != IGNITE_HDR_NULL)
- ThrowOnInvalidHeader(IGNITE_TYPE_ARRAY, hdr);
-
- return -1;
- }
-
- int32_t PortableReaderImpl::ReadArray(int32_t* size)
- {
- return StartContainerSession(true, IGNITE_TYPE_ARRAY, size);
- }
-
- int32_t PortableReaderImpl::ReadArray(const char* fieldName, int32_t* size)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- return StartContainerSession(false, IGNITE_TYPE_ARRAY, size);
- else {
- *size = -1;
-
- return ++elemIdGen;
- }
- }
-
- int32_t PortableReaderImpl::ReadCollection(CollectionType* typ, int32_t* size)
- {
- int32_t id = StartContainerSession(true, IGNITE_TYPE_COLLECTION, size);
-
- if (*size == -1)
- *typ = IGNITE_COLLECTION_UNDEFINED;
- else
- *typ = static_cast<CollectionType>(stream->ReadInt8());
-
- return id;
- }
-
- int32_t PortableReaderImpl::ReadCollection(const char* fieldName, CollectionType* typ, int32_t* size)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- {
- int32_t id = StartContainerSession(false, IGNITE_TYPE_COLLECTION, size);
-
- if (*size == -1)
- *typ = IGNITE_COLLECTION_UNDEFINED;
- else
- *typ = static_cast<CollectionType>(stream->ReadInt8());
-
- return id;
- }
- else {
- *typ = IGNITE_COLLECTION_UNDEFINED;
- *size = -1;
-
- return ++elemIdGen;
- }
- }
-
- int32_t PortableReaderImpl::ReadMap(MapType* typ, int32_t* size)
- {
- int32_t id = StartContainerSession(true, IGNITE_TYPE_MAP, size);
-
- if (*size == -1)
- *typ = IGNITE_MAP_UNDEFINED;
- else
- *typ = static_cast<MapType>(stream->ReadInt8());
-
- return id;
- }
-
- int32_t PortableReaderImpl::ReadMap(const char* fieldName, MapType* typ, int32_t* size)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- {
- int32_t id = StartContainerSession(false, IGNITE_TYPE_MAP, size);
-
- if (*size == -1)
- *typ = IGNITE_MAP_UNDEFINED;
- else
- *typ = static_cast<MapType>(stream->ReadInt8());
-
- return id;
- }
- else {
- *typ = IGNITE_MAP_UNDEFINED;
- *size = -1;
-
- return ++elemIdGen;
- }
- }
-
- bool PortableReaderImpl::HasNextElement(int32_t id)
- {
- return elemId == id && elemRead < elemCnt;
- }
-
- void PortableReaderImpl::SetRawMode()
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- stream->Position(pos + rawOff);
- rawMode = true;
- }
-
- template <>
- int8_t PortableReaderImpl::ReadTopObject<int8_t>()
- {
- return ReadTopObject0(IGNITE_TYPE_BYTE, PortableUtils::ReadInt8, static_cast<int8_t>(0));
- }
-
- template <>
- bool PortableReaderImpl::ReadTopObject<bool>()
- {
- return ReadTopObject0(IGNITE_TYPE_BOOL, PortableUtils::ReadBool, static_cast<bool>(0));
- }
-
- template <>
- int16_t PortableReaderImpl::ReadTopObject<int16_t>()
- {
- return ReadTopObject0(IGNITE_TYPE_SHORT, PortableUtils::ReadInt16, static_cast<int16_t>(0));
- }
-
- template <>
- uint16_t PortableReaderImpl::ReadTopObject<uint16_t>()
- {
- return ReadTopObject0(IGNITE_TYPE_CHAR, PortableUtils::ReadUInt16, static_cast<uint16_t>(0));
- }
-
- template <>
- int32_t PortableReaderImpl::ReadTopObject<int32_t>()
- {
- return ReadTopObject0(IGNITE_TYPE_INT, PortableUtils::ReadInt32, static_cast<int32_t>(0));
- }
-
- template <>
- int64_t PortableReaderImpl::ReadTopObject<int64_t>()
- {
- return ReadTopObject0(IGNITE_TYPE_LONG, PortableUtils::ReadInt64, static_cast<int64_t>(0));
- }
-
- template <>
- float PortableReaderImpl::ReadTopObject<float>()
- {
- return ReadTopObject0(IGNITE_TYPE_FLOAT, PortableUtils::ReadFloat, static_cast<float>(0));
- }
-
- template <>
- double PortableReaderImpl::ReadTopObject<double>()
- {
- return ReadTopObject0(IGNITE_TYPE_DOUBLE, PortableUtils::ReadDouble, static_cast<double>(0));
- }
-
- template <>
- Guid PortableReaderImpl::ReadTopObject<Guid>()
- {
- int8_t typeId = stream->ReadInt8();
-
- if (typeId == IGNITE_TYPE_UUID)
- return PortableUtils::ReadGuid(stream);
- else if (typeId == IGNITE_HDR_NULL)
- return Guid();
- else {
- int32_t pos = stream->Position() - 1;
-
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid header", "position", pos, "expected", IGNITE_TYPE_UUID, "actual", typeId)
- }
- }
-
- InteropInputStream* PortableReaderImpl::GetStream()
- {
- return stream;
- }
-
- int32_t PortableReaderImpl::SeekField(const int32_t fieldId)
- {
- // We assume that it is very likely that fields are read in the same
- // order as they were initially written. So we start seeking field
- // from current stream position making a "loop" up to this position.
- int32_t marker = stream->Position();
-
- for (int32_t curPos = marker; curPos < pos + rawOff;)
- {
- int32_t curFieldId = stream->ReadInt32();
- int32_t curFieldLen = stream->ReadInt32();
-
- if (fieldId == curFieldId)
- return curFieldLen;
- else {
- curPos = stream->Position() + curFieldLen;
-
- stream->Position(curPos);
- }
- }
-
- stream->Position(pos + IGNITE_FULL_HDR_LEN);
-
- for (int32_t curPos = stream->Position(); curPos < marker;)
- {
- int32_t curFieldId = stream->ReadInt32();
- int32_t curFieldLen = stream->ReadInt32();
-
- if (fieldId == curFieldId)
- return curFieldLen;
- else {
- curPos = stream->Position() + curFieldLen;
-
- stream->Position(curPos);
- }
- }
-
- return -1;
- }
-
- void PortableReaderImpl::CheckRawMode(bool expected)
- {
- if (expected && !rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only in raw mode.")
- }
- else if (!expected && rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed in raw mode.")
- }
- }
-
- void PortableReaderImpl::CheckSingleMode(bool expected)
- {
- if (expected && elemId != 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed when container is being read.");
- }
- else if (!expected && elemId == 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only when container is being read.");
- }
- }
-
- int32_t PortableReaderImpl::StartContainerSession(bool expRawMode, int8_t expHdr, int32_t* size)
- {
- CheckRawMode(expRawMode);
- CheckSingleMode(true);
-
- int8_t hdr = stream->ReadInt8();
-
- if (hdr == expHdr)
- {
- int32_t cnt = stream->ReadInt32();
-
- if (cnt != 0)
- {
- elemId = ++elemIdGen;
- elemCnt = cnt;
- elemRead = 0;
-
- *size = cnt;
-
- return elemId;
- }
- else
- {
- *size = 0;
-
- return ++elemIdGen;
- }
- }
- else if (hdr == IGNITE_HDR_NULL) {
- *size = -1;
-
- return ++elemIdGen;
- }
- else {
- ThrowOnInvalidHeader(expHdr, hdr);
-
- return 0;
- }
- }
-
- void PortableReaderImpl::CheckSession(int32_t expSes)
- {
- if (elemId != expSes) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Containter read session has been finished or is not started yet.");
- }
- }
-
- void PortableReaderImpl::ThrowOnInvalidHeader(int32_t pos, int8_t expHdr, int8_t hdr)
- {
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid header", "position", pos, "expected", expHdr, "actual", hdr)
- }
-
- void PortableReaderImpl::ThrowOnInvalidHeader(int8_t expHdr, int8_t hdr)
- {
- int32_t pos = stream->Position() - 1;
-
- ThrowOnInvalidHeader(pos, expHdr, hdr);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_utils.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_utils.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_utils.cpp
deleted file mode 100644
index 2f9c259..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_utils.cpp
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/impl/portable/portable_utils.h"
-
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- int8_t PortableUtils::ReadInt8(InteropInputStream* stream)
- {
- return stream->ReadInt8();
- }
-
- void PortableUtils::WriteInt8(InteropOutputStream* stream, int8_t val)
- {
- stream->WriteInt8(val);
- }
-
- void PortableUtils::ReadInt8Array(InteropInputStream* stream, int8_t* res, const int32_t len)
- {
- stream->ReadInt8Array(res, len);
- }
-
- void PortableUtils::WriteInt8Array(InteropOutputStream* stream, const int8_t* val, const int32_t len)
- {
- stream->WriteInt8Array(val, len);
- }
-
- bool PortableUtils::ReadBool(InteropInputStream* stream)
- {
- return stream->ReadBool();
- }
-
- void PortableUtils::WriteBool(InteropOutputStream* stream, bool val)
- {
- stream->WriteBool(val);
- }
-
- void PortableUtils::ReadBoolArray(InteropInputStream* stream, bool* res, const int32_t len)
- {
- stream->ReadBoolArray(res, len);
- }
-
- void PortableUtils::WriteBoolArray(InteropOutputStream* stream, const bool* val, const int32_t len)
- {
- stream->WriteBoolArray(val, len);
- }
-
- int16_t PortableUtils::ReadInt16(InteropInputStream* stream)
- {
- return stream->ReadInt16();
- }
-
- void PortableUtils::WriteInt16(InteropOutputStream* stream, int16_t val)
- {
- stream->WriteInt16(val);
- }
-
- void PortableUtils::ReadInt16Array(InteropInputStream* stream, int16_t* res, const int32_t len)
- {
- stream->ReadInt16Array(res, len);
- }
-
- void PortableUtils::WriteInt16Array(InteropOutputStream* stream, const int16_t* val, const int32_t len)
- {
- stream->WriteInt16Array(val, len);
- }
-
- uint16_t PortableUtils::ReadUInt16(InteropInputStream* stream)
- {
- return stream->ReadUInt16();
- }
-
- void PortableUtils::WriteUInt16(InteropOutputStream* stream, uint16_t val)
- {
- stream->WriteUInt16(val);
- }
-
- void PortableUtils::ReadUInt16Array(InteropInputStream* stream, uint16_t* res, const int32_t len)
- {
- stream->ReadUInt16Array(res, len);
- }
-
- void PortableUtils::WriteUInt16Array(InteropOutputStream* stream, const uint16_t* val, const int32_t len)
- {
- stream->WriteUInt16Array(val, len);
- }
-
- int32_t PortableUtils::ReadInt32(InteropInputStream* stream)
- {
- return stream->ReadInt32();
- }
-
- void PortableUtils::WriteInt32(InteropOutputStream* stream, int32_t val)
- {
- stream->WriteInt32(val);
- }
-
- void PortableUtils::ReadInt32Array(InteropInputStream* stream, int32_t* res, const int32_t len)
- {
- stream->ReadInt32Array(res, len);
- }
-
- void PortableUtils::WriteInt32Array(InteropOutputStream* stream, const int32_t* val, const int32_t len)
- {
- stream->WriteInt32Array(val, len);
- }
-
- int64_t PortableUtils::ReadInt64(InteropInputStream* stream)
- {
- return stream->ReadInt64();
- }
-
- void PortableUtils::WriteInt64(InteropOutputStream* stream, int64_t val)
- {
- stream->WriteInt64(val);
- }
-
- void PortableUtils::ReadInt64Array(InteropInputStream* stream, int64_t* res, const int32_t len)
- {
- stream->ReadInt64Array(res, len);
- }
-
- void PortableUtils::WriteInt64Array(InteropOutputStream* stream, const int64_t* val, const int32_t len)
- {
- stream->WriteInt64Array(val, len);
- }
-
- float PortableUtils::ReadFloat(InteropInputStream* stream)
- {
- return stream->ReadFloat();
- }
-
- void PortableUtils::WriteFloat(InteropOutputStream* stream, float val)
- {
- stream->WriteFloat(val);
- }
-
- void PortableUtils::ReadFloatArray(InteropInputStream* stream, float* res, const int32_t len)
- {
- stream->ReadFloatArray(res, len);
- }
-
- void PortableUtils::WriteFloatArray(InteropOutputStream* stream, const float* val, const int32_t len)
- {
- stream->WriteFloatArray(val, len);
- }
-
- double PortableUtils::ReadDouble(InteropInputStream* stream)
- {
- return stream->ReadDouble();
- }
-
- void PortableUtils::WriteDouble(InteropOutputStream* stream, double val)
- {
- stream->WriteDouble(val);
- }
-
- void PortableUtils::ReadDoubleArray(InteropInputStream* stream, double* res, const int32_t len)
- {
- stream->ReadDoubleArray(res, len);
- }
-
- void PortableUtils::WriteDoubleArray(InteropOutputStream* stream, const double* val, const int32_t len)
- {
- stream->WriteDoubleArray(val, len);
- }
-
- Guid PortableUtils::ReadGuid(interop::InteropInputStream* stream)
- {
- int64_t most = stream->ReadInt64();
- int64_t least = stream->ReadInt64();
-
- return Guid(most, least);
- }
-
- void PortableUtils::WriteGuid(interop::InteropOutputStream* stream, const Guid val)
- {
- stream->WriteInt64(val.GetMostSignificantBits());
- stream->WriteInt64(val.GetLeastSignificantBits());
- }
-
- void PortableUtils::WriteString(interop::InteropOutputStream* stream, const char* val, const int32_t len)
- {
- stream->WriteBool(false);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- stream->WriteUInt16(*(val + i));
- }
- }
- }
-}
\ No newline at end of file
[21/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
deleted file mode 100644
index dc0f570..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderImpl.cs
+++ /dev/null
@@ -1,923 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Portable.Metadata;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable builder implementation.
- /// </summary>
- internal class PortableBuilderImpl : IPortableBuilder
- {
- /** Type IDs for metadata. */
- private static readonly IDictionary<Type, int> TypeIds;
-
- /** Cached dictionary with no values. */
- private static readonly IDictionary<int, object> EmptyVals = new Dictionary<int, object>();
-
- /** Offset: length. */
- private const int OffsetLen = 10;
-
- /** Portables. */
- private readonly PortablesImpl _portables;
-
- /** */
- private readonly PortableBuilderImpl _parent;
-
- /** Initial portable object. */
- private readonly PortableUserObject _obj;
-
- /** Type descriptor. */
- private readonly IPortableTypeDescriptor _desc;
-
- /** Values. */
- private IDictionary<string, PortableBuilderField> _vals;
-
- /** Contextual fields. */
- private IDictionary<int, object> _cache;
-
- /** Hash code. */
- private int _hashCode;
-
- /** Current context. */
- private Context _ctx;
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- static PortableBuilderImpl()
- {
- TypeIds = new Dictionary<Type, int>();
-
- // 1. Primitives.
- TypeIds[typeof(byte)] = PortableUtils.TypeByte;
- TypeIds[typeof(bool)] = PortableUtils.TypeBool;
- TypeIds[typeof(short)] = PortableUtils.TypeShort;
- TypeIds[typeof(char)] = PortableUtils.TypeChar;
- TypeIds[typeof(int)] = PortableUtils.TypeInt;
- TypeIds[typeof(long)] = PortableUtils.TypeLong;
- TypeIds[typeof(float)] = PortableUtils.TypeFloat;
- TypeIds[typeof(double)] = PortableUtils.TypeDouble;
- TypeIds[typeof(decimal)] = PortableUtils.TypeDecimal;
-
- TypeIds[typeof(byte[])] = PortableUtils.TypeArrayByte;
- TypeIds[typeof(bool[])] = PortableUtils.TypeArrayBool;
- TypeIds[typeof(short[])] = PortableUtils.TypeArrayShort;
- TypeIds[typeof(char[])] = PortableUtils.TypeArrayChar;
- TypeIds[typeof(int[])] = PortableUtils.TypeArrayInt;
- TypeIds[typeof(long[])] = PortableUtils.TypeArrayLong;
- TypeIds[typeof(float[])] = PortableUtils.TypeArrayFloat;
- TypeIds[typeof(double[])] = PortableUtils.TypeArrayDouble;
- TypeIds[typeof(decimal[])] = PortableUtils.TypeArrayDecimal;
-
- // 2. String.
- TypeIds[typeof(string)] = PortableUtils.TypeString;
- TypeIds[typeof(string[])] = PortableUtils.TypeArrayString;
-
- // 3. Guid.
- TypeIds[typeof(Guid)] = PortableUtils.TypeGuid;
- TypeIds[typeof(Guid?)] = PortableUtils.TypeGuid;
- TypeIds[typeof(Guid[])] = PortableUtils.TypeArrayGuid;
- TypeIds[typeof(Guid?[])] = PortableUtils.TypeArrayGuid;
-
- // 4. Date.
- TypeIds[typeof(DateTime)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime?)] = PortableUtils.TypeDate;
- TypeIds[typeof(DateTime[])] = PortableUtils.TypeArrayDate;
- TypeIds[typeof(DateTime?[])] = PortableUtils.TypeArrayDate;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="portables">Portables.</param>
- /// <param name="obj">Initial portable object.</param>
- /// <param name="desc">Type descriptor.</param>
- public PortableBuilderImpl(PortablesImpl portables, PortableUserObject obj,
- IPortableTypeDescriptor desc) : this(portables, null, obj, desc)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="portables">Portables.</param>
- /// <param name="parent">Parent builder.</param>
- /// <param name="obj">Initial portable object.</param>
- /// <param name="desc">Type descriptor.</param>
- public PortableBuilderImpl(PortablesImpl portables, PortableBuilderImpl parent,
- PortableUserObject obj, IPortableTypeDescriptor desc)
- {
- _portables = portables;
- _parent = parent ?? this;
- _obj = obj;
- _desc = desc;
-
- _hashCode = obj.GetHashCode();
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder SetHashCode(int hashCode)
- {
- _hashCode = hashCode;
-
- return this;
- }
-
- /** <inheritDoc /> */
- public T GetField<T>(string name)
- {
- PortableBuilderField field;
-
- if (_vals != null && _vals.TryGetValue(name, out field))
- return field != PortableBuilderField.RmvMarker ? (T)field.Value : default(T);
- T val = _obj.Field<T>(name, this);
-
- if (_vals == null)
- _vals = new Dictionary<string, PortableBuilderField>(2);
-
- _vals[name] = new PortableBuilderField(typeof(T), val);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder SetField<T>(string name, T val)
- {
- return SetField0(name, new PortableBuilderField(typeof(T), val));
- }
-
- /** <inheritDoc /> */
- public IPortableBuilder RemoveField(string name)
- {
- return SetField0(name, PortableBuilderField.RmvMarker);
- }
-
- /** <inheritDoc /> */
- public IPortableObject Build()
- {
- PortableHeapStream inStream = new PortableHeapStream(_obj.Data);
-
- inStream.Seek(_obj.Offset, SeekOrigin.Begin);
-
- // Assume that resulting length will be no less than header + [fields_cnt] * 12;
- int len = PortableUtils.FullHdrLen + (_vals == null ? 0 : _vals.Count * 12);
-
- PortableHeapStream outStream = new PortableHeapStream(len);
-
- PortableWriterImpl writer = _portables.Marshaller.StartMarshal(outStream);
-
- writer.Builder(this);
-
- // All related builders will work in this context with this writer.
- _parent._ctx = new Context(writer);
-
- try
- {
- // Write.
- writer.Write(this, null);
-
- // Process metadata.
- _portables.Marshaller.FinishMarshal(writer);
-
- // Create portable object once metadata is processed.
- return new PortableUserObject(_portables.Marshaller, outStream.InternalArray, 0,
- _desc.TypeId, _hashCode);
- }
- finally
- {
- // Cleanup.
- _parent._ctx.Closed = true;
- }
- }
-
- /// <summary>
- /// Create child builder.
- /// </summary>
- /// <param name="obj">Portable object.</param>
- /// <returns>Child builder.</returns>
- public PortableBuilderImpl Child(PortableUserObject obj)
- {
- return _portables.ChildBuilder(_parent, obj);
- }
-
- /// <summary>
- /// Get cache field.
- /// </summary>
- /// <param name="pos">Position.</param>
- /// <param name="val">Value.</param>
- /// <returns><c>true</c> if value is found in cache.</returns>
- public bool CachedField<T>(int pos, out T val)
- {
- if (_parent._cache != null)
- {
- object res;
-
- if (_parent._cache.TryGetValue(pos, out res))
- {
- val = res != null ? (T)res : default(T);
-
- return true;
- }
- }
-
- val = default(T);
-
- return false;
- }
-
- /// <summary>
- /// Add field to cache test.
- /// </summary>
- /// <param name="pos">Position.</param>
- /// <param name="val">Value.</param>
- public void CacheField(int pos, object val)
- {
- if (_parent._cache == null)
- _parent._cache = new Dictionary<int, object>(2);
-
- _parent._cache[pos] = val;
- }
-
- /// <summary>
- /// Internal set field routine.
- /// </summary>
- /// <param name="fieldName">Name.</param>
- /// <param name="val">Value.</param>
- /// <returns>This builder.</returns>
- private IPortableBuilder SetField0(string fieldName, PortableBuilderField val)
- {
- if (_vals == null)
- _vals = new Dictionary<string, PortableBuilderField>();
-
- _vals[fieldName] = val;
-
- return this;
- }
-
- /// <summary>
- /// Mutate portable object.
- /// </summary>
- /// <param name="inStream">Input stream with initial object.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="desc">Portable type descriptor.</param>
- /// <param name="hashCode">Hash code.</param>
- /// <param name="vals">Values.</param>
- internal void Mutate(
- PortableHeapStream inStream,
- PortableHeapStream outStream,
- IPortableTypeDescriptor desc,
- int hashCode,
- IDictionary<string, PortableBuilderField> vals)
- {
- // Set correct builder to writer frame.
- PortableBuilderImpl oldBuilder = _parent._ctx.Writer.Builder(_parent);
-
- int streamPos = inStream.Position;
-
- try
- {
- // Prepare fields.
- IPortableMetadataHandler metaHnd = _portables.Marshaller.MetadataHandler(desc);
-
- IDictionary<int, object> vals0;
-
- if (vals == null || vals.Count == 0)
- vals0 = EmptyVals;
- else
- {
- vals0 = new Dictionary<int, object>(vals.Count);
-
- foreach (KeyValuePair<string, PortableBuilderField> valEntry in vals)
- {
- int fieldId = PortableUtils.FieldId(desc.TypeId, valEntry.Key, desc.NameConverter, desc.Mapper);
-
- if (vals0.ContainsKey(fieldId))
- throw new IgniteException("Collision in field ID detected (change field name or " +
- "define custom ID mapper) [fieldName=" + valEntry.Key + ", fieldId=" + fieldId + ']');
-
- vals0[fieldId] = valEntry.Value.Value;
-
- // Write metadata if: 1) it is enabled for type; 2) type is not null (i.e. it is neither
- // remove marker, nor a field read through "GetField" method.
- if (metaHnd != null && valEntry.Value.Type != null)
- metaHnd.OnFieldWrite(fieldId, valEntry.Key, TypeId(valEntry.Value.Type));
- }
- }
-
- // Actual processing.
- Mutate0(_parent._ctx, inStream, outStream, true, hashCode, vals0);
-
- // 3. Handle metadata.
- if (metaHnd != null)
- {
- IDictionary<string, int> meta = metaHnd.OnObjectWriteFinished();
-
- if (meta != null)
- _parent._ctx.Writer.SaveMetadata(desc.TypeId, desc.TypeName, desc.AffinityKeyFieldName, meta);
- }
- }
- finally
- {
- // Restore builder frame.
- _parent._ctx.Writer.Builder(oldBuilder);
-
- inStream.Seek(streamPos, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Internal mutation routine.
- /// </summary>
- /// <param name="inStream">Input stream.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="ctx">Context.</param>
- /// <param name="changeHash">WHether hash should be changed.</param>
- /// <param name="hash">New hash.</param>
- /// <param name="vals">Values to be replaced.</param>
- /// <returns>Mutated object.</returns>
- private void Mutate0(Context ctx, PortableHeapStream inStream, IPortableStream outStream,
- bool changeHash, int hash, IDictionary<int, object> vals)
- {
- int inStartPos = inStream.Position;
- int outStartPos = outStream.Position;
-
- byte inHdr = inStream.ReadByte();
-
- if (inHdr == PortableUtils.HdrNull)
- outStream.WriteByte(PortableUtils.HdrNull);
- else if (inHdr == PortableUtils.HdrHnd)
- {
- int inHnd = inStream.ReadInt();
-
- int oldPos = inStartPos - inHnd;
- int newPos;
-
- if (ctx.OldToNew(oldPos, out newPos))
- {
- // Handle is still valid.
- outStream.WriteByte(PortableUtils.HdrHnd);
- outStream.WriteInt(outStartPos - newPos);
- }
- else
- {
- // Handle is invalid, write full object.
- int inRetPos = inStream.Position;
-
- inStream.Seek(oldPos, SeekOrigin.Begin);
-
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
-
- inStream.Seek(inRetPos, SeekOrigin.Begin);
- }
- }
- else if (inHdr == PortableUtils.HdrFull)
- {
- byte inUsrFlag = inStream.ReadByte();
- int inTypeId = inStream.ReadInt();
- int inHash = inStream.ReadInt();
- int inLen = inStream.ReadInt();
- int inRawOff = inStream.ReadInt();
-
- int hndPos;
-
- if (ctx.AddOldToNew(inStartPos, outStartPos, out hndPos))
- {
- // Object could be cached in parent builder.
- object cachedVal;
-
- if (_parent._cache != null && _parent._cache.TryGetValue(inStartPos, out cachedVal)) {
- ctx.Writer.Write(cachedVal, null);
- }
- else
- {
- // New object, write in full form.
- outStream.WriteByte(PortableUtils.HdrFull);
- outStream.WriteByte(inUsrFlag);
- outStream.WriteInt(inTypeId);
- outStream.WriteInt(changeHash ? hash : inHash);
-
- // Skip length and raw offset as they are not known at this point.
- outStream.Seek(8, SeekOrigin.Current);
-
- // Write regular fields.
- while (inStream.Position < inStartPos + inRawOff)
- {
- int inFieldId = inStream.ReadInt();
- int inFieldLen = inStream.ReadInt();
- int inFieldDataPos = inStream.Position;
-
- object fieldVal;
-
- bool fieldFound = vals.TryGetValue(inFieldId, out fieldVal);
-
- if (!fieldFound || fieldVal != PortableBuilderField.RmvMarkerObj)
- {
- outStream.WriteInt(inFieldId);
-
- int fieldLenPos = outStream.Position; // Here we will write length later.
-
- outStream.Seek(4, SeekOrigin.Current);
-
- if (fieldFound)
- {
- // Replace field with new value.
- if (fieldVal != PortableBuilderField.RmvMarkerObj)
- ctx.Writer.Write(fieldVal, null);
-
- vals.Remove(inFieldId);
- }
- else
- {
- // If field was requested earlier, then we must write tracked value
- if (_parent._cache != null && _parent._cache.TryGetValue(inFieldDataPos, out fieldVal))
- ctx.Writer.Write(fieldVal, null);
- else
- // Filed is not tracked, re-write as is.
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
- }
-
- int fieldEndPos = outStream.Position;
-
- outStream.Seek(fieldLenPos, SeekOrigin.Begin);
- outStream.WriteInt(fieldEndPos - fieldLenPos - 4);
- outStream.Seek(fieldEndPos, SeekOrigin.Begin);
- }
-
- // Position intput stream pointer after the field.
- inStream.Seek(inFieldDataPos + inFieldLen, SeekOrigin.Begin);
- }
-
- // Write remaining new fields.
- foreach (KeyValuePair<int, object> valEntry in vals)
- {
- if (valEntry.Value != PortableBuilderField.RmvMarkerObj)
- {
- outStream.WriteInt(valEntry.Key);
-
- int fieldLenPos = outStream.Position; // Here we will write length later.
-
- outStream.Seek(4, SeekOrigin.Current);
-
- ctx.Writer.Write(valEntry.Value, null);
-
- int fieldEndPos = outStream.Position;
-
- outStream.Seek(fieldLenPos, SeekOrigin.Begin);
- outStream.WriteInt(fieldEndPos - fieldLenPos - 4);
- outStream.Seek(fieldEndPos, SeekOrigin.Begin);
- }
- }
-
- // Write raw data.
- int rawPos = outStream.Position;
-
- outStream.Write(inStream.InternalArray, inStartPos + inRawOff, inLen - inRawOff);
-
- // Write length and raw data offset.
- int outResPos = outStream.Position;
-
- outStream.Seek(outStartPos + OffsetLen, SeekOrigin.Begin);
-
- outStream.WriteInt(outResPos - outStartPos); // Length.
- outStream.WriteInt(rawPos - outStartPos); // Raw offset.
-
- outStream.Seek(outResPos, SeekOrigin.Begin);
- }
- }
- else
- {
- // Object has already been written, write as handle.
- outStream.WriteByte(PortableUtils.HdrHnd);
- outStream.WriteInt(outStartPos - hndPos);
- }
-
- // Synchronize input stream position.
- inStream.Seek(inStartPos + inLen, SeekOrigin.Begin);
- }
- else
- {
- // Try writing as well-known type with fixed size.
- outStream.WriteByte(inHdr);
-
- if (!WriteAsPredefined(inHdr, inStream, outStream, ctx))
- throw new IgniteException("Unexpected header [position=" + (inStream.Position - 1) +
- ", header=" + inHdr + ']');
- }
- }
-
- /// <summary>
- /// Process portable object inverting handles if needed.
- /// </summary>
- /// <param name="outStream">Output stream.</param>
- /// <param name="port">Portable.</param>
- internal void ProcessPortable(IPortableStream outStream, PortableUserObject port)
- {
- // Special case: writing portable object with correct inversions.
- PortableHeapStream inStream = new PortableHeapStream(port.Data);
-
- inStream.Seek(port.Offset, SeekOrigin.Begin);
-
- // Use fresh context to ensure correct portable inversion.
- Mutate0(new Context(), inStream, outStream, false, 0, EmptyVals);
- }
-
- /// <summary>
- /// Process child builder.
- /// </summary>
- /// <param name="outStream">Output stream.</param>
- /// <param name="builder">Builder.</param>
- internal void ProcessBuilder(IPortableStream outStream, PortableBuilderImpl builder)
- {
- PortableHeapStream inStream = new PortableHeapStream(builder._obj.Data);
-
- inStream.Seek(builder._obj.Offset, SeekOrigin.Begin);
-
- // Builder parent context might be null only in one case: if we never met this group of
- // builders before. In this case we set context to their parent and track it. Context
- // cleanup will be performed at the very end of build process.
- if (builder._parent._ctx == null || builder._parent._ctx.Closed)
- builder._parent._ctx = new Context(_parent._ctx);
-
- builder.Mutate(inStream, outStream as PortableHeapStream, builder._desc,
- builder._hashCode, builder._vals);
- }
-
- /// <summary>
- /// Write object as a predefined type if possible.
- /// </summary>
- /// <param name="hdr">Header.</param>
- /// <param name="inStream">Input stream.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="ctx">Context.</param>
- /// <returns><c>True</c> if was written.</returns>
- private bool WriteAsPredefined(byte hdr, PortableHeapStream inStream, IPortableStream outStream,
- Context ctx)
- {
- switch (hdr)
- {
- case PortableUtils.TypeByte:
- TransferBytes(inStream, outStream, 1);
-
- break;
-
- case PortableUtils.TypeShort:
- TransferBytes(inStream, outStream, 2);
-
- break;
-
- case PortableUtils.TypeInt:
- TransferBytes(inStream, outStream, 4);
-
- break;
-
- case PortableUtils.TypeLong:
- TransferBytes(inStream, outStream, 8);
-
- break;
-
- case PortableUtils.TypeFloat:
- TransferBytes(inStream, outStream, 4);
-
- break;
-
- case PortableUtils.TypeDouble:
- TransferBytes(inStream, outStream, 8);
-
- break;
-
- case PortableUtils.TypeChar:
- TransferBytes(inStream, outStream, 2);
-
- break;
-
- case PortableUtils.TypeBool:
- TransferBytes(inStream, outStream, 1);
-
- break;
-
- case PortableUtils.TypeDecimal:
- TransferBytes(inStream, outStream, 4); // Transfer scale
-
- int magLen = inStream.ReadInt(); // Transfer magnitude length.
-
- outStream.WriteInt(magLen);
-
- TransferBytes(inStream, outStream, magLen); // Transfer magnitude.
-
- break;
-
- case PortableUtils.TypeString:
- PortableUtils.WriteString(PortableUtils.ReadString(inStream), outStream);
-
- break;
-
- case PortableUtils.TypeGuid:
- TransferBytes(inStream, outStream, 16);
-
- break;
-
- case PortableUtils.TypeDate:
- TransferBytes(inStream, outStream, 12);
-
- break;
-
- case PortableUtils.TypeArrayByte:
- TransferArray(inStream, outStream, 1);
-
- break;
-
- case PortableUtils.TypeArrayShort:
- TransferArray(inStream, outStream, 2);
-
- break;
-
- case PortableUtils.TypeArrayInt:
- TransferArray(inStream, outStream, 4);
-
- break;
-
- case PortableUtils.TypeArrayLong:
- TransferArray(inStream, outStream, 8);
-
- break;
-
- case PortableUtils.TypeArrayFloat:
- TransferArray(inStream, outStream, 4);
-
- break;
-
- case PortableUtils.TypeArrayDouble:
- TransferArray(inStream, outStream, 8);
-
- break;
-
- case PortableUtils.TypeArrayChar:
- TransferArray(inStream, outStream, 2);
-
- break;
-
- case PortableUtils.TypeArrayBool:
- TransferArray(inStream, outStream, 1);
-
- break;
-
- case PortableUtils.TypeArrayDecimal:
- case PortableUtils.TypeArrayString:
- case PortableUtils.TypeArrayGuid:
- case PortableUtils.TypeArrayDate:
- case PortableUtils.TypeArrayEnum:
- case PortableUtils.TypeArray:
- int arrLen = inStream.ReadInt();
-
- outStream.WriteInt(arrLen);
-
- for (int i = 0; i < arrLen; i++)
- Mutate0(ctx, inStream, outStream, false, 0, null);
-
- break;
-
- case PortableUtils.TypeCollection:
- int colLen = inStream.ReadInt();
-
- outStream.WriteInt(colLen);
-
- outStream.WriteByte(inStream.ReadByte());
-
- for (int i = 0; i < colLen; i++)
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
-
- break;
-
- case PortableUtils.TypeDictionary:
- int dictLen = inStream.ReadInt();
-
- outStream.WriteInt(dictLen);
-
- outStream.WriteByte(inStream.ReadByte());
-
- for (int i = 0; i < dictLen; i++)
- {
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
- }
-
- break;
-
- case PortableUtils.TypeMapEntry:
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
- Mutate0(ctx, inStream, outStream, false, 0, EmptyVals);
-
- break;
-
- case PortableUtils.TypePortable:
- TransferArray(inStream, outStream, 1); // Data array.
- TransferBytes(inStream, outStream, 4); // Offset in array.
-
- break;
-
- case PortableUtils.TypeEnum:
- TransferBytes(inStream, outStream, 4); // Integer ordinal.
-
- break;
-
- default:
- return false;
- }
-
- return true;
- }
-
- /// <summary>
- /// Get's metadata field type ID for the given type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Type ID.</returns>
- private static int TypeId(Type type)
- {
- int typeId;
-
- if (TypeIds.TryGetValue(type, out typeId))
- return typeId;
- if (type.IsEnum)
- return PortableUtils.TypeEnum;
- if (type.IsArray)
- return type.GetElementType().IsEnum ? PortableUtils.TypeArrayEnum : PortableUtils.TypeArray;
- PortableCollectionInfo colInfo = PortableCollectionInfo.Info(type);
-
- return colInfo.IsAny ? colInfo.IsCollection || colInfo.IsGenericCollection ?
- PortableUtils.TypeCollection : PortableUtils.TypeDictionary : PortableUtils.TypeObject;
- }
-
- /// <summary>
- /// Transfer bytes from one stream to another.
- /// </summary>
- /// <param name="inStream">Input stream.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="cnt">Bytes count.</param>
- private static void TransferBytes(PortableHeapStream inStream, IPortableStream outStream, int cnt)
- {
- outStream.Write(inStream.InternalArray, inStream.Position, cnt);
-
- inStream.Seek(cnt, SeekOrigin.Current);
- }
-
- /// <summary>
- /// Transfer array of fixed-size elements from one stream to another.
- /// </summary>
- /// <param name="inStream">Input stream.</param>
- /// <param name="outStream">Output stream.</param>
- /// <param name="elemSize">Element size.</param>
- private static void TransferArray(PortableHeapStream inStream, IPortableStream outStream,
- int elemSize)
- {
- int len = inStream.ReadInt();
-
- outStream.WriteInt(len);
-
- TransferBytes(inStream, outStream, elemSize * len);
- }
-
- /// <summary>
- /// Mutation ocntext.
- /// </summary>
- private class Context
- {
- /** Map from object position in old portable to position in new portable. */
- private IDictionary<int, int> _oldToNew;
-
- /** Parent context. */
- private readonly Context _parent;
-
- /** Portable writer. */
- private readonly PortableWriterImpl _writer;
-
- /** Children contexts. */
- private ICollection<Context> _children;
-
- /** Closed flag; if context is closed, it can no longer be used. */
- private bool _closed;
-
- /// <summary>
- /// Constructor for parent context where writer invocation is not expected.
- /// </summary>
- public Context()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor for parent context.
- /// </summary>
- /// <param name="writer">Writer</param>
- public Context(PortableWriterImpl writer)
- {
- _writer = writer;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="parent">Parent context.</param>
- public Context(Context parent)
- {
- _parent = parent;
-
- _writer = parent._writer;
-
- if (parent._children == null)
- parent._children = new List<Context>();
-
- parent._children.Add(this);
- }
-
- /// <summary>
- /// Add another old-to-new position mapping.
- /// </summary>
- /// <param name="oldPos">Old position.</param>
- /// <param name="newPos">New position.</param>
- /// <param name="hndPos">Handle position.</param>
- /// <returns><c>True</c> if ampping was added, <c>false</c> if mapping already existed and handle
- /// position in the new object is returned.</returns>
- public bool AddOldToNew(int oldPos, int newPos, out int hndPos)
- {
- if (_oldToNew == null)
- _oldToNew = new Dictionary<int, int>();
-
- if (_oldToNew.TryGetValue(oldPos, out hndPos))
- return false;
- _oldToNew[oldPos] = newPos;
-
- return true;
- }
-
- /// <summary>
- /// Get mapping of old position to the new one.
- /// </summary>
- /// <param name="oldPos">Old position.</param>
- /// <param name="newPos">New position.</param>
- /// <returns><c>True</c> if mapping exists.</returns>
- public bool OldToNew(int oldPos, out int newPos)
- {
- return _oldToNew.TryGetValue(oldPos, out newPos);
- }
-
- /// <summary>
- /// Writer.
- /// </summary>
- public PortableWriterImpl Writer
- {
- get { return _writer; }
- }
-
- /// <summary>
- /// Closed flag.
- /// </summary>
- public bool Closed
- {
- get
- {
- return _closed;
- }
- set
- {
- Context ctx = this;
-
- while (ctx != null)
- {
- ctx._closed = value;
-
- if (_children != null) {
- foreach (Context child in _children)
- child.Closed = value;
- }
-
- ctx = ctx._parent;
- }
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableCollectionInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableCollectionInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableCollectionInfo.cs
deleted file mode 100644
index fc61833..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableCollectionInfo.cs
+++ /dev/null
@@ -1,251 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Reflection;
- using Apache.Ignite.Core.Impl.Common;
-
- /**
- * <summary>Collection info helper.</summary>
- */
- internal class PortableCollectionInfo
- {
- /** Flag: none. */
- private const byte FlagNone = 0;
-
- /** Flag: generic dictionary. */
- private const byte FlagGenericDictionary = 1;
-
- /** Flag: generic collection. */
- private const byte FlagGenericCollection = 2;
-
- /** Flag: dictionary. */
- private const byte FlagDictionary = 3;
-
- /** Flag: collection. */
- private const byte FlagCollection = 4;
-
- /** Cache "none" value. */
- private static readonly PortableCollectionInfo None =
- new PortableCollectionInfo(FlagNone, null, null, null);
-
- /** Cache "dictionary" value. */
- private static readonly PortableCollectionInfo Dictionary =
- new PortableCollectionInfo(FlagDictionary, PortableSystemHandlers.WriteHndDictionary, null, null);
-
- /** Cache "collection" value. */
- private static readonly PortableCollectionInfo Collection =
- new PortableCollectionInfo(FlagCollection, PortableSystemHandlers.WriteHndCollection, null, null);
-
- /** Cached infos. */
- private static readonly IDictionary<Type, PortableCollectionInfo> Infos =
- new ConcurrentDictionary<Type, PortableCollectionInfo>(64, 32);
-
- /**
- * <summary>Get collection info for type.</summary>
- * <param name="type">Type.</param>
- * <returns>Collection info.</returns>
- */
- public static PortableCollectionInfo Info(Type type)
- {
- PortableCollectionInfo info;
-
- if (!Infos.TryGetValue(type, out info))
- {
- info = Info0(type);
-
- Infos[type] = info;
- }
-
- return info;
- }
-
- /**
- * <summary>Internal routine to get collection info for type.</summary>
- * <param name="type">Type.</param>
- * <returns>Collection info.</returns>
- */
- private static PortableCollectionInfo Info0(Type type)
- {
- if (type.IsGenericType)
- {
- if (type.GetGenericTypeDefinition() == PortableUtils.TypGenericDictionary)
- {
- MethodInfo writeMthd =
- PortableUtils.MtdhWriteGenericDictionary.MakeGenericMethod(type.GetGenericArguments());
- MethodInfo readMthd =
- PortableUtils.MtdhReadGenericDictionary.MakeGenericMethod(type.GetGenericArguments());
-
- return new PortableCollectionInfo(FlagGenericDictionary,
- PortableSystemHandlers.WriteHndGenericDictionary, writeMthd, readMthd);
- }
-
- Type genTyp = type.GetInterface(PortableUtils.TypGenericDictionary.FullName);
-
- if (genTyp != null)
- {
- MethodInfo writeMthd =
- PortableUtils.MtdhWriteGenericDictionary.MakeGenericMethod(genTyp.GetGenericArguments());
- MethodInfo readMthd =
- PortableUtils.MtdhReadGenericDictionary.MakeGenericMethod(genTyp.GetGenericArguments());
-
- return new PortableCollectionInfo(FlagGenericDictionary,
- PortableSystemHandlers.WriteHndGenericDictionary, writeMthd, readMthd);
- }
-
- if (type.GetGenericTypeDefinition() == PortableUtils.TypGenericCollection)
- {
- MethodInfo writeMthd =
- PortableUtils.MtdhWriteGenericCollection.MakeGenericMethod(type.GetGenericArguments());
- MethodInfo readMthd =
- PortableUtils.MtdhReadGenericCollection.MakeGenericMethod(type.GetGenericArguments());
-
- return new PortableCollectionInfo(FlagGenericCollection,
- PortableSystemHandlers.WriteHndGenericCollection, writeMthd, readMthd);
- }
-
- genTyp = type.GetInterface(PortableUtils.TypGenericCollection.FullName);
-
- if (genTyp != null)
- {
- MethodInfo writeMthd =
- PortableUtils.MtdhWriteGenericCollection.MakeGenericMethod(genTyp.GetGenericArguments());
- MethodInfo readMthd =
- PortableUtils.MtdhReadGenericCollection.MakeGenericMethod(genTyp.GetGenericArguments());
-
- return new PortableCollectionInfo(FlagGenericCollection,
- PortableSystemHandlers.WriteHndGenericCollection, writeMthd, readMthd);
- }
- }
-
- if (type == PortableUtils.TypDictionary || type.GetInterface(PortableUtils.TypDictionary.FullName) != null)
- return Dictionary;
- if (type == PortableUtils.TypCollection || type.GetInterface(PortableUtils.TypCollection.FullName) != null)
- return Collection;
- return None;
- }
-
- /** Flag. */
- private readonly byte _flag;
-
- /** Write handler. */
- private readonly PortableSystemWriteDelegate _writeHnd;
-
- /** Generic write func. */
- private readonly Action<object, PortableWriterImpl> _writeFunc;
-
- /** Generic read func. */
- private readonly Func<PortableReaderImpl, object, object> _readFunc;
-
- /**
- * <summary>Constructor.</summary>
- * <param name="flag0">Flag.</param>
- * <param name="writeHnd0">Write handler.</param>
- * <param name="writeMthd0">Generic write method.</param>
- * <param name="readMthd0">Generic read method.</param>
- */
- private PortableCollectionInfo(byte flag0, PortableSystemWriteDelegate writeHnd0,
- MethodInfo writeMthd0, MethodInfo readMthd0)
- {
- _flag = flag0;
- _writeHnd = writeHnd0;
-
- if (writeMthd0 != null)
- _writeFunc = DelegateConverter.CompileFunc<Action<object, PortableWriterImpl>>(null, writeMthd0, null,
- new[] {true, false, false});
-
- if (readMthd0 != null)
- _readFunc = DelegateConverter.CompileFunc<Func<PortableReaderImpl, object, object>>(null, readMthd0,
- null, new[] {false, true, false});
- }
-
- /**
- * <summary>Generic dictionary flag.</summary>
- */
- public bool IsGenericDictionary
- {
- get { return _flag == FlagGenericDictionary; }
- }
-
- /**
- * <summary>Generic collection flag.</summary>
- */
- public bool IsGenericCollection
- {
- get { return _flag == FlagGenericCollection; }
- }
-
- /**
- * <summary>Dictionary flag.</summary>
- */
- public bool IsDictionary
- {
- get { return _flag == FlagDictionary; }
- }
-
- /**
- * <summary>Collection flag.</summary>
- */
- public bool IsCollection
- {
- get { return _flag == FlagCollection; }
- }
-
- /**
- * <summary>Whether at least one flag is set..</summary>
- */
- public bool IsAny
- {
- get { return _flag != FlagNone; }
- }
-
- /**
- * <summary>Write handler.</summary>
- */
- public PortableSystemWriteDelegate WriteHandler
- {
- get { return _writeHnd; }
- }
-
- /// <summary>
- /// Reads the generic collection.
- /// </summary>
- public object ReadGeneric(PortableReaderImpl reader)
- {
- Debug.Assert(reader != null);
- Debug.Assert(_readFunc != null);
-
- return _readFunc(reader, null);
- }
-
- /// <summary>
- /// Writes the generic collection.
- /// </summary>
- public void WriteGeneric(PortableWriterImpl writer, object value)
- {
- Debug.Assert(writer != null);
- Debug.Assert(_writeFunc != null);
-
- _writeFunc(value, writer);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableFullTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableFullTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableFullTypeDescriptor.cs
deleted file mode 100644
index f294cbd..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableFullTypeDescriptor.cs
+++ /dev/null
@@ -1,203 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Full type descriptor.
- /// </summary>
- internal class PortableFullTypeDescriptor : IPortableTypeDescriptor
- {
- /** Type. */
- private readonly Type _type;
-
- /** Type ID. */
- private readonly int _typeId;
-
- /** Type name. */
- private readonly string _typeName;
-
- /** User type flag. */
- private readonly bool _userType;
-
- /** Name converter. */
- private readonly IPortableNameMapper _nameConverter;
-
- /** Mapper. */
- private readonly IPortableIdMapper _mapper;
-
- /** Serializer. */
- private readonly IPortableSerializer _serializer;
-
- /** Metadata enabled flag. */
- private readonly bool _metaEnabled;
-
- /** Whether to cache deserialized value in IPortableObject */
- private readonly bool _keepDeserialized;
-
- /** Affinity field key name. */
- private readonly string _affKeyFieldName;
-
- /** Typed handler. */
- private readonly object _typedHandler;
-
- /** Untyped handler. */
- private readonly PortableSystemWriteDelegate _untypedHandler;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="userType">User type flag.</param>
- /// <param name="nameConverter">Name converter.</param>
- /// <param name="mapper">Mapper.</param>
- /// <param name="serializer">Serializer.</param>
- /// <param name="metaEnabled">Metadata enabled flag.</param>
- /// <param name="keepDeserialized">Whether to cache deserialized value in IPortableObject</param>
- /// <param name="affKeyFieldName">Affinity field key name.</param>
- /// <param name="typedHandler">Typed handler.</param>
- /// <param name="untypedHandler">Untyped handler.</param>
- public PortableFullTypeDescriptor(
- Type type,
- int typeId,
- string typeName,
- bool userType,
- IPortableNameMapper nameConverter,
- IPortableIdMapper mapper,
- IPortableSerializer serializer,
- bool metaEnabled,
- bool keepDeserialized,
- string affKeyFieldName,
- object typedHandler,
- PortableSystemWriteDelegate untypedHandler)
- {
- _type = type;
- _typeId = typeId;
- _typeName = typeName;
- _userType = userType;
- _nameConverter = nameConverter;
- _mapper = mapper;
- _serializer = serializer;
- _metaEnabled = metaEnabled;
- _keepDeserialized = keepDeserialized;
- _affKeyFieldName = affKeyFieldName;
- _typedHandler = typedHandler;
- _untypedHandler = untypedHandler;
- }
-
- /// <summary>
- /// Type.
- /// </summary>
- public Type Type
- {
- get { return _type; }
- }
-
- /// <summary>
- /// Type ID.
- /// </summary>
- public int TypeId
- {
- get { return _typeId; }
- }
-
- /// <summary>
- /// Type name.
- /// </summary>
- public string TypeName
- {
- get { return _typeName; }
- }
-
- /// <summary>
- /// User type flag.
- /// </summary>
- public bool UserType
- {
- get { return _userType; }
- }
-
- /// <summary>
- /// Metadata enabled flag.
- /// </summary>
- public bool MetadataEnabled
- {
- get { return _metaEnabled; }
- }
-
- /// <summary>
- /// Whether to cache deserialized value in IPortableObject
- /// </summary>
- public bool KeepDeserialized
- {
- get { return _keepDeserialized; }
- }
-
- /// <summary>
- /// Name converter.
- /// </summary>
- public IPortableNameMapper NameConverter
- {
- get { return _nameConverter; }
- }
-
- /// <summary>
- /// Mapper.
- /// </summary>
- public IPortableIdMapper Mapper
- {
- get { return _mapper; }
- }
-
- /// <summary>
- /// Serializer.
- /// </summary>
- public IPortableSerializer Serializer
- {
- get { return _serializer; }
- }
-
- /// <summary>
- /// Affinity key field name.
- /// </summary>
- public string AffinityKeyFieldName
- {
- get { return _affKeyFieldName; }
- }
-
- /// <summary>
- /// Typed handler.
- /// </summary>
- public object TypedHandler
- {
- get { return _typedHandler; }
- }
-
- /// <summary>
- /// Untyped handler.
- /// </summary>
- public PortableSystemWriteDelegate UntypedHandler
- {
- get { return _untypedHandler; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableHandleDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableHandleDictionary.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableHandleDictionary.cs
deleted file mode 100644
index 32e1e02..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableHandleDictionary.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Object handle dictionary.
- /// </summary>
- internal class PortableHandleDictionary<TK, TV>
- {
- /** Initial array sizes. */
- private const int InitialSize = 7;
-
- /** Dictionary. */
- private Dictionary<TK, TV> _dict;
-
- /** First key. */
- private readonly TK _key1;
-
- /** First value. */
- private readonly TV _val1;
-
- /** Second key. */
- private TK _key2;
-
- /** Second value. */
- private TV _val2;
-
- /** Third key. */
- private TK _key3;
-
- /** Third value. */
- private TV _val3;
-
- /// <summary>
- /// Constructor with initial key-value pair.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- [SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors"),
- SuppressMessage("ReSharper", "DoNotCallOverridableMethodsInConstructor")]
- public PortableHandleDictionary(TK key, TV val)
- {
- Debug.Assert(!Equals(key, EmptyKey));
-
- _key1 = key;
- _val1 = val;
-
- _key2 = EmptyKey;
- _key3 = EmptyKey;
- }
-
- /// <summary>
- /// Add value to dictionary.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- public void Add(TK key, TV val)
- {
- Debug.Assert(!Equals(key, EmptyKey));
-
- if (Equals(_key2, EmptyKey))
- {
- _key2 = key;
- _val2 = val;
-
- return;
- }
-
- if (Equals(_key3, EmptyKey))
- {
- _key3 = key;
- _val3 = val;
-
- return;
- }
-
- if (_dict == null)
- _dict = new Dictionary<TK, TV>(InitialSize);
-
- _dict[key] = val;
- }
-
- /// <summary>
- /// Try getting value for the given key.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- /// <returns>True if key was found.</returns>
- public bool TryGetValue(TK key, out TV val)
- {
- Debug.Assert(!Equals(key, EmptyKey));
-
- if (Equals(key, _key1))
- {
- val = _val1;
-
- return true;
- }
-
- if (Equals(key, _key2))
- {
- val = _val2;
-
- return true;
- }
-
- if (Equals(key, _key3))
- {
- val = _val3;
-
- return true;
- }
-
- if (_dict == null)
- {
- val = default(TV);
-
- return false;
- }
-
- return _dict.TryGetValue(key, out val);
- }
-
- /// <summary>
- /// Merge data from another dictionary without overwrite.
- /// </summary>
- /// <param name="that">Other dictionary.</param>
- public void Merge(PortableHandleDictionary<TK, TV> that)
- {
- Debug.Assert(that != null, "that == null");
-
- AddIfAbsent(that._key1, that._val1);
- AddIfAbsent(that._key2, that._val2);
- AddIfAbsent(that._key3, that._val3);
-
- if (that._dict == null)
- return;
-
- foreach (var pair in that._dict)
- AddIfAbsent(pair.Key, pair.Value);
- }
-
- /// <summary>
- /// Add key/value pair to the bucket if absent.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- private void AddIfAbsent(TK key, TV val)
- {
- if (Equals(key, EmptyKey))
- return;
-
- if (Equals(key, _key1) || Equals(key, _key2) || Equals(key, _key3))
- return;
-
- if (_dict == null || !_dict.ContainsKey(key))
- Add(key, val);
- }
-
- /// <summary>
- /// Gets the empty key.
- /// </summary>
- protected virtual TK EmptyKey
- {
- get { return default(TK); }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshalAwareSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshalAwareSerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshalAwareSerializer.cs
deleted file mode 100644
index e3c7523..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshalAwareSerializer.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable serializer which only supports <see cref="IPortableMarshalAware"/> types with a default ctor.
- /// Does not use reflection.
- /// </summary>
- internal class PortableMarshalAwareSerializer : IPortableSerializer
- {
- /// <summary>
- /// Default instance.
- /// </summary>
- public static readonly PortableMarshalAwareSerializer Instance = new PortableMarshalAwareSerializer();
-
- /** <inheritdoc /> */
- public void WritePortable(object obj, IPortableWriter writer)
- {
- ((IPortableMarshalAware)obj).WritePortable(writer);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(object obj, IPortableReader reader)
- {
- ((IPortableMarshalAware)obj).ReadPortable(reader);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs
deleted file mode 100644
index 6286ebb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMarshaller.cs
+++ /dev/null
@@ -1,599 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Compute;
- using Apache.Ignite.Core.Impl.Compute.Closure;
- using Apache.Ignite.Core.Impl.Datastream;
- using Apache.Ignite.Core.Impl.Messaging;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Portable.Metadata;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable marshaller implementation.
- /// </summary>
- internal class PortableMarshaller
- {
- /** Portable configuration. */
- private readonly PortableConfiguration _cfg;
-
- /** Type to descriptor map. */
- private readonly IDictionary<Type, IPortableTypeDescriptor> _typeToDesc =
- new Dictionary<Type, IPortableTypeDescriptor>();
-
- /** Type name to descriptor map. */
- private readonly IDictionary<string, IPortableTypeDescriptor> _typeNameToDesc =
- new Dictionary<string, IPortableTypeDescriptor>();
-
- /** ID to descriptor map. */
- private readonly IDictionary<long, IPortableTypeDescriptor> _idToDesc =
- new Dictionary<long, IPortableTypeDescriptor>();
-
- /** Cached metadatas. */
- private volatile IDictionary<int, PortableMetadataHolder> _metas =
- new Dictionary<int, PortableMetadataHolder>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cfg">Configurtaion.</param>
- public PortableMarshaller(PortableConfiguration cfg)
- {
- // Validation.
- if (cfg == null)
- cfg = new PortableConfiguration();
-
- if (cfg.TypeConfigurations == null)
- cfg.TypeConfigurations = new List<PortableTypeConfiguration>();
-
- foreach (PortableTypeConfiguration typeCfg in cfg.TypeConfigurations)
- {
- if (string.IsNullOrEmpty(typeCfg.TypeName))
- throw new PortableException("Type name cannot be null or empty: " + typeCfg);
-
- if (typeCfg.AssemblyName != null && typeCfg.AssemblyName.Length == 0)
- throw new PortableException("Assembly name cannot be empty string: " + typeCfg);
- }
-
- // Define predefined types.
- AddPredefinedType(typeof(bool), PortableUtils.TypeBool, PortableSystemHandlers.WriteHndBoolTyped, PortableSystemHandlers.WriteHndBool);
- AddPredefinedType(typeof(byte), PortableUtils.TypeByte, PortableSystemHandlers.WriteHndByteTyped, PortableSystemHandlers.WriteHndByte);
- AddPredefinedType(typeof(short), PortableUtils.TypeShort, PortableSystemHandlers.WriteHndShortTyped, PortableSystemHandlers.WriteHndShort);
- AddPredefinedType(typeof(char), PortableUtils.TypeChar, PortableSystemHandlers.WriteHndCharTyped, PortableSystemHandlers.WriteHndChar);
- AddPredefinedType(typeof(int), PortableUtils.TypeInt, PortableSystemHandlers.WriteHndIntTyped, PortableSystemHandlers.WriteHndInt);
- AddPredefinedType(typeof(long), PortableUtils.TypeLong, PortableSystemHandlers.WriteHndLongTyped, PortableSystemHandlers.WriteHndLong);
- AddPredefinedType(typeof(float), PortableUtils.TypeFloat, PortableSystemHandlers.WriteHndFloatTyped, PortableSystemHandlers.WriteHndFloat);
- AddPredefinedType(typeof(double), PortableUtils.TypeDouble, PortableSystemHandlers.WriteHndDoubleTyped, PortableSystemHandlers.WriteHndDouble);
- AddPredefinedType(typeof(string), PortableUtils.TypeString, PortableSystemHandlers.WriteHndStringTyped, PortableSystemHandlers.WriteHndString);
- AddPredefinedType(typeof(decimal), PortableUtils.TypeDecimal, PortableSystemHandlers.WriteHndDecimalTyped, PortableSystemHandlers.WriteHndDecimal);
- AddPredefinedType(typeof(DateTime), PortableUtils.TypeDate, PortableSystemHandlers.WriteHndDateTyped, PortableSystemHandlers.WriteHndDate);
- AddPredefinedType(typeof(Guid), PortableUtils.TypeGuid, PortableSystemHandlers.WriteHndGuidTyped, PortableSystemHandlers.WriteHndGuid);
-
- // TODO: Remove this registration
- AddPredefinedType(typeof(PortableUserObject), PortableUtils.TypePortable, PortableSystemHandlers.WriteHndPortableTyped,
- PortableSystemHandlers.WriteHndPortable);
-
- AddPredefinedType(typeof(bool[]), PortableUtils.TypeArrayBool, PortableSystemHandlers.WriteHndBoolArrayTyped,
- PortableSystemHandlers.WriteHndBoolArray);
- AddPredefinedType(typeof(byte[]), PortableUtils.TypeArrayByte, PortableSystemHandlers.WriteHndByteArrayTyped,
- PortableSystemHandlers.WriteHndByteArray);
- AddPredefinedType(typeof(short[]), PortableUtils.TypeArrayShort, PortableSystemHandlers.WriteHndShortArrayTyped,
- PortableSystemHandlers.WriteHndShortArray);
- AddPredefinedType(typeof(char[]), PortableUtils.TypeArrayChar, PortableSystemHandlers.WriteHndCharArrayTyped,
- PortableSystemHandlers.WriteHndCharArray);
- AddPredefinedType(typeof(int[]), PortableUtils.TypeArrayInt, PortableSystemHandlers.WriteHndIntArrayTyped,
- PortableSystemHandlers.WriteHndIntArray);
- AddPredefinedType(typeof(long[]), PortableUtils.TypeArrayLong, PortableSystemHandlers.WriteHndLongArrayTyped,
- PortableSystemHandlers.WriteHndLongArray);
- AddPredefinedType(typeof(float[]), PortableUtils.TypeArrayFloat, PortableSystemHandlers.WriteHndFloatArrayTyped,
- PortableSystemHandlers.WriteHndFloatArray);
- AddPredefinedType(typeof(double[]), PortableUtils.TypeArrayDouble, PortableSystemHandlers.WriteHndDoubleArrayTyped,
- PortableSystemHandlers.WriteHndDoubleArray);
- AddPredefinedType(typeof(decimal[]), PortableUtils.TypeArrayDecimal, PortableSystemHandlers.WriteHndDecimalArrayTyped,
- PortableSystemHandlers.WriteHndDecimalArray);
- AddPredefinedType(typeof(string[]), PortableUtils.TypeArrayString, PortableSystemHandlers.WriteHndStringArrayTyped,
- PortableSystemHandlers.WriteHndStringArray);
- AddPredefinedType(typeof(DateTime?[]), PortableUtils.TypeArrayDate, PortableSystemHandlers.WriteHndDateArrayTyped,
- PortableSystemHandlers.WriteHndDateArray);
- AddPredefinedType(typeof(Guid?[]), PortableUtils.TypeArrayGuid, PortableSystemHandlers.WriteHndGuidArrayTyped,
- PortableSystemHandlers.WriteHndGuidArray);
-
- // Define system types. They use internal reflective stuff, so configuration doesn't affect them.
- AddSystemTypes();
-
- // 2. Define user types.
- var dfltSerializer = cfg.DefaultSerializer == null ? new PortableReflectiveSerializer() : null;
-
- var typeResolver = new TypeResolver();
-
- ICollection<PortableTypeConfiguration> typeCfgs = cfg.TypeConfigurations;
-
- if (typeCfgs != null)
- foreach (PortableTypeConfiguration typeCfg in typeCfgs)
- AddUserType(cfg, typeCfg, typeResolver, dfltSerializer);
-
- ICollection<string> types = cfg.Types;
-
- if (types != null)
- foreach (string type in types)
- AddUserType(cfg, new PortableTypeConfiguration(type), typeResolver, dfltSerializer);
-
- if (cfg.DefaultSerializer == null)
- cfg.DefaultSerializer = dfltSerializer;
-
- _cfg = cfg;
- }
-
- /// <summary>
- /// Gets or sets the backing grid.
- /// </summary>
- public Ignite Ignite { get; set; }
-
- /// <summary>
- /// Marshal object.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <returns>Serialized data as byte array.</returns>
- public byte[] Marshal(object val)
- {
- PortableHeapStream stream = new PortableHeapStream(128);
-
- Marshal(val, stream);
-
- return stream.ArrayCopy();
- }
-
- /// <summary>
- /// Marshal object.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <param name="stream">Output stream.</param>
- /// <returns>Collection of metadatas (if any).</returns>
- private void Marshal<T>(T val, IPortableStream stream)
- {
- PortableWriterImpl writer = StartMarshal(stream);
-
- writer.Write(val);
-
- FinishMarshal(writer);
- }
-
- /// <summary>
- /// Start marshal session.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Writer.</returns>
- public PortableWriterImpl StartMarshal(IPortableStream stream)
- {
- return new PortableWriterImpl(this, stream);
- }
-
- /// <summary>
- /// Finish marshal session.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <returns>Dictionary with metadata.</returns>
- public void FinishMarshal(IPortableWriter writer)
- {
- var meta = ((PortableWriterImpl) writer).Metadata();
-
- var ignite = Ignite;
-
- if (ignite != null && meta != null && meta.Count > 0)
- ignite.PutMetadata(meta);
- }
-
- /// <summary>
- /// Unmarshal object.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="data">Data array.</param>
- /// <param name="keepPortable">Whether to keep portables as portables.</param>
- /// <returns>
- /// Object.
- /// </returns>
- public T Unmarshal<T>(byte[] data, bool keepPortable)
- {
- return Unmarshal<T>(new PortableHeapStream(data), keepPortable);
- }
-
- /// <summary>
- /// Unmarshal object.
- /// </summary>
- /// <param name="data">Data array.</param>
- /// <param name="mode">The mode.</param>
- /// <returns>
- /// Object.
- /// </returns>
- public T Unmarshal<T>(byte[] data, PortableMode mode = PortableMode.Deserialize)
- {
- return Unmarshal<T>(new PortableHeapStream(data), mode);
- }
-
- /// <summary>
- /// Unmarshal object.
- /// </summary>
- /// <param name="stream">Stream over underlying byte array with correct position.</param>
- /// <param name="keepPortable">Whether to keep portables as portables.</param>
- /// <returns>
- /// Object.
- /// </returns>
- public T Unmarshal<T>(IPortableStream stream, bool keepPortable)
- {
- return Unmarshal<T>(stream, keepPortable ? PortableMode.KeepPortable : PortableMode.Deserialize, null);
- }
-
- /// <summary>
- /// Unmarshal object.
- /// </summary>
- /// <param name="stream">Stream over underlying byte array with correct position.</param>
- /// <param name="mode">The mode.</param>
- /// <returns>
- /// Object.
- /// </returns>
- public T Unmarshal<T>(IPortableStream stream, PortableMode mode = PortableMode.Deserialize)
- {
- return Unmarshal<T>(stream, mode, null);
- }
-
- /// <summary>
- /// Unmarshal object.
- /// </summary>
- /// <param name="stream">Stream over underlying byte array with correct position.</param>
- /// <param name="mode">The mode.</param>
- /// <param name="builder">Builder.</param>
- /// <returns>
- /// Object.
- /// </returns>
- public T Unmarshal<T>(IPortableStream stream, PortableMode mode, PortableBuilderImpl builder)
- {
- return new PortableReaderImpl(this, _idToDesc, stream, mode, builder).Deserialize<T>();
- }
-
- /// <summary>
- /// Start unmarshal session.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="keepPortable">Whether to keep portables as portables.</param>
- /// <returns>
- /// Reader.
- /// </returns>
- public PortableReaderImpl StartUnmarshal(IPortableStream stream, bool keepPortable)
- {
- return new PortableReaderImpl(this, _idToDesc, stream,
- keepPortable ? PortableMode.KeepPortable : PortableMode.Deserialize, null);
- }
-
- /// <summary>
- /// Start unmarshal session.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="mode">The mode.</param>
- /// <returns>Reader.</returns>
- public PortableReaderImpl StartUnmarshal(IPortableStream stream, PortableMode mode = PortableMode.Deserialize)
- {
- return new PortableReaderImpl(this, _idToDesc, stream, mode, null);
- }
-
- /// <summary>
- /// Gets metadata for the given type ID.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <returns>Metadata or null.</returns>
- public IPortableMetadata Metadata(int typeId)
- {
- if (Ignite != null)
- {
- IPortableMetadata meta = Ignite.Metadata(typeId);
-
- if (meta != null)
- return meta;
- }
-
- return PortableMetadataImpl.EmptyMeta;
- }
-
- /// <summary>
- /// Gets metadata handler for the given type ID.
- /// </summary>
- /// <param name="desc">Type descriptor.</param>
- /// <returns>Metadata handler.</returns>
- public IPortableMetadataHandler MetadataHandler(IPortableTypeDescriptor desc)
- {
- PortableMetadataHolder holder;
-
- if (!_metas.TryGetValue(desc.TypeId, out holder))
- {
- lock (this)
- {
- if (!_metas.TryGetValue(desc.TypeId, out holder))
- {
- IDictionary<int, PortableMetadataHolder> metas0 =
- new Dictionary<int, PortableMetadataHolder>(_metas);
-
- holder = desc.MetadataEnabled ? new PortableMetadataHolder(desc.TypeId,
- desc.TypeName, desc.AffinityKeyFieldName) : null;
-
- metas0[desc.TypeId] = holder;
-
- _metas = metas0;
- }
- }
- }
-
- if (holder != null)
- {
- ICollection<int> ids = holder.FieldIds();
-
- bool newType = ids.Count == 0 && !holder.Saved();
-
- return new PortableHashsetMetadataHandler(ids, newType);
- }
- return null;
- }
-
- /// <summary>
- /// Callback invoked when metadata has been sent to the server and acknowledged by it.
- /// </summary>
- /// <param name="newMetas"></param>
- public void OnMetadataSent(IDictionary<int, IPortableMetadata> newMetas)
- {
- foreach (KeyValuePair<int, IPortableMetadata> metaEntry in newMetas)
- {
- PortableMetadataImpl meta = (PortableMetadataImpl) metaEntry.Value;
-
- IDictionary<int, Tuple<string, int>> mergeInfo =
- new Dictionary<int, Tuple<string, int>>(meta.FieldsMap().Count);
-
- foreach (KeyValuePair<string, int> fieldMeta in meta.FieldsMap())
- {
- int fieldId = PortableUtils.FieldId(metaEntry.Key, fieldMeta.Key, null, null);
-
- mergeInfo[fieldId] = new Tuple<string, int>(fieldMeta.Key, fieldMeta.Value);
- }
-
- _metas[metaEntry.Key].Merge(mergeInfo);
- }
- }
-
- /// <summary>
- /// Gets descriptor for type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Descriptor.</returns>
- public IPortableTypeDescriptor Descriptor(Type type)
- {
- IPortableTypeDescriptor desc;
-
- _typeToDesc.TryGetValue(type, out desc);
-
- return desc;
- }
-
- /// <summary>
- /// Gets descriptor for type name.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- /// <returns>Descriptor.</returns>
- public IPortableTypeDescriptor Descriptor(string typeName)
- {
- IPortableTypeDescriptor desc;
-
- return _typeNameToDesc.TryGetValue(typeName, out desc) ? desc :
- new PortableSurrogateTypeDescriptor(_cfg, typeName);
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="userType"></param>
- /// <param name="typeId"></param>
- /// <returns></returns>
- public IPortableTypeDescriptor Descriptor(bool userType, int typeId)
- {
- IPortableTypeDescriptor desc;
-
- return _idToDesc.TryGetValue(PortableUtils.TypeKey(userType, typeId), out desc) ? desc :
- userType ? new PortableSurrogateTypeDescriptor(_cfg, typeId) : null;
- }
-
- /// <summary>
- /// Add user type.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <param name="typeCfg">Type configuration.</param>
- /// <param name="typeResolver">The type resolver.</param>
- /// <param name="dfltSerializer">The default serializer.</param>
- private void AddUserType(PortableConfiguration cfg, PortableTypeConfiguration typeCfg,
- TypeResolver typeResolver, IPortableSerializer dfltSerializer)
- {
- // Get converter/mapper/serializer.
- IPortableNameMapper nameMapper = typeCfg.NameMapper ?? cfg.DefaultNameMapper;
-
- IPortableIdMapper idMapper = typeCfg.IdMapper ?? cfg.DefaultIdMapper;
-
- bool metaEnabled = typeCfg.MetadataEnabled ?? cfg.DefaultMetadataEnabled;
-
- bool keepDeserialized = typeCfg.KeepDeserialized ?? cfg.DefaultKeepDeserialized;
-
- // Try resolving type.
- Type type = typeResolver.ResolveType(typeCfg.TypeName, typeCfg.AssemblyName);
-
- if (type != null)
- {
- // Type is found.
- var typeName = GetTypeName(type);
-
- int typeId = PortableUtils.TypeId(typeName, nameMapper, idMapper);
-
- var serializer = typeCfg.Serializer ?? cfg.DefaultSerializer
- ?? GetPortableMarshalAwareSerializer(type) ?? dfltSerializer;
-
- var refSerializer = serializer as PortableReflectiveSerializer;
-
- if (refSerializer != null)
- refSerializer.Register(type, typeId, nameMapper, idMapper);
-
- AddType(type, typeId, typeName, true, metaEnabled, keepDeserialized, nameMapper, idMapper, serializer,
- typeCfg.AffinityKeyFieldName, null, null);
- }
- else
- {
- // Type is not found.
- string typeName = PortableUtils.SimpleTypeName(typeCfg.TypeName);
-
- int typeId = PortableUtils.TypeId(typeName, nameMapper, idMapper);
-
- AddType(null, typeId, typeName, true, metaEnabled, keepDeserialized, nameMapper, idMapper, null,
- typeCfg.AffinityKeyFieldName, null, null);
- }
- }
-
- /// <summary>
- /// Gets the <see cref="PortableMarshalAwareSerializer"/> for a type if it is compatible.
- /// </summary>
- /// <param name="type">The type.</param>
- /// <returns>Resulting <see cref="PortableMarshalAwareSerializer"/>, or null.</returns>
- private static IPortableSerializer GetPortableMarshalAwareSerializer(Type type)
- {
- return type.GetInterfaces().Contains(typeof (IPortableMarshalAware))
- ? PortableMarshalAwareSerializer.Instance
- : null;
- }
-
- /// <summary>
- /// Add predefined type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typedHandler">Typed handler.</param>
- /// <param name="untypedHandler">Untyped handler.</param>
- private void AddPredefinedType(Type type, int typeId, object typedHandler,
- PortableSystemWriteDelegate untypedHandler)
- {
- AddType(type, typeId, GetTypeName(type), false, false, false, null, null, null, null, typedHandler,
- untypedHandler);
- }
-
- /// <summary>
- /// Add type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="userType">User type flag.</param>
- /// <param name="metaEnabled">Metadata enabled flag.</param>
- /// <param name="keepDeserialized">Whether to cache deserialized value in IPortableObject</param>
- /// <param name="nameMapper">Name mapper.</param>
- /// <param name="idMapper">ID mapper.</param>
- /// <param name="serializer">Serializer.</param>
- /// <param name="affKeyFieldName">Affinity key field name.</param>
- /// <param name="typedHandler">Typed handler.</param>
- /// <param name="untypedHandler">Untyped handler.</param>
- private void AddType(Type type, int typeId, string typeName, bool userType, bool metaEnabled,
- bool keepDeserialized, IPortableNameMapper nameMapper, IPortableIdMapper idMapper,
- IPortableSerializer serializer, string affKeyFieldName, object typedHandler,
- PortableSystemWriteDelegate untypedHandler)
- {
- long typeKey = PortableUtils.TypeKey(userType, typeId);
-
- if (_idToDesc.ContainsKey(typeKey))
- {
- string type1 = _idToDesc[typeKey].Type != null ? _idToDesc[typeKey].Type.AssemblyQualifiedName : null;
- string type2 = type != null ? type.AssemblyQualifiedName : null;
-
- throw new PortableException("Conflicting type IDs [type1=" + type1 + ", type2=" + type2 +
- ", typeId=" + typeId + ']');
- }
-
- if (userType && _typeNameToDesc.ContainsKey(typeName))
- throw new PortableException("Conflicting type name: " + typeName);
-
- IPortableTypeDescriptor descriptor =
- new PortableFullTypeDescriptor(type, typeId, typeName, userType, nameMapper, idMapper, serializer,
- metaEnabled, keepDeserialized, affKeyFieldName, typedHandler, untypedHandler);
-
- if (type != null)
- _typeToDesc[type] = descriptor;
-
- if (userType)
- _typeNameToDesc[typeName] = descriptor;
-
- _idToDesc[typeKey] = descriptor;
- }
-
- /// <summary>
- /// Adds a predefined system type.
- /// </summary>
- private void AddSystemType<T>(byte typeId, Func<PortableReaderImpl, T> ctor) where T : IPortableWriteAware
- {
- var type = typeof(T);
-
- var serializer = new PortableSystemTypeSerializer<T>(ctor);
-
- AddType(type, typeId, GetTypeName(type), false, false, false, null, null, serializer, null, null, null);
- }
-
- /// <summary>
- /// Adds predefined system types.
- /// </summary>
- private void AddSystemTypes()
- {
- AddSystemType(PortableUtils.TypeNativeJobHolder, w => new ComputeJobHolder(w));
- AddSystemType(PortableUtils.TypeComputeJobWrapper, w => new ComputeJobWrapper(w));
- AddSystemType(PortableUtils.TypePortableJobResHolder, w => new PortableResultWrapper(w));
- AddSystemType(PortableUtils.TypeIgniteProxy, w => new IgniteProxy());
- AddSystemType(PortableUtils.TypeComputeOutFuncJob, w => new ComputeOutFuncJob(w));
- AddSystemType(PortableUtils.TypeComputeOutFuncWrapper, w => new ComputeOutFuncWrapper(w));
- AddSystemType(PortableUtils.TypeComputeFuncWrapper, w => new ComputeFuncWrapper(w));
- AddSystemType(PortableUtils.TypeComputeFuncJob, w => new ComputeFuncJob(w));
- AddSystemType(PortableUtils.TypeComputeActionJob, w => new ComputeActionJob(w));
- AddSystemType(PortableUtils.TypeContinuousQueryRemoteFilterHolder, w => new ContinuousQueryFilterHolder(w));
- AddSystemType(PortableUtils.TypeSerializableHolder, w => new SerializableObjectHolder(w));
- AddSystemType(PortableUtils.TypeCacheEntryProcessorHolder, w => new CacheEntryProcessorHolder(w));
- AddSystemType(PortableUtils.TypeCacheEntryPredicateHolder, w => new CacheEntryFilterHolder(w));
- AddSystemType(PortableUtils.TypeMessageFilterHolder, w => new MessageFilterHolder(w));
- AddSystemType(PortableUtils.TypePortableOrSerializableHolder, w => new PortableOrSerializableObjectHolder(w));
- AddSystemType(PortableUtils.TypeStreamReceiverHolder, w => new StreamReceiverHolder(w));
- }
-
- /// <summary>
- /// Gets the name of the type.
- /// </summary>
- /// <param name="type">The type.</param>
- /// <returns>
- /// Simple type name for non-generic types; simple type name with appended generic arguments for generic types.
- /// </returns>
- private static string GetTypeName(Type type)
- {
- if (!type.IsGenericType)
- return type.Name;
-
- var args = type.GetGenericArguments().Select(GetTypeName).Aggregate((x, y) => x + "," + y);
-
- return string.Format("{0}[{1}]", type.Name, args);
- }
- }
-}
[18/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
deleted file mode 100644
index f926adc..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUtils.cs
+++ /dev/null
@@ -1,2130 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Reflection;
- using System.Runtime.Serialization.Formatters.Binary;
- using System.Text;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /**
- * <summary>Utilities for portable serialization.</summary>
- */
- static class PortableUtils
- {
- /** Cache empty dictionary. */
- public static readonly IDictionary<int, int> EmptyFields = new Dictionary<int, int>();
-
- /** Header of NULL object. */
- public const byte HdrNull = 101;
-
- /** Header of object handle. */
- public const byte HdrHnd = 102;
-
- /** Header of object in fully serialized form. */
- public const byte HdrFull = 103;
-
- /** Full header length. */
- public const int FullHdrLen = 18;
-
- /** Type: object. */
- public const byte TypeObject = HdrFull;
-
- /** Type: unsigned byte. */
- public const byte TypeByte = 1;
-
- /** Type: short. */
- public const byte TypeShort = 2;
-
- /** Type: int. */
- public const byte TypeInt = 3;
-
- /** Type: long. */
- public const byte TypeLong = 4;
-
- /** Type: float. */
- public const byte TypeFloat = 5;
-
- /** Type: double. */
- public const byte TypeDouble = 6;
-
- /** Type: char. */
- public const byte TypeChar = 7;
-
- /** Type: boolean. */
- public const byte TypeBool = 8;
-
- /** Type: decimal. */
- public const byte TypeDecimal = 30;
-
- /** Type: string. */
- public const byte TypeString = 9;
-
- /** Type: GUID. */
- public const byte TypeGuid = 10;
-
- /** Type: date. */
- public const byte TypeDate = 11;
-
- /** Type: unsigned byte array. */
- public const byte TypeArrayByte = 12;
-
- /** Type: short array. */
- public const byte TypeArrayShort = 13;
-
- /** Type: int array. */
- public const byte TypeArrayInt = 14;
-
- /** Type: long array. */
- public const byte TypeArrayLong = 15;
-
- /** Type: float array. */
- public const byte TypeArrayFloat = 16;
-
- /** Type: double array. */
- public const byte TypeArrayDouble = 17;
-
- /** Type: char array. */
- public const byte TypeArrayChar = 18;
-
- /** Type: boolean array. */
- public const byte TypeArrayBool = 19;
-
- /** Type: decimal array. */
- public const byte TypeArrayDecimal = 31;
-
- /** Type: string array. */
- public const byte TypeArrayString = 20;
-
- /** Type: GUID array. */
- public const byte TypeArrayGuid = 21;
-
- /** Type: date array. */
- public const byte TypeArrayDate = 22;
-
- /** Type: object array. */
- public const byte TypeArray = 23;
-
- /** Type: collection. */
- public const byte TypeCollection = 24;
-
- /** Type: map. */
- public const byte TypeDictionary = 25;
-
- /** Type: map entry. */
- public const byte TypeMapEntry = 26;
-
- /** Type: portable object. */
- public const byte TypePortable = 27;
-
- /** Type: enum. */
- public const byte TypeEnum = 28;
-
- /** Type: enum array. */
- public const byte TypeArrayEnum = 29;
-
- /** Type: native job holder. */
- public const byte TypeNativeJobHolder = 77;
-
- /** Type: native job result holder. */
- public const byte TypePortableJobResHolder = 76;
-
- /** Type: .Net configuration. */
- public const byte TypeDotNetCfg = 202;
-
- /** Type: .Net portable configuration. */
- public const byte TypeDotNetPortableCfg = 203;
-
- /** Type: .Net portable type configuration. */
- public const byte TypeDotNetPortableTypCfg = 204;
-
- /** Type: Ignite proxy. */
- public const byte TypeIgniteProxy = 74;
-
- /** Type: function wrapper. */
- public const byte TypeComputeOutFuncJob = 80;
-
- /** Type: function wrapper. */
- public const byte TypeComputeFuncJob = 81;
-
- /** Type: continuous query remote filter. */
- public const byte TypeContinuousQueryRemoteFilterHolder = 82;
-
- /** Type: Compute out func wrapper. */
- public const byte TypeComputeOutFuncWrapper = 83;
-
- /** Type: Compute func wrapper. */
- public const byte TypeComputeFuncWrapper = 85;
-
- /** Type: Compute job wrapper. */
- public const byte TypeComputeJobWrapper = 86;
-
- /** Type: Compute job wrapper. */
- public const byte TypeSerializableHolder = 87;
-
- /** Type: action wrapper. */
- public const byte TypeComputeActionJob = 88;
-
- /** Type: entry processor holder. */
- public const byte TypeCacheEntryProcessorHolder = 89;
-
- /** Type: entry predicate holder. */
- public const byte TypeCacheEntryPredicateHolder = 90;
-
- /** Type: product license. */
- public const byte TypeProductLicense = 78;
-
- /** Type: message filter holder. */
- public const byte TypeMessageFilterHolder = 92;
-
- /** Type: message filter holder. */
- public const byte TypePortableOrSerializableHolder = 93;
-
- /** Type: stream receiver holder. */
- public const byte TypeStreamReceiverHolder = 94;
-
- /** Collection: custom. */
- public const byte CollectionCustom = 0;
-
- /** Collection: array list. */
- public const byte CollectionArrayList = 1;
-
- /** Collection: linked list. */
- public const byte CollectionLinkedList = 2;
-
- /** Collection: hash set. */
- public const byte CollectionHashSet = 3;
-
- /** Collection: hash set. */
- public const byte CollectionLinkedHashSet = 4;
-
- /** Collection: sorted set. */
- public const byte CollectionSortedSet = 5;
-
- /** Collection: concurrent bag. */
- public const byte CollectionConcurrentBag = 6;
-
- /** Map: custom. */
- public const byte MapCustom = 0;
-
- /** Map: hash map. */
- public const byte MapHashMap = 1;
-
- /** Map: linked hash map. */
- public const byte MapLinkedHashMap = 2;
-
- /** Map: sorted map. */
- public const byte MapSortedMap = 3;
-
- /** Map: concurrent hash map. */
- public const byte MapConcurrentHashMap = 4;
-
- /** Byte "0". */
- public const byte ByteZero = 0;
-
- /** Byte "1". */
- public const byte ByteOne = 1;
-
- /** Indicates object array. */
- public const int ObjTypeId = -1;
-
- /** Int type. */
- public static readonly Type TypInt = typeof(int);
-
- /** Collection type. */
- public static readonly Type TypCollection = typeof(ICollection);
-
- /** Dictionary type. */
- public static readonly Type TypDictionary = typeof(IDictionary);
-
- /** Generic collection type. */
- public static readonly Type TypGenericCollection = typeof(ICollection<>);
-
- /** Generic dictionary type. */
- public static readonly Type TypGenericDictionary = typeof(IDictionary<,>);
-
- /** Ticks for Java epoch. */
- private static readonly long JavaDateTicks = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc).Ticks;
-
- /** Bindig flags for static search. */
- private static BindingFlags _bindFlagsStatic =
- BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
-
- /** Default poratble marshaller. */
- private static readonly PortableMarshaller Marsh = new PortableMarshaller(null);
-
- /** Method: WriteGenericCollection. */
- public static readonly MethodInfo MtdhWriteGenericCollection =
- typeof(PortableUtils).GetMethod("WriteGenericCollection", _bindFlagsStatic);
-
- /** Method: ReadGenericCollection. */
- public static readonly MethodInfo MtdhReadGenericCollection =
- typeof(PortableUtils).GetMethod("ReadGenericCollection", _bindFlagsStatic);
-
- /** Method: WriteGenericDictionary. */
- public static readonly MethodInfo MtdhWriteGenericDictionary =
- typeof(PortableUtils).GetMethod("WriteGenericDictionary", _bindFlagsStatic);
-
- /** Method: ReadGenericDictionary. */
- public static readonly MethodInfo MtdhReadGenericDictionary =
- typeof(PortableUtils).GetMethod("ReadGenericDictionary", _bindFlagsStatic);
-
- /** Method: ReadGenericArray. */
- public static readonly MethodInfo MtdhReadGenericArray =
- typeof(PortableUtils).GetMethod("ReadGenericArray", _bindFlagsStatic);
-
- /** Cached UTF8 encoding. */
- private static readonly Encoding Utf8 = Encoding.UTF8;
-
- /** Cached generic array read funcs. */
- private static readonly CopyOnWriteConcurrentDictionary<Type, Func<PortableReaderImpl, bool, object>>
- ArrayReaders = new CopyOnWriteConcurrentDictionary<Type, Func<PortableReaderImpl, bool, object>>();
-
- /// <summary>
- /// Default marshaller.
- /// </summary>
- public static PortableMarshaller Marshaller
- {
- get { return Marsh; }
- }
-
- /**
- * <summary>Write boolean array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteBooleanArray(bool[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteBoolArray(vals);
- }
-
- /**
- * <summary>Read boolean array.</summary>
- * <param name="stream">Output stream.</param>
- * <returns>Value.</returns>
- */
- public static bool[] ReadBooleanArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- return stream.ReadBoolArray(len);
- }
-
- /**
- * <summary>Write byte array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- * <returns>Length of written data.</returns>
- */
- public static void WriteByteArray(byte[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteByteArray(vals);
- }
-
- /**
- * <summary>Read byte array.</summary>
- * <param name="stream">Output stream.</param>
- * <returns>Value.</returns>
- */
- public static byte[] ReadByteArray(IPortableStream stream)
- {
- return stream.ReadByteArray(stream.ReadInt());
- }
-
- /**
- * <summary>Read byte array.</summary>
- * <param name="stream">Output stream.</param>
- * <returns>Value.</returns>
- */
- public static unsafe sbyte[] ReadSbyteArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- sbyte[] res = new sbyte[len];
-
- fixed (sbyte* res0 = res)
- {
- stream.Read((byte*) res0, len);
- }
-
- return res;
- }
-
- /**
- * <summary>Read byte array.</summary>
- * <param name="data">Data.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static byte[] ReadByteArray(byte[] data, int pos) {
- int len = ReadInt(data, pos);
-
- pos += 4;
-
- byte[] res = new byte[len];
-
- Buffer.BlockCopy(data, pos, res, 0, len);
-
- return res;
- }
-
- /**
- * <summary>Write short array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteShortArray(short[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteShortArray(vals);
- }
-
- /**
- * <summary>Read short array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static unsafe ushort[] ReadUshortArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- ushort[] res = new ushort[len];
-
- fixed (ushort* res0 = res)
- {
- stream.Read((byte*) res0, len * 2);
- }
-
- return res;
- }
-
- /**
- * <summary>Read short array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static short[] ReadShortArray(IPortableStream stream)
- {
- return stream.ReadShortArray(stream.ReadInt());
- }
-
- /**
- * <summary>Read int value.</summary>
- * <param name="data">Data array.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static int ReadInt(byte[] data, int pos) {
- int val = data[pos];
-
- val |= data[pos + 1] << 8;
- val |= data[pos + 2] << 16;
- val |= data[pos + 3] << 24;
-
- return val;
- }
-
- /**
- * <summary>Read long value.</summary>
- * <param name="data">Data array.</param>
- * <param name="pos">Position.</param>
- * <returns>Value.</returns>
- */
- public static long ReadLong(byte[] data, int pos) {
- long val = (long)(data[pos]) << 0;
-
- val |= (long)(data[pos + 1]) << 8;
- val |= (long)(data[pos + 2]) << 16;
- val |= (long)(data[pos + 3]) << 24;
- val |= (long)(data[pos + 4]) << 32;
- val |= (long)(data[pos + 5]) << 40;
- val |= (long)(data[pos + 6]) << 48;
- val |= (long)(data[pos + 7]) << 56;
-
- return val;
- }
-
- /**
- * <summary>Write int array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteIntArray(int[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteIntArray(vals);
- }
-
- /**
- * <summary>Read int array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static int[] ReadIntArray(IPortableStream stream)
- {
- return stream.ReadIntArray(stream.ReadInt());
- }
-
- /**
- * <summary>Read int array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static unsafe uint[] ReadUintArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- uint[] res = new uint[len];
-
- fixed (uint* res0 = res)
- {
- stream.Read((byte*) res0, len * 4);
- }
-
- return res;
- }
-
- /**
- * <summary>Write long array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteLongArray(long[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteLongArray(vals);
- }
-
- /**
- * <summary>Read long array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static long[] ReadLongArray(IPortableStream stream)
- {
- return stream.ReadLongArray(stream.ReadInt());
- }
-
- /**
- * <summary>Read ulong array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static unsafe ulong[] ReadUlongArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- ulong[] res = new ulong[len];
-
- fixed (ulong* res0 = res)
- {
- stream.Read((byte*) res0, len * 8);
- }
-
- return res;
- }
-
- /**
- * <summary>Write char array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteCharArray(char[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteCharArray(vals);
- }
-
- /**
- * <summary>Read char array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static char[] ReadCharArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- return stream.ReadCharArray(len);
- }
-
- /**
- * <summary>Write float array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteFloatArray(float[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteFloatArray(vals);
- }
-
- /**
- * <summary>Read float array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static float[] ReadFloatArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- return stream.ReadFloatArray(len);
- }
-
- /**
- * <summary>Write double array.</summary>
- * <param name="vals">Value.</param>
- * <param name="stream">Output stream.</param>
- */
- public static void WriteDoubleArray(double[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- stream.WriteDoubleArray(vals);
- }
-
- /**
- * <summary>Read double array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Value.</returns>
- */
- public static double[] ReadDoubleArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- return stream.ReadDoubleArray(len);
- }
-
- /**
- * <summary>Write date.</summary>
- * <param name="val">Date.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteDate(DateTime? val, IPortableStream stream)
- {
- long high;
- int low;
-
- Debug.Assert(val.HasValue);
- ToJavaDate(val.Value, out high, out low);
-
- stream.WriteLong(high);
- stream.WriteInt(low);
- }
-
- /**
- * <summary>Read date.</summary>
- * <param name="stream">Stream.</param>
- * <param name="local">Local flag.</param>
- * <returns>Date</returns>
- */
- public static DateTime? ReadDate(IPortableStream stream, bool local)
- {
- long high = stream.ReadLong();
- int low = stream.ReadInt();
-
- return ToDotNetDate(high, low, local);
- }
-
- /**
- * <summary>Write date array.</summary>
- * <param name="vals">Date array.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteDateArray(DateTime?[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (DateTime? val in vals)
- {
- if (val.HasValue)
- PortableSystemHandlers.WriteHndDateTyped(stream, val);
- else
- stream.WriteByte(HdrNull);
- }
- }
-
- /**
- * <summary>Write string in UTF8 encoding.</summary>
- * <param name="val">String.</param>
- * <param name="stream">Stream.</param>
- */
- public static unsafe void WriteString(string val, IPortableStream stream)
- {
- stream.WriteBool(true);
-
- int charCnt = val.Length;
-
- fixed (char* chars = val)
- {
- int byteCnt = Utf8.GetByteCount(chars, charCnt);
-
- stream.WriteInt(byteCnt);
-
- stream.WriteString(chars, charCnt, byteCnt, Utf8);
- }
- }
-
- /**
- * <summary>Read string in UTF8 encoding.</summary>
- * <param name="stream">Stream.</param>
- * <returns>String.</returns>
- */
- public static string ReadString(IPortableStream stream)
- {
- if (stream.ReadBool())
- {
- byte[] bytes = ReadByteArray(stream);
-
- return bytes != null ? Utf8.GetString(bytes) : null;
- }
-
- char[] chars = ReadCharArray(stream);
-
- return new string(chars);
- }
-
- /**
- * <summary>Write string array in UTF8 encoding.</summary>
- * <param name="vals">String array.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteStringArray(string[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (string val in vals)
- {
- if (val != null)
- PortableSystemHandlers.WriteHndStringTyped(stream, val);
- else
- stream.WriteByte(HdrNull);
- }
- }
-
- /**
- * <summary>Read string array in UTF8 encoding.</summary>
- * <param name="stream">Stream.</param>
- * <returns>String array.</returns>
- */
- public static string[] ReadStringArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- string[] vals = new string[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ReadString(stream);
-
- return vals;
- }
-
- /**
- * <summary>Write decimal value.</summary>
- * <param name="val">Decimal value.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteDecimal(decimal val, IPortableStream stream)
- {
- // Vals are:
- // [0] = lo
- // [1] = mid
- // [2] = high
- // [3] = flags
- int[] vals = decimal.GetBits(val);
-
- // Get start index skipping leading zeros.
- int idx = vals[2] != 0 ? 2 : vals[1] != 0 ? 1 : vals[0] != 0 ? 0 : -1;
-
- // Write scale and negative flag.
- int scale = (vals[3] & 0x00FF0000) >> 16;
-
- stream.WriteInt(((vals[3] & 0x80000000) == 0x80000000) ? (int)((uint)scale | 0x80000000) : scale);
-
- if (idx == -1)
- {
- // Writing zero.
- stream.WriteInt(1);
- stream.WriteByte(0);
- }
- else
- {
- int len = (idx + 1) << 2;
-
- // Write data.
- for (int i = idx; i >= 0; i--)
- {
- int curPart = vals[i];
-
- int part24 = (curPart >> 24) & 0xFF;
- int part16 = (curPart >> 16) & 0xFF;
- int part8 = (curPart >> 8) & 0xFF;
- int part0 = curPart & 0xFF;
-
- if (i == idx)
- {
- // Possibly skipping some values here.
- if (part24 != 0)
- {
- if ((part24 & 0x80) == 0x80)
- {
- stream.WriteInt(len + 1);
-
- stream.WriteByte(ByteZero);
- }
- else
- stream.WriteInt(len);
-
- stream.WriteByte((byte)part24);
- stream.WriteByte((byte)part16);
- stream.WriteByte((byte)part8);
- stream.WriteByte((byte)part0);
- }
- else if (part16 != 0)
- {
- if ((part16 & 0x80) == 0x80)
- {
- stream.WriteInt(len);
-
- stream.WriteByte(ByteZero);
- }
- else
- stream.WriteInt(len - 1);
-
- stream.WriteByte((byte)part16);
- stream.WriteByte((byte)part8);
- stream.WriteByte((byte)part0);
- }
- else if (part8 != 0)
- {
- if ((part8 & 0x80) == 0x80)
- {
- stream.WriteInt(len - 1);
-
- stream.WriteByte(ByteZero);
- }
- else
- stream.WriteInt(len - 2);
-
- stream.WriteByte((byte)part8);
- stream.WriteByte((byte)part0);
- }
- else
- {
- if ((part0 & 0x80) == 0x80)
- {
- stream.WriteInt(len - 2);
-
- stream.WriteByte(ByteZero);
- }
- else
- stream.WriteInt(len - 3);
-
- stream.WriteByte((byte)part0);
- }
- }
- else
- {
- stream.WriteByte((byte)part24);
- stream.WriteByte((byte)part16);
- stream.WriteByte((byte)part8);
- stream.WriteByte((byte)part0);
- }
- }
- }
- }
-
- /**
- * <summary>Read decimal value.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Decimal value.</returns>
- */
- public static decimal ReadDecimal(IPortableStream stream)
- {
- int scale = stream.ReadInt();
-
- bool neg;
-
- if (scale < 0)
- {
- scale = scale & 0x7FFFFFFF;
-
- neg = true;
- }
- else
- neg = false;
-
- byte[] mag = ReadByteArray(stream);
-
- if (scale < 0 || scale > 28)
- throw new PortableException("Decimal value scale overflow (must be between 0 and 28): " + scale);
-
- if (mag.Length > 13)
- throw new PortableException("Decimal magnitude overflow (must be less than 96 bits): " +
- mag.Length * 8);
-
- if (mag.Length == 13 && mag[0] != 0)
- throw new PortableException("Decimal magnitude overflow (must be less than 96 bits): " +
- mag.Length * 8);
-
- int hi = 0;
- int mid = 0;
- int lo = 0;
-
- int ctr = -1;
-
- for (int i = mag.Length - 12; i < mag.Length; i++)
- {
- if (++ctr == 4)
- {
- mid = lo;
- lo = 0;
- }
- else if (ctr == 8)
- {
- hi = mid;
- mid = lo;
- lo = 0;
- }
-
- if (i >= 0)
- lo = (lo << 8) + mag[i];
- }
-
- return new decimal(lo, mid, hi, neg, (byte)scale);
- }
-
- /**
- * <summary>Write decimal array.</summary>
- * <param name="vals">Decimal array.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteDecimalArray(decimal[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (decimal val in vals)
- WriteDecimal(val, stream);
- }
-
- /**
- * <summary>Read decimal array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>Decimal array.</returns>
- */
- public static decimal[] ReadDecimalArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- decimal[] vals = new decimal[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ReadDecimal(stream);
-
- return vals;
- }
-
- /**
- * <summary>Write GUID.</summary>
- * <param name="val">GUID.</param>
- * <param name="stream">Stream.</param>
- */
- public static unsafe void WriteGuid(Guid? val, IPortableStream stream)
- {
- Debug.Assert(val.HasValue);
- byte[] bytes = val.Value.ToByteArray();
-
- // .Net returns bytes in the following order: _a(4), _b(2), _c(2), _d, _e, _g, _h, _i, _j, _k.
- // And _a, _b and _c are always in little endian format irrespective of system configuration.
- // To be compliant with Java we rearrange them as follows: _c, _b_, a_, _k, _j, _i, _h, _g, _e, _d.
- fixed (byte* bytes0 = bytes)
- {
- stream.Write(bytes0 + 6, 2); // _c
- stream.Write(bytes0 + 4, 2); // _a
- stream.Write(bytes0, 4); // _a
- }
-
- stream.WriteByte(bytes[15]); // _k
- stream.WriteByte(bytes[14]); // _j
- stream.WriteByte(bytes[13]); // _i
- stream.WriteByte(bytes[12]); // _h
-
- stream.WriteByte(bytes[11]); // _g
- stream.WriteByte(bytes[10]); // _f
- stream.WriteByte(bytes[9]); // _e
- stream.WriteByte(bytes[8]); // _d
- }
-
- /**
- * <summary>Read GUID.</summary>
- * <param name="stream">Stream.</param>
- * <returns>GUID</returns>
- */
- public static unsafe Guid? ReadGuid(IPortableStream stream)
- {
- byte[] bytes = new byte[16];
-
- // Perform conversion opposite to what write does.
- fixed (byte* bytes0 = bytes)
- {
- stream.Read(bytes0 + 6, 2); // _c
- stream.Read(bytes0 + 4, 2); // _b
- stream.Read(bytes0, 4); // _a
- }
-
- bytes[15] = stream.ReadByte(); // _k
- bytes[14] = stream.ReadByte(); // _j
- bytes[13] = stream.ReadByte(); // _i
- bytes[12] = stream.ReadByte(); // _h
-
- bytes[11] = stream.ReadByte(); // _g
- bytes[10] = stream.ReadByte(); // _f
- bytes[9] = stream.ReadByte(); // _e
- bytes[8] = stream.ReadByte(); // _d
-
- return new Guid(bytes);
- }
-
- /**
- * <summary>Read GUID.</summary>
- * <param name="data">Data array.</param>
- * <param name="pos">Position.</param>
- * <returns>GUID</returns>
- */
- public static Guid ReadGuid(byte[] data, int pos) {
- byte[] bytes = new byte[16];
-
- // Perform conversion opposite to what write does.
- bytes[6] = data[pos]; // _c
- bytes[7] = data[pos + 1];
-
- bytes[4] = data[pos + 2]; // _b
- bytes[5] = data[pos + 3];
-
- bytes[0] = data[pos + 4]; // _a
- bytes[1] = data[pos + 5];
- bytes[2] = data[pos + 6];
- bytes[3] = data[pos + 7];
-
- bytes[15] = data[pos + 8]; // _k
- bytes[14] = data[pos + 9]; // _j
- bytes[13] = data[pos + 10]; // _i
- bytes[12] = data[pos + 11]; // _h
-
- bytes[11] = data[pos + 12]; // _g
- bytes[10] = data[pos + 13]; // _f
- bytes[9] = data[pos + 14]; // _e
- bytes[8] = data[pos + 15]; // _d
-
- return new Guid(bytes);
- }
-
- /**
- * <summary>Write GUID array.</summary>
- * <param name="vals">GUID array.</param>
- * <param name="stream">Stream.</param>
- */
- public static void WriteGuidArray(Guid?[] vals, IPortableStream stream)
- {
- stream.WriteInt(vals.Length);
-
- foreach (Guid? val in vals)
- {
- if (val.HasValue)
- PortableSystemHandlers.WriteHndGuidTyped(stream, val);
- else
- stream.WriteByte(HdrNull);
- }
- }
-
- /**
- * <summary>Read GUID array.</summary>
- * <param name="stream">Stream.</param>
- * <returns>GUID array.</returns>
- */
- public static Guid?[] ReadGuidArray(IPortableStream stream)
- {
- int len = stream.ReadInt();
-
- Guid?[] vals = new Guid?[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ReadGuid(stream);
-
- return vals;
- }
-
- /// <summary>
- /// Write array.
- /// </summary>
- /// <param name="val">Array.</param>
- /// <param name="ctx">Write context.</param>
- /// <param name="typed">Typed flag.</param>
- public static void WriteArray(Array val, PortableWriterImpl ctx, bool typed)
- {
- IPortableStream stream = ctx.Stream;
-
- if (typed)
- stream.WriteInt(ObjTypeId);
-
- stream.WriteInt(val.Length);
-
- for (int i = 0; i < val.Length; i++)
- ctx.Write(val.GetValue(i));
- }
-
- /// <summary>
- /// Read array.
- /// </summary>
- /// <param name="ctx">Read context.</param>
- /// <param name="typed">Typed flag.</param>
- /// <param name="elementType">Type of the element.</param>
- /// <returns>Array.</returns>
- public static object ReadArray(PortableReaderImpl ctx, bool typed, Type elementType)
- {
- Func<PortableReaderImpl, bool, object> result;
-
- if (!ArrayReaders.TryGetValue(elementType, out result))
- result = ArrayReaders.GetOrAdd(elementType, t =>
- DelegateConverter.CompileFunc<Func<PortableReaderImpl, bool, object>>(null,
- MtdhReadGenericArray.MakeGenericMethod(t),
- new[] {typeof (PortableReaderImpl), typeof (bool)}, new[] {false, false, true}));
-
- return result(ctx, typed);
- }
-
- /// <summary>
- /// Read array.
- /// </summary>
- /// <param name="ctx">Read context.</param>
- /// <param name="typed">Typed flag.</param>
- /// <returns>Array.</returns>
- public static T[] ReadGenericArray<T>(PortableReaderImpl ctx, bool typed)
- {
- IPortableStream stream = ctx.Stream;
-
- if (typed)
- stream.ReadInt();
-
- int len = stream.ReadInt();
-
- var vals = new T[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = ctx.Deserialize<T>();
-
- return vals;
- }
-
- /**
- * <summary>Read DateTime array.</summary>
- * <param name="stream">Stream.</param>
- * <param name="local">Local flag.</param>
- * <returns>Array.</returns>
- */
- public static DateTime?[] ReadDateArray(IPortableStream stream, bool local)
- {
- int len = stream.ReadInt();
-
- DateTime?[] vals = new DateTime?[len];
-
- for (int i = 0; i < len; i++)
- vals[i] = stream.ReadByte() == HdrNull ? null : ReadDate(stream, local);
-
- return vals;
- }
-
- /**
- * <summary>Write collection.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- */
- public static void WriteCollection(ICollection val, PortableWriterImpl ctx)
- {
- byte colType = val.GetType() == typeof(ArrayList) ? CollectionArrayList : CollectionCustom;
-
- WriteTypedCollection(val, ctx, colType);
- }
-
- /**
- * <summary>Write non-null collection with known type.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- * <param name="colType">Collection type.</param>
- */
- public static void WriteTypedCollection(ICollection val, PortableWriterImpl ctx, byte colType)
- {
- ctx.Stream.WriteInt(val.Count);
-
- ctx.Stream.WriteByte(colType);
-
- foreach (object elem in val)
- ctx.Write(elem);
- }
-
- /**
- * <summary>Read collection.</summary>
- * <param name="ctx">Context.</param>
- * <param name="factory">Factory delegate.</param>
- * <param name="adder">Adder delegate.</param>
- * <returns>Collection.</returns>
- */
- public static ICollection ReadCollection(PortableReaderImpl ctx,
- PortableCollectionFactory factory, PortableCollectionAdder adder)
- {
- if (factory == null)
- factory = PortableSystemHandlers.CreateArrayList;
-
- if (adder == null)
- adder = PortableSystemHandlers.AddToArrayList;
-
- IPortableStream stream = ctx.Stream;
-
- int len = stream.ReadInt();
-
- ctx.Stream.Seek(1, SeekOrigin.Current);
-
- ICollection res = factory.Invoke(len);
-
- for (int i = 0; i < len; i++)
- adder.Invoke(res, ctx.Deserialize<object>());
-
- return res;
- }
-
- /**
- * <summary>Write generic collection.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- */
- public static void WriteGenericCollection<T>(ICollection<T> val, PortableWriterImpl ctx)
- {
- Type type = val.GetType().GetGenericTypeDefinition();
-
- byte colType;
-
- if (type == typeof(List<>))
- colType = CollectionArrayList;
- else if (type == typeof(LinkedList<>))
- colType = CollectionLinkedList;
- else if (type == typeof(HashSet<>))
- colType = CollectionHashSet;
- else if (type == typeof(SortedSet<>))
- colType = CollectionSortedSet;
- else
- colType = CollectionCustom;
-
- WriteTypedGenericCollection(val, ctx, colType);
- }
-
- /**
- * <summary>Write generic non-null collection with known type.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- * <param name="colType">Collection type.</param>
- */
- public static void WriteTypedGenericCollection<T>(ICollection<T> val, PortableWriterImpl ctx,
- byte colType)
- {
- ctx.Stream.WriteInt(val.Count);
-
- ctx.Stream.WriteByte(colType);
-
- foreach (T elem in val)
- ctx.Write(elem);
- }
-
- /**
- * <summary>Read generic collection.</summary>
- * <param name="ctx">Context.</param>
- * <param name="factory">Factory delegate.</param>
- * <returns>Collection.</returns>
- */
- public static ICollection<T> ReadGenericCollection<T>(PortableReaderImpl ctx,
- PortableGenericCollectionFactory<T> factory)
- {
- int len = ctx.Stream.ReadInt();
-
- if (len >= 0)
- {
- byte colType = ctx.Stream.ReadByte();
-
- if (factory == null)
- {
- // Need to detect factory automatically.
- if (colType == CollectionLinkedList)
- factory = PortableSystemHandlers.CreateLinkedList<T>;
- else if (colType == CollectionHashSet)
- factory = PortableSystemHandlers.CreateHashSet<T>;
- else if (colType == CollectionSortedSet)
- factory = PortableSystemHandlers.CreateSortedSet<T>;
- else
- factory = PortableSystemHandlers.CreateList<T>;
- }
-
- ICollection<T> res = factory.Invoke(len);
-
- for (int i = 0; i < len; i++)
- res.Add(ctx.Deserialize<T>());
-
- return res;
- }
- return null;
- }
-
- /**
- * <summary>Write dictionary.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- */
- public static void WriteDictionary(IDictionary val, PortableWriterImpl ctx)
- {
- byte dictType = val.GetType() == typeof(Hashtable) ? MapHashMap : MapCustom;
-
- WriteTypedDictionary(val, ctx, dictType);
- }
-
- /**
- * <summary>Write non-null dictionary with known type.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- * <param name="dictType">Dictionary type.</param>
- */
- public static void WriteTypedDictionary(IDictionary val, PortableWriterImpl ctx, byte dictType)
- {
- ctx.Stream.WriteInt(val.Count);
-
- ctx.Stream.WriteByte(dictType);
-
- foreach (DictionaryEntry entry in val)
- {
- ctx.Write(entry.Key);
- ctx.Write(entry.Value);
- }
- }
-
- /**
- * <summary>Read dictionary.</summary>
- * <param name="ctx">Context.</param>
- * <param name="factory">Factory delegate.</param>
- * <returns>Dictionary.</returns>
- */
- public static IDictionary ReadDictionary(PortableReaderImpl ctx,
- PortableDictionaryFactory factory)
- {
- if (factory == null)
- factory = PortableSystemHandlers.CreateHashtable;
-
- IPortableStream stream = ctx.Stream;
-
- int len = stream.ReadInt();
-
- ctx.Stream.Seek(1, SeekOrigin.Current);
-
- IDictionary res = factory.Invoke(len);
-
- for (int i = 0; i < len; i++)
- {
- object key = ctx.Deserialize<object>();
- object val = ctx.Deserialize<object>();
-
- res[key] = val;
- }
-
- return res;
- }
-
- /**
- * <summary>Write generic dictionary.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- */
- public static void WriteGenericDictionary<TK, TV>(IDictionary<TK, TV> val, PortableWriterImpl ctx)
- {
- Type type = val.GetType().GetGenericTypeDefinition();
-
- byte dictType;
-
- if (type == typeof(Dictionary<,>))
- dictType = MapHashMap;
- else if (type == typeof(SortedDictionary<,>))
- dictType = MapSortedMap;
- else if (type == typeof(ConcurrentDictionary<,>))
- dictType = MapConcurrentHashMap;
- else
- dictType = MapCustom;
-
- WriteTypedGenericDictionary(val, ctx, dictType);
- }
-
- /**
- * <summary>Write generic non-null dictionary with known type.</summary>
- * <param name="val">Value.</param>
- * <param name="ctx">Write context.</param>
- * <param name="dictType">Dictionary type.</param>
- */
- public static void WriteTypedGenericDictionary<TK, TV>(IDictionary<TK, TV> val,
- PortableWriterImpl ctx, byte dictType)
- {
- ctx.Stream.WriteInt(val.Count);
-
- ctx.Stream.WriteByte(dictType);
-
- foreach (KeyValuePair<TK, TV> entry in val)
- {
- ctx.Write(entry.Key);
- ctx.Write(entry.Value);
- }
- }
-
- /**
- * <summary>Read generic dictionary.</summary>
- * <param name="ctx">Context.</param>
- * <param name="factory">Factory delegate.</param>
- * <returns>Collection.</returns>
- */
- public static IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(PortableReaderImpl ctx,
- PortableGenericDictionaryFactory<TK, TV> factory)
- {
- int len = ctx.Stream.ReadInt();
-
- if (len >= 0)
- {
- byte colType = ctx.Stream.ReadByte();
-
- if (factory == null)
- {
- if (colType == MapSortedMap)
- factory = PortableSystemHandlers.CreateSortedDictionary<TK, TV>;
- else if (colType == MapConcurrentHashMap)
- factory = PortableSystemHandlers.CreateConcurrentDictionary<TK, TV>;
- else
- factory = PortableSystemHandlers.CreateDictionary<TK, TV>;
- }
-
- IDictionary<TK, TV> res = factory.Invoke(len);
-
- for (int i = 0; i < len; i++)
- {
- TK key = ctx.Deserialize<TK>();
- TV val = ctx.Deserialize<TV>();
-
- res[key] = val;
- }
-
- return res;
- }
- return null;
- }
-
- /**
- * <summary>Write map entry.</summary>
- * <param name="ctx">Write context.</param>
- * <param name="val">Value.</param>
- */
- public static void WriteMapEntry(PortableWriterImpl ctx, DictionaryEntry val)
- {
- ctx.Write(val.Key);
- ctx.Write(val.Value);
- }
-
- /**
- * <summary>Read map entry.</summary>
- * <param name="ctx">Context.</param>
- * <returns>Map entry.</returns>
- */
- public static DictionaryEntry ReadMapEntry(PortableReaderImpl ctx)
- {
- object key = ctx.Deserialize<object>();
- object val = ctx.Deserialize<object>();
-
- return new DictionaryEntry(key, val);
- }
-
- /**
- * <summary>Write portable object.</summary>
- * <param name="stream">Stream.</param>
- * <param name="val">Value.</param>
- */
- public static void WritePortable(IPortableStream stream, PortableUserObject val)
- {
- WriteByteArray(val.Data, stream);
-
- stream.WriteInt(val.Offset);
- }
-
- /// <summary>
- /// Write enum.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="val">Value.</param>
- public static void WriteEnum(IPortableStream stream, Enum val)
- {
- if (Enum.GetUnderlyingType(val.GetType()) == TypInt)
- {
- stream.WriteInt(ObjTypeId);
- stream.WriteInt(Convert.ToInt32(val));
- }
- else
- throw new PortableException("Only Int32 underlying type is supported for enums: " +
- val.GetType().Name);
- }
-
- /// <summary>
- /// Read enum.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Enumeration.</returns>
- public static T ReadEnum<T>(IPortableStream stream)
- {
- if (!typeof(T).IsEnum || Enum.GetUnderlyingType(typeof(T)) == TypInt)
- {
- stream.ReadInt();
-
- return TypeCaster<T>.Cast(stream.ReadInt());
- }
-
- throw new PortableException("Only Int32 underlying type is supported for enums: " +
- typeof (T).Name);
- }
-
- /**
- * <summary>Gets type key.</summary>
- * <param name="userType">User type flag.</param>
- * <param name="typeId">Type ID.</param>
- * <returns>Type key.</returns>
- */
- public static long TypeKey(bool userType, int typeId)
- {
- long res = typeId;
-
- if (userType)
- res |= (long)1 << 32;
-
- return res;
- }
-
- /**
- * <summary>Get string hash code.</summary>
- * <param name="val">Value.</param>
- * <returns>Hash code.</returns>
- */
- public static int StringHashCode(string val)
- {
- if (val == null)
- return 0;
- int hash = 0;
-
- for (int i = 0; i < val.Length; i++)
- {
- char c = val[i];
-
- if ('A' <= c && c <= 'Z')
- c = (char)(c | 0x20);
-
- hash = 31 * hash + c;
- }
-
- return hash;
- }
-
- public static string CleanFieldName(string fieldName)
- {
- if (fieldName.StartsWith("<") && fieldName.EndsWith(">k__BackingField"))
- return fieldName.Substring(1, fieldName.IndexOf(">", StringComparison.Ordinal) - 1);
-
- return fieldName;
- }
-
- /**
- * <summary>Check whether this is predefined type.</summary>
- * <param name="hdr">Header.</param>
- * <returns>True is this is one of predefined types with special semantics.</returns>
- */
- public static bool IsPredefinedType(byte hdr)
- {
- switch (hdr)
- {
- case TypeByte:
- case TypeShort:
- case TypeInt:
- case TypeLong:
- case TypeFloat:
- case TypeDouble:
- case TypeChar:
- case TypeBool:
- case TypeDecimal:
- case TypeString:
- case TypeGuid:
- case TypeDate:
- case TypeEnum:
- case TypeArrayByte:
- case TypeArrayShort:
- case TypeArrayInt:
- case TypeArrayLong:
- case TypeArrayFloat:
- case TypeArrayDouble:
- case TypeArrayChar:
- case TypeArrayBool:
- case TypeArrayDecimal:
- case TypeArrayString:
- case TypeArrayGuid:
- case TypeArrayDate:
- case TypeArrayEnum:
- case TypeArray:
- case TypeCollection:
- case TypeDictionary:
- case TypeMapEntry:
- case TypePortable:
- return true;
- default:
- return false;
- }
- }
-
- /**
- * <summary>Convert type name.</summary>
- * <param name="typeName">Type name.</param>
- * <param name="converter">Converter.</param>
- * <returns>Converted name.</returns>
- */
- public static string ConvertTypeName(string typeName, IPortableNameMapper converter)
- {
- var typeName0 = typeName;
-
- try
- {
- if (converter != null)
- typeName = converter.GetTypeName(typeName);
- }
- catch (Exception e)
- {
- throw new PortableException("Failed to convert type name due to converter exception " +
- "[typeName=" + typeName + ", converter=" + converter + ']', e);
- }
-
- if (typeName == null)
- throw new PortableException("Name converter returned null name for type [typeName=" +
- typeName0 + ", converter=" + converter + "]");
-
- return typeName;
- }
-
- /**
- * <summary>Convert field name.</summary>
- * <param name="fieldName">Field name.</param>
- * <param name="converter">Converter.</param>
- * <returns>Converted name.</returns>
- */
- public static string ConvertFieldName(string fieldName, IPortableNameMapper converter)
- {
- var fieldName0 = fieldName;
-
- try
- {
- if (converter != null)
- fieldName = converter.GetFieldName(fieldName);
- }
- catch (Exception e)
- {
- throw new PortableException("Failed to convert field name due to converter exception " +
- "[fieldName=" + fieldName + ", converter=" + converter + ']', e);
- }
-
- if (fieldName == null)
- throw new PortableException("Name converter returned null name for field [fieldName=" +
- fieldName0 + ", converter=" + converter + "]");
-
- return fieldName;
- }
-
- /**
- * <summary>Extract simple type name.</summary>
- * <param name="typeName">Type name.</param>
- * <returns>Simple type name.</returns>
- */
- public static string SimpleTypeName(string typeName)
- {
- int idx = typeName.LastIndexOf('.');
-
- return idx < 0 ? typeName : typeName.Substring(idx + 1);
- }
-
- /**
- * <summary>Resolve type ID.</summary>
- * <param name="typeName">Type name.</param>
- * <param name="nameMapper">Name mapper.</param>
- * <param name="idMapper">ID mapper.</param>
- */
- public static int TypeId(string typeName, IPortableNameMapper nameMapper,
- IPortableIdMapper idMapper)
- {
- Debug.Assert(typeName != null);
-
- typeName = ConvertTypeName(typeName, nameMapper);
-
- int id = 0;
-
- if (idMapper != null)
- {
- try
- {
- id = idMapper.GetTypeId(typeName);
- }
- catch (Exception e)
- {
- throw new PortableException("Failed to resolve type ID due to ID mapper exception " +
- "[typeName=" + typeName + ", idMapper=" + idMapper + ']', e);
- }
- }
-
- if (id == 0)
- id = StringHashCode(typeName);
-
- return id;
- }
-
- /**
- * <summary>Resolve field ID.</summary>
- * <param name="typeId">Type ID.</param>
- * <param name="fieldName">Field name.</param>
- * <param name="nameMapper">Name mapper.</param>
- * <param name="idMapper">ID mapper.</param>
- */
- public static int FieldId(int typeId, string fieldName, IPortableNameMapper nameMapper,
- IPortableIdMapper idMapper)
- {
- Debug.Assert(typeId != 0);
- Debug.Assert(fieldName != null);
-
- fieldName = ConvertFieldName(fieldName, nameMapper);
-
- int id = 0;
-
- if (idMapper != null)
- {
- try
- {
- id = idMapper.GetFieldId(typeId, fieldName);
- }
- catch (Exception e)
- {
- throw new PortableException("Failed to resolve field ID due to ID mapper exception " +
- "[typeId=" + typeId + ", fieldName=" + fieldName + ", idMapper=" + idMapper + ']', e);
- }
- }
-
- if (id == 0)
- id = StringHashCode(fieldName);
-
- return id;
- }
-
- /**
- * <summary>Get fields map for the given object.</summary>
- * <param name="stream">Stream.</param>
- * <param name="typeId">Type ID.</param>
- * <param name="rawDataOffset">Raw data offset.</param>
- * <returns>Dictionary with field ID as key and field position as value.</returns>
- */
- public static IDictionary<int, int> ObjectFields(IPortableStream stream, int typeId, int rawDataOffset)
- {
- int endPos = stream.Position + rawDataOffset - 18;
-
- // First loop detects amount of fields in the object.
- int retPos = stream.Position;
- int cnt = 0;
-
- while (stream.Position < endPos)
- {
- cnt++;
-
- stream.Seek(4, SeekOrigin.Current);
- int len = stream.ReadInt();
-
- stream.Seek(stream.Position + len, SeekOrigin.Begin);
- }
-
- if (cnt == 0)
- return EmptyFields;
-
- stream.Seek(retPos, SeekOrigin.Begin);
-
- IDictionary<int, int> fields = new Dictionary<int, int>(cnt);
-
- // Second loop populates fields.
- while (stream.Position < endPos)
- {
- int id = stream.ReadInt();
- int len = stream.ReadInt();
-
- if (fields.ContainsKey(id))
- throw new PortableException("Object contains duplicate field IDs [typeId=" +
- typeId + ", fieldId=" + id + ']');
-
- fields[id] = stream.Position; // Add field ID and length.
-
- stream.Seek(stream.Position + len, SeekOrigin.Begin);
- }
-
- return fields;
- }
-
- /// <summary>
- /// Compare contents of two byte array chunks.
- /// </summary>
- /// <param name="arr1">Array 1.</param>
- /// <param name="offset1">Offset 1.</param>
- /// <param name="len1">Length 1.</param>
- /// <param name="arr2">Array 2.</param>
- /// <param name="offset2">Offset 2.</param>
- /// <param name="len2">Length 2.</param>
- /// <returns>True if array chunks are equal.</returns>
- public static bool CompareArrays(byte[] arr1, int offset1, int len1, byte[] arr2, int offset2, int len2)
- {
- if (len1 == len2)
- {
- for (int i = 0; i < len1; i++)
- {
- if (arr1[offset1 + i] != arr2[offset2 + i])
- return false;
- }
-
- return true;
- }
- return false;
- }
-
- /// <summary>
- /// Write object which is not necessary portable.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="obj">Object.</param>
- public static void WritePortableOrSerializable<T>(PortableWriterImpl writer, T obj)
- {
- if (writer.IsPortable(obj))
- {
- writer.WriteBoolean(true);
-
- writer.WriteObject(obj);
- }
- else
- {
- writer.WriteBoolean(false);
-
- WriteSerializable(writer, obj);
- }
- }
-
- /// <summary>
- /// Writes a serializable object.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="obj">Object.</param>
- public static void WriteSerializable<T>(PortableWriterImpl writer, T obj)
- {
- new BinaryFormatter().Serialize(new PortableStreamAdapter(writer.Stream), obj);
- }
-
- /// <summary>
- /// Read object which is not necessary portable.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Object.</returns>
- public static T ReadPortableOrSerializable<T>(PortableReaderImpl reader)
- {
- return reader.ReadBoolean()
- ? reader.ReadObject<T>()
- : ReadSerializable<T>(reader);
- }
-
- /// <summary>
- /// Reads a serializable object.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Object.</returns>
- public static T ReadSerializable<T>(PortableReaderImpl reader)
- {
- return (T) new BinaryFormatter().Deserialize(new PortableStreamAdapter(reader.Stream), null);
- }
-
- /// <summary>
- /// Writes wrapped invocation result.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="success">Success flag.</param>
- /// <param name="res">Result.</param>
- public static void WriteWrappedInvocationResult(PortableWriterImpl writer, bool success, object res)
- {
- var pos = writer.Stream.Position;
-
- try
- {
- if (success)
- writer.WriteBoolean(true);
- else
- {
- writer.WriteBoolean(false); // Call failed.
- writer.WriteBoolean(true); // Exception serialized sucessfully.
- }
-
- writer.Write(new PortableResultWrapper(res));
- }
- catch (Exception marshErr)
- {
- // Failed to serialize result, fallback to plain string.
- writer.Stream.Seek(pos, SeekOrigin.Begin);
-
- writer.WriteBoolean(false); // Call failed.
- writer.WriteBoolean(false); // Cannot serialize result or exception.
-
- if (success)
- {
- writer.WriteString("Call completed successfully, but result serialization failed [resultType=" +
- res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']');
- }
- else
- {
- writer.WriteString("Call completed with error, but error serialization failed [errType=" +
- res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']');
- }
- }
- }
- /// <summary>
- /// Writes invocation result.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="success">Success flag.</param>
- /// <param name="res">Result.</param>
- public static void WriteInvocationResult(PortableWriterImpl writer, bool success, object res)
- {
- var pos = writer.Stream.Position;
-
- try
- {
- if (success)
- writer.WriteBoolean(true);
- else
- {
- writer.WriteBoolean(false); // Call failed.
- writer.WriteBoolean(true); // Exception serialized sucessfully.
- }
-
- writer.Write(res);
- }
- catch (Exception marshErr)
- {
- // Failed to serialize result, fallback to plain string.
- writer.Stream.Seek(pos, SeekOrigin.Begin);
-
- writer.WriteBoolean(false); // Call failed.
- writer.WriteBoolean(false); // Cannot serialize result or exception.
-
- if (success)
- {
- writer.WriteString("Call completed successfully, but result serialization failed [resultType=" +
- res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']');
- }
- else
- {
- writer.WriteString("Call completed with error, but error serialization failed [errType=" +
- res.GetType().Name + ", serializationErrMsg=" + marshErr.Message + ']');
- }
- }
- }
-
- /// <summary>
- /// Reads wrapped invocation result.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <param name="err">Error.</param>
- /// <returns>Result.</returns>
- public static object ReadWrappedInvocationResult(PortableReaderImpl reader, out object err)
- {
- err = null;
-
- if (reader.ReadBoolean())
- return reader.ReadObject<PortableResultWrapper>().Result;
-
- if (reader.ReadBoolean())
- err = (Exception) reader.ReadObject<PortableResultWrapper>().Result;
- else
- err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString());
-
- return null;
- }
-
- /// <summary>
- /// Reads invocation result.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <param name="err">Error.</param>
- /// <returns>Result.</returns>
- public static object ReadInvocationResult(PortableReaderImpl reader, out object err)
- {
- err = null;
-
- if (reader.ReadBoolean())
- return reader.ReadObject<object>();
-
- if (reader.ReadBoolean())
- err = reader.ReadObject<object>();
- else
- err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString());
-
- return null;
- }
-
- /**
- * <summary>Convert date to Java ticks.</summary>
- * <param name="date">Date</param>
- * <param name="high">High part (milliseconds).</param>
- * <param name="low">Low part (nanoseconds)</param>
- */
- private static void ToJavaDate(DateTime date, out long high, out int low)
- {
- long diff = date.ToUniversalTime().Ticks - JavaDateTicks;
-
- high = diff / TimeSpan.TicksPerMillisecond;
-
- low = (int)(diff % TimeSpan.TicksPerMillisecond) * 100;
- }
-
- /**
- * <summary>Convert Java ticks to date.</summary>
- * <param name="high">High part (milliseconds).</param>
- * <param name="low">Low part (nanoseconds).</param>
- * <param name="local">Whether the time should be treaten as local.</param>
- * <returns>Date.</returns>
- */
- private static DateTime ToDotNetDate(long high, int low, bool local)
- {
- DateTime res =
- new DateTime(JavaDateTicks + high * TimeSpan.TicksPerMillisecond + low / 100, DateTimeKind.Utc);
-
- return local ? res.ToLocalTime() : res;
- }
-
- /// <summary>
- /// Read additional configuration from the stream.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <param name="assemblies">Assemblies.</param>
- /// <param name="cfg">Portable configuration.</param>
- public static void ReadConfiguration(PortableReaderImpl reader, out ICollection<string> assemblies, out PortableConfiguration cfg)
- {
- if (reader.ReadBoolean())
- {
- int assemblyCnt = reader.ReadInt();
-
- assemblies = new List<string>(assemblyCnt);
-
- for (int i = 0; i < assemblyCnt; i++)
- assemblies.Add(reader.ReadObject<string>());
- }
- else
- assemblies = null;
-
- if (reader.ReadBoolean())
- {
- cfg = new PortableConfiguration();
-
- // Read portable types in full form.
- if (reader.ReadBoolean())
- {
- int typesCnt = reader.ReadInt();
-
- cfg.TypeConfigurations = new List<PortableTypeConfiguration>();
-
- for (int i = 0; i < typesCnt; i++)
- {
- PortableTypeConfiguration typCfg = new PortableTypeConfiguration();
-
- typCfg.AssemblyName = reader.ReadString();
- typCfg.TypeName = reader.ReadString();
- typCfg.NameMapper = (IPortableNameMapper)CreateInstance(reader.ReadString());
- typCfg.IdMapper = (IPortableIdMapper)CreateInstance(reader.ReadString());
- typCfg.Serializer = (IPortableSerializer)CreateInstance(reader.ReadString());
- typCfg.AffinityKeyFieldName = reader.ReadString();
- typCfg.MetadataEnabled = reader.ReadObject<bool?>();
- typCfg.KeepDeserialized = reader.ReadObject<bool?>();
-
- cfg.TypeConfigurations.Add(typCfg);
- }
- }
-
- // Read portable types in compact form.
- if (reader.ReadBoolean())
- {
- int typesCnt = reader.ReadInt();
-
- cfg.Types = new List<string>(typesCnt);
-
- for (int i = 0; i < typesCnt; i++)
- cfg.Types.Add(reader.ReadString());
- }
-
- // Read the rest.
- cfg.DefaultNameMapper = (IPortableNameMapper)CreateInstance(reader.ReadString());
- cfg.DefaultIdMapper = (IPortableIdMapper)CreateInstance(reader.ReadString());
- cfg.DefaultSerializer = (IPortableSerializer)CreateInstance(reader.ReadString());
- cfg.DefaultMetadataEnabled = reader.ReadBoolean();
- cfg.DefaultKeepDeserialized = reader.ReadBoolean();
- }
- else
- cfg = null;
- }
-
- /// <summary>
- /// Create new instance of specified class.
- /// </summary>
- /// <param name="typeName">Name of the type.</param>
- /// <returns>New Instance.</returns>
- public static object CreateInstance(string typeName)
- {
- if (typeName == null)
- return null;
-
- foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies())
- {
- object instance = assembly.CreateInstance(typeName);
-
- if (instance != null)
- return instance;
- }
-
- throw new PortableException("Failed to find class: " + typeName);
- }
- }
-}
[24/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
deleted file mode 100644
index 265fd0d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteUtils.cs
+++ /dev/null
@@ -1,438 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.Text;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Native utility methods.
- /// </summary>
- internal static class IgniteUtils
- {
- /** Environment variable: JAVA_HOME. */
- private const string EnvJavaHome = "JAVA_HOME";
-
- /** Directory: jre. */
- private const string DirJre = "jre";
-
- /** Directory: bin. */
- private const string DirBin = "bin";
-
- /** Directory: server. */
- private const string DirServer = "server";
-
- /** File: jvm.dll. */
- private const string FileJvmDll = "jvm.dll";
-
- /** File: Ignite.Common.dll. */
- internal const string FileIgniteJniDll = "ignite.common.dll";
-
- /** Prefix for temp directory names. */
- private const string DirIgniteTmp = "Ignite_";
-
- /** Loaded. */
- private static bool _loaded;
-
- /** Thread-local random. */
- [ThreadStatic]
- private static Random _rnd;
-
- /// <summary>
- /// Initializes the <see cref="IgniteUtils"/> class.
- /// </summary>
- static IgniteUtils()
- {
- TryCleanTempDirectories();
- }
-
- /// <summary>
- /// Gets thread local random.
- /// </summary>
- /// <returns>Thread local random.</returns>
- public static Random ThreadLocalRandom()
- {
- if (_rnd == null)
- _rnd = new Random();
-
- return _rnd;
- }
-
- /// <summary>
- /// Returns shuffled list copy.
- /// </summary>
- /// <returns>Shuffled list copy.</returns>
- public static IList<T> Shuffle<T>(IList<T> list)
- {
- int cnt = list.Count;
-
- if (cnt > 1) {
- List<T> res = new List<T>(list);
-
- Random rnd = ThreadLocalRandom();
-
- while (cnt > 1)
- {
- cnt--;
-
- int idx = rnd.Next(cnt + 1);
-
- T val = res[idx];
- res[idx] = res[cnt];
- res[cnt] = val;
- }
-
- return res;
- }
- return list;
- }
-
- /// <summary>
- /// Load JVM DLL if needed.
- /// </summary>
- /// <param name="configJvmDllPath">JVM DLL path from config.</param>
- public static void LoadDlls(string configJvmDllPath)
- {
- if (_loaded) return;
-
- // 1. Load JNI dll.
- LoadJvmDll(configJvmDllPath);
-
- // 2. Load GG JNI dll.
- UnmanagedUtils.Initialize();
-
- _loaded = true;
- }
-
- /// <summary>
- /// Create new instance of specified class.
- /// </summary>
- /// <param name="assemblyName">Assembly name.</param>
- /// <param name="clsName">Class name</param>
- /// <returns>New Instance.</returns>
- public static object CreateInstance(string assemblyName, string clsName)
- {
- IgniteArgumentCheck.NotNullOrEmpty(clsName, "clsName");
-
- var type = new TypeResolver().ResolveType(clsName, assemblyName);
-
- if (type == null)
- throw new IgniteException("Failed to create class instance [assemblyName=" + assemblyName +
- ", className=" + clsName + ']');
-
- return Activator.CreateInstance(type);
- }
-
- /// <summary>
- /// Set properties on the object.
- /// </summary>
- /// <param name="target">Target object.</param>
- /// <param name="props">Properties.</param>
- public static void SetProperties(object target, IEnumerable<KeyValuePair<string, object>> props)
- {
- if (props == null)
- return;
-
- IgniteArgumentCheck.NotNull(target, "target");
-
- Type typ = target.GetType();
-
- foreach (KeyValuePair<string, object> prop in props)
- {
- PropertyInfo prop0 = typ.GetProperty(prop.Key,
- BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
-
- if (prop0 == null)
- throw new IgniteException("Property is not found [type=" + typ.Name +
- ", property=" + prop.Key + ']');
-
- prop0.SetValue(target, prop.Value, null);
- }
- }
-
- /// <summary>
- /// Loads the JVM DLL.
- /// </summary>
- private static void LoadJvmDll(string configJvmDllPath)
- {
- var messages = new List<string>();
- foreach (var dllPath in GetJvmDllPaths(configJvmDllPath))
- {
- var errCode = LoadDll(dllPath.Value, FileJvmDll);
- if (errCode == 0)
- return;
-
- messages.Add(string.Format("[option={0}, path={1}, errorCode={2}]",
- dllPath.Key, dllPath.Value, errCode));
-
- if (dllPath.Value == configJvmDllPath)
- break; // if configJvmDllPath is specified and is invalid - do not try other options
- }
-
- if (!messages.Any()) // not loaded and no messages - everything was null
- messages.Add(string.Format("Please specify IgniteConfiguration.JvmDllPath or {0}.", EnvJavaHome));
-
- if (messages.Count == 1)
- throw new IgniteException(string.Format("Failed to load {0} ({1})", FileJvmDll, messages[0]));
-
- var combinedMessage = messages.Aggregate((x, y) => string.Format("{0}\n{1}", x, y));
- throw new IgniteException(string.Format("Failed to load {0}:\n{1}", FileJvmDll, combinedMessage));
- }
-
- /// <summary>
- /// Try loading DLLs first using file path, then using it's simple name.
- /// </summary>
- /// <param name="filePath"></param>
- /// <param name="simpleName"></param>
- /// <returns>Zero in case of success, error code in case of failure.</returns>
- private static int LoadDll(string filePath, string simpleName)
- {
- int res = 0;
-
- IntPtr ptr;
-
- if (filePath != null)
- {
- ptr = NativeMethods.LoadLibrary(filePath);
-
- if (ptr == IntPtr.Zero)
- res = Marshal.GetLastWin32Error();
- else
- return res;
- }
-
- // Failed to load using file path, fallback to simple name.
- ptr = NativeMethods.LoadLibrary(simpleName);
-
- if (ptr == IntPtr.Zero)
- {
- // Preserve the first error code, if any.
- if (res == 0)
- res = Marshal.GetLastWin32Error();
- }
- else
- res = 0;
-
- return res;
- }
-
- /// <summary>
- /// Gets the JVM DLL paths in order of lookup priority.
- /// </summary>
- private static IEnumerable<KeyValuePair<string, string>> GetJvmDllPaths(string configJvmDllPath)
- {
- if (!string.IsNullOrEmpty(configJvmDllPath))
- yield return new KeyValuePair<string, string>("IgniteConfiguration.JvmDllPath", configJvmDllPath);
-
- var javaHomeDir = Environment.GetEnvironmentVariable(EnvJavaHome);
-
- if (!string.IsNullOrEmpty(javaHomeDir))
- yield return
- new KeyValuePair<string, string>(EnvJavaHome, GetJvmDllPath(Path.Combine(javaHomeDir, DirJre)));
- }
-
- /// <summary>
- /// Gets the JVM DLL path from JRE dir.
- /// </summary>
- private static string GetJvmDllPath(string jreDir)
- {
- return Path.Combine(jreDir, DirBin, DirServer, FileJvmDll);
- }
-
- /// <summary>
- /// Unpacks an embedded resource into a temporary folder and returns the full path of resulting file.
- /// </summary>
- /// <param name="resourceName">Resource name.</param>
- /// <returns>Path to a temp file with an unpacked resource.</returns>
- public static string UnpackEmbeddedResource(string resourceName)
- {
- var dllRes = Assembly.GetExecutingAssembly().GetManifestResourceNames()
- .Single(x => x.EndsWith(resourceName, StringComparison.OrdinalIgnoreCase));
-
- return WriteResourceToTempFile(dllRes, resourceName);
- }
-
- /// <summary>
- /// Writes the resource to temporary file.
- /// </summary>
- /// <param name="resource">The resource.</param>
- /// <param name="name">File name prefix</param>
- /// <returns>Path to the resulting temp file.</returns>
- private static string WriteResourceToTempFile(string resource, string name)
- {
- // Dll file name should not be changed, so we create a temp folder with random name instead.
- var file = Path.Combine(GetTempDirectoryName(), name);
-
- using (var src = Assembly.GetExecutingAssembly().GetManifestResourceStream(resource))
- using (var dest = File.OpenWrite(file))
- {
- // ReSharper disable once PossibleNullReferenceException
- src.CopyTo(dest);
-
- return file;
- }
- }
-
- /// <summary>
- /// Tries to clean temporary directories created with <see cref="GetTempDirectoryName"/>.
- /// </summary>
- private static void TryCleanTempDirectories()
- {
- foreach (var dir in Directory.GetDirectories(Path.GetTempPath(), DirIgniteTmp + "*"))
- {
- try
- {
- Directory.Delete(dir, true);
- }
- catch (IOException)
- {
- // Expected
- }
- catch (UnauthorizedAccessException)
- {
- // Expected
- }
- }
- }
-
- /// <summary>
- /// Creates a uniquely named, empty temporary directory on disk and returns the full path of that directory.
- /// </summary>
- /// <returns>The full path of the temporary directory.</returns>
- private static string GetTempDirectoryName()
- {
- while (true)
- {
- var dir = Path.Combine(Path.GetTempPath(), DirIgniteTmp + Path.GetRandomFileName());
-
- try
- {
- return Directory.CreateDirectory(dir).FullName;
- }
- catch (IOException)
- {
- // Expected
- }
- catch (UnauthorizedAccessException)
- {
- // Expected
- }
- }
- }
-
- /// <summary>
- /// Convert unmanaged char array to string.
- /// </summary>
- /// <param name="chars">Char array.</param>
- /// <param name="charsLen">Char array length.</param>
- /// <returns></returns>
- public static unsafe string Utf8UnmanagedToString(sbyte* chars, int charsLen)
- {
- IntPtr ptr = new IntPtr(chars);
-
- if (ptr == IntPtr.Zero)
- return null;
-
- byte[] arr = new byte[charsLen];
-
- Marshal.Copy(ptr, arr, 0, arr.Length);
-
- return Encoding.UTF8.GetString(arr);
- }
-
- /// <summary>
- /// Convert string to unmanaged byte array.
- /// </summary>
- /// <param name="str">String.</param>
- /// <returns>Unmanaged byte array.</returns>
- public static unsafe sbyte* StringToUtf8Unmanaged(string str)
- {
- var ptr = IntPtr.Zero;
-
- if (str != null)
- {
- byte[] strBytes = Encoding.UTF8.GetBytes(str);
-
- ptr = Marshal.AllocHGlobal(strBytes.Length + 1);
-
- Marshal.Copy(strBytes, 0, ptr, strBytes.Length);
-
- *((byte*)ptr.ToPointer() + strBytes.Length) = 0; // NULL-terminator.
- }
-
- return (sbyte*)ptr.ToPointer();
- }
-
- /// <summary>
- /// Reads node collection from stream.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <param name="pred">The predicate.</param>
- /// <returns> Nodes list or null. </returns>
- public static List<IClusterNode> ReadNodes(IPortableRawReader reader, Func<ClusterNodeImpl, bool> pred = null)
- {
- var cnt = reader.ReadInt();
-
- if (cnt < 0)
- return null;
-
- var res = new List<IClusterNode>(cnt);
-
- var ignite = ((PortableReaderImpl)reader).Marshaller.Ignite;
-
- if (pred == null)
- {
- for (var i = 0; i < cnt; i++)
- res.Add(ignite.GetNode(reader.ReadGuid()));
- }
- else
- {
- for (var i = 0; i < cnt; i++)
- {
- var node = ignite.GetNode(reader.ReadGuid());
-
- if (pred(node))
- res.Add(node);
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Gets the asynchronous mode disabled exception.
- /// </summary>
- /// <returns>Asynchronous mode disabled exception.</returns>
- public static InvalidOperationException GetAsyncModeDisabledException()
- {
- return new InvalidOperationException("Asynchronous mode is disabled");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
deleted file mode 100644
index 98d57da..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/InteropExceptionHolder.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Runtime.Serialization.Formatters.Binary;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Holder of exception which must be serialized to Java and then backwards to the native platform.
- /// </summary>
- internal class InteropExceptionHolder : IPortableMarshalAware
- {
- /** Initial exception. */
- private Exception _err;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public InteropExceptionHolder()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="err">Error.</param>
- public InteropExceptionHolder(Exception err)
- {
- _err = err;
- }
-
- /// <summary>
- /// Underlying exception.
- /// </summary>
- public Exception Error
- {
- get { return _err; }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl) writer.RawWriter();
-
- if (writer0.IsPortable(_err))
- {
- writer0.WriteBoolean(true);
- writer0.WriteObject(_err);
- }
- else
- {
- writer0.WriteBoolean(false);
-
- BinaryFormatter bf = new BinaryFormatter();
-
- bf.Serialize(new PortableStreamAdapter(writer0.Stream), _err);
- }
- }
-
- /** <inheritDoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- throw new NotImplementedException();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/LifecycleBeanHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/LifecycleBeanHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/LifecycleBeanHolder.cs
deleted file mode 100644
index cce4ec5..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/LifecycleBeanHolder.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Lifecycle;
-
- /// <summary>
- /// Lifecycle bean holder.
- /// </summary>
- internal class LifecycleBeanHolder : ILifecycleBean
- {
- /** Target bean. */
- private readonly ILifecycleBean _target;
-
- /** Whether start event was invoked. */
- private volatile bool _startEvt;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target bean.</param>
- public LifecycleBeanHolder(ILifecycleBean target)
- {
- _target = target;
- }
-
- /** <inheritDoc /> */
- public void OnLifecycleEvent(LifecycleEventType evt)
- {
- if (evt == LifecycleEventType.AfterNodeStart)
- // This event cannot be propagated right away because at this point we
- // do not have Ignite instance yet. So just schedule it.
- _startEvt = true;
- else
- _target.OnLifecycleEvent(evt);
- }
-
- /// <summary>
- /// Grid start callback.
- /// </summary>
- /// <param name="grid">Ignite instance.</param>
- internal void OnStart(Ignite grid)
- {
- ResourceProcessor.Inject(_target, grid);
-
- if (_startEvt)
- _target.OnLifecycleEvent(LifecycleEventType.AfterNodeStart);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
deleted file mode 100644
index 93fd164..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/IPlatformMemory.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
-
- /// <summary>
- /// Platform memory chunk.
- /// </summary>
- [CLSCompliant(false)]
- public interface IPlatformMemory
- {
- /// <summary>
- /// Gets stream for read/write operations on the given memory chunk.
- /// </summary>
- /// <returns></returns>
- PlatformMemoryStream Stream();
-
- /// <summary>
- /// Cross-platform pointer.
- /// </summary>
- long Pointer { get; }
-
- /// <summary>
- /// Data pointer.
- /// </summary>
- long Data { get; }
-
- /// <summary>
- /// CalculateCapacity.
- /// </summary>
- int Capacity { get; }
-
- /// <summary>
- /// Length.
- /// </summary>
- int Length { get; set; }
-
- /// <summary>
- /// Reallocates memory chunk.
- /// </summary>
- /// <param name="cap">Minimum capacity.</param>
- void Reallocate(int cap);
-
- /// <summary>
- /// Release memory.
- /// </summary>
- void Release();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropExternalMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropExternalMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropExternalMemory.cs
deleted file mode 100644
index d356b5e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropExternalMemory.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- /// <summary>
- /// Interop external memory chunk.
- /// </summary>
- internal class InteropExternalMemory : PlatformMemory
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- public InteropExternalMemory(long memPtr) : base(memPtr)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public override void Reallocate(int cap)
- {
- InteropMemoryUtils.ReallocateExternal(Pointer, cap);
- }
-
- /** <inheritdoc /> */
- public override void Release()
- {
- // Memory can only be released by native platform.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropMemoryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropMemoryUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropMemoryUtils.cs
deleted file mode 100644
index 485d3db..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/InteropMemoryUtils.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using Apache.Ignite.Core.Impl.Unmanaged;
-
- /// <summary>
- /// Utility methods for interop memory management.
- /// </summary>
- internal static class InteropMemoryUtils
- {
- /// <summary>
- /// Re-allocate external memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">CalculateCapacity.</param>
- /// <returns>New memory pointer.</returns>
- public static void ReallocateExternal(long memPtr, int cap)
- {
- UnmanagedUtils.Reallocate(memPtr, cap);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformBigEndianMemoryStream.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformBigEndianMemoryStream.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformBigEndianMemoryStream.cs
deleted file mode 100644
index 33a0487..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformBigEndianMemoryStream.cs
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- /// <summary>
- /// Platform memory stream for big endian platforms.
- /// </summary>
- internal class PlatformBigEndianMemoryStream : PlatformMemoryStream
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="mem"></param>
- public PlatformBigEndianMemoryStream(IPlatformMemory mem) : base(mem)
- {
- // No-op.
- }
-
- #region WRITE
-
- /** <inheritDoc /> */
- public override unsafe void WriteShort(short val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(Len2);
-
- byte* valPtr = (byte*)&val;
-
- curPos[0] = valPtr[1];
- curPos[1] = valPtr[0];
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteShortArray(short[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift2);
-
- for (int i = 0; i < val.Length; i++)
- {
- short val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteChar(char val)
- {
- WriteShort(*(short*)(&val));
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteCharArray(char[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift2);
-
- for (int i = 0; i < val.Length; i++)
- {
- char val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteInt(int val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(Len4);
-
- byte* valPtr = (byte*)&val;
-
- curPos[0] = valPtr[3];
- curPos[1] = valPtr[2];
- curPos[2] = valPtr[1];
- curPos[3] = valPtr[0];
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteInt(int writePos, int val)
- {
- EnsureWriteCapacity(writePos + 4);
-
- byte* curPos = Data + writePos;
-
- byte* valPtr = (byte*)&val;
-
- curPos[0] = valPtr[3];
- curPos[1] = valPtr[2];
- curPos[2] = valPtr[1];
- curPos[3] = valPtr[0];
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteIntArray(int[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift4);
-
- for (int i = 0; i < val.Length; i++)
- {
- int val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteLong(long val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(Len8);
-
- byte* valPtr = (byte*)&val;
-
- curPos[0] = valPtr[7];
- curPos[1] = valPtr[6];
- curPos[2] = valPtr[5];
- curPos[3] = valPtr[4];
- curPos[4] = valPtr[3];
- curPos[5] = valPtr[2];
- curPos[6] = valPtr[1];
- curPos[7] = valPtr[0];
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteLongArray(long[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift8);
-
- for (int i = 0; i < val.Length; i++)
- {
- long val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[7];
- *curPos++ = valPtr[6];
- *curPos++ = valPtr[5];
- *curPos++ = valPtr[4];
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteFloat(float val)
- {
- WriteInt(*(int*)(&val));
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteFloatArray(float[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift4);
-
- for (int i = 0; i < val.Length; i++)
- {
- float val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteDouble(double val)
- {
- WriteLong(*(long*)(&val));
- }
-
- /** <inheritDoc /> */
- public override unsafe void WriteDoubleArray(double[] val)
- {
- byte* curPos = Data + EnsureWriteCapacityAndShift(val.Length << Shift8);
-
- for (int i = 0; i < val.Length; i++)
- {
- double val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[7];
- *curPos++ = valPtr[6];
- *curPos++ = valPtr[5];
- *curPos++ = valPtr[4];
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
-
- #endregion
-
- #region READ
-
- /** <inheritDoc /> */
- public override unsafe short ReadShort()
- {
- int curPos = EnsureReadCapacityAndShift(Len2);
-
- short val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public override unsafe short[] ReadShortArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift2);
-
- short[] res = new short[len];
-
- for (int i = 0; i < len; i++)
- {
- short val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- /** <inheritDoc /> */
- public override unsafe char ReadChar()
- {
- int curPos = EnsureReadCapacityAndShift(Len2);
-
- char val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public override unsafe char[] ReadCharArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift2);
-
- char[] res = new char[len];
-
- for (int i = 0; i < len; i++)
- {
- char val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- /** <inheritDoc /> */
- public override unsafe int ReadInt()
- {
- int curPos = EnsureReadCapacityAndShift(Len4);
-
- int val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public override unsafe int[] ReadIntArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift4);
-
- int[] res = new int[len];
-
- for (int i = 0; i < len; i++)
- {
- int val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- /** <inheritDoc /> */
- public override unsafe long ReadLong()
- {
- int curPos = EnsureReadCapacityAndShift(Len8);
-
- long val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[7] = *(Data + curPos++);
- valPtr[6] = *(Data + curPos++);
- valPtr[5] = *(Data + curPos++);
- valPtr[4] = *(Data + curPos++);
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
-
- public override unsafe long[] ReadLongArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift8);
-
- long[] res = new long[len];
-
- for (int i = 0; i < len; i++)
- {
- long val;
-
- byte* valPtr = (byte*) &val;
-
- valPtr[7] = *(Data + curPos++);
- valPtr[6] = *(Data + curPos++);
- valPtr[5] = *(Data + curPos++);
- valPtr[4] = *(Data + curPos++);
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- /** <inheritDoc /> */
- public override unsafe float ReadFloat()
- {
- int curPos = EnsureReadCapacityAndShift(Len4);
-
- float val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public override unsafe float[] ReadFloatArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift4);
-
- float[] res = new float[len];
-
- for (int i = 0; i < len; i++)
- {
- float val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- /** <inheritDoc /> */
- public override unsafe double ReadDouble()
- {
- int curPos = EnsureReadCapacityAndShift(Len8);
-
- double val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[7] = *(Data + curPos++);
- valPtr[6] = *(Data + curPos++);
- valPtr[5] = *(Data + curPos++);
- valPtr[4] = *(Data + curPos++);
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos);
-
- return val;
- }
-
- /** <inheritDoc /> */
- public override unsafe double[] ReadDoubleArray(int len)
- {
- int curPos = EnsureReadCapacityAndShift(len << Shift8);
-
- double[] res = new double[len];
-
- for (int i = 0; i < len; i++)
- {
- double val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[7] = *(Data + curPos++);
- valPtr[6] = *(Data + curPos++);
- valPtr[5] = *(Data + curPos++);
- valPtr[4] = *(Data + curPos++);
- valPtr[3] = *(Data + curPos++);
- valPtr[2] = *(Data + curPos++);
- valPtr[1] = *(Data + curPos++);
- valPtr[0] = *(Data + curPos++);
-
- res[i] = val;
- }
-
- return res;
- }
-
- #endregion
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
deleted file mode 100644
index 3a9ed26..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemory.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
-
- /// <summary>
- /// Abstract memory chunk.
- /// </summary>
- [CLSCompliant(false)]
- public abstract class PlatformMemory : IPlatformMemory
- {
- /** Memory pointer. */
- protected readonly long MemPtr;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- protected PlatformMemory(long memPtr)
- {
- MemPtr = memPtr;
- }
-
- /** <inheritdoc /> */
- public virtual PlatformMemoryStream Stream()
- {
- return BitConverter.IsLittleEndian ? new PlatformMemoryStream(this) :
- new PlatformBigEndianMemoryStream(this);
- }
-
- /** <inheritdoc /> */
- public long Pointer
- {
- get { return MemPtr; }
- }
-
- /** <inheritdoc /> */
- public long Data
- {
- get { return PlatformMemoryUtils.Data(MemPtr); }
- }
-
- /** <inheritdoc /> */
- public int Capacity
- {
- get { return PlatformMemoryUtils.Capacity(MemPtr); }
- }
-
- /** <inheritdoc /> */
- public int Length
- {
- get { return PlatformMemoryUtils.Length(MemPtr); }
- set { PlatformMemoryUtils.Length(MemPtr, value); }
- }
-
- /** <inheritdoc /> */
- public abstract void Reallocate(int cap);
-
- /** <inheritdoc /> */
- public abstract void Release();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
deleted file mode 100644
index b280140..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryManager.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
-
- /// <summary>
- /// Memory manager implementation.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
- Justification = "This class instance usually lives as long as the app runs.")]
- [CLSCompliant(false)]
- public class PlatformMemoryManager
- {
- /** Default capacity. */
- private readonly int _dfltCap;
-
- /** Thread-local pool. */
- private readonly ThreadLocal<PlatformMemoryPool> _threadLocPool = new ThreadLocal<PlatformMemoryPool>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="dfltCap">Default capacity.</param>
- public PlatformMemoryManager(int dfltCap)
- {
- _dfltCap = dfltCap;
- }
-
- /// <summary>
- /// Allocate memory.
- /// </summary>
- /// <returns>Memory.</returns>
- public IPlatformMemory Allocate()
- {
- return Allocate(_dfltCap);
- }
-
- /// <summary>
- /// Allocate memory having at least the given capacity.
- /// </summary>
- /// <param name="cap">Minimum capacity.</param>
- /// <returns>Memory.</returns>
- public IPlatformMemory Allocate(int cap)
- {
- return Pool().Allocate(cap);
- }
-
- /// <summary>
- /// Gets memory from existing pointer.
- /// </summary>
- /// <param name="memPtr">Cross-platform memory pointer.</param>
- /// <returns>Memory.</returns>
- public IPlatformMemory Get(long memPtr)
- {
- int flags = PlatformMemoryUtils.Flags(memPtr);
-
- return PlatformMemoryUtils.IsExternal(flags) ? GetExternalMemory(memPtr)
- : PlatformMemoryUtils.IsPooled(flags) ? Pool().Get(memPtr) : new PlatformUnpooledMemory(memPtr);
- }
-
- /// <summary>
- /// Gets or creates thread-local memory pool.
- /// </summary>
- /// <returns>Memory pool.</returns>
- public PlatformMemoryPool Pool()
- {
- PlatformMemoryPool pool = _threadLocPool.Value;
-
- if (pool == null)
- {
- pool = new PlatformMemoryPool();
-
- _threadLocPool.Value = pool;
- }
-
- return pool;
- }
-
- /// <summary>
- /// Gets the external memory.
- /// </summary>
- /// <param name="memPtr">Cross-platform memory pointer.</param>
- /// <returns>Memory.</returns>
- protected virtual IPlatformMemory GetExternalMemory(long memPtr)
- {
- return new InteropExternalMemory(memPtr);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
deleted file mode 100644
index 75e8965..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryPool.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
- using Microsoft.Win32.SafeHandles;
-
- /// <summary>
- /// Platform memory pool.
- /// </summary>
- [CLSCompliant(false)]
- public class PlatformMemoryPool : SafeHandleMinusOneIsInvalid
- {
- /** First pooled memory chunk. */
- private PlatformPooledMemory _mem1;
-
- /** Second pooled memory chunk. */
- private PlatformPooledMemory _mem2;
-
- /** Third pooled memory chunk. */
- private PlatformPooledMemory _mem3;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public PlatformMemoryPool() : base(true)
- {
- handle = (IntPtr)PlatformMemoryUtils.AllocatePool();
- }
-
- /// <summary>
- /// Allocate memory chunk, optionally pooling it.
- /// </summary>
- /// <param name="cap">Minimum capacity.</param>
- /// <returns>Memory chunk</returns>
- public PlatformMemory Allocate(int cap)
- {
- var memPtr = PlatformMemoryUtils.AllocatePooled(handle.ToInt64(), cap);
-
- // memPtr == 0 means that we failed to acquire thread-local memory chunk, so fallback to unpooled memory.
- return memPtr != 0 ? Get(memPtr) : new PlatformUnpooledMemory(PlatformMemoryUtils.AllocateUnpooled(cap));
- }
-
- /// <summary>
- /// Re-allocate existing pool memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">Minimum capacity.</param>
- public void Reallocate(long memPtr, int cap)
- {
- PlatformMemoryUtils.ReallocatePooled(memPtr, cap);
- }
-
- /// <summary>
- /// Release pooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- public void Release(long memPtr)
- {
- PlatformMemoryUtils.ReleasePooled(memPtr);
- }
-
- /// <summary>
- /// Get pooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>Memory chunk.</returns>
- public PlatformMemory Get(long memPtr)
- {
- long delta = memPtr - handle.ToInt64();
-
- if (delta == PlatformMemoryUtils.PoolHdrOffMem1)
- return _mem1 ?? (_mem1 = new PlatformPooledMemory(this, memPtr));
-
- if (delta == PlatformMemoryUtils.PoolHdrOffMem2)
- return _mem2 ?? (_mem2 = new PlatformPooledMemory(this, memPtr));
-
- return _mem3 ?? (_mem3 = new PlatformPooledMemory(this, memPtr));
- }
-
- /** <inheritdoc /> */
- protected override bool ReleaseHandle()
- {
- PlatformMemoryUtils.ReleasePool(handle.ToInt64());
-
- handle = new IntPtr(-1);
-
- return true;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
deleted file mode 100644
index 71da18f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryStream.cs
+++ /dev/null
@@ -1,677 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
- using System.IO;
- using System.Text;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Platform memory stream.
- /// </summary>
- [CLSCompliant(false)]
- public unsafe class PlatformMemoryStream : IPortableStream
- {
- /** Length: 1 byte. */
- protected const int Len1 = 1;
-
- /** Length: 2 bytes. */
- protected const int Len2 = 2;
-
- /** Length: 4 bytes. */
- protected const int Len4 = 4;
-
- /** Length: 8 bytes. */
- protected const int Len8 = 8;
-
- /** Shift: 2 bytes. */
- protected const int Shift2 = 1;
-
- /** Shift: 4 bytes. */
- protected const int Shift4 = 2;
-
- /** Shift: 8 bytes. */
- protected const int Shift8 = 3;
-
- /** Underlying memory. */
- private readonly IPlatformMemory _mem;
-
- /** Actual data. */
- protected byte* Data;
-
- /** CalculateCapacity. */
- private int _cap;
-
- /** Position. */
- private int _pos;
-
- /** Length. */
- private int _len;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="mem">Memory.</param>
- public PlatformMemoryStream(IPlatformMemory mem)
- {
- _mem = mem;
-
- Data = (byte*)mem.Data;
- _cap = mem.Capacity;
- _len = mem.Length;
- }
-
- #region WRITE
-
- /** <inheritdoc /> */
- public void WriteByte(byte val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len1);
-
- *(Data + curPos) = val;
- }
-
- /** <inheritdoc /> */
- public void WriteByteArray(byte[] val)
- {
- fixed (byte* val0 = val)
- {
- CopyFromAndShift(val0, val.Length);
- }
- }
-
- /** <inheritdoc /> */
- public void WriteBool(bool val)
- {
- WriteByte(val ? (byte)1 : (byte)0);
- }
-
- /** <inheritdoc /> */
- public void WriteBoolArray(bool[] val)
- {
- fixed (bool* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteShort(short val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len2);
-
- *((short*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteShortArray(short[] val)
- {
- fixed (short* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift2);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteChar(char val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len2);
-
- *((char*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteCharArray(char[] val)
- {
- fixed (char* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift2);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteInt(int val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len4);
-
- *((int*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteInt(int writePos, int val)
- {
- EnsureWriteCapacity(writePos + 4);
-
- *((int*)(Data + writePos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteIntArray(int[] val)
- {
- fixed (int* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift4);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteLong(long val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len8);
-
- *((long*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteLongArray(long[] val)
- {
- fixed (long* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift8);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteFloat(float val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len4);
-
- *((float*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteFloatArray(float[] val)
- {
- fixed (float* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift4);
- }
- }
-
- /** <inheritdoc /> */
- public virtual void WriteDouble(double val)
- {
- int curPos = EnsureWriteCapacityAndShift(Len8);
-
- *((double*)(Data + curPos)) = val;
- }
-
- /** <inheritdoc /> */
- public virtual void WriteDoubleArray(double[] val)
- {
- fixed (double* val0 = val)
- {
- CopyFromAndShift((byte*)val0, val.Length << Shift8);
- }
- }
-
- /** <inheritdoc /> */
- public int WriteString(char* chars, int charCnt, int byteCnt, Encoding enc)
- {
- int curPos = EnsureWriteCapacityAndShift(byteCnt);
-
- return enc.GetBytes(chars, charCnt, Data + curPos, byteCnt);
- }
-
- /** <inheritdoc /> */
- public void Write(byte[] src, int off, int cnt)
- {
- fixed (byte* src0 = src)
- {
- CopyFromAndShift(src0 + off, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public void Write(byte* src, int cnt)
- {
- CopyFromAndShift(src, cnt);
- }
-
- #endregion WRITE
-
- #region READ
-
- /** <inheritdoc /> */
- public byte ReadByte()
- {
- int curPos = EnsureReadCapacityAndShift(Len1);
-
- return *(Data + curPos);
- }
-
- /** <inheritdoc /> */
-
- public byte[] ReadByteArray(int cnt)
- {
- int curPos = EnsureReadCapacityAndShift(cnt);
-
- byte[] res = new byte[cnt];
-
- fixed (byte* res0 = res)
- {
- PlatformMemoryUtils.CopyMemory(Data + curPos, res0, cnt);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public bool ReadBool()
- {
- return ReadByte() == 1;
- }
-
- /** <inheritdoc /> */
- public bool[] ReadBoolArray(int cnt)
- {
- bool[] res = new bool[cnt];
-
- fixed (bool* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual short ReadShort()
- {
- int curPos = EnsureReadCapacityAndShift(Len2);
-
- return *((short*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual short[] ReadShortArray(int cnt)
- {
- short[] res = new short[cnt];
-
- fixed (short* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift2);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual char ReadChar()
- {
- int curPos = EnsureReadCapacityAndShift(Len2);
-
- return *((char*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual char[] ReadCharArray(int cnt)
- {
- char[] res = new char[cnt];
-
- fixed (char* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift2);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual int ReadInt()
- {
- int curPos = EnsureReadCapacityAndShift(Len4);
-
- return *((int*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual int[] ReadIntArray(int cnt)
- {
- int[] res = new int[cnt];
-
- fixed (int* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift4);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual long ReadLong()
- {
- int curPos = EnsureReadCapacityAndShift(Len8);
-
- return *((long*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual long[] ReadLongArray(int cnt)
- {
- long[] res = new long[cnt];
-
- fixed (long* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift8);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual float ReadFloat()
- {
- int curPos = EnsureReadCapacityAndShift(Len4);
-
- return *((float*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual float[] ReadFloatArray(int cnt)
- {
- float[] res = new float[cnt];
-
- fixed (float* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift4);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public virtual double ReadDouble()
- {
- int curPos = EnsureReadCapacityAndShift(Len8);
-
- return *((double*)(Data + curPos));
- }
-
- /** <inheritdoc /> */
- public virtual double[] ReadDoubleArray(int cnt)
- {
- double[] res = new double[cnt];
-
- fixed (double* res0 = res)
- {
- CopyToAndShift((byte*)res0, cnt << Shift8);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public void Read(byte[] dest, int off, int cnt)
- {
- fixed (byte* dest0 = dest)
- {
- Read(dest0 + off, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public void Read(byte* dest, int cnt)
- {
- CopyToAndShift(dest, cnt);
- }
-
- #endregion
-
- #region MISC
-
- /// <summary>
- /// Get cross-platform memory pointer for the stream.
- /// </summary>
- public long MemoryPointer
- {
- get { return _mem.Pointer; }
- }
-
- /// <summary>
- /// Synchronize stream write opeartions with underlying memory and return current memory pointer.
- /// <returns>Memory pointer.</returns>
- /// </summary>
- public long SynchronizeOutput()
- {
- if (_pos > _len)
- _len = _pos;
-
- _mem.Length = _len;
-
- return MemoryPointer;
- }
-
- /// <summary>
- /// Synchronized stream read operations from underlying memory. This is required when stream was passed
- /// to Java and something might have been written there.
- /// </summary>
- public void SynchronizeInput()
- {
- Data = (byte*)_mem.Data;
- _cap = _mem.Capacity;
- _len = _mem.Length;
- }
-
- /// <summary>
- /// Reset stream state. Sets both position and length to 0.
- /// </summary>
- public void Reset()
- {
- _pos = 0;
- }
-
- /// <summary>
- /// Reset stream state as if it was just created.
- /// </summary>
- public void Reuse()
- {
- Data = (byte*)_mem.Data;
- _cap = _mem.Capacity;
- _len = _mem.Length;
- _pos = 0;
- }
-
- /** <inheritdoc /> */
- public int Seek(int offset, SeekOrigin origin)
- {
- int newPos;
-
- switch (origin)
- {
- case SeekOrigin.Begin:
- {
- newPos = offset;
-
- break;
- }
-
- case SeekOrigin.Current:
- {
- newPos = _pos + offset;
-
- break;
- }
-
- default:
- throw new ArgumentException("Unsupported seek origin: " + origin);
- }
-
- if (newPos < 0)
- throw new ArgumentException("Seek before origin: " + newPos);
-
- EnsureWriteCapacity(newPos);
-
- _pos = newPos;
-
- return _pos;
- }
-
- /// <summary>
- /// Ensure capacity for write and shift position.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Position before shift.</returns>
- protected int EnsureWriteCapacityAndShift(int cnt)
- {
- int curPos = _pos;
-
- int newPos = _pos + cnt;
-
- EnsureWriteCapacity(newPos);
-
- _pos = newPos;
-
- return curPos;
- }
-
- /// <summary>
- /// Ensure write capacity.
- /// </summary>
- /// <param name="reqCap">Required capacity.</param>
- protected void EnsureWriteCapacity(int reqCap)
- {
- if (reqCap > _cap)
- {
- reqCap = CalculateCapacity(_cap, reqCap);
-
- _mem.Reallocate(reqCap);
-
- Data = (byte*)_mem.Data;
- _cap = _mem.Capacity;
- }
- }
-
- /// <summary>
- /// Ensure capacity for read and shift position.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Position before shift.</returns>
- protected int EnsureReadCapacityAndShift(int cnt)
- {
- int curPos = _pos;
-
- if (_len - _pos < cnt)
- throw new EndOfStreamException("Not enough data in stream [expected=" + cnt +
- ", remaining=" + (_len - _pos) + ']');
-
- _pos += cnt;
-
- return curPos;
- }
-
- /// <summary>
- /// Copy (read) some data into destination and shift the stream forward.
- /// </summary>
- /// <param name="dest">Destination.</param>
- /// <param name="cnt">Bytes count.</param>
- private void CopyToAndShift(byte* dest, int cnt)
- {
- int curPos = EnsureReadCapacityAndShift(cnt);
-
- PlatformMemoryUtils.CopyMemory(Data + curPos, dest, cnt);
- }
-
- /// <summary>
- /// Copy (write) some data from source and shift the stream forward.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="cnt">Bytes count.</param>
- private void CopyFromAndShift(byte* src, int cnt)
- {
- int curPos = EnsureWriteCapacityAndShift(cnt);
-
- PlatformMemoryUtils.CopyMemory(src, Data + curPos, cnt);
- }
-
- /// <summary>
- /// Calculate new capacity.
- /// </summary>
- /// <param name="curCap">Current capacity.</param>
- /// <param name="reqCap">Required capacity.</param>
- /// <returns>New capacity.</returns>
- private static int CalculateCapacity(int curCap, int reqCap)
- {
- int newCap;
-
- if (reqCap < 256)
- newCap = 256;
- else
- {
- newCap = curCap << 1;
-
- if (newCap < reqCap)
- newCap = reqCap;
- }
-
- return newCap;
- }
-
- /** <inheritdoc /> */
- public int Position
- {
- get { return _pos; }
- }
-
- /** <inheritdoc /> */
- public int Remaining()
- {
- return _len - _pos;
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- SynchronizeOutput();
-
- _mem.Release();
- }
-
- #endregion
-
- #region ARRAYS
-
- /** <inheritdoc /> */
- public byte[] Array()
- {
- return ArrayCopy();
- }
-
- /** <inheritdoc /> */
- public byte[] ArrayCopy()
- {
- byte[] res = new byte[_mem.Length];
-
- fixed (byte* res0 = res)
- {
- PlatformMemoryUtils.CopyMemory(Data, res0, res.Length);
- }
-
- return res;
- }
-
- /** <inheritdoc /> */
- public bool IsSameArray(byte[] arr)
- {
- return false;
- }
-
- #endregion
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
deleted file mode 100644
index dd53281..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformMemoryUtils.cs
+++ /dev/null
@@ -1,463 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Reflection;
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Utility methods for platform memory management.
- /// </summary>
- [CLSCompliant(false)]
- public static unsafe class PlatformMemoryUtils
- {
- #region CONSTANTS
-
- /** Header length. */
- private const int PoolHdrLen = 64;
-
- /** Pool header offset: first memory chunk. */
- internal const int PoolHdrOffMem1 = 0;
-
- /** Pool header offset: second memory chunk. */
- internal const int PoolHdrOffMem2 = 20;
-
- /** Pool header offset: third memory chunk. */
- internal const int PoolHdrOffMem3 = 40;
-
- /** Memory chunk header length. */
- private const int MemHdrLen = 20;
-
- /** Offset: capacity. */
- private const int MemHdrOffCap = 8;
-
- /** Offset: length. */
- private const int MemHdrOffLen = 12;
-
- /** Offset: flags. */
- private const int MemHdrOffFlags = 16;
-
- /** Flag: external. */
- private const int FlagExt = 0x1;
-
- /** Flag: pooled. */
- private const int FlagPooled = 0x2;
-
- /** Flag: whether this pooled memory chunk is acquired. */
- private const int FlagAcquired = 0x4;
-
- #endregion
-
- #region COMMON
-
- /// <summary>
- /// Gets data pointer for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>Data pointer.</returns>
- public static long Data(long memPtr)
- {
- return *((long*)memPtr);
- }
-
- /// <summary>
- /// Gets capacity for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>CalculateCapacity.</returns>
- public static int Capacity(long memPtr)
- {
- return *((int*)(memPtr + MemHdrOffCap));
- }
-
- /// <summary>
- /// Sets capacity for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">CalculateCapacity.</param>
- public static void Capacity(long memPtr, int cap)
- {
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- }
-
- /// <summary>
- /// Gets length for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>Length.</returns>
- public static int Length(long memPtr)
- {
- return *((int*)(memPtr + MemHdrOffLen));
- }
-
- /// <summary>
- /// Sets length for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="len">Length.</param>
- public static void Length(long memPtr, int len)
- {
- *((int*)(memPtr + MemHdrOffLen)) = len;
- }
-
- /// <summary>
- /// Gets flags for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>Flags.</returns>
- public static int Flags(long memPtr)
- {
- return *((int*)(memPtr + MemHdrOffFlags));
- }
-
- /// <summary>
- /// Sets flags for the given memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="flags">Flags.</param>
- public static void Flags(long memPtr, int flags)
- {
- *((int*)(memPtr + MemHdrOffFlags)) = flags;
- }
-
- /// <summary>
- /// Check whether this memory chunk is external.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns><c>True</c> if owned by Java.</returns>
- public static bool IsExternal(long memPtr)
- {
- return IsExternal(Flags(memPtr));
- }
-
- /// <summary>
- /// Check whether flags denote that this memory chunk is external.
- /// </summary>
- /// <param name="flags">Flags.</param>
- /// <returns><c>True</c> if owned by Java.</returns>
- public static bool IsExternal(int flags)
- {
- return (flags & FlagExt) != FlagExt;
- }
-
- /// <summary>
- /// Check whether this memory chunk is pooled.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns><c>True</c> if pooled.</returns>
- public static bool IsPooled(long memPtr)
- {
- return IsPooled(Flags(memPtr));
- }
-
- /// <summary>
- /// Check whether flags denote pooled memory chunk.
- /// </summary>
- /// <param name="flags">Flags.</param>
- /// <returns><c>True</c> if pooled.</returns>
- public static bool IsPooled(int flags)
- {
- return (flags & FlagPooled) != 0;
- }
-
- /// <summary>
- /// Check whether this memory chunk is pooled and acquired.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns><c>True</c> if acquired.</returns>
- public static bool IsAcquired(long memPtr)
- {
- return IsAcquired(Flags(memPtr));
- }
-
- /// <summary>
- /// Check whether flags denote pooled and acquired memory chunk.
- /// </summary>
- /// <param name="flags">Flags.</param>
- /// <returns><c>True</c> if acquired.</returns>
- public static bool IsAcquired(int flags)
- {
- return (flags & FlagAcquired) != 0;
- }
-
- #endregion
-
- #region UNPOOLED MEMORY
-
- /// <summary>
- /// Allocate unpooled memory chunk.
- /// </summary>
- /// <param name="cap">Minimum capacity.</param>
- /// <returns>New memory pointer.</returns>
- public static long AllocateUnpooled(int cap)
- {
- long memPtr = Marshal.AllocHGlobal(MemHdrLen).ToInt64();
- long dataPtr = Marshal.AllocHGlobal(cap).ToInt64();
-
- *((long*)memPtr) = dataPtr;
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- *((int*)(memPtr + MemHdrOffLen)) = 0;
- *((int*)(memPtr + MemHdrOffFlags)) = FlagExt;
-
- return memPtr;
- }
-
-
- /// <summary>
- /// Reallocate unpooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">Minimum capacity.</param>
- /// <returns></returns>
- public static void ReallocateUnpooled(long memPtr, int cap)
- {
- long dataPtr = Data(memPtr);
-
- long newDataPtr = Marshal.ReAllocHGlobal((IntPtr)dataPtr, (IntPtr)cap).ToInt64();
-
- if (dataPtr != newDataPtr)
- *((long*)memPtr) = newDataPtr; // Write new data address if needed.
-
- *((int*)(memPtr + MemHdrOffCap)) = cap; // Write new capacity.
- }
-
- /// <summary>
- /// Release unpooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- public static void ReleaseUnpooled(long memPtr)
- {
- Marshal.FreeHGlobal((IntPtr)Data(memPtr));
- Marshal.FreeHGlobal((IntPtr)memPtr);
- }
-
- #endregion
-
- #region POOLED MEMORY
-
- /// <summary>
- /// Allocate pool memory.
- /// </summary>
- /// <returns>Pool pointer.</returns>
- public static long AllocatePool()
- {
- // 1. Allocate memory.
- long poolPtr = Marshal.AllocHGlobal((IntPtr)PoolHdrLen).ToInt64();
-
- // 2. Clear memory.
- for (int i = 0; i < PoolHdrLen; i += 8)
- *((long*)(poolPtr + i)) = 0;
-
- // 3. Set flags for memory chunks.
- Flags(poolPtr + PoolHdrOffMem1, FlagExt | FlagPooled);
- Flags(poolPtr + PoolHdrOffMem2, FlagExt | FlagPooled);
- Flags(poolPtr + PoolHdrOffMem3, FlagExt | FlagPooled);
-
- return poolPtr;
- }
-
- /// <summary>
- /// Release pool memory.
- /// </summary>
- /// <param name="poolPtr">Pool pointer.</param>
- public static void ReleasePool(long poolPtr)
- {
- // Clean predefined memory chunks.
- long mem = *((long*)(poolPtr + PoolHdrOffMem1));
-
- if (mem != 0)
- Marshal.FreeHGlobal((IntPtr)mem);
-
- mem = *((long*)(poolPtr + PoolHdrOffMem2));
-
- if (mem != 0)
- Marshal.FreeHGlobal((IntPtr)mem);
-
- mem = *((long*)(poolPtr + PoolHdrOffMem3));
-
- if (mem != 0)
- Marshal.FreeHGlobal((IntPtr)mem);
-
- // Clean pool chunk.
- Marshal.FreeHGlobal((IntPtr)poolPtr);
- }
-
- /// <summary>
- /// Allocate pooled memory chunk.
- /// </summary>
- /// <param name="poolPtr">Pool pointer.</param>
- /// <param name="cap">CalculateCapacity.</param>
- /// <returns>Memory pointer or <c>0</c> in case there are no free memory chunks in the pool.</returns>
- public static long AllocatePooled(long poolPtr, int cap)
- {
- long memPtr = poolPtr + PoolHdrOffMem1;
-
- if (IsAcquired(memPtr))
- {
- memPtr = poolPtr + PoolHdrOffMem2;
-
- if (IsAcquired(memPtr))
- {
- memPtr = poolPtr + PoolHdrOffMem3;
-
- if (IsAcquired(memPtr))
- memPtr = 0;
- else
- AllocatePooled0(memPtr, cap);
- }
- else
- AllocatePooled0(memPtr, cap);
- }
- else
- AllocatePooled0(memPtr, cap);
-
- return memPtr;
- }
-
- /// <summary>
- /// Internal pooled memory chunk allocation routine.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">CalculateCapacity.</param>
- private static void AllocatePooled0(long memPtr, int cap)
- {
- long data = *((long*)memPtr);
-
- if (data == 0) {
- // First allocation of the chunk.
- data = Marshal.AllocHGlobal(cap).ToInt64();
-
- *((long*)memPtr) = data;
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- }
- else {
- // Ensure that we have enough capacity.
- int curCap = Capacity(memPtr);
-
- if (cap > curCap) {
- data = Marshal.ReAllocHGlobal((IntPtr)data, (IntPtr)cap).ToInt64();
-
- *((long*)memPtr) = data;
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- }
- }
-
- Flags(memPtr, FlagExt | FlagPooled | FlagAcquired);
- }
-
- /// <summary>
- /// Reallocate pooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="cap">Minimum capacity.</param>
- public static void ReallocatePooled(long memPtr, int cap)
- {
- long data = *((long*)memPtr);
-
- int curCap = Capacity(memPtr);
-
- if (cap > curCap) {
- data = Marshal.ReAllocHGlobal((IntPtr)data, (IntPtr)cap).ToInt64();
-
- *((long*)memPtr) = data;
- *((int*)(memPtr + MemHdrOffCap)) = cap;
- }
- }
-
- /// <summary>
- /// Release pooled memory chunk.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- public static void ReleasePooled(long memPtr)
- {
- Flags(memPtr, Flags(memPtr) ^ FlagAcquired);
- }
-
- #endregion
-
- #region MEMCPY
-
- /** Array copy delegate. */
- private delegate void MemCopy(byte* a1, byte* a2, int len);
-
- /** memcpy function handle. */
- private static readonly MemCopy Memcpy;
-
- /** Whether src and dest arguments are inverted. */
- private static readonly bool MemcpyInverted;
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
- static PlatformMemoryUtils()
- {
- Type type = typeof(Buffer);
-
- const BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic;
- Type[] paramTypes = { typeof(byte*), typeof(byte*), typeof(int) };
-
- // Assume .Net 4.5.
- MethodInfo mthd = type.GetMethod("Memcpy", flags, null, paramTypes, null);
-
- MemcpyInverted = true;
-
- if (mthd == null)
- {
- // Assume .Net 4.0.
- mthd = type.GetMethod("memcpyimpl", flags, null, paramTypes, null);
-
- MemcpyInverted = false;
-
- if (mthd == null)
- throw new InvalidOperationException("Unable to get memory copy function delegate.");
- }
-
- Memcpy = (MemCopy)Delegate.CreateDelegate(typeof(MemCopy), mthd);
- }
-
- /// <summary>
- /// Unsafe memory copy routine.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="dest">Destination.</param>
- /// <param name="len">Length.</param>
- public static void CopyMemory(void* src, void* dest, int len)
- {
- CopyMemory((byte*)src, (byte*)dest, len);
- }
-
- /// <summary>
- /// Unsafe memory copy routine.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="dest">Destination.</param>
- /// <param name="len">Length.</param>
- public static void CopyMemory(byte* src, byte* dest, int len)
- {
- if (MemcpyInverted)
- Memcpy.Invoke(dest, src, len);
- else
- Memcpy.Invoke(src, dest, len);
- }
-
- #endregion
- }
-}
[37/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/impl/portable/portable_writer_impl.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/impl/portable/portable_writer_impl.cpp b/modules/platform/src/main/cpp/core/src/impl/portable/portable_writer_impl.cpp
deleted file mode 100644
index 93aacd9..0000000
--- a/modules/platform/src/main/cpp/core/src/impl/portable/portable_writer_impl.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/ignite_error.h"
-
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- PortableWriterImpl::PortableWriterImpl(InteropOutputStream* stream, PortableIdResolver* idRslvr,
- PortableMetadataManager* metaMgr, PortableMetadataHandler* metaHnd) :
- stream(stream), idRslvr(idRslvr), metaMgr(metaMgr), metaHnd(metaHnd), typeId(idRslvr->GetTypeId()),
- elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(-1)
- {
- // No-op.
- }
-
- PortableWriterImpl::PortableWriterImpl(InteropOutputStream* stream, PortableMetadataManager* metaMgr) :
- stream(stream), idRslvr(NULL), metaMgr(metaMgr), metaHnd(NULL), typeId(0),
- elemIdGen(0), elemId(0), elemCnt(0), elemPos(-1), rawPos(0)
- {
- // No-op.
- }
-
- void PortableWriterImpl::WriteInt8(const int8_t val)
- {
- WritePrimitiveRaw<int8_t>(val, PortableUtils::WriteInt8);
- }
-
- void PortableWriterImpl::WriteInt8Array(const int8_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int8_t>(val, len, PortableUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE);
- }
-
- void PortableWriterImpl::WriteInt8(const char* fieldName, const int8_t val)
- {
- WritePrimitive<int8_t>(fieldName, val, PortableUtils::WriteInt8, IGNITE_TYPE_BYTE, 1);
- }
-
- void PortableWriterImpl::WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len)
- {
- WritePrimitiveArray<int8_t>(fieldName, val, len, PortableUtils::WriteInt8Array, IGNITE_TYPE_ARRAY_BYTE, 0);
- }
-
- void PortableWriterImpl::WriteBool(const bool val)
- {
- WritePrimitiveRaw<bool>(val, PortableUtils::WriteBool);
- }
-
- void PortableWriterImpl::WriteBoolArray(const bool* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<bool>(val, len, PortableUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL);
- }
-
- void PortableWriterImpl::WriteBool(const char* fieldName, const bool val)
- {
- WritePrimitive<bool>(fieldName, val, PortableUtils::WriteBool, IGNITE_TYPE_BOOL, 1);
- }
-
- void PortableWriterImpl::WriteBoolArray(const char* fieldName, const bool* val, const int32_t len)
- {
- WritePrimitiveArray<bool>(fieldName, val, len, PortableUtils::WriteBoolArray, IGNITE_TYPE_ARRAY_BOOL, 0);
- }
-
- void PortableWriterImpl::WriteInt16(const int16_t val)
- {
- WritePrimitiveRaw<int16_t>(val, PortableUtils::WriteInt16);
- }
-
- void PortableWriterImpl::WriteInt16Array(const int16_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int16_t>(val, len, PortableUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT);
- }
-
- void PortableWriterImpl::WriteInt16(const char* fieldName, const int16_t val)
- {
- WritePrimitive<int16_t>(fieldName, val, PortableUtils::WriteInt16, IGNITE_TYPE_SHORT, 2);
- }
-
- void PortableWriterImpl::WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len)
- {
- WritePrimitiveArray<int16_t>(fieldName, val, len, PortableUtils::WriteInt16Array, IGNITE_TYPE_ARRAY_SHORT, 1);
- }
-
- void PortableWriterImpl::WriteUInt16(const uint16_t val)
- {
- WritePrimitiveRaw<uint16_t>(val, PortableUtils::WriteUInt16);
- }
-
- void PortableWriterImpl::WriteUInt16Array(const uint16_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<uint16_t>(val, len, PortableUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR);
- }
-
- void PortableWriterImpl::WriteUInt16(const char* fieldName, const uint16_t val)
- {
- WritePrimitive<uint16_t>(fieldName, val, PortableUtils::WriteUInt16, IGNITE_TYPE_CHAR, 2);
- }
-
- void PortableWriterImpl::WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len)
- {
- WritePrimitiveArray<uint16_t>(fieldName, val, len, PortableUtils::WriteUInt16Array, IGNITE_TYPE_ARRAY_CHAR, 1);
- }
-
- void PortableWriterImpl::WriteInt32(const int32_t val)
- {
- WritePrimitiveRaw<int32_t>(val, PortableUtils::WriteInt32);
- }
-
- void PortableWriterImpl::WriteInt32Array(const int32_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int32_t>(val, len, PortableUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT);
- }
-
- void PortableWriterImpl::WriteInt32(const char* fieldName, const int32_t val)
- {
- WritePrimitive<int32_t>(fieldName, val, PortableUtils::WriteInt32, IGNITE_TYPE_INT, 4);
- }
-
- void PortableWriterImpl::WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len)
- {
- WritePrimitiveArray<int32_t>(fieldName, val, len, PortableUtils::WriteInt32Array, IGNITE_TYPE_ARRAY_INT, 2);
- }
-
- void PortableWriterImpl::WriteInt64(const int64_t val)
- {
- WritePrimitiveRaw<int64_t>(val, PortableUtils::WriteInt64);
- }
-
- void PortableWriterImpl::WriteInt64Array(const int64_t* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<int64_t>(val, len, PortableUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG);
- }
-
- void PortableWriterImpl::WriteInt64(const char* fieldName, const int64_t val)
- {
- WritePrimitive<int64_t>(fieldName, val, PortableUtils::WriteInt64, IGNITE_TYPE_LONG, 8);
- }
-
- void PortableWriterImpl::WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len)
- {
- WritePrimitiveArray<int64_t>(fieldName, val, len, PortableUtils::WriteInt64Array, IGNITE_TYPE_ARRAY_LONG, 3);
- }
-
- void PortableWriterImpl::WriteFloat(const float val)
- {
- WritePrimitiveRaw<float>(val, PortableUtils::WriteFloat);
- }
-
- void PortableWriterImpl::WriteFloatArray(const float* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<float>(val, len, PortableUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT);
- }
-
- void PortableWriterImpl::WriteFloat(const char* fieldName, const float val)
- {
- WritePrimitive<float>(fieldName, val, PortableUtils::WriteFloat, IGNITE_TYPE_FLOAT, 4);
- }
-
- void PortableWriterImpl::WriteFloatArray(const char* fieldName, const float* val, const int32_t len)
- {
- WritePrimitiveArray<float>(fieldName, val, len, PortableUtils::WriteFloatArray, IGNITE_TYPE_ARRAY_FLOAT, 2);
- }
-
- void PortableWriterImpl::WriteDouble(const double val)
- {
- WritePrimitiveRaw<double>(val, PortableUtils::WriteDouble);
- }
-
- void PortableWriterImpl::WriteDoubleArray(const double* val, const int32_t len)
- {
- WritePrimitiveArrayRaw<double>(val, len, PortableUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE);
- }
-
- void PortableWriterImpl::WriteDouble(const char* fieldName, const double val)
- {
- WritePrimitive<double>(fieldName, val, PortableUtils::WriteDouble, IGNITE_TYPE_DOUBLE, 8);
- }
-
- void PortableWriterImpl::WriteDoubleArray(const char* fieldName, const double* val, const int32_t len)
- {
- WritePrimitiveArray<double>(fieldName, val, len, PortableUtils::WriteDoubleArray, IGNITE_TYPE_ARRAY_DOUBLE, 3);
- }
-
- void PortableWriterImpl::WriteGuid(const Guid val)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
-
- PortableUtils::WriteGuid(stream, val);
- }
-
- void PortableWriterImpl::WriteGuidArray(const Guid* val, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_ARRAY_UUID);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- {
- Guid elem = *(val + i);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
- PortableUtils::WriteGuid(stream, elem);
- }
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void PortableWriterImpl::WriteGuid(const char* fieldName, const Guid val)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldIdAndLength(fieldName, IGNITE_TYPE_UUID, 1 + 16);
-
- stream->WriteInt8(IGNITE_TYPE_UUID);
-
- PortableUtils::WriteGuid(stream, val);
- }
-
- void PortableWriterImpl::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_ARRAY_UUID);
-
- if (val)
- {
- stream->WriteInt32(5 + len * 17);
- stream->WriteInt8(IGNITE_TYPE_ARRAY_UUID);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- {
- Guid elem = *(val + i);
-
- WriteTopObject(elem);
- }
- }
- else
- {
- stream->WriteInt32(1);
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
- }
-
- void PortableWriterImpl::WriteString(const char* val, const int32_t len)
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- PortableUtils::WriteString(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void PortableWriterImpl::WriteString(const char* fieldName, const char* val, const int32_t len)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldId(fieldName, IGNITE_TYPE_STRING);
-
- if (val)
- {
- int32_t lenPos = stream->Position();
- stream->Position(lenPos + 4);
-
- stream->WriteInt8(IGNITE_TYPE_STRING);
- stream->WriteBool(false);
- stream->WriteInt32(len);
-
- for (int i = 0; i < len; i++)
- stream->WriteUInt16(*(val + i));
-
- stream->WriteInt32(lenPos, stream->Position() - lenPos - 4);
- }
- else
- {
- stream->WriteInt32(1);
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
- }
-
- int32_t PortableWriterImpl::WriteStringArray()
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteStringArray(const char* fieldName)
- {
- StartContainerSession(false);
-
- WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_ARRAY_STRING);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY_STRING);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- void PortableWriterImpl::WriteStringElement(int32_t id, const char* val, int32_t len)
- {
- CheckSession(id);
-
- if (val)
- {
- stream->WriteInt8(IGNITE_TYPE_STRING);
-
- PortableUtils::WriteString(stream, val, len);
- }
- else
- stream->WriteInt8(IGNITE_HDR_NULL);
-
- elemCnt++;
- }
-
- void PortableWriterImpl::WriteNull()
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- void PortableWriterImpl::WriteNull(const char* fieldName)
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- WriteFieldIdAndLength(fieldName, IGNITE_TYPE_OBJECT, 1);
- stream->WriteInt8(IGNITE_HDR_NULL);
- }
-
- int32_t PortableWriterImpl::WriteArray()
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteArray(const char* fieldName)
- {
- StartContainerSession(false);
-
- WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_ARRAY);
-
- stream->WriteInt8(IGNITE_TYPE_ARRAY);
- stream->Position(stream->Position() + 4);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteCollection(CollectionType typ)
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_COLLECTION);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteCollection(const char* fieldName, CollectionType typ)
- {
- StartContainerSession(false);
-
- WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_COLLECTION);
-
- stream->WriteInt8(IGNITE_TYPE_COLLECTION);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteMap(ignite::portable::MapType typ)
- {
- StartContainerSession(true);
-
- stream->WriteInt8(IGNITE_TYPE_MAP);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- int32_t PortableWriterImpl::WriteMap(const char* fieldName, ignite::portable::MapType typ)
- {
- StartContainerSession(false);
-
- WriteFieldIdSkipLength(fieldName, IGNITE_TYPE_MAP);
-
- stream->WriteInt8(IGNITE_TYPE_MAP);
- stream->Position(stream->Position() + 4);
- stream->WriteInt8(typ);
-
- return elemId;
- }
-
- void PortableWriterImpl::CommitContainer(int32_t id)
- {
- CheckSession(id);
-
- if (rawPos == -1)
- {
- int32_t len = stream->Position() - elemPos - 4;
-
- stream->WriteInt32(elemPos + 4, len);
- stream->WriteInt32(elemPos + 9, elemCnt);
- }
- else
- stream->WriteInt32(elemPos + 1, elemCnt);
-
- elemId = 0;
- elemCnt = 0;
- elemPos = -1;
- }
-
- void PortableWriterImpl::SetRawMode()
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- rawPos = stream->Position();
- }
-
- int32_t PortableWriterImpl::GetRawPosition()
- {
- return rawPos == -1 ? stream->Position() : rawPos;
- }
-
- void PortableWriterImpl::CheckRawMode(bool expected)
- {
- bool rawMode = rawPos != -1;
-
- if (expected && !rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only in raw mode.");
- }
- else if (!expected && rawMode) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed in raw mode.");
- }
- }
-
- void PortableWriterImpl::CheckSingleMode(bool expected)
- {
- if (expected && elemId != 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation cannot be performed when container is being written.");
- }
- else if (!expected && elemId == 0) {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Operation can be performed only when container is being written.");
- }
- }
-
- void PortableWriterImpl::StartContainerSession(bool expRawMode)
- {
- CheckRawMode(expRawMode);
- CheckSingleMode(true);
-
- elemId = ++elemIdGen;
- elemPos = stream->Position();
- }
-
- void PortableWriterImpl::CheckSession(int32_t expSes)
- {
- if (elemId != expSes)
- {
- IGNITE_ERROR_1(IgniteError::IGNITE_ERR_PORTABLE, "Containter write session has been finished or is not started yet.");
- }
- }
-
- void PortableWriterImpl::WriteFieldId(const char* fieldName, int32_t fieldTypeId)
- {
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
-
- stream->WriteInt32(fieldId);
-
- if (metaHnd)
- metaHnd->OnFieldWritten(fieldId, fieldName, fieldTypeId);
- }
-
- void PortableWriterImpl::WriteFieldIdSkipLength(const char* fieldName, int32_t fieldTypeId)
- {
- WriteFieldId(fieldName, fieldTypeId);
-
- stream->Position(stream->Position() + 4);
- }
-
- void PortableWriterImpl::WriteFieldIdAndLength(const char* fieldName, int32_t fieldTypeId, int32_t len)
- {
- WriteFieldId(fieldName, fieldTypeId);
-
- stream->WriteInt32(len);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<int8_t>(const int8_t& obj)
- {
- WriteTopObject0<int8_t>(obj, PortableUtils::WriteInt8, IGNITE_TYPE_BYTE);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<bool>(const bool& obj)
- {
- WriteTopObject0<bool>(obj, PortableUtils::WriteBool, IGNITE_TYPE_BOOL);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<int16_t>(const int16_t& obj)
- {
- WriteTopObject0<int16_t>(obj, PortableUtils::WriteInt16, IGNITE_TYPE_SHORT);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<uint16_t>(const uint16_t& obj)
- {
- WriteTopObject0<uint16_t>(obj, PortableUtils::WriteUInt16, IGNITE_TYPE_CHAR);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<int32_t>(const int32_t& obj)
- {
- WriteTopObject0<int32_t>(obj, PortableUtils::WriteInt32, IGNITE_TYPE_INT);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<int64_t>(const int64_t& obj)
- {
- WriteTopObject0<int64_t>(obj, PortableUtils::WriteInt64, IGNITE_TYPE_LONG);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<float>(const float& obj)
- {
- WriteTopObject0<float>(obj, PortableUtils::WriteFloat, IGNITE_TYPE_FLOAT);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<double>(const double& obj)
- {
- WriteTopObject0<double>(obj, PortableUtils::WriteDouble, IGNITE_TYPE_DOUBLE);
- }
-
- template <>
- void PortableWriterImpl::WriteTopObject<Guid>(const Guid& obj)
- {
- WriteTopObject0<Guid>(obj, PortableUtils::WriteGuid, IGNITE_TYPE_UUID);
- }
-
- InteropOutputStream* PortableWriterImpl::GetStream()
- {
- return stream;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_containers.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_containers.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_containers.cpp
deleted file mode 100644
index 8270a13..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_containers.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/portable/portable_containers.h"
-
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace portable
- {
- PortableStringArrayWriter::PortableStringArrayWriter(PortableWriterImpl* impl, const int32_t id) :
- impl(impl), id(id)
- {
- // No-op.
- }
-
- void PortableStringArrayWriter::Write(const char* val)
- {
- if (val)
- Write(val, static_cast<int32_t>(strlen(val)));
- else
- Write(NULL, -1);
- }
-
- void PortableStringArrayWriter::Write(const char* val, const int32_t len)
- {
- impl->WriteStringElement(id, val, len);
- }
-
- void PortableStringArrayWriter::Close()
- {
- impl->CommitContainer(id);
- }
-
- PortableStringArrayReader::PortableStringArrayReader(impl::portable::PortableReaderImpl* impl,
- int32_t id, int32_t size) : impl(impl), id(id), size(size)
- {
- // No-op.
- }
-
- bool PortableStringArrayReader::HasNext()
- {
- return impl->HasNextElement(id);
- }
-
- int32_t PortableStringArrayReader::GetNext(char* res, const int32_t len)
- {
- return impl->ReadStringElement(id, res, len);
- }
-
- int32_t PortableStringArrayReader::GetSize()
- {
- return size;
- }
-
- bool PortableStringArrayReader::IsNull()
- {
- return size == -1;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_raw_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_raw_reader.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_raw_reader.cpp
deleted file mode 100644
index f659913..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_raw_reader.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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.
- */
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/portable/portable_raw_reader.h"
-
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace portable
- {
- PortableRawReader::PortableRawReader(PortableReaderImpl* impl) : impl(impl)
- {
- // No-op.
- }
-
- int8_t PortableRawReader::ReadInt8()
- {
- return impl->ReadInt8();
- }
-
- int32_t PortableRawReader::ReadInt8Array(int8_t* res, const int32_t len)
- {
- return impl->ReadInt8Array(res, len);
- }
-
- bool PortableRawReader::ReadBool()
- {
- return impl->ReadBool();
- }
-
- int32_t PortableRawReader::ReadBoolArray(bool* res, const int32_t len)
- {
- return impl->ReadBoolArray(res, len);
- }
-
- int16_t PortableRawReader::ReadInt16()
- {
- return impl->ReadInt16();
- }
-
- int32_t PortableRawReader::ReadInt16Array(int16_t* res, const int32_t len)
- {
- return impl->ReadInt16Array(res, len);
- }
-
- uint16_t PortableRawReader::ReadUInt16()
- {
- return impl->ReadUInt16();
- }
-
- int32_t PortableRawReader::ReadUInt16Array(uint16_t* res, const int32_t len)
- {
- return impl->ReadUInt16Array(res, len);
- }
-
- int32_t PortableRawReader::ReadInt32()
- {
- return impl->ReadInt32();
- }
-
- int32_t PortableRawReader::ReadInt32Array(int32_t* res, const int32_t len)
- {
- return impl->ReadInt32Array(res, len);
- }
-
- int64_t PortableRawReader::ReadInt64()
- {
- return impl->ReadInt64();
- }
-
- int32_t PortableRawReader::ReadInt64Array(int64_t* res, const int32_t len)
- {
- return impl->ReadInt64Array(res, len);
- }
-
- float PortableRawReader::ReadFloat()
- {
- return impl->ReadFloat();
- }
-
- int32_t PortableRawReader::ReadFloatArray(float* res, const int32_t len)
- {
- return impl->ReadFloatArray(res, len);
- }
-
- double PortableRawReader::ReadDouble()
- {
- return impl->ReadDouble();
- }
-
- int32_t PortableRawReader::ReadDoubleArray(double* res, const int32_t len)
- {
- return impl->ReadDoubleArray(res, len);
- }
-
- Guid PortableRawReader::ReadGuid()
- {
- return impl->ReadGuid();
- }
-
- int32_t PortableRawReader::ReadGuidArray(Guid* res, const int32_t len)
- {
- return impl->ReadGuidArray(res, len);
- }
-
- int32_t PortableRawReader::ReadString(char* res, const int32_t len)
- {
- return impl->ReadString(res, len);
- }
-
- PortableStringArrayReader PortableRawReader::ReadStringArray()
- {
- int32_t size;
-
- int32_t id = impl->ReadStringArray(&size);
-
- return PortableStringArrayReader(impl, id, size);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_raw_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_raw_writer.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_raw_writer.cpp
deleted file mode 100644
index c682abe..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_raw_writer.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/portable/portable_raw_writer.h"
-
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace portable
- {
- PortableRawWriter::PortableRawWriter(PortableWriterImpl* impl) : impl(impl)
- {
- // No-op.
- }
-
- void PortableRawWriter::WriteInt8(const int8_t val)
- {
- impl->WriteInt8(val);
- }
-
- void PortableRawWriter::WriteInt8Array(const int8_t* val, const int32_t len)
- {
- impl->WriteInt8Array(val, len);
- }
-
- void PortableRawWriter::WriteBool(const bool val)
- {
- impl->WriteBool(val);
- }
-
- void PortableRawWriter::WriteBoolArray(const bool* val, const int32_t len)
- {
- impl->WriteBoolArray(val, len);
- }
-
- void PortableRawWriter::WriteInt16(const int16_t val)
- {
- impl->WriteInt16(val);
- }
-
- void PortableRawWriter::WriteInt16Array(const int16_t* val, const int32_t len)
- {
- impl->WriteInt16Array(val, len);
- }
-
- void PortableRawWriter::WriteUInt16(const uint16_t val)
- {
- impl->WriteUInt16(val);
- }
-
- void PortableRawWriter::WriteUInt16Array(const uint16_t* val, const int32_t len)
- {
- impl->WriteUInt16Array(val, len);
- }
-
- void PortableRawWriter::WriteInt32(const int32_t val)
- {
- impl->WriteInt32(val);
- }
-
- void PortableRawWriter::WriteInt32Array(const int32_t* val, const int32_t len)
- {
- impl->WriteInt32Array(val, len);
- }
-
- void PortableRawWriter::WriteInt64(const int64_t val)
- {
- impl->WriteInt64(val);
- }
-
- void PortableRawWriter::WriteInt64Array(const int64_t* val, const int32_t len)
- {
- impl->WriteInt64Array(val, len);
- }
-
- void PortableRawWriter::WriteFloat(const float val)
- {
- impl->WriteFloat(val);
- }
-
- void PortableRawWriter::WriteFloatArray(const float* val, const int32_t len)
- {
- impl->WriteFloatArray(val, len);
- }
-
- void PortableRawWriter::WriteDouble(const double val)
- {
- impl->WriteDouble(val);
- }
-
- void PortableRawWriter::WriteDoubleArray(const double* val, const int32_t len)
- {
- impl->WriteDoubleArray(val, len);
- }
-
- void PortableRawWriter::WriteGuid(const Guid val)
- {
- impl->WriteGuid(val);
- }
-
- void PortableRawWriter::WriteGuidArray(const Guid* val, const int32_t len)
- {
- impl->WriteGuidArray(val, len);
- }
-
- void PortableRawWriter::WriteString(const char* val)
- {
- if (val)
- WriteString(val, static_cast<int32_t>(strlen(val)));
- else
- WriteNull();
- }
-
- void PortableRawWriter::WriteString(const char* val, const int32_t len)
- {
- impl->WriteString(val, len);
- }
-
- PortableStringArrayWriter PortableRawWriter::WriteStringArray()
- {
- int32_t id = impl->WriteStringArray();
-
- return PortableStringArrayWriter(impl, id);
- }
-
- void PortableRawWriter::WriteNull()
- {
- impl->WriteNull();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_reader.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_reader.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_reader.cpp
deleted file mode 100644
index 515216d..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_reader.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.
- */
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/portable/portable_reader.h"
-
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace portable
- {
- PortableReader::PortableReader(PortableReaderImpl* impl) : impl(impl)
- {
- // No-op.
- }
-
- int8_t PortableReader::ReadInt8(const char* fieldName)
- {
- return impl->ReadInt8(fieldName);
- }
-
- int32_t PortableReader::ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len)
- {
- return impl->ReadInt8Array(fieldName, res, len);
- }
-
- bool PortableReader::ReadBool(const char* fieldName)
- {
- return impl->ReadBool(fieldName);
- }
-
- int32_t PortableReader::ReadBoolArray(const char* fieldName, bool* res, const int32_t len)
- {
- return impl->ReadBoolArray(fieldName, res, len);
- }
-
- int16_t PortableReader::ReadInt16(const char* fieldName)
- {
- return impl->ReadInt16(fieldName);
- }
-
- int32_t PortableReader::ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len)
- {
- return impl->ReadInt16Array(fieldName, res, len);
- }
-
- uint16_t PortableReader::ReadUInt16(const char* fieldName)
- {
- return impl->ReadUInt16(fieldName);
- }
-
- int32_t PortableReader::ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len)
- {
- return impl->ReadUInt16Array(fieldName, res, len);
- }
-
- int32_t PortableReader::ReadInt32(const char* fieldName)
- {
- return impl->ReadInt32(fieldName);
- }
-
- int32_t PortableReader::ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len)
- {
- return impl->ReadInt32Array(fieldName, res, len);
- }
-
- int64_t PortableReader::ReadInt64(const char* fieldName)
- {
- return impl->ReadInt64(fieldName);
- }
-
- int32_t PortableReader::ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len)
- {
- return impl->ReadInt64Array(fieldName, res, len);
- }
-
- float PortableReader::ReadFloat(const char* fieldName)
- {
- return impl->ReadFloat(fieldName);
- }
-
- int32_t PortableReader::ReadFloatArray(const char* fieldName, float* res, const int32_t len)
- {
- return impl->ReadFloatArray(fieldName, res, len);
- }
-
- double PortableReader::ReadDouble(const char* fieldName)
- {
- return impl->ReadDouble(fieldName);
- }
-
- int32_t PortableReader::ReadDoubleArray(const char* fieldName, double* res, const int32_t len)
- {
- return impl->ReadDoubleArray(fieldName, res, len);
- }
-
- Guid PortableReader::ReadGuid(const char* fieldName)
- {
- return impl->ReadGuid(fieldName);
- }
-
- int32_t PortableReader::ReadGuidArray(const char* fieldName, Guid* res, const int32_t len)
- {
- return impl->ReadGuidArray(fieldName, res, len);
- }
-
- int32_t PortableReader::ReadString(const char* fieldName, char* res, const int32_t len)
- {
- return impl->ReadString(fieldName, res, len);
- }
-
- PortableStringArrayReader PortableReader::ReadStringArray(const char* fieldName)
- {
- int32_t size;
-
- int32_t id = impl->ReadStringArray(fieldName, &size);
-
- return PortableStringArrayReader(impl, id, size);
- }
-
- PortableRawReader PortableReader::RawReader()
- {
- impl->SetRawMode();
-
- return PortableRawReader(impl);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_type.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_type.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_type.cpp
deleted file mode 100644
index e22f869..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_type.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/portable/portable_type.h"
-
-namespace ignite
-{
- namespace portable
- {
- int32_t GetPortableStringHashCode(const char* val)
- {
- if (val)
- {
- int32_t hash = 0;
-
- int i = 0;
-
- while (true)
- {
- char c = *(val + i++);
-
- if (c == '\0')
- break;
-
- if ('A' <= c && c <= 'Z')
- c = c | 0x20;
-
- hash = 31 * hash + c;
- }
-
- return hash;
- }
- else
- return 0;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/src/portable/portable_writer.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/src/portable/portable_writer.cpp b/modules/platform/src/main/cpp/core/src/portable/portable_writer.cpp
deleted file mode 100644
index f31b9dd..0000000
--- a/modules/platform/src/main/cpp/core/src/portable/portable_writer.cpp
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/portable/portable_writer_impl.h"
-#include "ignite/portable/portable_writer.h"
-
-using namespace ignite::impl::portable;
-
-namespace ignite
-{
- namespace portable
- {
- PortableWriter::PortableWriter(PortableWriterImpl* impl) : impl(impl)
- {
- // No-op.
- }
-
- void PortableWriter::WriteInt8(const char* fieldName, const int8_t val)
- {
- impl->WriteInt8(fieldName, val);
- }
-
- void PortableWriter::WriteInt8Array(const char* fieldName, const int8_t* val, const int32_t len)
- {
- impl->WriteInt8Array(fieldName, val, len);
- }
-
- void PortableWriter::WriteBool(const char* fieldName, const bool val)
- {
- impl->WriteBool(fieldName, val);
- }
-
- void PortableWriter::WriteBoolArray(const char* fieldName, const bool* val, const int32_t len)
- {
- impl->WriteBoolArray(fieldName, val, len);
- }
-
- void PortableWriter::WriteInt16(const char* fieldName, const int16_t val)
- {
- impl->WriteInt16(fieldName, val);
- }
-
- void PortableWriter::WriteInt16Array(const char* fieldName, const int16_t* val, const int32_t len)
- {
- impl->WriteInt16Array(fieldName, val, len);
- }
-
- void PortableWriter::WriteUInt16(const char* fieldName, const uint16_t val)
- {
- impl->WriteUInt16(fieldName, val);
- }
-
- void PortableWriter::WriteUInt16Array(const char* fieldName, const uint16_t* val, const int32_t len)
- {
- impl->WriteUInt16Array(fieldName, val, len);
- }
-
- void PortableWriter::WriteInt32(const char* fieldName, const int32_t val)
- {
- impl->WriteInt32(fieldName, val);
- }
-
- void PortableWriter::WriteInt32Array(const char* fieldName, const int32_t* val, const int32_t len)
- {
- impl->WriteInt32Array(fieldName, val, len);
- }
-
- void PortableWriter::WriteInt64(const char* fieldName, const int64_t val)
- {
- impl->WriteInt64(fieldName, val);
- }
-
- void PortableWriter::WriteInt64Array(const char* fieldName, const int64_t* val, const int32_t len)
- {
- impl->WriteInt64Array(fieldName, val, len);
- }
-
- void PortableWriter::WriteFloat(const char* fieldName, const float val)
- {
- impl->WriteFloat(fieldName, val);
- }
-
- void PortableWriter::WriteFloatArray(const char* fieldName, const float* val, const int32_t len)
- {
- impl->WriteFloatArray(fieldName, val, len);
- }
-
- void PortableWriter::WriteDouble(const char* fieldName, const double val)
- {
- impl->WriteDouble(fieldName, val);
- }
-
- void PortableWriter::WriteDoubleArray(const char* fieldName, const double* val, const int32_t len)
- {
- impl->WriteDoubleArray(fieldName, val, len);
- }
-
- void PortableWriter::WriteGuid(const char* fieldName, const Guid val)
- {
- impl->WriteGuid(fieldName, val);
- }
-
- void PortableWriter::WriteGuidArray(const char* fieldName, const Guid* val, const int32_t len)
- {
- impl->WriteGuidArray(fieldName, val, len);
- }
-
- void PortableWriter::WriteString(const char* fieldName, const char* val)
- {
- if (val)
- WriteString(fieldName, val, static_cast<int32_t>(strlen(val)));
- else
- WriteNull(fieldName);
- }
-
- void PortableWriter::WriteString(const char* fieldName, const char* val, const int32_t len)
- {
- impl->WriteString(fieldName, val, len);
- }
-
- PortableStringArrayWriter PortableWriter::WriteStringArray(const char* fieldName)
- {
- int32_t id = impl->WriteStringArray(fieldName);
-
- return PortableStringArrayWriter(impl, id);
- }
-
- void PortableWriter::WriteNull(const char* fieldName)
- {
- impl->WriteNull(fieldName);
- }
-
- PortableRawWriter PortableWriter::RawWriter()
- {
- impl->SetRawMode();
-
- return PortableRawWriter(impl);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/Makefile.am b/modules/platform/src/main/cpp/examples/Makefile.am
deleted file mode 100644
index d99cd82..0000000
--- a/modules/platform/src/main/cpp/examples/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-SUBDIRS = .
-DIST_SUBDIRS = . include
-
-AM_CPPFLAGS = -I$(srcdir)/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
-AM_CXXFLAGS = -Wall -std=c++0x
-
-noinst_PROGRAMS = ignite-putgetexample
-
-ignite_putgetexample_SOURCES = src/putgetexample.cpp
-
-ignite_putgetexample_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite
-
-run-check: check
- ./ignite-putgetexample -p
-
-clean-local: clean-check
- $(RM) *.gcno *.gcda
-
-clean-check:
- $(RM) $(ignite_putgetexample_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/README.txt
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/README.txt b/modules/platform/src/main/cpp/examples/README.txt
deleted file mode 100644
index a00cb3b..0000000
--- a/modules/platform/src/main/cpp/examples/README.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-Ignite C++ Examples
-==================================
-
-Common requirements
-----------------------------------
- * Java Development Kit (JDK) must be installed: https://java.com/en/download/index.jsp
- * JAVA_HOME environment variable must be set pointing to Java installation directory.
- * IGNITE_HOME environment variable must be set to Ignite installation directory.
- * Ignite must be build and packaged using Maven. You can use the followin Maven command: mvn clean package -DskipTests
- * Ignite C++ must be built according to instructions for your platform.
-
-Running examples on Linux
-----------------------------------
-
-Prerequisites:
- * GCC, g++, autotools, automake, and libtool must be installed.
-
-To build examples execute the following commands one by one from $IGNITE_HOME/platforms/cpp/examples directory:
- * libtoolize
- * aclocal
- * autoheader
- * automake --add-missing
- * autoreconf
- * ./configure
- * make
-
-As a result several executables will appear in example's directory.
-
-Before running examples ensure that:
- * LD_LIBRARY_PATH environment variable is set and pointing to a directory with "libjvm.so" library. Typically this
- library is located in $JAVA_HOME/jre/lib/amd64/server directory.
-
-
-Running examples on Windows
-----------------------------------
-
-Prerequisites:
- * Microsoft Visual Studio (tm) 2010 or higher must be installed.
- * Windows SDK 7.1 must be installed.
-
-Open Visual Studio solution %IGNITE_HOME%\platforms\cpp\examples\project\vs\ignite-examples.sln and select proper
-platform (x64 or x86). Run the solution.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/config/example-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/config/example-cache.xml b/modules/platform/src/main/cpp/examples/config/example-cache.xml
deleted file mode 100644
index beed238..0000000
--- a/modules/platform/src/main/cpp/examples/config/example-cache.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <!-- Set to true to enable distributed class loading for examples, default is false. -->
- <property name="peerClassLoadingEnabled" value="true"/>
-
- <property name="cacheConfiguration">
- <list>
- <!--
- Partitioned cache example configuration with portable objects enabled.
- Used in .NET example that is available only in enterprise edition.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="backups" value="1"/>
- </bean>
-
- <!--
- Partitioned cache example configuration.
- Used in .NET cache store example that is available only in enterprise edition.
- -->
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="tx"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="backups" value="1"/>
- </bean>
- </list>
- </property>
-
- <!-- Explicitly configure TCP discovery SPI to provide list of initial nodes. -->
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <!--
- Ignite provides several options for automatic discovery that can be used
- instead os static IP based discovery.
- -->
- <!-- Uncomment static IP finder to enable static-based discovery of initial nodes. -->
- <!--<bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">-->
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/configure.ac b/modules/platform/src/main/cpp/examples/configure.ac
deleted file mode 100644
index a5e902d..0000000
--- a/modules/platform/src/main/cpp/examples/configure.ac
+++ /dev/null
@@ -1,38 +0,0 @@
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.69])
-AC_INIT([Ingnite C++ examples],[1.4.0],[dec@ignite.apache.org],[ignite-examples],[ignite.apache.org])
-AC_CONFIG_SRCDIR(src)
-
-AC_CANONICAL_SYSTEM
-AC_CONFIG_MACRO_DIR([m4])
-AC_LANG([C++])
-
-# Initialize automake
-AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
-AC_CONFIG_HEADER(config.h)
-
-AM_PROG_AR
-
-# Checks for programs.
-GXX="-g -O2"
-
-AC_PROG_CXX
-
-# Initialize Libtool
-LT_INIT
-
-AC_ARG_ENABLE([debug],
- [AS_HELP_STRING([--enable-debug],[enable debug build [default=no]])],
- [],[enable_debug=no])
-
-if test "x$enable_debug" = xyes; then
- CXXFLAGS="-g -O0"
-else
- CXXFLAGS="-g -O3"
-fi
-
-AC_CONFIG_FILES(Makefile)
-
-AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/include/Makefile.am b/modules/platform/src/main/cpp/examples/include/Makefile.am
deleted file mode 100644
index 13a8816..0000000
--- a/modules/platform/src/main/cpp/examples/include/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/examples/address.h \
- ignite/examples/organization.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/include/ignite/examples/address.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/include/ignite/examples/address.h b/modules/platform/src/main/cpp/examples/include/ignite/examples/address.h
deleted file mode 100644
index 29dbb0c..0000000
--- a/modules/platform/src/main/cpp/examples/include/ignite/examples/address.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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_EXAMPLES_ADDRESS
-#define _IGNITE_EXAMPLES_ADDRESS
-
-#include "ignite/portable/portable.h"
-
-namespace ignite
-{
- namespace examples
- {
- struct Address
- {
- Address()
- {
- street = "";
- zip = 0;
- }
-
- Address(std::string street, int zip) : street(street), zip(zip)
- {
- // No-op.
- }
-
- std::string ToString()
- {
- std::ostringstream oss;
-
- oss << "Address [street=" << street << ", zip=" << zip << "]";
-
- return oss.str();
- }
-
- std::string street;
- int zip;
- };
- }
-}
-
-namespace ignite
-{
- namespace portable
- {
- template<>
- struct PortableType<ignite::examples::Address>
- {
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("Address");
- }
-
- std::string GetTypeName()
- {
- return "Address";
- }
-
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- int32_t GetHashCode(ignite::examples::Address obj)
- {
- return 0;
- }
-
- bool IsNull(ignite::examples::Address obj)
- {
- return false;
- }
-
- ignite::examples::Address GetNull()
- {
- return ignite::examples::Address("", 0);
- }
-
- void Write(PortableWriter& writer, ignite::examples::Address obj)
- {
- writer.WriteString("street", obj.street);
- writer.WriteInt32("zip", obj.zip);
- }
-
- ignite::examples::Address Read(PortableReader& reader)
- {
- std::string street = reader.ReadString("street");
- int zip = reader.ReadInt32("zip");
-
- return ignite::examples::Address(street, zip);
- }
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/include/ignite/examples/organization.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/include/ignite/examples/organization.h b/modules/platform/src/main/cpp/examples/include/ignite/examples/organization.h
deleted file mode 100644
index c9137c9..0000000
--- a/modules/platform/src/main/cpp/examples/include/ignite/examples/organization.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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_EXAMPLES_ORGANIZATION
-#define _IGNITE_EXAMPLES_ORGANIZATION
-
-#include "ignite/portable/portable.h"
-
-#include "ignite/examples/address.h"
-
-namespace ignite
-{
- namespace examples
- {
- struct Organization
- {
- Organization()
- {
- name = "";
- addr = Address();
- }
-
- Organization(std::string name, Address addr) : name(name), addr(addr)
- {
- // No-op.
- }
-
- std::string ToString()
- {
- std::ostringstream oss;
-
- oss << "Organization [name=" << name << ", Address=" << addr.ToString() << "]";
-
- return oss.str();
- }
-
- std::string name;
- Address addr;
- };
- }
-}
-
-namespace ignite
-{
- namespace portable
- {
- template<>
- struct PortableType<ignite::examples::Organization>
- {
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("Organization");
- }
-
- std::string GetTypeName()
- {
- return "Organization";
- }
-
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- int32_t GetHashCode(ignite::examples::Organization obj)
- {
- return 0;
- }
-
- bool IsNull(ignite::examples::Organization obj)
- {
- return false;
- }
-
- ignite::examples::Organization GetNull()
- {
- return ignite::examples::Organization("", ignite::examples::Address());
- }
-
- void Write(PortableWriter& writer, ignite::examples::Organization obj)
- {
- writer.WriteString("name", obj.name);
- writer.WriteObject<ignite::examples::Address>("addr", obj.addr);
- }
-
- ignite::examples::Organization Read(PortableReader& reader)
- {
- std::string name = reader.ReadString("name");
- ignite::examples::Address addr = reader.ReadObject<ignite::examples::Address>("addr");
-
- return ignite::examples::Organization(name, addr);
- }
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.sln
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.sln b/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.sln
deleted file mode 100644
index 4970654..0000000
--- a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.sln
+++ /dev/null
@@ -1,19 +0,0 @@
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ignite-examples", "ignite-examples.vcxproj", "{34935DEC-80FC-4168-AA52-3DBFF4F79B6B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x64.ActiveCfg = Release|x64
- {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x64.Build.0 = Release|x64
- {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x86.ActiveCfg = Release|Win32
- {34935DEC-80FC-4168-AA52-3DBFF4F79B6B}.Release|x86.Build.0 = Release|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj b/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj
deleted file mode 100644
index 13ec564..0000000
--- a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{34935DEC-80FC-4168-AA52-3DBFF4F79B6B}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>igniteexamples</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v120</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\include;..\..\..\src\common\os\win\include;..\..\..\src\common\include;..\..\..\src\core\os\win\include;..\..\..\src\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>jvm.lib;ignite.common.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>..\..\..\src\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- </Link>
- <PostBuildEvent>
- <Command>copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
-copy "$(ProjectDir)..\..\..\src\\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;..\..\include;..\..\..\src\common\os\win\include;..\..\..\src\common\include;..\..\..\src\core\os\win\include;..\..\..\src\core\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>jvm.lib;ignite.common.lib;ignite.core.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>..\..\..\src\project\vs\$(Platform)\$(Configuration)\;$(JAVA_HOME)\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- </Link>
- <PostBuildEvent>
- <Command>copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.common.dll" "$(OutDir)"
-copy "$(ProjectDir)..\..\..\src\project\vs\$(Platform)\$(Configuration)\ignite.core.dll" "$(OutDir)"</Command>
- </PostBuildEvent>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\..\src\putgetexample.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\examples\address.h" />
- <ClInclude Include="..\..\include\ignite\examples\organization.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj.filters b/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj.filters
deleted file mode 100644
index ca62db7..0000000
--- a/modules/platform/src/main/cpp/examples/project/vs/ignite-examples.vcxproj.filters
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Resource Files">
- <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
- <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\src\putgetexample.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\examples\address.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\examples\organization.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/examples/src/putgetexample.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/examples/src/putgetexample.cpp b/modules/platform/src/main/cpp/examples/src/putgetexample.cpp
deleted file mode 100644
index 206a2f4..0000000
--- a/modules/platform/src/main/cpp/examples/src/putgetexample.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * 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.
- */
-
-#include <iostream>
-
-#include "ignite/ignite.h"
-#include "ignite/ignition.h"
-
-#include "ignite/examples/organization.h"
-
-using namespace ignite;
-using namespace cache;
-
-using namespace examples;
-
-/*
- * Execute individual Put and Get operations.
- *
- * @param cache Cache instance.
- */
-void PutGet(Cache<int, Organization>& cache)
-{
- // Create new Organization to store in cache.
- Organization org("Microsoft", Address("1096 Eddy Street, San Francisco, CA", 94109));
-
- // Put organization to cache.
- cache.Put(1, org);
-
- // Get recently created employee as a strongly-typed fully de-serialized instance.
- Organization orgFromCache = cache.Get(1);
-
- std::cout << ">>> Retrieved organization instance from cache: " << std::endl;
- std::cout << orgFromCache.ToString() << std::endl;
- std::cout << std::endl;
-}
-
-/*
- * Execute bulk Put and Get operations.
- */
-void PutGetAll(Cache<int, Organization>& cache)
-{
- // Create new Organizations to store in cache.
- Organization org1("Microsoft", Address("1096 Eddy Street, San Francisco, CA", 94109));
- Organization org2("Red Cross", Address("184 Fidler Drive, San Antonio, TX", 78205));
-
- // Put created data entries to cache.
- std::map<int, Organization> vals;
-
- vals[1] = org1;
- vals[2] = org2;
-
- cache.PutAll(vals);
-
- // Get recently created organizations as a strongly-typed fully de-serialized instances.
- std::set<int> keys;
-
- keys.insert(1);
- keys.insert(2);
-
- std::map<int, Organization> valsFromCache = cache.GetAll(keys);
-
- std::cout << ">>> Retrieved organization instances from cache: " << std::endl;
-
- for (std::map<int, Organization>::iterator it = valsFromCache.begin(); it != valsFromCache.end(); ++it)
- std::cout << it->second.ToString() << std::endl;
-
- std::cout << std::endl;
-}
-
-int main()
-{
- IgniteConfiguration cfg;
-
- cfg.jvmInitMem = 512;
- cfg.jvmMaxMem = 512;
-
- cfg.springCfgPath = "platforms/cpp/examples/config/example-cache.xml";
-
- try
- {
- // Start a node.
- Ignite grid = Ignition::Start(cfg);
-
- std::cout << std::endl;
- std::cout << ">>> Cache put-get example started." << std::endl;
- std::cout << std::endl;
-
- // Get cache instance.
- Cache<int, Organization> cache = grid.GetCache<int, Organization>(NULL);
-
- // Clear cache.
- cache.Clear();
-
- PutGet(cache);
- PutGetAll(cache);
-
- // Stop node.
- Ignition::StopAll(false);
- }
- catch (IgniteError& err)
- {
- std::cout << "An error occurred: " << err.GetText() << std::endl;
- }
-
- std::cout << std::endl;
- std::cout << ">>> Example finished, press any key to exit ..." << std::endl;
- std::cout << std::endl;
-
- std::cin.get();
-
- return 0;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/project/vs/ignite.sln
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/project/vs/ignite.sln b/modules/platform/src/main/cpp/project/vs/ignite.sln
deleted file mode 100644
index f34d8e5..0000000
--- a/modules/platform/src/main/cpp/project/vs/ignite.sln
+++ /dev/null
@@ -1,46 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core-test", "..\..\core-test\project\vs\core-test.vcxproj", "{133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Win32 = Debug|Win32
- Debug|x64 = Debug|x64
- Release|Win32 = Release|Win32
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|Win32.ActiveCfg = Debug|Win32
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|Win32.Build.0 = Debug|Win32
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|x64.ActiveCfg = Debug|x64
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Debug|x64.Build.0 = Debug|x64
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|Win32.ActiveCfg = Release|Win32
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|Win32.Build.0 = Release|Win32
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|x64.ActiveCfg = Release|x64
- {133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/project/vs/ignite.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/project/vs/ignite.slnrel b/modules/platform/src/main/cpp/project/vs/ignite.slnrel
deleted file mode 100644
index 7456097..0000000
--- a/modules/platform/src/main/cpp/project/vs/ignite.slnrel
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/project/vs/ignite_x86.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/project/vs/ignite_x86.slnrel b/modules/platform/src/main/cpp/project/vs/ignite_x86.slnrel
deleted file mode 100644
index b716b49..0000000
--- a/modules/platform/src/main/cpp/project/vs/ignite_x86.slnrel
+++ /dev/null
@@ -1,33 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "core", "..\..\core\project\vs\core.vcxproj", "{E2DEA693-F2EA-43C2-A813-053378F6E4DB}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|Win32 = Release|Win32
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|Win32.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|Win32.Build.0 = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.ActiveCfg = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|Win32.Build.0 = Debug|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.ActiveCfg = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Debug|x64.Build.0 = Debug|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.ActiveCfg = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|Win32.Build.0 = Release|Win32
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.ActiveCfg = Release|x64
- {E2DEA693-F2EA-43C2-A813-053378F6E4DB}.Release|x64.Build.0 = Release|x64
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
[05/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
deleted file mode 100644
index 12c9992..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/AbstractTaskTest.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Tests.Process;
- using NUnit.Framework;
-
- /// <summary>
- /// Base class for all task-related tests.
- /// </summary>
- public abstract class AbstractTaskTest
- {
- /** */
- protected const string Grid1Name = "grid1";
-
- /** */
- protected const string Grid2Name = "grid2";
-
- /** */
- protected const string Grid3Name = "grid3";
-
- /** */
- protected const string Cache1Name = "cache1";
-
- /** Whether this is a test with forked JVMs. */
- private readonly bool _fork;
-
- /** First node. */
- [NonSerialized]
- protected IIgnite Grid1;
-
- /** Second node. */
- [NonSerialized]
- private IIgnite _grid2;
-
- /** Third node. */
- [NonSerialized]
- private IIgnite _grid3;
-
- /** Second process. */
- [NonSerialized]
- private IgniteProcess _proc2;
-
- /** Third process. */
- [NonSerialized]
- private IgniteProcess _proc3;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected AbstractTaskTest(bool fork)
- {
- _fork = fork;
- }
-
- /// <summary>
- /// Initialization routine.
- /// </summary>
- [TestFixtureSetUp]
- public void InitClient()
- {
- TestUtils.KillProcesses();
-
- if (_fork)
- {
- Grid1 = Ignition.Start(Configuration("config\\compute\\compute-standalone.xml"));
-
- _proc2 = Fork("config\\compute\\compute-standalone.xml");
-
- while (true)
- {
- if (!_proc2.Alive)
- throw new Exception("Process 2 died unexpectedly: " + _proc2.Join());
-
- if (Grid1.GetCluster().GetNodes().Count < 2)
- Thread.Sleep(100);
- else
- break;
- }
-
- _proc3 = Fork("config\\compute\\compute-standalone.xml");
-
- while (true)
- {
- if (!_proc3.Alive)
- throw new Exception("Process 3 died unexpectedly: " + _proc3.Join());
-
- if (Grid1.GetCluster().GetNodes().Count < 3)
- Thread.Sleep(100);
- else
- break;
- }
- }
- else
- {
- Grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml"));
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
- _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
- }
- }
-
- [SetUp]
- public void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- [TestFixtureTearDown]
- public void StopClient()
- {
- if (Grid1 != null)
- Ignition.Stop(Grid1.Name, true);
-
- if (_fork)
- {
- if (_proc2 != null) {
- _proc2.Kill();
-
- _proc2.Join();
- }
-
- if (_proc3 != null)
- {
- _proc3.Kill();
-
- _proc3.Join();
- }
- }
- else
- {
- if (_grid2 != null)
- Ignition.Stop(_grid2.Name, true);
-
- if (_grid3 != null)
- Ignition.Stop(_grid3.Name, true);
- }
- }
-
- /// <summary>
- /// Configuration for node.
- /// </summary>
- /// <param name="path">Path to Java XML configuration.</param>
- /// <returns>Node configuration.</returns>
- protected IgniteConfiguration Configuration(string path)
- {
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- if (!_fork)
- {
- PortableConfiguration portCfg = new PortableConfiguration();
-
- ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>();
-
- PortableTypeConfigurations(portTypeCfgs);
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.PortableConfiguration = portCfg;
- }
-
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
-
- cfg.JvmOptions = TestUtils.TestJavaOptions();
-
- cfg.SpringConfigUrl = path;
-
- return cfg;
- }
-
- /// <summary>
- /// Create forked process with the following Spring config.
- /// </summary>
- /// <param name="path">Path to Java XML configuration.</param>
- /// <returns>Forked process.</returns>
- private static IgniteProcess Fork(string path)
- {
- return new IgniteProcess(
- "-springConfigUrl=" + path,
- "-J-ea",
- "-J-Xcheck:jni",
- "-J-Xms512m",
- "-J-Xmx512m",
- "-J-DIGNITE_QUIET=false"
- //"-J-Xnoagent", "-J-Djava.compiler=NONE", "-J-Xdebug", "-J-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5006"
- );
- }
-
- /// <summary>
- /// Define portable types.
- /// </summary>
- /// <param name="portTypeCfgs">Portable type configurations.</param>
- protected virtual void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ClosureTaskTest.cs
deleted file mode 100644
index 8664413..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ClosureTaskTest.cs
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for distributed closure executions.
- /// </summary>
- public abstract class ClosureTaskTest : AbstractTaskTest
- {
- /** Amount of multiple clousres. */
- private const int MultiCloCnt = 5;
-
- /** */
- protected const string ErrMsg = "An error has occurred.";
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork mode.</param>
- protected ClosureTaskTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test for single closure returning result.
- /// </summary>
- [Test]
- public void TestExecuteSingle()
- {
- var res = Grid1.GetCompute().Call(OutFunc(false));
-
- CheckResult(res);
- }
-
- /// <summary>
- /// Test for single closure returning exception.
- /// </summary>
- [Test]
- public void TestExecuteSingleException()
- {
- try
- {
- Grid1.GetCompute().Call(OutFunc(true));
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test for multiple closures execution.
- /// </summary>
- [Test]
- public void TestExecuteMultiple()
- {
- var clos = new List<IComputeFunc<object>>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- clos.Add(OutFunc(false));
-
- ICollection<object> ress = Grid1.GetCompute().Call(clos);
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test for multiple closures execution.
- /// </summary>
- [Test]
- public void TestExecuteMultipleReduced()
- {
- var clos = new List<IComputeFunc<object>>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- clos.Add(OutFunc(false));
-
- ICollection<object> ress = Grid1.GetCompute().Call(clos, new Reducer(false));
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test for multiple closures execution with exceptions thrown from some of them.
- /// </summary>
- [Test]
- public void TestExecuteMultipleException()
- {
- var clos = new List<IComputeFunc<object>>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- clos.Add(OutFunc(i % 2 == 0)); // Some closures will be faulty.
-
- try
- {
- Grid1.GetCompute().Call(clos);
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test broadcast out-closure execution.
- /// </summary>
- [Test]
- public void TestBroadcastOut()
- {
- ICollection<object> ress = Grid1.GetCompute().Broadcast(OutFunc(false));
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test broadcast out-closure execution with exception.
- /// </summary>
- [Test]
- public void TestBroadcastOutException()
- {
- try
- {
- Grid1.GetCompute().Broadcast(OutFunc(true));
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test broadcast in-out-closure execution.
- /// </summary>
- [Test]
- public void TestBroadcastInOut()
- {
- ICollection<object> ress = Grid1.GetCompute().Broadcast(Func(false), 1);
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test broadcast in-out-closure execution with exception.
- /// </summary>
- [Test]
- public void TestBroadcastInOutException()
- {
- try
- {
- Grid1.GetCompute().Broadcast(Func(true), 1);
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test apply in-out-closure execution.
- /// </summary>
- [Test]
- public void TestApply()
- {
- object res = Grid1.GetCompute().Apply(Func(false), 1);
-
- CheckResult(res);
- }
-
- /// <summary>
- /// Test apply in-out-closure execution with exception.
- /// </summary>
- [Test]
- public void TestApplyException()
- {
- try
- {
- Grid1.GetCompute().Apply(Func(true), 1);
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test apply multiple in-out-closures execution.
- /// </summary>
- [Test]
- public void TestApplyMultiple()
- {
- var args = new List<object>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- args.Add(1);
-
- Console.WriteLine("START TASK");
-
- var ress = Grid1.GetCompute().Apply(Func(false), args);
-
- Console.WriteLine("END TASK.");
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test apply multiple in-out-closures execution with exception.
- /// </summary>
- [Test]
- public void TestApplyMultipleException()
- {
- ICollection<int> args = new List<int>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- args.Add(1);
-
- try
- {
- Grid1.GetCompute().Apply(Func(true), args);
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test apply multiple in-out-closures execution with reducer.
- /// </summary>
- [Test]
- public void TestApplyMultipleReducer()
- {
- var args = new List<object>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- args.Add(1);
-
- ICollection<object> ress =
- Grid1.GetCompute().Apply(Func(false), args, new Reducer(false));
-
- foreach (object res in ress)
- CheckResult(res);
- }
-
- /// <summary>
- /// Test apply multiple in-out-closures execution with reducer and exception thrown from closure.
- /// </summary>
- [Test]
- public void TestAppylMultipleReducerJobException()
- {
- List<object> args = new List<object>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- args.Add(1);
-
- try
- {
- Grid1.GetCompute().Apply(Func(true), args, new Reducer(false));
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- CheckError(e);
- }
- }
-
- /// <summary>
- /// Test apply multiple in-out-closures execution with reducer and exception thrown from reducer.
- /// </summary>
- [Test]
- public void TestAppylMultipleReducerReduceException()
- {
- var args = new List<object>(MultiCloCnt);
-
- for (int i = 0; i < MultiCloCnt; i++)
- args.Add(1);
-
- try
- {
- Grid1.GetCompute().Apply(Func(false), args, new Reducer(true));
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- Assert.AreEqual(typeof(Exception), e.GetType());
-
- Assert.AreEqual(ErrMsg, e.Message);
- }
- }
-
- /// <summary>
- /// Create out-only closure.
- /// </summary>
- /// <param name="err">Error flag.</param>
- /// <returns>Closure.</returns>
- protected abstract IComputeFunc<object> OutFunc(bool err);
-
- /// <summary>
- /// Create in-out closure.
- /// </summary>
- /// <param name="err">Error flag.</param>
- /// <returns>Closure.</returns>
- protected abstract IComputeFunc<object, object> Func(bool err);
-
- /// <summary>
- /// Check result.
- /// </summary>
- /// <param name="res">Result.</param>
- protected abstract void CheckResult(object res);
-
- /// <summary>
- /// Check error.
- /// </summary>
- /// <param name="err">Error.</param>
- protected abstract void CheckError(Exception err);
-
- /// <summary>
- /// Test reducer.
- /// </summary>
- public class Reducer : IComputeReducer<object, ICollection<object>>
- {
- /** Whether to throw an error on reduce. */
- private readonly bool _err;
-
- /** Results. */
- private readonly ICollection<object> _ress = new List<object>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="err">Error.</param>
- public Reducer(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public bool Collect(object res)
- {
- _ress.Add(res);
-
- return true;
- }
-
- /** <inheritDoc /> */
- public ICollection<object> Reduce()
- {
- if (_err)
- throw new Exception(ErrMsg);
- return _ress;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
deleted file mode 100644
index 039813b..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeApiTest.cs
+++ /dev/null
@@ -1,1281 +0,0 @@
-/*
- * 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.
- */
-
-// ReSharper disable SpecifyACultureInStringConversionExplicitly
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for compute.
- /// </summary>
- public class ComputeApiTest
- {
- /** Echo task name. */
- private const string EchoTask = "org.apache.ignite.platform.PlatformComputeEchoTask";
-
- /** Portable argument task name. */
- private const string PortableArgTask = "org.apache.ignite.platform.PlatformComputePortableArgTask";
-
- /** Broadcast task name. */
- private const string BroadcastTask = "org.apache.ignite.platform.PlatformComputeBroadcastTask";
-
- /** Broadcast task name. */
- private const string DecimalTask = "org.apache.ignite.platform.PlatformComputeDecimalTask";
-
- /** Java portable class name. */
- private const string JavaPortableCls = "GridInteropComputeJavaPortable";
-
- /** Echo type: null. */
- private const int EchoTypeNull = 0;
-
- /** Echo type: byte. */
- private const int EchoTypeByte = 1;
-
- /** Echo type: bool. */
- private const int EchoTypeBool = 2;
-
- /** Echo type: short. */
- private const int EchoTypeShort = 3;
-
- /** Echo type: char. */
- private const int EchoTypeChar = 4;
-
- /** Echo type: int. */
- private const int EchoTypeInt = 5;
-
- /** Echo type: long. */
- private const int EchoTypeLong = 6;
-
- /** Echo type: float. */
- private const int EchoTypeFloat = 7;
-
- /** Echo type: double. */
- private const int EchoTypeDouble = 8;
-
- /** Echo type: array. */
- private const int EchoTypeArray = 9;
-
- /** Echo type: collection. */
- private const int EchoTypeCollection = 10;
-
- /** Echo type: map. */
- private const int EchoTypeMap = 11;
-
- /** Echo type: portable. */
- private const int EchoTypePortable = 12;
-
- /** Echo type: portable (Java only). */
- private const int EchoTypePortableJava = 13;
-
- /** Type: object array. */
- private const int EchoTypeObjArray = 14;
-
- /** Type: portable object array. */
- private const int EchoTypePortableArray = 15;
-
- /** Type: enum. */
- private const int EchoTypeEnum = 16;
-
- /** Type: enum array. */
- private const int EchoTypeEnumArray = 17;
-
- /** First node. */
- private IIgnite _grid1;
-
- /** Second node. */
- private IIgnite _grid2;
-
- /** Third node. */
- private IIgnite _grid3;
-
- /// <summary>
- /// Initialization routine.
- /// </summary>
- [TestFixtureSetUp]
- public void InitClient()
- {
- //TestUtils.JVM_DEBUG = true;
- TestUtils.KillProcesses();
-
- _grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml"));
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
- _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
- }
-
- [TestFixtureTearDown]
- public void StopClient()
- {
- if (_grid1 != null)
- Ignition.Stop(_grid1.Name, true);
-
- if (_grid2 != null)
- Ignition.Stop(_grid2.Name, true);
-
- if (_grid3 != null)
- Ignition.Stop(_grid3.Name, true);
- }
-
- [TearDown]
- public void AfterTest()
- {
- TestUtils.AssertHandleRegistryIsEmpty(1000, _grid1, _grid2, _grid3);
- }
-
- /// <summary>
- /// Test that it is possible to get projection from grid.
- /// </summary>
- [Test]
- public void TestProjection()
- {
- IClusterGroup prj = _grid1.GetCluster();
-
- Assert.NotNull(prj);
-
- Assert.IsTrue(prj == prj.Ignite);
- }
-
- /// <summary>
- /// Test getting cache with default (null) name.
- /// </summary>
- [Test]
- public void TestCacheDefaultName()
- {
- var cache = _grid1.GetCache<int, int>(null);
-
- Assert.IsNotNull(cache);
-
- cache.GetAndPut(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- /// <summary>
- /// Test non-existent cache.
- /// </summary>
- [Test]
- public void TestNonExistentCache()
- {
- Assert.Catch(typeof(ArgumentException), () =>
- {
- _grid1.GetCache<int, int>("bad_name");
- });
- }
-
- /// <summary>
- /// Test node content.
- /// </summary>
- [Test]
- public void TestNodeContent()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- foreach (IClusterNode node in nodes)
- {
- Assert.NotNull(node.Addresses);
- Assert.IsTrue(node.Addresses.Count > 0);
- Assert.Throws<NotSupportedException>(() => node.Addresses.Add("addr"));
-
- Assert.NotNull(node.GetAttributes());
- Assert.IsTrue(node.GetAttributes().Count > 0);
- Assert.Throws<NotSupportedException>(() => node.GetAttributes().Add("key", "val"));
-
- Assert.NotNull(node.HostNames);
- Assert.Throws<NotSupportedException>(() => node.HostNames.Add("h"));
-
- Assert.IsTrue(node.Id != Guid.Empty);
-
- Assert.IsTrue(node.Order > 0);
-
- Assert.NotNull(node.GetMetrics());
- }
- }
-
- /// <summary>
- /// Test cluster metrics.
- /// </summary>
- [Test]
- public void TestClusterMetrics()
- {
- var cluster = _grid1.GetCluster();
-
- IClusterMetrics metrics = cluster.GetMetrics();
-
- Assert.IsNotNull(metrics);
-
- Assert.AreEqual(cluster.GetNodes().Count, metrics.TotalNodes);
-
- Thread.Sleep(2000);
-
- IClusterMetrics newMetrics = cluster.GetMetrics();
-
- Assert.IsFalse(metrics == newMetrics);
- Assert.IsTrue(metrics.LastUpdateTime < newMetrics.LastUpdateTime);
- }
-
- /// <summary>
- /// Test cluster metrics.
- /// </summary>
- [Test]
- public void TestNodeMetrics()
- {
- var node = _grid1.GetCluster().GetNode();
-
- IClusterMetrics metrics = node.GetMetrics();
-
- Assert.IsNotNull(metrics);
-
- Assert.IsTrue(metrics == node.GetMetrics());
-
- Thread.Sleep(2000);
-
- IClusterMetrics newMetrics = node.GetMetrics();
-
- Assert.IsFalse(metrics == newMetrics);
- Assert.IsTrue(metrics.LastUpdateTime < newMetrics.LastUpdateTime);
- }
-
- /// <summary>
- /// Test cluster metrics.
- /// </summary>
- [Test]
- public void TestResetMetrics()
- {
- var cluster = _grid1.GetCluster();
-
- Thread.Sleep(2000);
-
- var metrics1 = cluster.GetMetrics();
-
- cluster.ResetMetrics();
-
- var metrics2 = cluster.GetMetrics();
-
- Assert.IsNotNull(metrics1);
- Assert.IsNotNull(metrics2);
- }
-
- /// <summary>
- /// Test node ping.
- /// </summary>
- [Test]
- public void TestPingNode()
- {
- var cluster = _grid1.GetCluster();
-
- Assert.IsTrue(cluster.GetNodes().Select(node => node.Id).All(cluster.PingNode));
-
- Assert.IsFalse(cluster.PingNode(Guid.NewGuid()));
- }
-
- /// <summary>
- /// Tests the topology version.
- /// </summary>
- [Test]
- public void TestTopologyVersion()
- {
- var cluster = _grid1.GetCluster();
-
- var topVer = cluster.TopologyVersion;
-
- Ignition.Stop(_grid3.Name, true);
-
- Assert.AreEqual(topVer + 1, _grid1.GetCluster().TopologyVersion);
-
- _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
-
- Assert.AreEqual(topVer + 2, _grid1.GetCluster().TopologyVersion);
- }
-
- /// <summary>
- /// Tests the topology by version.
- /// </summary>
- [Test]
- public void TestTopology()
- {
- var cluster = _grid1.GetCluster();
-
- Assert.AreEqual(1, cluster.GetTopology(1).Count);
-
- Assert.AreEqual(null, cluster.GetTopology(int.MaxValue));
-
- // Check that Nodes and Topology return the same for current version
- var topVer = cluster.TopologyVersion;
-
- var top = cluster.GetTopology(topVer);
-
- var nodes = cluster.GetNodes();
-
- Assert.AreEqual(top.Count, nodes.Count);
-
- Assert.IsTrue(top.All(nodes.Contains));
-
- // Stop/start node to advance version and check that history is still correct
- Assert.IsTrue(Ignition.Stop(_grid2.Name, true));
-
- try
- {
- top = cluster.GetTopology(topVer);
-
- Assert.AreEqual(top.Count, nodes.Count);
-
- Assert.IsTrue(top.All(nodes.Contains));
- }
- finally
- {
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
- }
- }
-
- /// <summary>
- /// Test nodes in full topology.
- /// </summary>
- [Test]
- public void TestNodes()
- {
- Assert.IsNotNull(_grid1.GetCluster().GetNode());
-
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count == 3);
-
- // Check subsequent call on the same topology.
- nodes = _grid1.GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count == 3);
-
- Assert.IsTrue(Ignition.Stop(_grid2.Name, true));
-
- // Check subsequent calls on updating topologies.
- nodes = _grid1.GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count == 2);
-
- nodes = _grid1.GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count == 2);
-
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
-
- nodes = _grid1.GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count == 3);
- }
-
- /// <summary>
- /// Test "ForNodes" and "ForNodeIds".
- /// </summary>
- [Test]
- public void TestForNodes()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- IClusterNode first = nodes.ElementAt(0);
- IClusterNode second = nodes.ElementAt(1);
-
- IClusterGroup singleNodePrj = _grid1.GetCluster().ForNodeIds(first.Id);
- Assert.AreEqual(1, singleNodePrj.GetNodes().Count);
- Assert.AreEqual(first.Id, singleNodePrj.GetNodes().First().Id);
-
- singleNodePrj = _grid1.GetCluster().ForNodeIds(new List<Guid> { first.Id });
- Assert.AreEqual(1, singleNodePrj.GetNodes().Count);
- Assert.AreEqual(first.Id, singleNodePrj.GetNodes().First().Id);
-
- singleNodePrj = _grid1.GetCluster().ForNodes(first);
- Assert.AreEqual(1, singleNodePrj.GetNodes().Count);
- Assert.AreEqual(first.Id, singleNodePrj.GetNodes().First().Id);
-
- singleNodePrj = _grid1.GetCluster().ForNodes(new List<IClusterNode> { first });
- Assert.AreEqual(1, singleNodePrj.GetNodes().Count);
- Assert.AreEqual(first.Id, singleNodePrj.GetNodes().First().Id);
-
- IClusterGroup multiNodePrj = _grid1.GetCluster().ForNodeIds(first.Id, second.Id);
- Assert.AreEqual(2, multiNodePrj.GetNodes().Count);
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(first));
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(second));
-
- multiNodePrj = _grid1.GetCluster().ForNodeIds(new[] {first, second}.Select(x => x.Id));
- Assert.AreEqual(2, multiNodePrj.GetNodes().Count);
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(first));
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(second));
-
- multiNodePrj = _grid1.GetCluster().ForNodes(first, second);
- Assert.AreEqual(2, multiNodePrj.GetNodes().Count);
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(first));
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(second));
-
- multiNodePrj = _grid1.GetCluster().ForNodes(new List<IClusterNode> { first, second });
- Assert.AreEqual(2, multiNodePrj.GetNodes().Count);
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(first));
- Assert.IsTrue(multiNodePrj.GetNodes().Contains(second));
- }
-
- /// <summary>
- /// Test "ForNodes" and "ForNodeIds". Make sure lazy enumerables are enumerated only once.
- /// </summary>
- [Test]
- public void TestForNodesLaziness()
- {
- var nodes = _grid1.GetCluster().GetNodes().Take(2).ToArray();
-
- var callCount = 0;
-
- Func<IClusterNode, IClusterNode> nodeSelector = node =>
- {
- callCount++;
- return node;
- };
-
- Func<IClusterNode, Guid> idSelector = node =>
- {
- callCount++;
- return node.Id;
- };
-
- var projection = _grid1.GetCluster().ForNodes(nodes.Select(nodeSelector));
- Assert.AreEqual(2, projection.GetNodes().Count);
- Assert.AreEqual(2, callCount);
-
- projection = _grid1.GetCluster().ForNodeIds(nodes.Select(idSelector));
- Assert.AreEqual(2, projection.GetNodes().Count);
- Assert.AreEqual(4, callCount);
- }
-
- /// <summary>
- /// Test for local node projection.
- /// </summary>
- [Test]
- public void TestForLocal()
- {
- IClusterGroup prj = _grid1.GetCluster().ForLocal();
-
- Assert.AreEqual(1, prj.GetNodes().Count);
- Assert.AreEqual(_grid1.GetCluster().GetLocalNode(), prj.GetNodes().First());
- }
-
- /// <summary>
- /// Test for remote nodes projection.
- /// </summary>
- [Test]
- public void TestForRemotes()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- IClusterGroup prj = _grid1.GetCluster().ForRemotes();
-
- Assert.AreEqual(2, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNodes().ElementAt(0)));
- Assert.IsTrue(nodes.Contains(prj.GetNodes().ElementAt(1)));
- }
-
- /// <summary>
- /// Test for host nodes projection.
- /// </summary>
- [Test]
- public void TestForHost()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- IClusterGroup prj = _grid1.GetCluster().ForHost(nodes.First());
-
- Assert.AreEqual(3, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNodes().ElementAt(0)));
- Assert.IsTrue(nodes.Contains(prj.GetNodes().ElementAt(1)));
- Assert.IsTrue(nodes.Contains(prj.GetNodes().ElementAt(2)));
- }
-
- /// <summary>
- /// Test for oldest, youngest and random projections.
- /// </summary>
- [Test]
- public void TestForOldestYoungestRandom()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- IClusterGroup prj = _grid1.GetCluster().ForYoungest();
- Assert.AreEqual(1, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNode()));
-
- prj = _grid1.GetCluster().ForOldest();
- Assert.AreEqual(1, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNode()));
-
- prj = _grid1.GetCluster().ForRandom();
- Assert.AreEqual(1, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNode()));
- }
-
- /// <summary>
- /// Test for attribute projection.
- /// </summary>
- [Test]
- public void TestForAttribute()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- IClusterGroup prj = _grid1.GetCluster().ForAttribute("my_attr", "value1");
- Assert.AreEqual(1, prj.GetNodes().Count);
- Assert.IsTrue(nodes.Contains(prj.GetNode()));
- Assert.AreEqual("value1", prj.GetNodes().First().GetAttribute<string>("my_attr"));
- }
-
- /// <summary>
- /// Test for cache/data/client projections.
- /// </summary>
- [Test]
- public void TestForCacheNodes()
- {
- ICollection<IClusterNode> nodes = _grid1.GetCluster().GetNodes();
-
- // Cache nodes.
- IClusterGroup prjCache = _grid1.GetCluster().ForCacheNodes("cache1");
-
- Assert.AreEqual(2, prjCache.GetNodes().Count);
-
- Assert.IsTrue(nodes.Contains(prjCache.GetNodes().ElementAt(0)));
- Assert.IsTrue(nodes.Contains(prjCache.GetNodes().ElementAt(1)));
-
- // Data nodes.
- IClusterGroup prjData = _grid1.GetCluster().ForDataNodes("cache1");
-
- Assert.AreEqual(2, prjData.GetNodes().Count);
-
- Assert.IsTrue(prjCache.GetNodes().Contains(prjData.GetNodes().ElementAt(0)));
- Assert.IsTrue(prjCache.GetNodes().Contains(prjData.GetNodes().ElementAt(1)));
-
- // Client nodes.
- IClusterGroup prjClient = _grid1.GetCluster().ForClientNodes("cache1");
-
- Assert.AreEqual(0, prjClient.GetNodes().Count);
- }
-
- /// <summary>
- /// Test for cache predicate.
- /// </summary>
- [Test]
- public void TestForPredicate()
- {
- IClusterGroup prj1 = _grid1.GetCluster().ForPredicate(new NotAttributePredicate("value1").Apply);
- Assert.AreEqual(2, prj1.GetNodes().Count);
-
- IClusterGroup prj2 = prj1.ForPredicate(new NotAttributePredicate("value2").Apply);
- Assert.AreEqual(1, prj2.GetNodes().Count);
-
- string val;
-
- prj2.GetNodes().First().TryGetAttribute("my_attr", out val);
-
- Assert.IsTrue(val == null || (!val.Equals("value1") && !val.Equals("value2")));
- }
-
- /// <summary>
- /// Attribute predicate.
- /// </summary>
- private class NotAttributePredicate
- {
- /** Required attribute value. */
- private readonly string _attrVal;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="attrVal">Required attribute value.</param>
- public NotAttributePredicate(string attrVal)
- {
- _attrVal = attrVal;
- }
-
- /** <inhreitDoc /> */
- public bool Apply(IClusterNode node)
- {
- string val;
-
- node.TryGetAttribute("my_attr", out val);
-
- return val == null || !val.Equals(_attrVal);
- }
- }
-
- /// <summary>
- /// Test echo with decimals.
- /// </summary>
- [Test]
- public void TestEchoDecimal()
- {
- decimal val;
-
- Assert.AreEqual(val = decimal.Zero, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = new decimal(0, 0, 1, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, 1, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, 1, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, 1, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, 1, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, 1, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MinValue, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 0, int.MaxValue, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = new decimal(0, 1, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 1, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 1, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 1, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 1, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, 1, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MinValue, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(0, int.MaxValue, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = new decimal(1, 0, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 0, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 0, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 0, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 0, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 0, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MinValue, 0, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(int.MaxValue, 0, 0, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = new decimal(1, 1, 1, false, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 1, 1, true, 0), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 1, 1, false, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 1, 1, true, 0) - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 1, 1, false, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = new decimal(1, 1, 1, true, 0) + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("65536"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-65536"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("65536") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-65536") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("65536") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-65536") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("4294967296"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-4294967296"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("4294967296") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-4294967296") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("4294967296") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-4294967296") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("281474976710656"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-281474976710656"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("281474976710656") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-281474976710656") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("281474976710656") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-281474976710656") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("18446744073709551616"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-18446744073709551616"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("18446744073709551616") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-18446744073709551616") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("18446744073709551616") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-18446744073709551616") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("1208925819614629174706176"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-1208925819614629174706176"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("1208925819614629174706176") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-1208925819614629174706176") - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("1208925819614629174706176") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-1208925819614629174706176") + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.MaxValue, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.MinValue, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.MaxValue - 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.MinValue + 1, _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- Assert.AreEqual(val = decimal.Parse("11,12"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
- Assert.AreEqual(val = decimal.Parse("-11,12"), _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { val, val.ToString() }));
-
- // Test echo with overflow.
- try
- {
- _grid1.GetCompute().ExecuteJavaTask<object>(DecimalTask, new object[] { null, decimal.MaxValue.ToString() + 1 });
-
- Assert.Fail();
- }
- catch (IgniteException)
- {
- // No-op.
- }
- }
-
- /// <summary>
- /// Test echo task returning null.
- /// </summary>
- [Test]
- public void TestEchoTaskNull()
- {
- Assert.IsNull(_grid1.GetCompute().ExecuteJavaTask<object>(EchoTask, EchoTypeNull));
- }
-
- /// <summary>
- /// Test echo task returning various primitives.
- /// </summary>
- [Test]
- public void TestEchoTaskPrimitives()
- {
- Assert.AreEqual(1, _grid1.GetCompute().ExecuteJavaTask<byte>(EchoTask, EchoTypeByte));
- Assert.AreEqual(true, _grid1.GetCompute().ExecuteJavaTask<bool>(EchoTask, EchoTypeBool));
- Assert.AreEqual(1, _grid1.GetCompute().ExecuteJavaTask<short>(EchoTask, EchoTypeShort));
- Assert.AreEqual((char)1, _grid1.GetCompute().ExecuteJavaTask<char>(EchoTask, EchoTypeChar));
- Assert.AreEqual(1, _grid1.GetCompute().ExecuteJavaTask<int>(EchoTask, EchoTypeInt));
- Assert.AreEqual(1, _grid1.GetCompute().ExecuteJavaTask<long>(EchoTask, EchoTypeLong));
- Assert.AreEqual((float)1, _grid1.GetCompute().ExecuteJavaTask<float>(EchoTask, EchoTypeFloat));
- Assert.AreEqual((double)1, _grid1.GetCompute().ExecuteJavaTask<double>(EchoTask, EchoTypeDouble));
- }
-
- /// <summary>
- /// Test echo task returning compound types.
- /// </summary>
- [Test]
- public void TestEchoTaskCompound()
- {
- int[] res1 = _grid1.GetCompute().ExecuteJavaTask<int[]>(EchoTask, EchoTypeArray);
-
- Assert.AreEqual(1, res1.Length);
- Assert.AreEqual(1, res1[0]);
-
- IList<int> res2 = _grid1.GetCompute().ExecuteJavaTask<IList<int>>(EchoTask, EchoTypeCollection);
-
- Assert.AreEqual(1, res2.Count);
- Assert.AreEqual(1, res2[0]);
-
- IDictionary<int, int> res3 = _grid1.GetCompute().ExecuteJavaTask<IDictionary<int, int>>(EchoTask, EchoTypeMap);
-
- Assert.AreEqual(1, res3.Count);
- Assert.AreEqual(1, res3[1]);
- }
-
- /// <summary>
- /// Test echo task returning portable object.
- /// </summary>
- [Test]
- public void TestEchoTaskPortable()
- {
- PlatformComputePortable res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputePortable>(EchoTask, EchoTypePortable);
-
- Assert.AreEqual(1, res.Field);
- }
-
- /// <summary>
- /// Test echo task returning portable object with no corresponding class definition.
- /// </summary>
- [Test]
- public void TestEchoTaskPortableNoClass()
- {
- ICompute compute = _grid1.GetCompute();
-
- compute.WithKeepPortable();
-
- IPortableObject res = compute.ExecuteJavaTask<IPortableObject>(EchoTask, EchoTypePortableJava);
-
- Assert.AreEqual(1, res.GetField<int>("field"));
-
- // This call must fail because "keepPortable" flag is reset.
- Assert.Catch(typeof(PortableException), () =>
- {
- compute.ExecuteJavaTask<IPortableObject>(EchoTask, EchoTypePortableJava);
- });
- }
-
- /// <summary>
- /// Tests the echo task returning object array.
- /// </summary>
- [Test]
- public void TestEchoTaskObjectArray()
- {
- var res = _grid1.GetCompute().ExecuteJavaTask<string[]>(EchoTask, EchoTypeObjArray);
-
- Assert.AreEqual(new[] {"foo", "bar", "baz"}, res);
- }
-
- /// <summary>
- /// Tests the echo task returning portable array.
- /// </summary>
- [Test]
- public void TestEchoTaskPortableArray()
- {
- var res = _grid1.GetCompute().ExecuteJavaTask<PlatformComputePortable[]>(EchoTask, EchoTypePortableArray);
-
- Assert.AreEqual(3, res.Length);
-
- for (var i = 0; i < res.Length; i++)
- Assert.AreEqual(i + 1, res[i].Field);
- }
-
- /// <summary>
- /// Tests the echo task returning enum.
- /// </summary>
- [Test]
- public void TestEchoTaskEnum()
- {
- var res = _grid1.GetCompute().ExecuteJavaTask<InteropComputeEnum>(EchoTask, EchoTypeEnum);
-
- Assert.AreEqual(InteropComputeEnum.Bar, res);
- }
-
- /// <summary>
- /// Tests the echo task returning enum.
- /// </summary>
- [Test]
- public void TestEchoTaskEnumArray()
- {
- var res = _grid1.GetCompute().ExecuteJavaTask<InteropComputeEnum[]>(EchoTask, EchoTypeEnumArray);
-
- Assert.AreEqual(new[]
- {
- InteropComputeEnum.Bar,
- InteropComputeEnum.Baz,
- InteropComputeEnum.Foo
- }, res);
- }
-
- /// <summary>
- /// Test for portable argument in Java.
- /// </summary>
- [Test]
- public void TestPortableArgTask()
- {
- ICompute compute = _grid1.GetCompute();
-
- compute.WithKeepPortable();
-
- PlatformComputeNetPortable arg = new PlatformComputeNetPortable();
-
- arg.Field = 100;
-
- int res = compute.ExecuteJavaTask<int>(PortableArgTask, arg);
-
- Assert.AreEqual(arg.Field, res);
- }
-
- /// <summary>
- /// Test running broadcast task.
- /// </summary>
- [Test]
- public void TestBroadcastTask()
- {
- ICollection<Guid> res = _grid1.GetCompute().ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null);
-
- Assert.AreEqual(3, res.Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(0)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(1)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(2)).GetNodes().Count);
-
- var prj = _grid1.GetCluster().ForPredicate(node => res.Take(2).Contains(node.Id));
-
- Assert.AreEqual(2, prj.GetNodes().Count);
-
- ICollection<Guid> filteredRes = prj.GetCompute().ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null);
-
- Assert.AreEqual(2, filteredRes.Count);
- Assert.IsTrue(filteredRes.Contains(res.ElementAt(0)));
- Assert.IsTrue(filteredRes.Contains(res.ElementAt(1)));
- }
-
- /// <summary>
- /// Test running broadcast task in async mode.
- /// </summary>
- [Test]
- public void TestBroadcastTaskAsync()
- {
- var gridCompute = _grid1.GetCompute().WithAsync();
- Assert.IsNull(gridCompute.ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null));
- ICollection<Guid> res = gridCompute.GetFuture<ICollection<Guid>>().Get();
-
- Assert.AreEqual(3, res.Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(0)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(1)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(2)).GetNodes().Count);
-
- var prj = _grid1.GetCluster().ForPredicate(node => res.Take(2).Contains(node.Id));
-
- Assert.AreEqual(2, prj.GetNodes().Count);
-
- var compute = prj.GetCompute().WithAsync();
- Assert.IsNull(compute.ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null));
- ICollection<Guid> filteredRes = compute.GetFuture<ICollection<Guid>>().Get();
-
- Assert.AreEqual(2, filteredRes.Count);
- Assert.IsTrue(filteredRes.Contains(res.ElementAt(0)));
- Assert.IsTrue(filteredRes.Contains(res.ElementAt(1)));
- }
-
- /// <summary>
- /// Tests the action broadcast.
- /// </summary>
- [Test]
- public void TestBroadcastAction()
- {
- ComputeAction.InvokeCount = 0;
-
- _grid1.GetCompute().Broadcast(new ComputeAction());
-
- Assert.AreEqual(_grid1.GetCluster().GetNodes().Count, ComputeAction.InvokeCount);
- }
-
- /// <summary>
- /// Tests single action run.
- /// </summary>
- [Test]
- public void TestRunAction()
- {
- ComputeAction.InvokeCount = 0;
-
- _grid1.GetCompute().Run(new ComputeAction());
-
- Assert.AreEqual(1, ComputeAction.InvokeCount);
- }
-
- /// <summary>
- /// Tests multiple actions run.
- /// </summary>
- [Test]
- public void TestRunActions()
- {
- ComputeAction.InvokeCount = 0;
-
- var actions = Enumerable.Range(0, 10).Select(x => new ComputeAction());
-
- _grid1.GetCompute().Run(actions);
-
- Assert.AreEqual(10, ComputeAction.InvokeCount);
- }
-
- /// <summary>
- /// Tests affinity run.
- /// </summary>
- [Test]
- public void TestAffinityRun()
- {
- const string cacheName = null;
-
- // Test keys for non-client nodes
- var nodes = new[] {_grid1, _grid2}.Select(x => x.GetCluster().GetLocalNode());
-
- var aff = _grid1.GetAffinity(cacheName);
-
- foreach (var node in nodes)
- {
- var primaryKey = Enumerable.Range(1, int.MaxValue).First(x => aff.IsPrimary(node, x));
-
- var affinityKey = _grid1.GetAffinity(cacheName).GetAffinityKey<int, int>(primaryKey);
-
- _grid1.GetCompute().AffinityRun(cacheName, affinityKey, new ComputeAction());
-
- Assert.AreEqual(node.Id, ComputeAction.LastNodeId);
- }
- }
-
- /// <summary>
- /// Tests affinity call.
- /// </summary>
- [Test]
- public void TestAffinityCall()
- {
- const string cacheName = null;
-
- // Test keys for non-client nodes
- var nodes = new[] { _grid1, _grid2 }.Select(x => x.GetCluster().GetLocalNode());
-
- var aff = _grid1.GetAffinity(cacheName);
-
- foreach (var node in nodes)
- {
- var primaryKey = Enumerable.Range(1, int.MaxValue).First(x => aff.IsPrimary(node, x));
-
- var affinityKey = _grid1.GetAffinity(cacheName).GetAffinityKey<int, int>(primaryKey);
-
- var result = _grid1.GetCompute().AffinityCall(cacheName, affinityKey, new ComputeFunc());
-
- Assert.AreEqual(result, ComputeFunc.InvokeCount);
-
- Assert.AreEqual(node.Id, ComputeFunc.LastNodeId);
- }
- }
-
- /// <summary>
- /// Test "withNoFailover" feature.
- /// </summary>
- [Test]
- public void TestWithNoFailover()
- {
- ICollection<Guid> res = _grid1.GetCompute().WithNoFailover().ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null);
-
- Assert.AreEqual(3, res.Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(0)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(1)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(2)).GetNodes().Count);
- }
-
- /// <summary>
- /// Test "withTimeout" feature.
- /// </summary>
- [Test]
- public void TestWithTimeout()
- {
- ICollection<Guid> res = _grid1.GetCompute().WithTimeout(1000).ExecuteJavaTask<ICollection<Guid>>(BroadcastTask, null);
-
- Assert.AreEqual(3, res.Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(0)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(1)).GetNodes().Count);
- Assert.AreEqual(1, _grid1.GetCluster().ForNodeIds(res.ElementAt(2)).GetNodes().Count);
- }
-
- /// <summary>
- /// Test simple dotNet task execution.
- /// </summary>
- [Test]
- public void TestNetTaskSimple()
- {
- int res = _grid1.GetCompute().Execute<NetSimpleJobArgument, NetSimpleJobResult, NetSimpleTaskResult>(
- typeof(NetSimpleTask), new NetSimpleJobArgument(1)).Res;
-
- Assert.AreEqual(_grid1.GetCompute().ClusterGroup.GetNodes().Count, res);
- }
-
- /// <summary>
- /// Create configuration.
- /// </summary>
- /// <param name="path">XML config path.</param>
- private IgniteConfiguration Configuration(string path)
- {
- IgniteConfiguration cfg = new IgniteConfiguration();
-
- PortableConfiguration portCfg = new PortableConfiguration();
-
- ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>();
-
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PlatformComputePortable)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PlatformComputeNetPortable)));
- portTypeCfgs.Add(new PortableTypeConfiguration(JavaPortableCls));
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.PortableConfiguration = portCfg;
-
- cfg.JvmClasspath = IgniteManager.CreateClasspath(cfg, true);
-
- cfg.JvmOptions = TestUtils.TestJavaOptions();
-
- cfg.SpringConfigUrl = path;
-
- return cfg;
- }
- }
-
- class PlatformComputePortable
- {
- public int Field
- {
- get;
- set;
- }
- }
-
- class PlatformComputeNetPortable : PlatformComputePortable
- {
-
- }
-
- [Serializable]
- class NetSimpleTask : IComputeTask<NetSimpleJobArgument, NetSimpleJobResult, NetSimpleTaskResult>
- {
- /** <inheritDoc /> */
-
- public IDictionary<IComputeJob<NetSimpleJobResult>, IClusterNode> Map(IList<IClusterNode> subgrid,
- NetSimpleJobArgument arg)
- {
- var jobs = new Dictionary<IComputeJob<NetSimpleJobResult>, IClusterNode>();
-
- for (int i = 0; i < subgrid.Count; i++)
- {
- NetSimpleJob job = new NetSimpleJob {Arg = arg};
-
- jobs[job] = subgrid[i];
- }
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- public ComputeJobResultPolicy Result(IComputeJobResult<NetSimpleJobResult> res,
- IList<IComputeJobResult<NetSimpleJobResult>> rcvd)
- {
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public NetSimpleTaskResult Reduce(IList<IComputeJobResult<NetSimpleJobResult>> results)
- {
- return new NetSimpleTaskResult(results.Sum(res => res.Data().Res));
- }
- }
-
- [Serializable]
- class NetSimpleJob : IComputeJob<NetSimpleJobResult>
- {
- public NetSimpleJobArgument Arg;
-
- /** <inheritDoc /> */
- public NetSimpleJobResult Execute()
- {
- return new NetSimpleJobResult(Arg.Arg);
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op.
- }
- }
-
- [Serializable]
- class NetSimpleJobArgument
- {
- public int Arg;
-
- public NetSimpleJobArgument(int arg)
- {
- Arg = arg;
- }
- }
-
- [Serializable]
- class NetSimpleTaskResult
- {
- public int Res;
-
- public NetSimpleTaskResult(int res)
- {
- Res = res;
- }
- }
-
- [Serializable]
- class NetSimpleJobResult
- {
- public int Res;
-
- public NetSimpleJobResult(int res)
- {
- Res = res;
- }
- }
-
- [Serializable]
- class ComputeAction : IComputeAction
- {
- [InstanceResource]
- #pragma warning disable 649
- private IIgnite _grid;
-
- public static int InvokeCount;
-
- public static Guid LastNodeId;
-
- public void Invoke()
- {
- Interlocked.Increment(ref InvokeCount);
- LastNodeId = _grid.GetCluster().GetLocalNode().Id;
- }
- }
-
- interface IUserInterface<out T>
- {
- T Invoke();
- }
-
- interface INestedComputeFunc : IComputeFunc<int>
- {
-
- }
-
- [Serializable]
- class ComputeFunc : INestedComputeFunc, IUserInterface<int>
- {
- [InstanceResource]
- private IIgnite _grid;
-
- public static int InvokeCount;
-
- public static Guid LastNodeId;
-
- int IComputeFunc<int>.Invoke()
- {
- InvokeCount++;
- LastNodeId = _grid.GetCluster().GetLocalNode().Id;
- return InvokeCount;
- }
-
- int IUserInterface<int>.Invoke()
- {
- // Same signature as IComputeFunc<int>, but from different interface
- throw new Exception("Invalid method");
- }
-
- public int Invoke()
- {
- // Same signature as IComputeFunc<int>, but due to explicit interface implementation this is a wrong method
- throw new Exception("Invalid method");
- }
- }
-
- public enum InteropComputeEnum
- {
- Foo,
- Bar,
- Baz
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs
deleted file mode 100644
index 5b6874f..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ComputeMultithreadedTest.cs
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests class.
- /// </summary>
- [Category(TestUtils.CategoryIntensive)]
- public class ComputeMultithreadedTest : AbstractTaskTest
- {
- /** */
- private static IList<Action<ICompute>> _actions;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public ComputeMultithreadedTest() : base(false) { }
-
- /// <summary>
- /// Set-up routine.
- /// </summary>
- [SetUp]
- public void SetUp()
- {
- _actions = new List<Action<ICompute>>
- {
- compute => { compute.Apply(new My1ArgClosure(), "zzzz"); },
- compute => { compute.Broadcast(new My1ArgClosure(), "zzzz"); },
- compute => { compute.Broadcast(new MyNoArgClosure("zzzz")); },
- compute => { compute.Call(new MyNoArgClosure("zzzz")); },
- compute => { compute.Execute(new StringLengthEmptyTask(), "zzzz"); },
- compute =>
- {
- compute.Apply(new My1ArgClosure(), new List<string> {"zzzz", "a", "b"}, new MyReducer());
- }
- };
-
- }
-
- /// <summary>
- /// Tear-down routine.
- /// </summary>
- [TearDown]
- public void TearDown()
- {
- _actions.Clear();
- }
-
- /// <summary>
- /// Test not-marshalable error occurred during map step.
- /// </summary>
- [Test]
- public void TestAllTaskTypeAtSameTime()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- var compute = Grid1.GetCompute();
-
- TestUtils.RunMultiThreaded(() =>
- {
- _actions[TestUtils.Random.Next(_actions.Count)](compute);
- }, 4, 60);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType0()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[0](Grid1.GetCompute()), 4, 20);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType1()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[1](Grid1.GetCompute()), 4, 20);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType2()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[2](Grid1.GetCompute()), 4, 20);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType3()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[3](Grid1.GetCompute()), 4, 20);
- }
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType4()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[4](Grid1.GetCompute()), 4, 20);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Test]
- public void TestSingleTaskType5()
- {
- Assert.AreEqual(_actions.Count, 6);
-
- TestUtils.RunMultiThreaded(() => _actions[5](Grid1.GetCompute()), 4, 20);
- }
- }
-
- /// <summary>
- /// Test class.
- /// </summary>
- [Serializable]
- public class My1ArgClosure : IComputeFunc<string, int>
- {
- /** <inheritDoc /> */
- public int Invoke(string s)
- {
- return s.Length;
- }
- }
-
- /// <summary>
- /// Test class.
- /// </summary>
- [Serializable]
- public class MyNoArgClosure : IComputeFunc<int>
- {
- /** */
- private readonly string _s;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="s"></param>
- public MyNoArgClosure(string s)
- {
- _s = s;
- }
-
- /** <inheritDoc /> */
- public int Invoke()
- {
- return _s.Length;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class StringLengthEmptyTask : IComputeTask<string, int, int>
- {
- /** <inheritDoc /> */
- public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, string arg)
- {
- var res = new Dictionary<IComputeJob<int>, IClusterNode>();
-
- var job = new StringLengthEmptyJob(arg);
-
- IClusterNode node = subgrid[TestUtils.Random.Next(subgrid.Count)];
-
- res.Add(job, node);
-
- return res;
- }
-
- /** <inheritDoc /> */
- public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd)
- {
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public int Reduce(IList<IComputeJobResult<int>> results)
- {
- return results.Count == 0 ? 0 : results[0].Data();
- }
- }
-
- /// <summary>
- /// Test class.
- /// </summary>
- [Serializable]
- public class StringLengthEmptyJob: IComputeJob<int>
- {
- /** */
- private string _s;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="s"></param>
- public StringLengthEmptyJob(string s)
- {
- _s = s;
- }
-
- /** <inheritDoc /> */
- public int Execute()
- {
- return _s.Length;
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op
- }
- }
-
- public class MyReducer : IComputeReducer<int, int>
- {
- /** */
- private int _res;
-
- public bool Collect(int res)
- {
- _res += res;
- return true;
- }
-
- public int Reduce()
- {
- return _res;
- }
- }
-}
[45/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
deleted file mode 100644
index aff929b..0000000
--- a/modules/platform/src/main/cpp/core-test/src/portable_reader_writer_test.cpp
+++ /dev/null
@@ -1,1951 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/portable/portable.h"
-
-#include "ignite/portable_test_defs.h"
-#include "ignite/portable_test_utils.h"
-
-using namespace ignite;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-using namespace ignite_test::core::portable;
-
-template<typename T>
-void CheckPrimitive(T val)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- out.Position(18);
-
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- try
- {
- Write<T>(writer, NULL, val);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- Write<T>(writer, "test", val);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
-
- in.Position(18);
-
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100);
- PortableReader reader(&readerImpl);
-
- try
- {
- Read<T>(reader, NULL);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- T readVal = Read<T>(reader, "test");
-
- BOOST_REQUIRE(readVal == val);
-}
-
-template<typename T>
-void CheckPrimitiveArray(T dflt, T val1, T val2)
-{
- const char* fieldName = "test";
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100);
- PortableReader reader(&readerImpl);
-
- out.Position(18);
-
- try
- {
- T nullFieldArr[2];
-
- nullFieldArr[0] = val1;
- nullFieldArr[1] = val2;
-
- WriteArray<T>(writer, NULL, nullFieldArr, 2);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- // 1. Write NULL and see what happens.
- WriteArray<T>(writer, fieldName, NULL, 0);
-
- out.Synchronize();
- in.Synchronize();
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == -1);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == -1);
-
- T arr1[2];
- arr1[0] = dflt;
- arr1[1] = dflt;
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 1) == -1);
-
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- // 2. Write empty array.
- T arr2[2];
- arr2[0] = val1;
- arr2[1] = val2;
-
- out.Position(18);
-
- WriteArray<T>(writer, fieldName, arr2, 0);
-
- out.Synchronize();
- in.Synchronize();
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 0);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 0);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 0);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 2) == 0);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- // 3. Partial array write.
- out.Position(18);
-
- WriteArray<T>(writer, fieldName, arr2, 1);
-
- out.Synchronize();
- in.Synchronize();
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 1);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 1);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 1);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 1) == 1);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == dflt);
- arr1[0] = dflt;
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 2) == 1);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == dflt);
- arr1[0] = dflt;
-
- // 4. Full array write.
- out.Position(18);
-
- WriteArray<T>(writer, fieldName, arr2, 2);
-
- out.Synchronize();
- in.Synchronize();
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 0) == 2);
-
- in.Position(18);
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, NULL, 2) == 2);
-
- try
- {
- ReadArray<T>(reader, NULL, arr1, 2);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 0) == 2);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 1) == 2);
- BOOST_REQUIRE(arr1[0] == dflt);
- BOOST_REQUIRE(arr1[1] == dflt);
-
- BOOST_REQUIRE(ReadArray<T>(reader, fieldName, arr1, 2) == 2);
- BOOST_REQUIRE(arr1[0] == val1);
- BOOST_REQUIRE(arr1[1] == val2);
-}
-
-void CheckWritesRestricted(PortableWriter& writer)
-{
- try
- {
- writer.WriteInt8("field", 1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- int8_t arr[1];
-
- writer.WriteInt8Array("field", arr, 1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- Guid val(1, 1);
-
- writer.WriteGuid("field", val);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteString("field", "test");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteArray<int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteCollection<int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteMap<int8_t, int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-}
-
-void CheckReadsRestricted(PortableReader& reader)
-{
- try
- {
- reader.ReadInt8("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- int8_t arr[1];
-
- reader.ReadInt8Array("field", arr, 1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadGuid("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadString("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadArray<int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadCollection<int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadMap<int8_t, int8_t>("field");
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-}
-
-void CheckCollectionEmpty(CollectionType* colType)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableCollectionWriter<PortableInner> colWriter = colType ?
- writer.WriteCollection<PortableInner>("field1", *colType) : writer.WriteCollection<PortableInner>("field1");
-
- CheckWritesRestricted(writer);
-
- colWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- colWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- colWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
-
- if (colType)
- BOOST_REQUIRE(colReader.GetType() == *colType);
- else
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
-
- BOOST_REQUIRE(colReader.GetSize() == 0);
- BOOST_REQUIRE(!colReader.HasNext());
- BOOST_REQUIRE(!colReader.IsNull());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-void CheckCollection(CollectionType* colType)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableCollectionWriter<PortableInner> colWriter = colType ?
- writer.WriteCollection<PortableInner>("field1", *colType) : writer.WriteCollection<PortableInner>("field1");
-
- colWriter.Write(writeVal1);
- colWriter.Write(writeVal2);
- colWriter.Write(writeVal3);
-
- CheckWritesRestricted(writer);
-
- colWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- colWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- colWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
-
- CheckReadsRestricted(reader);
-
- if (colType)
- BOOST_REQUIRE(colReader.GetType() == *colType);
- else
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
-
- BOOST_REQUIRE(colReader.GetSize() == 3);
- BOOST_REQUIRE(!colReader.IsNull());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal1.GetValue());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal2.GetValue());
-
- BOOST_REQUIRE(colReader.HasNext());
- BOOST_REQUIRE(colReader.GetNext().GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!colReader.HasNext());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-void CheckMapEmpty(MapType* mapType)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
- writer.WriteMap<int8_t, PortableInner>("field1", *mapType) : writer.WriteMap<int8_t, PortableInner>("field1");
-
- CheckWritesRestricted(writer);
-
- mapWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- mapWriter.Write(1, PortableInner(1));
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- mapWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t, PortableInner>("field1");
-
- if (mapType)
- BOOST_REQUIRE(mapReader.GetType() == *mapType);
- else
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
-
- BOOST_REQUIRE(mapReader.GetSize() == 0);
- BOOST_REQUIRE(!mapReader.HasNext());
- BOOST_REQUIRE(!mapReader.IsNull());
-
- try
- {
- int8_t key;
- PortableInner val;
-
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-void CheckMap(MapType* mapType)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableMapWriter<int8_t, PortableInner> mapWriter = mapType ?
- writer.WriteMap<int8_t, PortableInner>("field1", *mapType) : writer.WriteMap<int8_t, PortableInner>("field1");
-
- mapWriter.Write(1, writeVal1);
- mapWriter.Write(2, writeVal2);
- mapWriter.Write(3, writeVal3);
-
- CheckWritesRestricted(writer);
-
- mapWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- mapWriter.Write(4, PortableInner(4));
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- mapWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t, PortableInner>("field1");
-
- CheckReadsRestricted(reader);
-
- if (mapType)
- BOOST_REQUIRE(mapReader.GetType() == *mapType);
- else
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
-
- BOOST_REQUIRE(mapReader.GetSize() == 3);
- BOOST_REQUIRE(!mapReader.IsNull());
-
- int8_t key;
- PortableInner val;
-
- BOOST_REQUIRE(mapReader.HasNext());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 1);
- BOOST_REQUIRE(val.GetValue() == writeVal1.GetValue());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 2);
- BOOST_REQUIRE(val.GetValue() == writeVal2.GetValue());
-
- mapReader.GetNext(&key, &val);
- BOOST_REQUIRE(key == 3);
- BOOST_REQUIRE(val.GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!mapReader.HasNext());
-
- try
- {
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_SUITE(PortableReaderWriterTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt8)
-{
- CheckPrimitive<int8_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveBool)
-{
- CheckPrimitive<bool>(true);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt16)
-{
- CheckPrimitive<int16_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveUInt16)
-{
- CheckPrimitive<uint16_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt32)
-{
- CheckPrimitive<int32_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveInt64)
-{
- CheckPrimitive<int64_t>(1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveFloat)
-{
- CheckPrimitive<float>(1.1f);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveDouble)
-{
- CheckPrimitive<double>(1.1);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveGuid)
-{
- Guid val(1, 2);
-
- CheckPrimitive<Guid>(val);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt8)
-{
- CheckPrimitiveArray<int8_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayBool)
-{
- CheckPrimitiveArray<bool>(false, true, false);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt16)
-{
- CheckPrimitiveArray<int16_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayUInt16)
-{
- CheckPrimitiveArray<uint16_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt32)
-{
- CheckPrimitiveArray<int32_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayInt64)
-{
- CheckPrimitiveArray<int64_t>(1, 2, 3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayFloat)
-{
- CheckPrimitiveArray<float>(1.1f, 2.2f, 3.3f);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayDouble)
-{
- CheckPrimitiveArray<double>(1.1, 2.2, 3.3);
-}
-
-BOOST_AUTO_TEST_CASE(TestPrimitiveArrayGuid)
-{
- Guid dflt(1, 2);
- Guid val1(3, 4);
- Guid val2(5, 6);
-
- CheckPrimitiveArray<Guid>(dflt, val1, val2);
-}
-
-BOOST_AUTO_TEST_CASE(TestGuidNull)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- try
- {
- writer.WriteNull(NULL);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- writer.WriteNull("test");
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 100, 100);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- try
- {
- reader.ReadGuid(NULL);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- Guid expVal;
- Guid actualVal = reader.ReadGuid("test");
-
- BOOST_REQUIRE(actualVal == expVal);
-}
-
-BOOST_AUTO_TEST_CASE(TestString) {
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- const char* writeVal1 = "testtest";
- const char* writeVal2 = "test";
- std::string writeVal3 = writeVal1;
-
- try
- {
- writer.WriteString(NULL, writeVal1);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteString(NULL, writeVal1, 4);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- writer.WriteString(NULL, writeVal3);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- writer.WriteString("field1", writeVal1);
- writer.WriteString("field2", writeVal1, 4);
- writer.WriteString("field3", writeVal3);
- writer.WriteString("field4", NULL);
- writer.WriteString("field5", NULL, 4);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- try
- {
- char nullCheckRes[9];
-
- reader.ReadString(NULL, nullCheckRes, 9);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- reader.ReadString(NULL);
-
- BOOST_FAIL("Not restricted.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- char readVal1[9];
- char readVal2[5];
-
- BOOST_REQUIRE(reader.ReadString("field1", NULL, 0) == 8);
- BOOST_REQUIRE(reader.ReadString("field1", NULL, 8) == 8);
- BOOST_REQUIRE(reader.ReadString("field1", readVal1, 0) == 8);
- BOOST_REQUIRE(reader.ReadString("field1", readVal1, 4) == 8);
-
- BOOST_REQUIRE(reader.ReadString("field1", readVal1, 9) == 8);
- std::string writeVal1Str = writeVal1;
- std::string readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- BOOST_REQUIRE(reader.ReadString("field2", readVal2, 5) == 4);
- std::string writeVal2Str = writeVal2;
- std::string readVal2Str = readVal2;
- BOOST_REQUIRE(readVal2Str.compare(writeVal2Str) == 0);
-
- std::string readVal3 = reader.ReadString("field3");
- BOOST_REQUIRE(readVal3.compare(writeVal3) == 0);
-
- BOOST_REQUIRE(reader.ReadString("field4", readVal1, 9) == -1);
- BOOST_REQUIRE(reader.ReadString("field5", readVal1, 9) == -1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArrayNull)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteNull("field1");
- writer.WriteInt8("field2", 1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
-
- BOOST_REQUIRE(arrReader.GetSize() == -1);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(arrReader.IsNull());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArrayEmpty)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableStringArrayWriter arrWriter = writer.WriteStringArray("field1");
-
- CheckWritesRestricted(writer);
-
- arrWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val, 4);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- std::string val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
-
- BOOST_REQUIRE(arrReader.GetSize() == 0);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(!arrReader.IsNull());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestStringArray)
-{
- const char* writeVal1 = "testtest";
- const char* writeVal2 = "test";
- std::string writeVal3 = "test2";
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableStringArrayWriter arrWriter = writer.WriteStringArray("field1");
-
- arrWriter.Write(writeVal1);
- arrWriter.Write(writeVal1, 4);
- arrWriter.Write(NULL); // NULL value.
- arrWriter.Write(NULL, 100); // NULL value again.
- arrWriter.Write(writeVal3);
-
- CheckWritesRestricted(writer);
-
- arrWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val, 4);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- const char* val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- std::string val = "test";
-
- arrWriter.Write(val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableStringArrayReader arrReader = reader.ReadStringArray("field1");
-
- CheckReadsRestricted(reader);
-
- BOOST_REQUIRE(arrReader.GetSize() == 5);
- BOOST_REQUIRE(!arrReader.IsNull());
-
- // 1. Read first value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- char readVal1[9];
-
- BOOST_REQUIRE(arrReader.GetNext(NULL, 0) == 8);
- BOOST_REQUIRE(arrReader.GetNext(NULL, 8) == 8);
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 0) == 8);
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 4) == 8);
-
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 9) == 8);
- std::string writeVal1Str = writeVal1;
- std::string readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- // 2. Read second value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- char readVal2[5];
-
- BOOST_REQUIRE(arrReader.GetNext(readVal2, 5) == 4);
- std::string writeVal2Str = writeVal2;
- std::string readVal2Str = readVal2;
- BOOST_REQUIRE(readVal2Str.compare(writeVal2Str) == 0);
-
- // 3. Read NULL.
- BOOST_REQUIRE(arrReader.HasNext());
-
- BOOST_REQUIRE(arrReader.GetNext(readVal1, 4) == -1);
- readVal1Str = readVal1;
- BOOST_REQUIRE(readVal1Str.compare(writeVal1Str) == 0);
-
- // 4. Read NULL again, this time through another method.
- BOOST_REQUIRE(arrReader.HasNext());
-
- std::string readNullVal = arrReader.GetNext();
-
- BOOST_REQUIRE(readNullVal.length() == 0);
-
- // 5. Read third value.
- BOOST_REQUIRE(arrReader.HasNext());
-
- std::string readVal3 = arrReader.GetNext();
- BOOST_REQUIRE(readVal3.compare(writeVal3) == 0);
-
- BOOST_REQUIRE(!arrReader.HasNext());
-
- try
- {
- char res[100];
-
- arrReader.GetNext(res, 100);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestObject)
-{
- PortableInner writeVal1(1);
- PortableInner writeVal2(0);
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteObject("field1", writeVal1);
- writer.WriteObject("field2", writeVal2);
- writer.WriteNull("field3");
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableInner readVal1 = reader.ReadObject<PortableInner>("field1");
- BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
-
- PortableInner readVal2 = reader.ReadObject<PortableInner>("field2");
- BOOST_REQUIRE(writeVal2.GetValue() == readVal2.GetValue());
-
- PortableInner readVal3 = reader.ReadObject<PortableInner>("field3");
- BOOST_REQUIRE(0 == readVal3.GetValue());
-}
-
-BOOST_AUTO_TEST_CASE(TestNestedObject)
-{
- PortableOuter writeVal1(1, 2);
- PortableOuter writeVal2(0, 0);
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteObject("field1", writeVal1);
- writer.WriteObject("field2", writeVal2);
- writer.WriteNull("field3");
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableOuter readVal1 = reader.ReadObject<PortableOuter>("field1");
- BOOST_REQUIRE(writeVal1.GetValue() == readVal1.GetValue());
- BOOST_REQUIRE(writeVal1.GetInner().GetValue() == readVal1.GetInner().GetValue());
-
- PortableOuter readVal2 = reader.ReadObject<PortableOuter>("field2");
- BOOST_REQUIRE(writeVal2.GetValue() == readVal2.GetValue());
- BOOST_REQUIRE(writeVal2.GetInner().GetValue() == readVal2.GetInner().GetValue());
-
- PortableOuter readVal3 = reader.ReadObject<PortableOuter>("field3");
- BOOST_REQUIRE(0 == readVal3.GetValue());
- BOOST_REQUIRE(0 == readVal3.GetInner().GetValue());
-}
-
-BOOST_AUTO_TEST_CASE(TestArrayNull)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteNull("field1");
- writer.WriteInt8("field2", 1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
-
- BOOST_REQUIRE(arrReader.GetSize() == -1);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(arrReader.IsNull());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestArrayEmpty)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableArrayWriter<PortableInner> arrWriter = writer.WriteArray<PortableInner>("field1");
-
- CheckWritesRestricted(writer);
-
- arrWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- arrWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
-
- BOOST_REQUIRE(arrReader.GetSize() == 0);
- BOOST_REQUIRE(!arrReader.HasNext());
- BOOST_REQUIRE(!arrReader.IsNull());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestArray)
-{
- PortableInner writeVal1 = PortableInner(1);
- PortableInner writeVal2 = PortableInner(0);
- PortableInner writeVal3 = PortableInner(2);
-
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableArrayWriter<PortableInner> arrWriter = writer.WriteArray<PortableInner>("field1");
-
- arrWriter.Write(writeVal1);
- arrWriter.Write(writeVal2);
- arrWriter.Write(writeVal3);
-
- CheckWritesRestricted(writer);
-
- arrWriter.Close();
-
- writer.WriteInt8("field2", 1);
-
- try
- {
- arrWriter.Write(1);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- try
- {
- arrWriter.Close();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableArrayReader<PortableInner> arrReader = reader.ReadArray<PortableInner>("field1");
-
- CheckReadsRestricted(reader);
-
- BOOST_REQUIRE(arrReader.GetSize() == 3);
- BOOST_REQUIRE(!arrReader.IsNull());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal1.GetValue());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal2.GetValue());
-
- BOOST_REQUIRE(arrReader.HasNext());
- BOOST_REQUIRE(arrReader.GetNext().GetValue() == writeVal3.GetValue());
-
- BOOST_REQUIRE(!arrReader.HasNext());
-
- try
- {
- arrReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionNull)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteNull("field1");
- writer.WriteInt8("field2", 1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableCollectionReader<PortableInner> colReader = reader.ReadCollection<PortableInner>("field1");
-
- BOOST_REQUIRE(colReader.GetType() == IGNITE_COLLECTION_UNDEFINED);
- BOOST_REQUIRE(colReader.GetSize() == -1);
- BOOST_REQUIRE(!colReader.HasNext());
- BOOST_REQUIRE(colReader.IsNull());
-
- try
- {
- colReader.GetNext();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionEmpty)
-{
- CheckCollectionEmpty(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollectionEmptyTyped)
-{
- CollectionType typ = IGNITE_COLLECTION_CONCURRENT_SKIP_LIST_SET;
-
- CheckCollectionEmpty(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestCollection)
-{
- CheckCollection(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(testCollectionTyped)
-{
- CollectionType typ = IGNITE_COLLECTION_CONCURRENT_SKIP_LIST_SET;
-
- CheckCollection(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapNull)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- writer.WriteNull("field1");
- writer.WriteInt8("field2", 1);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 1000);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableMapReader<int8_t, PortableInner> mapReader = reader.ReadMap<int8_t, PortableInner>("field1");
-
- BOOST_REQUIRE(mapReader.GetType() == IGNITE_MAP_UNDEFINED);
- BOOST_REQUIRE(mapReader.GetSize() == -1);
- BOOST_REQUIRE(!mapReader.HasNext());
- BOOST_REQUIRE(mapReader.IsNull());
-
- try
- {
- int8_t key;
- PortableInner val;
-
- mapReader.GetNext(&key, &val);
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt8("field2") == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapEmpty)
-{
- CheckMapEmpty(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapEmptyTyped)
-{
- MapType typ = IGNITE_MAP_CONCURRENT_HASH_MAP;
-
- CheckMapEmpty(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestMap)
-{
- CheckMap(NULL);
-}
-
-BOOST_AUTO_TEST_CASE(TestMapTyped)
-{
- MapType typ = IGNITE_MAP_CONCURRENT_HASH_MAP;
-
- CheckMap(&typ);
-}
-
-BOOST_AUTO_TEST_CASE(TestRawMode)
-{
- TemplatedPortableIdResolver<PortableDummy> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writerImpl(&out, &idRslvr, NULL, NULL);
- PortableWriter writer(&writerImpl);
-
- out.Position(18);
-
- PortableRawWriter rawWriter = writer.RawWriter();
-
- try
- {
- writer.RawWriter();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- rawWriter.WriteInt8(1);
-
- CheckWritesRestricted(writer);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl readerImpl(&in, &idRslvr, 0, true, idRslvr.GetTypeId(), 0, 1000, 18);
- PortableReader reader(&readerImpl);
-
- in.Position(18);
-
- PortableRawReader rawReader = reader.RawReader();
-
- try
- {
- reader.RawReader();
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(rawReader.ReadInt8() == 1);
-
- CheckReadsRestricted(reader);
-}
-
-BOOST_AUTO_TEST_CASE(TestFieldSeek)
-{
- TemplatedPortableIdResolver<PortableFields> idRslvr;
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
-
- PortableFields writeVal(1, 2, 3, 4);
-
- writer.WriteTopObject<PortableFields>(writeVal);
-
- out.Synchronize();
-
- InteropInputStream in(&mem);
-
- int32_t pos = in.Position();
- in.ReadInt8(); // We do not need a header here.
- bool usrType = in.ReadBool();
- int32_t typeId = in.ReadInt32();
- int32_t hashCode = in.ReadInt32();
- int32_t len = in.ReadInt32();
- int32_t rawOff = in.ReadInt32();
-
- PortableReaderImpl readerImpl(&in, &idRslvr, pos, usrType, typeId, hashCode, len, rawOff);
- PortableReader reader(&readerImpl);
-
- // 1. Clockwise.
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
-
- // 2. Counter closkwise.
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
-
- // 3. Same field twice.
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
-
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
-
- // 4. Read missing field in between.
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
- BOOST_REQUIRE(reader.ReadInt32("missing") == 0);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
-
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
- BOOST_REQUIRE(reader.ReadInt32("missing") == 0);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
-
- // 5. Invalid field type.
- in.Position(18);
- BOOST_REQUIRE(reader.ReadInt32("val1") == 1);
-
- try
- {
- reader.ReadInt64("val2");
-
- BOOST_FAIL("Error expected.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_PORTABLE);
- }
-
- BOOST_REQUIRE(reader.ReadInt32("val2") == 2);
-
- // 6. Read missing primitive fields.
- BOOST_REQUIRE(reader.ReadInt8("missing") == 0);
- BOOST_REQUIRE(reader.ReadBool("missing") == false);
- BOOST_REQUIRE(reader.ReadInt16("missing") == 0);
- BOOST_REQUIRE(reader.ReadUInt16("missing") == 0);
- BOOST_REQUIRE(reader.ReadInt32("missing") == 0);
- BOOST_REQUIRE(reader.ReadInt64("missing") == 0);
- BOOST_REQUIRE(reader.ReadFloat("missing") == 0);
- BOOST_REQUIRE(reader.ReadDouble("missing") == 0);
-
- BOOST_REQUIRE(reader.ReadGuid("missing").GetMostSignificantBits() == 0);
- BOOST_REQUIRE(reader.ReadGuid("missing").GetLeastSignificantBits() == 0);
-
- // 7. Read missing primitive array fields.
- BOOST_REQUIRE(reader.ReadInt8Array("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadBoolArray("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadInt16Array("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadUInt16Array("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadInt32Array("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadInt64Array("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadFloatArray("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadDoubleArray("missing", NULL, 1) == -1);
-
- BOOST_REQUIRE(reader.ReadGuidArray("missing", NULL, 1) == -1);
-
- // 8. Read missing string fields.
- BOOST_REQUIRE(reader.ReadString("missing", NULL, 1) == -1);
- BOOST_REQUIRE(reader.ReadString("missing").length() == 0);
-
- // 9. Read missing object fields.
- BOOST_REQUIRE(reader.ReadObject<PortableFields*>("missing") == NULL);
-
- // 10. Read missing container fields.
- PortableStringArrayReader stringArrReader = reader.ReadStringArray("missing");
- BOOST_REQUIRE(stringArrReader.IsNull());
-
- PortableArrayReader<PortableFields> arrReader = reader.ReadArray<PortableFields>("missing");
- BOOST_REQUIRE(arrReader.IsNull());
-
- PortableCollectionReader<PortableFields> colReader = reader.ReadCollection<PortableFields>("missing");
- BOOST_REQUIRE(colReader.IsNull());
-
- PortableMapReader<int32_t, PortableFields> mapReader = reader.ReadMap<int32_t, PortableFields>("missing");
- BOOST_REQUIRE(mapReader.IsNull());
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp b/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp
deleted file mode 100644
index 9d84e48..0000000
--- a/modules/platform/src/main/cpp/core-test/src/portable_session_test.cpp
+++ /dev/null
@@ -1,257 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/impl/portable/portable_reader_impl.h"
-#include "ignite/impl/portable/portable_writer_impl.h"
-
-#include "ignite/portable_test_defs.h"
-
-using namespace ignite;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-using namespace ignite_test::core::portable;
-
-/*
- * Check primitive value serialization-deserialization.
- */
-template<typename T>
-void CheckRawPrimitive(T writeVal)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writeSes(&out, NULL);
- writeSes.WriteTopObject<T>(writeVal);
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- T readVal = reader.ReadTopObject<T>();
-
- BOOST_REQUIRE(readVal == writeVal);
-}
-
-BOOST_AUTO_TEST_SUITE(PortableSessionTestSuite)
-
-BOOST_AUTO_TEST_CASE(TestByte)
-{
- CheckRawPrimitive<int8_t>(-128);
- CheckRawPrimitive<int8_t>(-1);
- CheckRawPrimitive<int8_t>(0);
- CheckRawPrimitive<int8_t>(1);
- CheckRawPrimitive<int8_t>(127);
-}
-
-BOOST_AUTO_TEST_CASE(TestBool)
-{
- CheckRawPrimitive<bool>(true);
- CheckRawPrimitive<bool>(false);
-}
-
-BOOST_AUTO_TEST_CASE(TestShort)
-{
- //CheckRawPrimitive<int16_t>(std::numeric_limits<int16_t>::min());
- CheckRawPrimitive<int16_t>(-1);
- CheckRawPrimitive<int16_t>(0);
- CheckRawPrimitive<int16_t>(1);
- //CheckRawPrimitive<int16_t>(std::numeric_limits<int16_t>::max());
-}
-
-BOOST_AUTO_TEST_CASE(TestChar)
-{
- //CheckRawPrimitive<uint16_t>(std::numeric_limits<uint16_t>::min());
- CheckRawPrimitive<uint16_t>(1);
- //CheckRawPrimitive<uint16_t>(std::numeric_limits<uint16_t>::max());
-}
-
-BOOST_AUTO_TEST_CASE(TestInt)
-{
- //CheckRawPrimitive<int32_t>(std::numeric_limits<int32_t>::min());
- CheckRawPrimitive<int32_t>(-1);
- CheckRawPrimitive<int32_t>(0);
- CheckRawPrimitive<int32_t>(1);
- //CheckRawPrimitive<int32_t>(std::numeric_limits<int32_t>::max());
-}
-
-BOOST_AUTO_TEST_CASE(TestLong)
-{
- //CheckRawPrimitive<int64_t>(std::numeric_limits<int64_t>::min());
- CheckRawPrimitive<int64_t>(-1);
- CheckRawPrimitive<int64_t>(0);
- CheckRawPrimitive<int64_t>(1);
- //CheckRawPrimitive<int64_t>(std::numeric_limits<int64_t>::max());
-}
-
-BOOST_AUTO_TEST_CASE(TestFloat)
-{
- CheckRawPrimitive<float>(-1.1f);
- CheckRawPrimitive<float>(0);
- CheckRawPrimitive<float>(1.1f);
-}
-
-BOOST_AUTO_TEST_CASE(TestDouble)
-{
- CheckRawPrimitive<double>(-1.1);
- CheckRawPrimitive<double>(0);
- CheckRawPrimitive<double>(1.1);
-}
-
-BOOST_AUTO_TEST_CASE(TestGuid)
-{
- Guid writeVal = Guid(1, 1);
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writeSes(&out, NULL);
- writeSes.WriteTopObject<Guid>(writeVal);
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- Guid readVal = reader.ReadTopObject<Guid>();
-
- BOOST_REQUIRE(readVal.GetMostSignificantBits() == writeVal.GetMostSignificantBits());
- BOOST_REQUIRE(readVal.GetLeastSignificantBits() == writeVal.GetLeastSignificantBits());
-}
-
-BOOST_AUTO_TEST_CASE(TestString)
-{
- std::string writeVal = "MyString";
-
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writeSes(&out, NULL);
- writeSes.WriteTopObject<std::string>(writeVal);
- out.Synchronize();
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
- std::string readVal = reader.ReadTopObject<std::string>();
-
- BOOST_REQUIRE(readVal.compare(writeVal) == 0);
-}
-
-BOOST_AUTO_TEST_CASE(TestObject)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
-
- // 1. Test null object.
- PortableInner writeVal(0);
-
- writer.WriteTopObject<PortableInner>(writeVal);
- out.Synchronize();
-
- in.Synchronize();
- PortableInner readVal = reader.ReadTopObject<PortableInner>();
-
- BOOST_REQUIRE(readVal.GetValue() == 0);
-
- // 2. Test non-null object.
- out.Position(0);
- in.Position(0);
-
- writeVal = PortableInner(1);
-
- writer.WriteTopObject<PortableInner>(writeVal);
- out.Synchronize();
-
- in.Synchronize();
- readVal = reader.ReadTopObject<PortableInner>();
-
- BOOST_REQUIRE(readVal.GetValue() == 1);
-}
-
-BOOST_AUTO_TEST_CASE(TestObjectWithRawFields)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
-
- out.Position(0);
- in.Position(0);
-
- PortableFields writeVal = PortableFields(1, 2, 3, 4);
-
- writer.WriteTopObject<PortableFields>(writeVal);
- out.Synchronize();
-
- in.Synchronize();
- PortableFields readVal = reader.ReadTopObject<PortableFields>();
-
- BOOST_REQUIRE(readVal.val1 == 1);
- BOOST_REQUIRE(readVal.val2 == 2);
- BOOST_REQUIRE(readVal.rawVal1 == 3);
- BOOST_REQUIRE(readVal.rawVal2 == 4);
-}
-
-BOOST_AUTO_TEST_CASE(TestPointer)
-{
- InteropUnpooledMemory mem(1024);
-
- InteropOutputStream out(&mem);
- PortableWriterImpl writer(&out, NULL);
-
- InteropInputStream in(&mem);
- PortableReaderImpl reader(&in);
-
- // 1. Test null object.
- writer.WriteTopObject<PortableInner*>(NULL);
- out.Synchronize();
-
- in.Synchronize();
- PortableInner* readVal = reader.ReadTopObject<PortableInner*>();
-
- BOOST_REQUIRE(readVal == NULL);
-
- // 2. Test non-null object.
- out.Position(0);
- in.Position(0);
-
- PortableInner writeVal = PortableInner(1);
-
- writer.WriteTopObject<PortableInner*>(&writeVal);
- out.Synchronize();
-
- in.Synchronize();
- readVal = reader.ReadTopObject<PortableInner*>();
-
- BOOST_REQUIRE(readVal->GetValue() == 1);
-
- delete readVal;
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp b/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp
deleted file mode 100644
index e818711..0000000
--- a/modules/platform/src/main/cpp/core-test/src/portable_test_defs.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/impl/interop/interop.h"
-#include "ignite/portable/portable.h"
-
-#include "ignite/portable_test_defs.h"
-
-using namespace ignite;
-using namespace ignite::impl::interop;
-using namespace ignite::impl::portable;
-using namespace ignite::portable;
-
-namespace ignite_test
-{
- namespace core
- {
- namespace portable
- {
- PortableInner::PortableInner() : val(0)
- {
- // No-op.
- }
-
- PortableInner::PortableInner(int32_t val) : val(val)
- {
- // No-op.
- }
-
- int32_t PortableInner::GetValue() const
- {
- return val;
- }
-
- PortableOuter::PortableOuter(int32_t valIn, int32_t valOut) : inner(valIn), val(valOut)
- {
- // No-op.
- }
-
- PortableInner PortableOuter::GetInner() const
- {
- return inner;
- }
-
- int32_t PortableOuter::GetValue() const
- {
- return val;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp b/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp
deleted file mode 100644
index 45c666d..0000000
--- a/modules/platform/src/main/cpp/core-test/src/teamcity_boost.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Copyright 2011 JetBrains s.r.o.
- *
- * Licensed 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.
- *
- * $Revision: 88625 $
-*/
-
-#define BOOST_TEST_MODULE IgniteCoreTest
-
-#include <sstream>
-
-#include <boost/test/unit_test_suite_impl.hpp>
-#include <boost/test/results_collector.hpp>
-#include <boost/test/utils/basic_cstring/io.hpp>
-#include <boost/test/unit_test_log.hpp>
-#include <boost/test/included/unit_test.hpp>
-
-#include "teamcity_messages.h"
-
-using namespace boost::unit_test;
-using namespace std;
-
-namespace JetBrains {
-
-// Custom formatter for TeamCity messages
-class TeamcityBoostLogFormatter: public boost::unit_test::unit_test_log_formatter {
- TeamcityMessages messages;
- std::string currentDetails;
- std::string flowId;
-
-public:
- TeamcityBoostLogFormatter(const std::string &_flowId);
- TeamcityBoostLogFormatter();
-
- void log_start(std::ostream&, boost::unit_test::counter_t test_cases_amount);
- void log_finish(std::ostream&);
- void log_build_info(std::ostream&);
-
- void test_unit_start(std::ostream&, boost::unit_test::test_unit const& tu);
- void test_unit_finish(std::ostream&,
- boost::unit_test::test_unit const& tu,
- unsigned long elapsed);
- void test_unit_skipped(std::ostream&, boost::unit_test::test_unit const& tu);
-
- void log_exception(std::ostream&,
- boost::unit_test::log_checkpoint_data const&,
- boost::unit_test::const_string explanation);
-
- void log_entry_start(std::ostream&,
- boost::unit_test::log_entry_data const&,
- log_entry_types let);
- void log_entry_value(std::ostream&, boost::unit_test::const_string value);
- void log_entry_finish(std::ostream&);
-};
-
-// Fake fixture to register formatter
-struct TeamcityFormatterRegistrar {
- TeamcityFormatterRegistrar() {
- if (JetBrains::underTeamcity()) {
- boost::unit_test::unit_test_log.set_formatter(new JetBrains::TeamcityBoostLogFormatter());
- boost::unit_test::unit_test_log.set_threshold_level(boost::unit_test::log_successful_tests);
- }
- }
-};
-BOOST_GLOBAL_FIXTURE(TeamcityFormatterRegistrar);
-
-// Formatter implementation
-string toString(const_string bstr) {
- stringstream ss;
-
- ss << bstr;
-
- return ss.str();
-}
-
-TeamcityBoostLogFormatter::TeamcityBoostLogFormatter(const std::string &_flowId)
-: flowId(_flowId)
-{}
-
-TeamcityBoostLogFormatter::TeamcityBoostLogFormatter()
-: flowId(getFlowIdFromEnvironment())
-{}
-
-void TeamcityBoostLogFormatter::log_start(ostream &out, counter_t test_cases_amount)
-{}
-
-void TeamcityBoostLogFormatter::log_finish(ostream &out)
-{}
-
-void TeamcityBoostLogFormatter::log_build_info(ostream &out)
-{}
-
-void TeamcityBoostLogFormatter::test_unit_start(ostream &out, test_unit const& tu) {
- messages.setOutput(out);
-
- if (tu.p_type == tut_case) {
- messages.testStarted(tu.p_name, flowId);
- } else {
- messages.suiteStarted(tu.p_name, flowId);
- }
-
- currentDetails.clear();
-}
-
-void TeamcityBoostLogFormatter::test_unit_finish(ostream &out, test_unit const& tu, unsigned long elapsed) {
- messages.setOutput(out);
-
- test_results const& tr = results_collector.results(tu.p_id);
- if (tu.p_type == tut_case) {
- if(!tr.passed()) {
- if(tr.p_skipped) {
- messages.testIgnored(tu.p_name, "ignored", flowId);
- } else if (tr.p_aborted) {
- messages.testFailed(tu.p_name, "aborted", currentDetails, flowId);
- } else {
- messages.testFailed(tu.p_name, "failed", currentDetails, flowId);
- }
- }
-
- messages.testFinished(tu.p_name, elapsed / 1000, flowId);
- } else {
- messages.suiteFinished(tu.p_name, flowId);
- }
-}
-
-void TeamcityBoostLogFormatter::test_unit_skipped(ostream &out, test_unit const& tu)
-{}
-
-void TeamcityBoostLogFormatter::log_exception(ostream &out, log_checkpoint_data const&, const_string explanation) {
- string what = toString(explanation);
-
- out << what << endl;
- currentDetails += what + "\n";
-}
-
-void TeamcityBoostLogFormatter::log_entry_start(ostream&, log_entry_data const&, log_entry_types let)
-{}
-
-void TeamcityBoostLogFormatter::log_entry_value(ostream &out, const_string value) {
- out << value;
- currentDetails += toString(value);
-}
-
-void TeamcityBoostLogFormatter::log_entry_finish(ostream &out) {
- out << endl;
- currentDetails += "\n";
-}
-
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/teamcity_messages.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/teamcity_messages.cpp b/modules/platform/src/main/cpp/core-test/src/teamcity_messages.cpp
deleted file mode 100644
index 087409e..0000000
--- a/modules/platform/src/main/cpp/core-test/src/teamcity_messages.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/* Copyright 2011 JetBrains s.r.o.
- *
- * Licensed 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.
- *
- * $Revision: 88625 $
-*/
-
-#include <stdlib.h>
-#include <sstream>
-
-#include "teamcity_messages.h"
-
-using namespace std;
-
-namespace JetBrains {
-
-std::string getFlowIdFromEnvironment() {
- const char *flowId = getenv("TEAMCITY_PROCESS_FLOW_ID");
- return flowId == NULL ? "" : flowId;
-}
-
-bool underTeamcity() {
- return getenv("TEAMCITY_PROJECT_NAME") != NULL;
-}
-
-TeamcityMessages::TeamcityMessages()
-: m_out(&cout)
-{}
-
-void TeamcityMessages::setOutput(ostream &out) {
- m_out = &out;
-}
-
-string TeamcityMessages::escape(string s) {
- string result;
-
- for (size_t i = 0; i < s.length(); i++) {
- char c = s[i];
-
- switch (c) {
- case '\n': result.append("|n"); break;
- case '\r': result.append("|r"); break;
- case '\'': result.append("|'"); break;
- case '|': result.append("||"); break;
- case ']': result.append("|]"); break;
- default: result.append(&c, 1);
- }
- }
-
- return result;
-}
-
-void TeamcityMessages::openMsg(const string &name) {
- // endl for http://jetbrains.net/tracker/issue/TW-4412
- *m_out << endl << "##teamcity[" << name;
-}
-
-void TeamcityMessages::closeMsg() {
- *m_out << "]";
- // endl for http://jetbrains.net/tracker/issue/TW-4412
- *m_out << endl;
- m_out->flush();
-}
-
-void TeamcityMessages::writeProperty(string name, string value) {
- *m_out << " " << name << "='" << escape(value) << "'";
-}
-
-void TeamcityMessages::suiteStarted(string name, string flowid) {
- openMsg("testSuiteStarted");
- writeProperty("name", name);
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- closeMsg();
-}
-
-void TeamcityMessages::suiteFinished(string name, string flowid) {
- openMsg("testSuiteFinished");
- writeProperty("name", name);
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- closeMsg();
-}
-
-void TeamcityMessages::testStarted(string name, string flowid) {
- openMsg("testStarted");
- writeProperty("name", name);
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- closeMsg();
-}
-
-void TeamcityMessages::testFinished(string name, int durationMs, string flowid) {
- openMsg("testFinished");
-
- writeProperty("name", name);
-
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- if(durationMs >= 0) {
- stringstream out;
- out << durationMs;
- writeProperty("duration", out.str());
- }
-
- closeMsg();
-}
-
-void TeamcityMessages::testFailed(string name, string message, string details, string flowid) {
- openMsg("testFailed");
- writeProperty("name", name);
- writeProperty("message", message);
- writeProperty("details", details);
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- closeMsg();
-}
-
-void TeamcityMessages::testIgnored(std::string name, std::string message, string flowid) {
- openMsg("testIgnored");
- writeProperty("name", name);
- writeProperty("message", message);
- if(flowid.length() > 0) {
- writeProperty("flowId", flowid);
- }
-
- closeMsg();
-}
-
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/Makefile.am b/modules/platform/src/main/cpp/core/Makefile.am
deleted file mode 100644
index db50326..0000000
--- a/modules/platform/src/main/cpp/core/Makefile.am
+++ /dev/null
@@ -1,66 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-SUBDIRS = . include os/linux/include
-DIST_SUBDIRS = . include os/linux/include
-
-AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/os/linux/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
-AM_CXXFLAGS = -Wall -std=c++0x
-LIB_LDFLAGS = -no-undefined -version-info 1
-
-COMMON_SRC = os/linux/src/impl/utils.cpp \
- src/ignite_error.cpp \
- src/guid.cpp \
- src/impl/handle_registry.cpp \
- src/impl/interop/interop_memory.cpp \
- src/impl/interop/interop_input_stream.cpp \
- src/impl/interop/interop_output_stream.cpp \
- src/portable/portable_type.cpp \
- src/impl/portable/portable_metadata_snapshot.cpp \
- src/impl/portable/portable_metadata_handler.cpp \
- src/impl/portable/portable_metadata_updater.cpp \
- src/impl/portable/portable_metadata_manager.cpp \
- src/impl/portable/portable_utils.cpp \
- src/impl/portable/portable_reader_impl.cpp \
- src/impl/portable/portable_writer_impl.cpp \
- src/portable/portable_containers.cpp \
- src/portable/portable_raw_reader.cpp \
- src/portable/portable_raw_writer.cpp \
- src/portable/portable_reader.cpp \
- src/portable/portable_writer.cpp \
- src/impl/portable/portable_metadata_updater_impl.cpp \
- src/impl/ignite_environment.cpp \
- src/impl/cache/query/query_impl.cpp \
- src/impl/cache/cache_impl.cpp \
- src/impl/ignite_impl.cpp \
- src/ignite.cpp \
- src/ignition.cpp
-
-lib_LTLIBRARIES = libignite.la
-libignite_la_SOURCES = $(COMMON_SRC)
-libignite_la_LDFLAGS = $(LIB_LDFLAGS) -L/usr/local/lib -lignite-common -ldl -version-info 0:0:0 -release $(PACKAGE_VERSION)
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = ignite.pc
-
-clean-local:
- $(RM) *.gcno *.gcda
-
-clean-docs:
- $(RM) $(DX_CLEANFILES)
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/configure.ac b/modules/platform/src/main/cpp/core/configure.ac
deleted file mode 100644
index c1657d3..0000000
--- a/modules/platform/src/main/cpp/core/configure.ac
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# 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.
-#
-
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.69])
-AC_INIT([Apache Ignite C++], [1.5.0], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
-AC_CONFIG_SRCDIR(src)
-
-AC_CANONICAL_SYSTEM
-AC_CONFIG_MACRO_DIR([m4])
-AC_LANG([C++])
-
-# Initialize automake
-AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
-AC_CONFIG_HEADER(config.h)
-
-AM_PROG_AR
-
-# Checks for programs.
-GXX="-g -O2"
-
-AC_PROG_CXX
-
-# Initialize Libtool
-LT_INIT
-
-# Checks for libraries.
-AC_CHECK_LIB([pthread], [pthread_mutex_lock])
-
-# Checks for header files.
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_INLINE
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_INT8_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_FUNC_ERROR_AT_LINE
-
-AC_CONFIG_FILES(Makefile include/Makefile os/linux/include/Makefile ignite.pc)
-
-AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/ignite.pc.in
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/ignite.pc.in b/modules/platform/src/main/cpp/core/ignite.pc.in
deleted file mode 100644
index 613fd1a..0000000
--- a/modules/platform/src/main/cpp/core/ignite.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: ignite
-Description: Apache Ignite C++.
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lignite
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/Makefile.am b/modules/platform/src/main/cpp/core/include/Makefile.am
deleted file mode 100644
index da9d95e..0000000
--- a/modules/platform/src/main/cpp/core/include/Makefile.am
+++ /dev/null
@@ -1,61 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/cache/cache.h \
- ignite/cache/cache_entry.h \
- ignite/cache/cache_peek_mode.h \
- ignite/cache/query/query_argument.h \
- ignite/cache/query/query_cursor.h \
- ignite/cache/query/query_scan.h \
- ignite/cache/query/query_sql.h \
- ignite/cache/query/query_text.h \
- ignite/cache/query/query.h \
- ignite/impl/cache/cache_impl.h \
- ignite/impl/cache/query/query_impl.h \
- ignite/impl/interop/interop.h \
- ignite/impl/interop/interop_input_stream.h \
- ignite/impl/interop/interop_memory.h \
- ignite/impl/interop/interop_output_stream.h \
- ignite/impl/portable/portable_metadata_handler.h \
- ignite/impl/portable/portable_metadata_manager.h \
- ignite/impl/portable/portable_metadata_snapshot.h \
- ignite/impl/portable/portable_metadata_updater.h \
- ignite/impl/portable/portable_metadata_updater_impl.h \
- ignite/impl/portable/portable_common.h \
- ignite/impl/portable/portable_id_resolver.h \
- ignite/impl/portable/portable_reader_impl.h \
- ignite/impl/portable/portable_utils.h \
- ignite/impl/portable/portable_writer_impl.h \
- ignite/impl/ignite_environment.h \
- ignite/impl/ignite_impl.h \
- ignite/impl/handle_registry.h \
- ignite/impl/operations.h \
- ignite/portable/portable.h \
- ignite/portable/portable_consts.h \
- ignite/portable/portable_containers.h \
- ignite/portable/portable_type.h \
- ignite/portable/portable_raw_reader.h \
- ignite/portable/portable_raw_writer.h \
- ignite/portable/portable_reader.h \
- ignite/portable/portable_writer.h \
- ignite/ignite.h \
- ignite/ignite_configuration.h \
- ignite/ignite_error.h \
- ignite/ignition.h \
- ignite/guid.h
[51/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
IGNITE-1513: Finalized build procedure.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/f0bac562
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/f0bac562
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/f0bac562
Branch: refs/heads/ignite-1282
Commit: f0bac562c1ede9b4200cec5cdcdac535e637c996
Parents: 220ecb3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Tue Sep 22 18:01:50 2015 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Tue Sep 22 18:02:05 2015 +0300
----------------------------------------------------------------------
assembly/release-fabric.xml | 69 +-
modules/platform/licenses/apache-2.0.txt | 202 --
modules/platform/src/main/cpp/README.txt | 101 -
.../platform/src/main/cpp/common/Makefile.am | 45 -
.../platform/src/main/cpp/common/configure.ac | 62 -
.../src/main/cpp/common/ignite-common.pc.in | 9 -
.../src/main/cpp/common/include/Makefile.am | 22 -
.../common/include/ignite/common/concurrent.h | 210 --
.../cpp/common/include/ignite/common/exports.h | 145 -
.../cpp/common/include/ignite/common/java.h | 652 ----
.../cpp/common/os/linux/include/Makefile.am | 21 -
.../os/linux/include/ignite/common/common.h | 81 -
.../linux/include/ignite/common/concurrent_os.h | 394 ---
.../src/main/cpp/common/os/linux/src/common.cpp | 59 -
.../cpp/common/os/linux/src/concurrent_os.cpp | 175 -
.../os/win/include/ignite/common/common.h | 56 -
.../win/include/ignite/common/concurrent_os.h | 406 ---
.../src/main/cpp/common/os/win/src/common.cpp | 65 -
.../cpp/common/os/win/src/concurrent_os.cpp | 151 -
.../src/main/cpp/common/project/README.TXT | 1 -
.../src/main/cpp/common/project/vs/README.TXT | 1 -
.../main/cpp/common/project/vs/common.vcxproj | 202 --
.../common/project/vs/common.vcxproj.filters | 54 -
.../src/main/cpp/common/project/vs/module.def | 99 -
.../src/main/cpp/common/project/vs/targetver.h | 25 -
.../src/main/cpp/common/src/concurrent.cpp | 94 -
.../src/main/cpp/common/src/exports.cpp | 413 ---
.../platform/src/main/cpp/common/src/java.cpp | 2205 ------------
.../platform/src/main/cpp/core-test/Makefile.am | 49 -
.../main/cpp/core-test/config/cache-query.xml | 91 -
.../main/cpp/core-test/config/cache-test.xml | 129 -
.../src/main/cpp/core-test/configure.ac | 62 -
.../src/main/cpp/core-test/include/Makefile.am | 22 -
.../include/ignite/portable_test_defs.h | 320 --
.../include/ignite/portable_test_utils.h | 516 ---
.../cpp/core-test/include/teamcity_messages.h | 55 -
.../src/main/cpp/core-test/project/README.TXT | 1 -
.../main/cpp/core-test/project/vs/README.TXT | 1 -
.../cpp/core-test/project/vs/core-test.vcxproj | 174 -
.../project/vs/core-test.vcxproj.filters | 68 -
.../main/cpp/core-test/src/cache_query_test.cpp | 656 ----
.../src/main/cpp/core-test/src/cache_test.cpp | 486 ---
.../main/cpp/core-test/src/concurrent_test.cpp | 186 -
.../cpp/core-test/src/handle_registry_test.cpp | 176 -
.../main/cpp/core-test/src/ignition_test.cpp | 102 -
.../src/portable_reader_writer_raw_test.cpp | 1532 ---------
.../src/portable_reader_writer_test.cpp | 1951 -----------
.../cpp/core-test/src/portable_session_test.cpp | 257 --
.../cpp/core-test/src/portable_test_defs.cpp | 65 -
.../main/cpp/core-test/src/teamcity_boost.cpp | 159 -
.../cpp/core-test/src/teamcity_messages.cpp | 150 -
modules/platform/src/main/cpp/core/Makefile.am | 66 -
modules/platform/src/main/cpp/core/configure.ac | 62 -
modules/platform/src/main/cpp/core/ignite.pc.in | 9 -
.../src/main/cpp/core/include/Makefile.am | 61 -
.../main/cpp/core/include/ignite/cache/cache.h | 1153 -------
.../cpp/core/include/ignite/cache/cache_entry.h | 118 -
.../core/include/ignite/cache/cache_peek_mode.h | 71 -
.../cpp/core/include/ignite/cache/query/query.h | 27 -
.../include/ignite/cache/query/query_argument.h | 125 -
.../include/ignite/cache/query/query_cursor.h | 191 -
.../include/ignite/cache/query/query_scan.h | 151 -
.../core/include/ignite/cache/query/query_sql.h | 253 --
.../include/ignite/cache/query/query_text.h | 159 -
.../src/main/cpp/core/include/ignite/guid.h | 112 -
.../src/main/cpp/core/include/ignite/ignite.h | 154 -
.../core/include/ignite/ignite_configuration.h | 92 -
.../main/cpp/core/include/ignite/ignite_error.h | 260 --
.../src/main/cpp/core/include/ignite/ignition.h | 195 --
.../core/include/ignite/impl/cache/cache_impl.h | 418 ---
.../ignite/impl/cache/query/query_impl.h | 115 -
.../core/include/ignite/impl/handle_registry.h | 202 --
.../include/ignite/impl/ignite_environment.h | 130 -
.../cpp/core/include/ignite/impl/ignite_impl.h | 146 -
.../core/include/ignite/impl/interop/interop.h | 25 -
.../ignite/impl/interop/interop_input_stream.h | 234 --
.../ignite/impl/interop/interop_memory.h | 280 --
.../ignite/impl/interop/interop_output_stream.h | 234 --
.../cpp/core/include/ignite/impl/operations.h | 452 ---
.../ignite/impl/portable/portable_common.h | 146 -
.../ignite/impl/portable/portable_id_resolver.h | 106 -
.../impl/portable/portable_metadata_handler.h | 102 -
.../impl/portable/portable_metadata_manager.h | 120 -
.../impl/portable/portable_metadata_snapshot.h | 122 -
.../impl/portable/portable_metadata_updater.h | 53 -
.../portable/portable_metadata_updater_impl.h | 65 -
.../ignite/impl/portable/portable_reader_impl.h | 1130 ------
.../ignite/impl/portable/portable_utils.h | 344 --
.../ignite/impl/portable/portable_writer_impl.h | 859 -----
.../cpp/core/include/ignite/portable/portable.h | 29 -
.../include/ignite/portable/portable_consts.h | 106 -
.../ignite/portable/portable_containers.h | 525 ---
.../ignite/portable/portable_raw_reader.h | 324 --
.../ignite/portable/portable_raw_writer.h | 300 --
.../include/ignite/portable/portable_reader.h | 355 --
.../include/ignite/portable/portable_type.h | 293 --
.../include/ignite/portable/portable_writer.h | 335 --
.../main/cpp/core/os/linux/include/Makefile.am | 20 -
.../core/os/linux/include/ignite/impl/utils.h | 155 -
.../main/cpp/core/os/linux/src/impl/utils.cpp | 439 ---
.../cpp/core/os/win/include/ignite/impl/utils.h | 155 -
.../src/main/cpp/core/os/win/src/impl/utils.cpp | 453 ---
.../src/main/cpp/core/project/README.TXT | 1 -
.../src/main/cpp/core/project/vs/README.TXT | 1 -
.../src/main/cpp/core/project/vs/core.vcxproj | 272 --
.../cpp/core/project/vs/core.vcxproj.filters | 246 --
modules/platform/src/main/cpp/core/src/guid.cpp | 65 -
.../platform/src/main/cpp/core/src/ignite.cpp | 43 -
.../src/main/cpp/core/src/ignite_error.cpp | 222 --
.../platform/src/main/cpp/core/src/ignition.cpp | 468 ---
.../main/cpp/core/src/impl/cache/cache_impl.cpp | 388 ---
.../core/src/impl/cache/query/query_impl.cpp | 193 --
.../main/cpp/core/src/impl/handle_registry.cpp | 234 --
.../cpp/core/src/impl/ignite_environment.cpp | 167 -
.../src/main/cpp/core/src/impl/ignite_impl.cpp | 42 -
.../src/impl/interop/interop_input_stream.cpp | 215 --
.../core/src/impl/interop/interop_memory.cpp | 182 -
.../src/impl/interop/interop_output_stream.cpp | 215 --
.../impl/portable/portable_metadata_handler.cpp | 78 -
.../impl/portable/portable_metadata_manager.cpp | 201 --
.../portable/portable_metadata_snapshot.cpp | 70 -
.../impl/portable/portable_metadata_updater.cpp | 32 -
.../portable/portable_metadata_updater_impl.cpp | 94 -
.../src/impl/portable/portable_reader_impl.cpp | 683 ----
.../core/src/impl/portable/portable_utils.cpp | 214 --
.../src/impl/portable/portable_writer_impl.cpp | 600 ----
.../core/src/portable/portable_containers.cpp | 76 -
.../core/src/portable/portable_raw_reader.cpp | 135 -
.../core/src/portable/portable_raw_writer.cpp | 147 -
.../cpp/core/src/portable/portable_reader.cpp | 142 -
.../cpp/core/src/portable/portable_type.cpp | 51 -
.../cpp/core/src/portable/portable_writer.cpp | 154 -
.../platform/src/main/cpp/examples/Makefile.am | 39 -
.../platform/src/main/cpp/examples/README.txt | 42 -
.../main/cpp/examples/config/example-cache.xml | 77 -
.../platform/src/main/cpp/examples/configure.ac | 38 -
.../src/main/cpp/examples/include/Makefile.am | 21 -
.../examples/include/ignite/examples/address.h | 109 -
.../include/ignite/examples/organization.h | 111 -
.../cpp/examples/project/vs/ignite-examples.sln | 19 -
.../examples/project/vs/ignite-examples.vcxproj | 107 -
.../project/vs/ignite-examples.vcxproj.filters | 30 -
.../src/main/cpp/examples/src/putgetexample.cpp | 126 -
.../platform/src/main/cpp/project/vs/ignite.sln | 46 -
.../src/main/cpp/project/vs/ignite.slnrel | 33 -
.../src/main/cpp/project/vs/ignite_x86.slnrel | 33 -
.../Apache.Ignite.Core.csproj | 373 --
.../Cache/CacheAtomicUpdateTimeoutException.cs | 67 -
.../Cache/CacheEntryProcessorException.cs | 79 -
.../Apache.Ignite.Core/Cache/CacheException.cs | 68 -
.../Cache/CachePartialUpdateException.cs | 119 -
.../Apache.Ignite.Core/Cache/CachePeekMode.cs | 68 -
.../Cache/Event/CacheEntryEventType.cs | 41 -
.../Cache/Event/ICacheEntryEvent.cs | 40 -
.../Cache/Event/ICacheEntryEventFilter.cs | 31 -
.../Cache/Event/ICacheEntryEventListener.cs | 33 -
.../Cache/Expiry/ExpiryPolicy.cs | 89 -
.../Cache/Expiry/IExpiryPolicy.cs | 59 -
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 542 ---
.../Apache.Ignite.Core/Cache/ICacheAffinity.cs | 158 -
.../Apache.Ignite.Core/Cache/ICacheEntry.cs | 37 -
.../Cache/ICacheEntryFilter.cs | 34 -
.../Cache/ICacheEntryProcessor.cs | 45 -
.../Cache/ICacheEntryProcessorResult.cs | 40 -
.../Apache.Ignite.Core/Cache/ICacheLock.cs | 58 -
.../Apache.Ignite.Core/Cache/ICacheMetrics.cs | 486 ---
.../Cache/IMutableCacheEntry.cs | 47 -
.../Cache/Query/Continuous/ContinuousQuery.cs | 170 -
.../Query/Continuous/IContinuousQueryHandle.cs | 45 -
.../Cache/Query/IQueryCursor.cs | 40 -
.../Apache.Ignite.Core/Cache/Query/QueryBase.cs | 82 -
.../Apache.Ignite.Core/Cache/Query/ScanQuery.cs | 77 -
.../Cache/Query/SqlFieldsQuery.cs | 81 -
.../Apache.Ignite.Core/Cache/Query/SqlQuery.cs | 119 -
.../Apache.Ignite.Core/Cache/Query/TextQuery.cs | 104 -
.../Store/CacheParallelLoadStoreAdapter.cs | 205 --
.../Cache/Store/CacheStoreAdapter.cs | 146 -
.../Cache/Store/CacheStoreException.cs | 66 -
.../Cache/Store/ICacheStore.cs | 184 -
.../Cache/Store/ICacheStoreSession.cs | 42 -
.../Cluster/ClusterGroupEmptyException.cs | 70 -
.../Cluster/ClusterTopologyException.cs | 69 -
.../Apache.Ignite.Core/Cluster/ICluster.cs | 77 -
.../Apache.Ignite.Core/Cluster/IClusterGroup.cs | 227 --
.../Cluster/IClusterMetrics.cs | 515 ---
.../Apache.Ignite.Core/Cluster/IClusterNode.cs | 121 -
.../Cluster/IClusterNodeFilter.cs | 32 -
.../Common/AsyncSupportedAttribute.cs | 33 -
.../Apache.Ignite.Core/Common/IAsyncSupport.cs | 52 -
.../dotnet/Apache.Ignite.Core/Common/IFuture.cs | 115 -
.../Common/IgniteException.cs | 66 -
.../Apache.Ignite.Core/Common/IgniteGuid.cs | 138 -
.../ComputeExecutionRejectedException.cs | 69 -
.../Compute/ComputeJobAdapter.cs | 122 -
.../Compute/ComputeJobFailoverException.cs | 72 -
.../Compute/ComputeJobResultPolicy.cs | 45 -
.../Compute/ComputeTaskAdapter.cs | 93 -
.../Compute/ComputeTaskCancelledException.cs | 69 -
.../ComputeTaskNoResultCacheAttribute.cs | 35 -
.../Compute/ComputeTaskSplitAdapter.cs | 95 -
.../Compute/ComputeTaskTimeoutException.cs | 67 -
.../Compute/ComputeUserUndeclaredException.cs | 70 -
.../Apache.Ignite.Core/Compute/ICompute.cs | 271 --
.../Apache.Ignite.Core/Compute/IComputeFunc.cs | 55 -
.../Apache.Ignite.Core/Compute/IComputeJob.cs | 58 -
.../Compute/IComputeJobResult.cs | 73 -
.../Compute/IComputeReducer.cs | 39 -
.../Apache.Ignite.Core/Compute/IComputeTask.cs | 132 -
.../Datastream/IDataStreamer.cs | 206 --
.../Datastream/IStreamReceiver.cs | 38 -
.../Datastream/StreamTransformer.cs | 73 -
.../Datastream/StreamVisitor.cs | 55 -
.../Apache.Ignite.Core/Events/CacheEvent.cs | 176 -
.../Events/CacheQueryExecutedEvent.cs | 97 -
.../Events/CacheQueryReadEvent.cs | 134 -
.../Events/CacheRebalancingEvent.cs | 98 -
.../Events/CheckpointEvent.cs | 50 -
.../Apache.Ignite.Core/Events/DiscoveryEvent.cs | 80 -
.../Apache.Ignite.Core/Events/EventBase.cs | 160 -
.../Apache.Ignite.Core/Events/EventReader.cs | 72 -
.../Apache.Ignite.Core/Events/EventType.cs | 514 ---
.../dotnet/Apache.Ignite.Core/Events/IEvent.cs | 74 -
.../Apache.Ignite.Core/Events/IEventFilter.cs | 36 -
.../dotnet/Apache.Ignite.Core/Events/IEvents.cs | 182 -
.../Apache.Ignite.Core/Events/JobEvent.cs | 100 -
.../Apache.Ignite.Core/Events/SwapSpaceEvent.cs | 50 -
.../Apache.Ignite.Core/Events/TaskEvent.cs | 91 -
.../main/dotnet/Apache.Ignite.Core/IIgnite.cs | 144 -
.../Apache.Ignite.Core/IgniteConfiguration.cs | 140 -
.../main/dotnet/Apache.Ignite.Core/Ignition.cs | 662 ----
.../Impl/Cache/CacheAffinityImpl.cs | 275 --
.../Apache.Ignite.Core/Impl/Cache/CacheEntry.cs | 126 -
.../Impl/Cache/CacheEntryFilterHolder.cs | 147 -
.../Impl/Cache/CacheEntryProcessorHolder.cs | 145 -
.../Impl/Cache/CacheEntryProcessorResult.cs | 65 -
.../Cache/CacheEntryProcessorResultHolder.cs | 127 -
.../Impl/Cache/CacheEnumerable.cs | 82 -
.../Impl/Cache/CacheEnumerator.cs | 117 -
.../Impl/Cache/CacheEnumeratorProxy.cs | 156 -
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 941 -----
.../Apache.Ignite.Core/Impl/Cache/CacheLock.cs | 171 -
.../Impl/Cache/CacheMetricsImpl.cs | 248 --
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 63 -
.../Impl/Cache/CacheProxyImpl.cs | 500 ---
.../Impl/Cache/Event/CacheEntryCreateEvent.cs | 74 -
.../Impl/Cache/Event/CacheEntryRemoveEvent.cs | 74 -
.../Impl/Cache/Event/CacheEntryUpdateEvent.cs | 79 -
.../Impl/Cache/MutableCacheEntry.cs | 163 -
.../Impl/Cache/Query/AbstractQueryCursor.cs | 264 --
.../Query/Continuous/ContinuousQueryFilter.cs | 125 -
.../Continuous/ContinuousQueryFilterHolder.cs | 118 -
.../Continuous/ContinuousQueryHandleImpl.cs | 210 --
.../Query/Continuous/ContinuousQueryUtils.cs | 115 -
.../Impl/Cache/Query/FieldsQueryCursor.cs | 54 -
.../Impl/Cache/Query/QueryCursor.cs | 50 -
.../Impl/Cache/Store/CacheStore.cs | 263 --
.../Impl/Cache/Store/CacheStoreSession.cs | 53 -
.../Impl/Cache/Store/CacheStoreSessionProxy.cs | 63 -
.../Impl/Cluster/ClusterGroupImpl.cs | 577 ----
.../Impl/Cluster/ClusterMetricsImpl.cs | 292 --
.../Impl/Cluster/ClusterNodeImpl.cs | 221 --
.../Impl/Cluster/IClusterGroupEx.cs | 35 -
.../Impl/Collections/CollectionExtensions.cs | 45 -
.../Impl/Collections/MultiValueDictionary.cs | 143 -
.../Impl/Collections/ReadOnlyCollection.cs | 102 -
.../Impl/Collections/ReadOnlyDictionary.cs | 149 -
.../Impl/Common/AsyncResult.cs | 71 -
.../Impl/Common/CompletedAsyncResult.cs | 70 -
.../Common/CopyOnWriteConcurrentDictionary.cs | 70 -
.../Impl/Common/DelegateConverter.cs | 253 --
.../Impl/Common/DelegateTypeDescriptor.cs | 314 --
.../Apache.Ignite.Core/Impl/Common/Future.cs | 286 --
.../Impl/Common/FutureConverter.cs | 62 -
.../Impl/Common/FutureType.cs | 52 -
.../Impl/Common/IFutureConverter.cs | 34 -
.../Impl/Common/IFutureInternal.cs | 46 -
.../Impl/Common/IgniteArgumentCheck.cs | 76 -
.../Impl/Common/LoadedAssembliesResolver.cs | 96 -
.../Impl/Common/PortableResultWrapper.cs | 68 -
.../Impl/Common/TypeCaster.cs | 72 -
.../Closure/ComputeAbstractClosureTask.cs | 101 -
.../Impl/Compute/Closure/ComputeActionJob.cs | 83 -
.../Impl/Compute/Closure/ComputeFuncJob.cs | 89 -
.../Compute/Closure/ComputeMultiClosureTask.cs | 56 -
.../Impl/Compute/Closure/ComputeOutFuncJob.cs | 76 -
.../Closure/ComputeReducingClosureTask.cs | 61 -
.../Compute/Closure/ComputeSingleClosureTask.cs | 48 -
.../Compute/Closure/IComputeResourceInjector.cs | 31 -
.../Apache.Ignite.Core/Impl/Compute/Compute.cs | 213 --
.../Impl/Compute/ComputeAsync.cs | 261 --
.../Impl/Compute/ComputeFunc.cs | 119 -
.../Impl/Compute/ComputeImpl.cs | 645 ----
.../Impl/Compute/ComputeJob.cs | 163 -
.../Impl/Compute/ComputeJobHolder.cs | 246 --
.../Compute/ComputeJobResultGenericWrapper.cs | 70 -
.../Impl/Compute/ComputeJobResultImpl.cs | 96 -
.../Impl/Compute/ComputeOutFunc.cs | 123 -
.../Impl/Compute/ComputeTaskHolder.cs | 484 ---
.../Impl/Datastream/DataStreamerBatch.cs | 269 --
.../Impl/Datastream/DataStreamerEntry.cs | 64 -
.../Impl/Datastream/DataStreamerImpl.cs | 832 -----
.../Impl/Datastream/DataStreamerRemoveEntry.cs | 48 -
.../Impl/Datastream/StreamReceiverHolder.cs | 144 -
.../Apache.Ignite.Core/Impl/Events/Events.cs | 498 ---
.../Impl/Events/EventsAsync.cs | 158 -
.../Impl/Events/RemoteListenEventFilter.cs | 85 -
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 204 --
.../Apache.Ignite.Core/Impl/Handle/Handle.cs | 69 -
.../Impl/Handle/HandleRegistry.cs | 340 --
.../Apache.Ignite.Core/Impl/Handle/IHandle.cs | 35 -
.../Apache.Ignite.Core/Impl/IInteropCallback.cs | 34 -
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 511 ---
.../Impl/IgniteConfigurationEx.cs | 57 -
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 490 ---
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 333 --
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 438 ---
.../Impl/InteropExceptionHolder.cs | 85 -
.../Impl/LifecycleBeanHolder.cs | 66 -
.../Impl/Memory/IPlatformMemory.cs | 65 -
.../Impl/Memory/InteropExternalMemory.cs | 46 -
.../Impl/Memory/InteropMemoryUtils.cs | 38 -
.../Memory/PlatformBigEndianMemoryStream.cs | 483 ---
.../Impl/Memory/PlatformMemory.cs | 78 -
.../Impl/Memory/PlatformMemoryManager.cs | 107 -
.../Impl/Memory/PlatformMemoryPool.cs | 106 -
.../Impl/Memory/PlatformMemoryStream.cs | 677 ----
.../Impl/Memory/PlatformMemoryUtils.cs | 463 ---
.../Impl/Memory/PlatformPooledMemory.cs | 70 -
.../Impl/Memory/PlatformRawMemory.cs | 89 -
.../Impl/Memory/PlatformUnpooledMemory.cs | 52 -
.../Impl/Messaging/MessageFilterHolder.cs | 179 -
.../Impl/Messaging/Messaging.cs | 262 --
.../Impl/Messaging/MessagingAsync.cs | 68 -
.../Apache.Ignite.Core/Impl/NativeMethods.cs | 47 -
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 715 ----
.../Portable/IPortableSystemTypeSerializer.cs | 34 -
.../Impl/Portable/IPortableTypeDescriptor.cs | 124 -
.../Impl/Portable/IPortableWriteAware.cs | 34 -
.../Impl/Portable/Io/IPortableStream.cs | 320 --
.../Impl/Portable/Io/PortableAbstractStream.cs | 1298 -------
.../Impl/Portable/Io/PortableHeapStream.cs | 447 ---
.../Impl/Portable/Io/PortableStreamAdapter.cs | 114 -
.../Metadata/IPortableMetadataHandler.cs | 41 -
.../Metadata/PortableHashsetMetadataHandler.cs | 69 -
.../Portable/Metadata/PortableMetadataHolder.cs | 149 -
.../Portable/Metadata/PortableMetadataImpl.cs | 200 --
.../Impl/Portable/PortableBuilderField.cs | 73 -
.../Impl/Portable/PortableBuilderImpl.cs | 923 -----
.../Impl/Portable/PortableCollectionInfo.cs | 251 --
.../Impl/Portable/PortableFullTypeDescriptor.cs | 203 --
.../Impl/Portable/PortableHandleDictionary.cs | 187 -
.../Portable/PortableMarshalAwareSerializer.cs | 45 -
.../Impl/Portable/PortableMarshaller.cs | 599 ----
.../Impl/Portable/PortableMode.cs | 40 -
.../Impl/Portable/PortableObjectHandle.cs | 59 -
.../PortableOrSerializableObjectHolder.cs | 66 -
.../Portable/PortableReaderHandleDictionary.cs | 42 -
.../Impl/Portable/PortableReaderImpl.cs | 1013 ------
.../Impl/Portable/PortableReflectiveRoutines.cs | 483 ---
.../Portable/PortableReflectiveSerializer.cs | 218 --
.../Portable/PortableSurrogateTypeDescriptor.cs | 133 -
.../Impl/Portable/PortableSystemHandlers.cs | 1336 -------
.../Portable/PortableSystemTypeSerializer.cs | 62 -
.../Impl/Portable/PortableUserObject.cs | 385 ---
.../Impl/Portable/PortableUtils.cs | 2130 ------------
.../Impl/Portable/PortableWriterImpl.cs | 1305 -------
.../Impl/Portable/PortablesImpl.cs | 205 --
.../Impl/Portable/SerializableObjectHolder.cs | 66 -
.../Impl/Portable/TypeResolver.cs | 227 --
.../Impl/Resource/IResourceInjector.cs | 27 -
.../Impl/Resource/ResourceFieldInjector.cs | 47 -
.../Impl/Resource/ResourceMethodInjector.cs | 48 -
.../Impl/Resource/ResourceProcessor.cs | 105 -
.../Impl/Resource/ResourcePropertyInjector.cs | 47 -
.../Impl/Resource/ResourceTypeDescriptor.cs | 291 --
.../Impl/Services/ServiceContext.cs | 60 -
.../Impl/Services/ServiceDescriptor.cs | 106 -
.../Impl/Services/ServiceProxy.cs | 71 -
.../Impl/Services/ServiceProxyInvoker.cs | 136 -
.../Impl/Services/ServiceProxySerializer.cs | 140 -
.../Impl/Services/Services.cs | 316 --
.../Impl/Services/ServicesAsync.cs | 89 -
.../Impl/Transactions/AsyncTransaction.cs | 78 -
.../Impl/Transactions/Transaction.cs | 155 -
.../Impl/Transactions/TransactionImpl.cs | 489 ---
.../Impl/Transactions/TransactionMetricsImpl.cs | 62 -
.../Impl/Transactions/TransactionsImpl.cs | 201 --
.../Impl/Unmanaged/IUnmanagedTarget.cs | 42 -
.../Impl/Unmanaged/UnmanagedCallbackHandlers.cs | 99 -
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 1154 -------
.../Impl/Unmanaged/UnmanagedContext.cs | 53 -
.../Unmanaged/UnmanagedNonReleaseableTarget.cs | 68 -
.../Impl/Unmanaged/UnmanagedTarget.cs | 77 -
.../Impl/Unmanaged/UnmanagedUtils.cs | 1263 -------
.../Lifecycle/ILifecycleBean.cs | 64 -
.../Lifecycle/LifecycleEventType.cs | 49 -
.../Messaging/IMessageFilter.cs | 35 -
.../Apache.Ignite.Core/Messaging/IMessaging.cs | 105 -
.../Portable/IPortableBuilder.cs | 77 -
.../Portable/IPortableIdMapper.cs | 40 -
.../Portable/IPortableMarshalAware.cs | 39 -
.../Portable/IPortableMetadata.cs | 52 -
.../Portable/IPortableNameMapper.cs | 39 -
.../Portable/IPortableObject.cs | 56 -
.../Portable/IPortableRawReader.cs | 264 --
.../Portable/IPortableRawWriter.cs | 221 --
.../Portable/IPortableReader.cs | 340 --
.../Portable/IPortableSerializer.cs | 39 -
.../Portable/IPortableWriter.cs | 259 --
.../Apache.Ignite.Core/Portable/IPortables.cs | 120 -
.../Portable/PortableConfiguration.cs | 122 -
.../Portable/PortableException.cs | 64 -
.../Portable/PortableTypeConfiguration.cs | 162 -
.../Portable/PortableTypeNames.cs | 115 -
.../Properties/AssemblyInfo.cs | 46 -
.../Resource/InstanceResourceAttribute.cs | 35 -
.../Resource/StoreSessionResourceAttribute.cs | 32 -
.../Apache.Ignite.Core/Services/IService.cs | 51 -
.../Services/IServiceContext.cs | 69 -
.../Services/IServiceDescriptor.cs | 96 -
.../Apache.Ignite.Core/Services/IServices.cs | 181 -
.../Services/ServiceConfiguration.cs | 62 -
.../Services/ServiceInvocationException.cs | 101 -
.../Transactions/ITransaction.cs | 230 --
.../Transactions/ITransactionMetrics.cs | 47 -
.../Transactions/ITransactions.cs | 73 -
.../Transactions/TransactionConcurrency.cs | 36 -
.../TransactionHeuristicException.cs | 72 -
.../Transactions/TransactionIsolation.cs | 41 -
.../TransactionOptimisticException.cs | 69 -
.../TransactionRollbackException.cs | 68 -
.../Transactions/TransactionState.cs | 70 -
.../Transactions/TransactionTimeoutException.cs | 69 -
.../platform/src/main/dotnet/Apache.Ignite.sln | 86 -
.../main/dotnet/Apache.Ignite.sln.DotSettings | 4 -
.../src/main/dotnet/Apache.Ignite.slnrel | 43 -
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 76 -
.../Apache.Ignite/Apache.Ignite.csprojrel | 76 -
.../src/main/dotnet/Apache.Ignite/App.config | 56 -
.../Config/AppSettingsConfigurator.cs | 113 -
.../Apache.Ignite/Config/ArgsConfigurator.cs | 164 -
.../Apache.Ignite/Config/ConfigValueParser.cs | 42 -
.../Apache.Ignite/Config/IConfigurator.cs | 34 -
.../main/dotnet/Apache.Ignite/IgniteRunner.cs | 171 -
.../Apache.Ignite/Properties/AssemblyInfo.cs | 35 -
.../Apache.Ignite/Service/IgniteService.cs | 219 --
.../Apache.Ignite/Service/NativeMethods.cs | 57 -
.../Apache.Ignite/Service/ServiceDescription.cs | 32 -
.../src/main/dotnet/Apache.Ignite_x86.slnrel | 43 -
.../dotnet/Examples/Apache.Ignite.Examples.sln | 72 -
.../Examples/Apache.Ignite.Examples.slnrel | 38 -
.../Apache.Ignite.Examples.csproj | 80 -
.../Apache.Ignite.Examples.csprojrel | 79 -
.../Examples/Apache.Ignite.Examples/App.config | 24 -
.../Compute/ClosureExample.cs | 84 -
.../Compute/TaskExample.cs | 140 -
.../Datagrid/ContinuousQueryExample.cs | 103 -
.../Datagrid/CrossPlatformExample.cs | 208 --
.../Datagrid/DataStreamerExample.cs | 101 -
.../Datagrid/PutGetExample.cs | 219 --
.../Datagrid/QueryExample.cs | 226 --
.../Datagrid/StoreExample.cs | 114 -
.../Datagrid/TransactionExample.cs | 104 -
.../Events/EventsExample.cs | 118 -
.../Messaging/MessagingExample.cs | 112 -
.../Misc/LifecycleExample.cs | 109 -
.../Properties/AssemblyInfo.cs | 35 -
.../Services/IMapService.cs | 56 -
.../Services/ServicesExample.cs | 77 -
.../Apache.Ignite.ExamplesDll.csproj | 75 -
.../Apache.Ignite.ExamplesDll.csprojrel | 72 -
.../Compute/AverageSalaryJob.cs | 65 -
.../Compute/AverageSalaryTask.cs | 84 -
.../Compute/CharacterCountClosure.cs | 43 -
.../Compute/CharacterCountReducer.cs | 51 -
.../Datagrid/ContinuousQueryFilter.cs | 50 -
.../Datagrid/EmployeeStore.cs | 121 -
.../Datagrid/EmployeeStorePredicate.cs | 40 -
.../Events/LocalListener.cs | 55 -
.../Events/RemoteFilter.cs | 42 -
.../Messaging/LocalListener.cs | 59 -
.../Messaging/RemoteOrderedListener.cs | 54 -
.../Messaging/RemoteUnorderedListener.cs | 54 -
.../Messaging/Topic.cs | 28 -
.../Portable/Account.cs | 60 -
.../Portable/Address.cs | 81 -
.../Portable/Employee.cs | 93 -
.../Portable/EmployeeKey.cs | 86 -
.../Portable/Organization.cs | 84 -
.../Portable/OrganizationType.cs | 43 -
.../Properties/AssemblyInfo.cs | 35 -
.../Services/MapService.cs | 119 -
.../Examples/Config/example-cache-query.xml | 111 -
.../Examples/Config/example-cache-store.xml | 60 -
.../dotnet/Examples/Config/example-cache.xml | 83 -
.../dotnet/Examples/Config/example-compute.xml | 70 -
.../src/main/dotnet/Examples/README.txt | 14 -
modules/platform/src/main/dotnet/README.txt | 24 -
.../Apache.Ignite.Core.Tests.TestDll.csproj | 52 -
.../Properties/AssemblyInfo.cs | 49 -
.../TestClass.cs | 35 -
.../Apache.Ignite.Core.Tests.csproj | 242 --
.../Cache/CacheAbstractTest.cs | 3252 ------------------
.../Cache/CacheAffinityTest.cs | 139 -
.../Cache/CacheDynamicStartTest.cs | 281 --
.../Cache/CacheEntryTest.cs | 69 -
.../Cache/CacheForkedTest.cs | 81 -
.../Cache/CacheLocalAtomicTest.cs | 57 -
.../Cache/CacheLocalTest.cs | 56 -
.../CachePartitionedAtomicNearEnabledTest.cs | 50 -
.../Cache/CachePartitionedAtomicTest.cs | 50 -
.../Cache/CachePartitionedNearEnabledTest.cs | 50 -
.../Cache/CachePartitionedTest.cs | 50 -
.../Cache/CacheReplicatedAtomicTest.cs | 60 -
.../Cache/CacheReplicatedTest.cs | 60 -
.../Cache/CacheTestAsyncWrapper.cs | 437 ---
.../Cache/Query/CacheQueriesTest.cs | 928 -----
.../Continuous/ContinuousQueryAbstractTest.cs | 1181 -------
.../ContinuousQueryAtomicBackupTest.cs | 33 -
.../ContinuousQueryAtomicNoBackupTest.cs | 34 -
.../ContinuousQueryNoBackupAbstractTest.cs | 72 -
.../ContinuousQueryTransactionalBackupTest.cs | 34 -
.../ContinuousQueryTransactionalNoBackupTest.cs | 33 -
.../Cache/Store/CacheParallelLoadStoreTest.cs | 110 -
.../Cache/Store/CacheStoreSessionTest.cs | 285 --
.../Cache/Store/CacheStoreTest.cs | 510 ---
.../Cache/Store/CacheTestParallelLoadStore.cs | 91 -
.../Cache/Store/CacheTestStore.cs | 155 -
.../Compute/AbstractTaskTest.cs | 217 --
.../Compute/ClosureTaskTest.cs | 390 ---
.../Compute/ComputeApiTest.cs | 1281 -------
.../Compute/ComputeMultithreadedTest.cs | 269 --
.../Compute/FailoverTaskSelfTest.cs | 246 --
.../Forked/ForkedPortableClosureTaskTest.cs | 30 -
.../Compute/Forked/ForkedResourceTaskTest.cs | 33 -
.../Forked/ForkedSerializableClosureTaskTest.cs | 33 -
.../Compute/Forked/ForkedTaskAdapterTest.cs | 30 -
.../Compute/IgniteExceptionTaskSelfTest.cs | 753 ----
.../Compute/PortableClosureTaskTest.cs | 217 --
.../Compute/PortableTaskTest.cs | 253 --
.../Compute/ResourceTaskTest.cs | 568 ---
.../Compute/SerializableClosureTaskTest.cs | 217 --
.../Compute/TaskAdapterTest.cs | 274 --
.../Compute/TaskResultTest.cs | 437 ---
.../Config/Apache.Ignite.exe.config.test | 41 -
.../Config/Cache/Store/cache-store-session.xml | 80 -
.../Config/Compute/compute-grid1.xml | 90 -
.../Config/Compute/compute-grid2.xml | 63 -
.../Config/Compute/compute-grid3.xml | 52 -
.../Config/Compute/compute-standalone.xml | 87 -
.../Config/Dynamic/dynamic-client.xml | 51 -
.../Config/Dynamic/dynamic-data-no-cfg.xml | 47 -
.../Config/Dynamic/dynamic-data.xml | 65 -
.../Config/Lifecycle/lifecycle-beans.xml | 66 -
.../Config/Lifecycle/lifecycle-no-beans.xml | 44 -
.../Config/cache-portables.xml | 78 -
.../Config/cache-query-continuous.xml | 171 -
.../Config/cache-query.xml | 100 -
.../Config/marshaller-default.xml | 43 -
.../Config/marshaller-invalid.xml | 46 -
.../Config/marshaller-portable.xml | 43 -
.../native-client-test-cache-affinity.xml | 70 -
.../native-client-test-cache-parallel-store.xml | 69 -
.../Config/native-client-test-cache-store.xml | 125 -
.../Config/native-client-test-cache.xml | 194 --
.../Config/portable.xml | 56 -
.../Config/start-test-grid1.xml | 54 -
.../Config/start-test-grid2.xml | 45 -
.../Config/start-test-grid3.xml | 43 -
.../Dataload/DataStreamerTest.cs | 592 ----
.../Apache.Ignite.Core.Tests/EventsTest.cs | 961 ------
.../Examples/Example.cs | 137 -
.../Examples/ExamplesTest.cs | 137 -
.../Examples/PathUtil.cs | 51 -
.../Examples/ProjectFilesTest.cs | 45 -
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 352 --
.../Apache.Ignite.Core.Tests/ExecutableTest.cs | 443 ---
.../Apache.Ignite.Core.Tests/FutureTest.cs | 278 --
.../IgniteManagerTest.cs | 51 -
.../IgniteStartStopTest.cs | 422 ---
.../Apache.Ignite.Core.Tests/LifecycleTest.cs | 288 --
.../Apache.Ignite.Core.Tests/LoadDllTest.cs | 243 --
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 71 -
.../Memory/InteropMemoryTest.cs | 213 --
.../Apache.Ignite.Core.Tests/MessagingTest.cs | 646 ----
.../Portable/PortableApiSelfTest.cs | 1787 ----------
.../Portable/PortableSelfTest.cs | 2078 -----------
.../PortableConfigurationTest.cs | 173 -
.../Process/IIgniteProcessOutputReader.cs | 35 -
.../Process/IgniteProcess.cs | 283 --
.../Process/IgniteProcessConsoleOutputReader.cs | 40 -
.../Properties/AssemblyInfo.cs | 35 -
.../Query/ImplicitPortablePerson.cs | 46 -
.../Query/NoDefPortablePerson.cs | 35 -
.../Query/PortablePerson.cs | 69 -
.../SerializationTest.cs | 240 --
.../Services/ServiceProxyTest.cs | 741 ----
.../Services/ServicesAsyncWrapper.cs | 174 -
.../Services/ServicesTest.cs | 823 -----
.../Services/ServicesTestAsync.cs | 33 -
.../Apache.Ignite.Core.Tests/TestRunner.cs | 71 -
.../Apache.Ignite.Core.Tests/TestUtils.cs | 292 --
.../TypeResolverTest.cs | 107 -
modules/platforms/cpp/README.txt | 101 +
modules/platforms/cpp/common/Makefile.am | 45 +
modules/platforms/cpp/common/configure.ac | 62 +
.../platforms/cpp/common/ignite-common.pc.in | 9 +
.../platforms/cpp/common/include/Makefile.am | 22 +
.../common/include/ignite/common/concurrent.h | 210 ++
.../cpp/common/include/ignite/common/exports.h | 145 +
.../cpp/common/include/ignite/common/java.h | 652 ++++
.../cpp/common/os/linux/include/Makefile.am | 21 +
.../os/linux/include/ignite/common/common.h | 81 +
.../linux/include/ignite/common/concurrent_os.h | 394 +++
.../cpp/common/os/linux/src/common.cpp | 59 +
.../cpp/common/os/linux/src/concurrent_os.cpp | 175 +
.../os/win/include/ignite/common/common.h | 56 +
.../win/include/ignite/common/concurrent_os.h | 406 +++
.../platforms/cpp/common/os/win/src/common.cpp | 65 +
.../cpp/common/os/win/src/concurrent_os.cpp | 151 +
modules/platforms/cpp/common/project/README.TXT | 1 +
.../platforms/cpp/common/project/vs/README.TXT | 1 +
.../cpp/common/project/vs/common.vcxproj | 202 ++
.../common/project/vs/common.vcxproj.filters | 54 +
.../platforms/cpp/common/project/vs/module.def | 99 +
.../platforms/cpp/common/project/vs/targetver.h | 25 +
modules/platforms/cpp/common/src/concurrent.cpp | 94 +
modules/platforms/cpp/common/src/exports.cpp | 413 +++
modules/platforms/cpp/common/src/java.cpp | 2205 ++++++++++++
modules/platforms/cpp/core-test/Makefile.am | 49 +
.../cpp/core-test/config/cache-query.xml | 91 +
.../cpp/core-test/config/cache-test.xml | 129 +
modules/platforms/cpp/core-test/configure.ac | 62 +
.../platforms/cpp/core-test/include/Makefile.am | 22 +
.../include/ignite/portable_test_defs.h | 320 ++
.../include/ignite/portable_test_utils.h | 516 +++
.../cpp/core-test/include/teamcity_messages.h | 55 +
.../platforms/cpp/core-test/project/README.TXT | 1 +
.../cpp/core-test/project/vs/README.TXT | 1 +
.../cpp/core-test/project/vs/core-test.vcxproj | 174 +
.../project/vs/core-test.vcxproj.filters | 68 +
.../cpp/core-test/src/cache_query_test.cpp | 656 ++++
.../platforms/cpp/core-test/src/cache_test.cpp | 486 +++
.../cpp/core-test/src/concurrent_test.cpp | 186 +
.../cpp/core-test/src/handle_registry_test.cpp | 176 +
.../cpp/core-test/src/ignition_test.cpp | 102 +
.../src/portable_reader_writer_raw_test.cpp | 1532 +++++++++
.../src/portable_reader_writer_test.cpp | 1951 +++++++++++
.../cpp/core-test/src/portable_session_test.cpp | 257 ++
.../cpp/core-test/src/portable_test_defs.cpp | 65 +
.../cpp/core-test/src/teamcity_boost.cpp | 159 +
.../cpp/core-test/src/teamcity_messages.cpp | 150 +
modules/platforms/cpp/core/Makefile.am | 66 +
modules/platforms/cpp/core/configure.ac | 62 +
modules/platforms/cpp/core/ignite.pc.in | 9 +
modules/platforms/cpp/core/include/Makefile.am | 61 +
.../cpp/core/include/ignite/cache/cache.h | 1153 +++++++
.../cpp/core/include/ignite/cache/cache_entry.h | 118 +
.../core/include/ignite/cache/cache_peek_mode.h | 71 +
.../cpp/core/include/ignite/cache/query/query.h | 27 +
.../include/ignite/cache/query/query_argument.h | 125 +
.../include/ignite/cache/query/query_cursor.h | 191 +
.../include/ignite/cache/query/query_scan.h | 151 +
.../core/include/ignite/cache/query/query_sql.h | 253 ++
.../include/ignite/cache/query/query_text.h | 159 +
.../platforms/cpp/core/include/ignite/guid.h | 112 +
.../platforms/cpp/core/include/ignite/ignite.h | 154 +
.../core/include/ignite/ignite_configuration.h | 92 +
.../cpp/core/include/ignite/ignite_error.h | 260 ++
.../cpp/core/include/ignite/ignition.h | 195 ++
.../core/include/ignite/impl/cache/cache_impl.h | 418 +++
.../ignite/impl/cache/query/query_impl.h | 115 +
.../core/include/ignite/impl/handle_registry.h | 202 ++
.../include/ignite/impl/ignite_environment.h | 130 +
.../cpp/core/include/ignite/impl/ignite_impl.h | 146 +
.../core/include/ignite/impl/interop/interop.h | 25 +
.../ignite/impl/interop/interop_input_stream.h | 234 ++
.../ignite/impl/interop/interop_memory.h | 280 ++
.../ignite/impl/interop/interop_output_stream.h | 234 ++
.../cpp/core/include/ignite/impl/operations.h | 452 +++
.../ignite/impl/portable/portable_common.h | 146 +
.../ignite/impl/portable/portable_id_resolver.h | 106 +
.../impl/portable/portable_metadata_handler.h | 102 +
.../impl/portable/portable_metadata_manager.h | 120 +
.../impl/portable/portable_metadata_snapshot.h | 122 +
.../impl/portable/portable_metadata_updater.h | 53 +
.../portable/portable_metadata_updater_impl.h | 65 +
.../ignite/impl/portable/portable_reader_impl.h | 1130 ++++++
.../ignite/impl/portable/portable_utils.h | 344 ++
.../ignite/impl/portable/portable_writer_impl.h | 859 +++++
.../cpp/core/include/ignite/portable/portable.h | 29 +
.../include/ignite/portable/portable_consts.h | 106 +
.../ignite/portable/portable_containers.h | 525 +++
.../ignite/portable/portable_raw_reader.h | 324 ++
.../ignite/portable/portable_raw_writer.h | 300 ++
.../include/ignite/portable/portable_reader.h | 355 ++
.../include/ignite/portable/portable_type.h | 293 ++
.../include/ignite/portable/portable_writer.h | 335 ++
.../cpp/core/os/linux/include/Makefile.am | 20 +
.../core/os/linux/include/ignite/impl/utils.h | 155 +
.../cpp/core/os/linux/src/impl/utils.cpp | 439 +++
.../cpp/core/os/win/include/ignite/impl/utils.h | 155 +
.../cpp/core/os/win/src/impl/utils.cpp | 453 +++
modules/platforms/cpp/core/project/README.TXT | 1 +
.../platforms/cpp/core/project/vs/README.TXT | 1 +
.../platforms/cpp/core/project/vs/core.vcxproj | 272 ++
.../cpp/core/project/vs/core.vcxproj.filters | 246 ++
modules/platforms/cpp/core/src/guid.cpp | 65 +
modules/platforms/cpp/core/src/ignite.cpp | 43 +
modules/platforms/cpp/core/src/ignite_error.cpp | 222 ++
modules/platforms/cpp/core/src/ignition.cpp | 468 +++
.../cpp/core/src/impl/cache/cache_impl.cpp | 388 +++
.../core/src/impl/cache/query/query_impl.cpp | 193 ++
.../cpp/core/src/impl/handle_registry.cpp | 234 ++
.../cpp/core/src/impl/ignite_environment.cpp | 167 +
.../platforms/cpp/core/src/impl/ignite_impl.cpp | 42 +
.../src/impl/interop/interop_input_stream.cpp | 215 ++
.../core/src/impl/interop/interop_memory.cpp | 182 +
.../src/impl/interop/interop_output_stream.cpp | 215 ++
.../impl/portable/portable_metadata_handler.cpp | 78 +
.../impl/portable/portable_metadata_manager.cpp | 201 ++
.../portable/portable_metadata_snapshot.cpp | 70 +
.../impl/portable/portable_metadata_updater.cpp | 32 +
.../portable/portable_metadata_updater_impl.cpp | 94 +
.../src/impl/portable/portable_reader_impl.cpp | 683 ++++
.../core/src/impl/portable/portable_utils.cpp | 214 ++
.../src/impl/portable/portable_writer_impl.cpp | 600 ++++
.../core/src/portable/portable_containers.cpp | 76 +
.../core/src/portable/portable_raw_reader.cpp | 135 +
.../core/src/portable/portable_raw_writer.cpp | 147 +
.../cpp/core/src/portable/portable_reader.cpp | 142 +
.../cpp/core/src/portable/portable_type.cpp | 51 +
.../cpp/core/src/portable/portable_writer.cpp | 154 +
modules/platforms/cpp/examples/Makefile.am | 39 +
modules/platforms/cpp/examples/README.txt | 42 +
.../cpp/examples/config/example-cache.xml | 77 +
modules/platforms/cpp/examples/configure.ac | 38 +
.../platforms/cpp/examples/include/Makefile.am | 21 +
.../examples/include/ignite/examples/address.h | 109 +
.../include/ignite/examples/organization.h | 111 +
.../cpp/examples/project/vs/ignite-examples.sln | 19 +
.../examples/project/vs/ignite-examples.vcxproj | 107 +
.../project/vs/ignite-examples.vcxproj.filters | 30 +
.../cpp/examples/src/putgetexample.cpp | 126 +
modules/platforms/cpp/project/vs/ignite.sln | 46 +
modules/platforms/cpp/project/vs/ignite.slnrel | 33 +
.../platforms/cpp/project/vs/ignite_x86.slnrel | 33 +
.../Apache.Ignite.Core.Tests.TestDll.csproj | 52 +
.../Properties/AssemblyInfo.cs | 49 +
.../TestClass.cs | 35 +
.../Apache.Ignite.Core.Tests.csproj | 242 ++
.../Cache/CacheAbstractTest.cs | 3252 ++++++++++++++++++
.../Cache/CacheAffinityTest.cs | 139 +
.../Cache/CacheDynamicStartTest.cs | 281 ++
.../Cache/CacheEntryTest.cs | 69 +
.../Cache/CacheForkedTest.cs | 81 +
.../Cache/CacheLocalAtomicTest.cs | 57 +
.../Cache/CacheLocalTest.cs | 56 +
.../CachePartitionedAtomicNearEnabledTest.cs | 50 +
.../Cache/CachePartitionedAtomicTest.cs | 50 +
.../Cache/CachePartitionedNearEnabledTest.cs | 50 +
.../Cache/CachePartitionedTest.cs | 50 +
.../Cache/CacheReplicatedAtomicTest.cs | 60 +
.../Cache/CacheReplicatedTest.cs | 60 +
.../Cache/CacheTestAsyncWrapper.cs | 437 +++
.../Cache/Query/CacheQueriesTest.cs | 928 +++++
.../Continuous/ContinuousQueryAbstractTest.cs | 1181 +++++++
.../ContinuousQueryAtomicBackupTest.cs | 33 +
.../ContinuousQueryAtomicNoBackupTest.cs | 34 +
.../ContinuousQueryNoBackupAbstractTest.cs | 72 +
.../ContinuousQueryTransactionalBackupTest.cs | 34 +
.../ContinuousQueryTransactionalNoBackupTest.cs | 33 +
.../Cache/Store/CacheParallelLoadStoreTest.cs | 110 +
.../Cache/Store/CacheStoreSessionTest.cs | 285 ++
.../Cache/Store/CacheStoreTest.cs | 510 +++
.../Cache/Store/CacheTestParallelLoadStore.cs | 91 +
.../Cache/Store/CacheTestStore.cs | 155 +
.../Compute/AbstractTaskTest.cs | 217 ++
.../Compute/ClosureTaskTest.cs | 390 +++
.../Compute/ComputeApiTest.cs | 1281 +++++++
.../Compute/ComputeMultithreadedTest.cs | 269 ++
.../Compute/FailoverTaskSelfTest.cs | 246 ++
.../Forked/ForkedPortableClosureTaskTest.cs | 30 +
.../Compute/Forked/ForkedResourceTaskTest.cs | 33 +
.../Forked/ForkedSerializableClosureTaskTest.cs | 33 +
.../Compute/Forked/ForkedTaskAdapterTest.cs | 30 +
.../Compute/IgniteExceptionTaskSelfTest.cs | 753 ++++
.../Compute/PortableClosureTaskTest.cs | 217 ++
.../Compute/PortableTaskTest.cs | 253 ++
.../Compute/ResourceTaskTest.cs | 568 +++
.../Compute/SerializableClosureTaskTest.cs | 217 ++
.../Compute/TaskAdapterTest.cs | 274 ++
.../Compute/TaskResultTest.cs | 437 +++
.../Config/Apache.Ignite.exe.config.test | 41 +
.../Config/Cache/Store/cache-store-session.xml | 80 +
.../Config/Compute/compute-grid1.xml | 90 +
.../Config/Compute/compute-grid2.xml | 63 +
.../Config/Compute/compute-grid3.xml | 52 +
.../Config/Compute/compute-standalone.xml | 87 +
.../Config/Dynamic/dynamic-client.xml | 51 +
.../Config/Dynamic/dynamic-data-no-cfg.xml | 47 +
.../Config/Dynamic/dynamic-data.xml | 65 +
.../Config/Lifecycle/lifecycle-beans.xml | 66 +
.../Config/Lifecycle/lifecycle-no-beans.xml | 44 +
.../Config/cache-portables.xml | 78 +
.../Config/cache-query-continuous.xml | 171 +
.../Config/cache-query.xml | 100 +
.../Config/marshaller-default.xml | 43 +
.../Config/marshaller-invalid.xml | 46 +
.../Config/marshaller-portable.xml | 43 +
.../native-client-test-cache-affinity.xml | 70 +
.../native-client-test-cache-parallel-store.xml | 69 +
.../Config/native-client-test-cache-store.xml | 125 +
.../Config/native-client-test-cache.xml | 194 ++
.../Config/portable.xml | 56 +
.../Config/start-test-grid1.xml | 54 +
.../Config/start-test-grid2.xml | 45 +
.../Config/start-test-grid3.xml | 43 +
.../Dataload/DataStreamerTest.cs | 592 ++++
.../Apache.Ignite.Core.Tests/EventsTest.cs | 961 ++++++
.../Examples/Example.cs | 137 +
.../Examples/ExamplesTest.cs | 137 +
.../Examples/PathUtil.cs | 51 +
.../Examples/ProjectFilesTest.cs | 45 +
.../Apache.Ignite.Core.Tests/ExceptionsTest.cs | 352 ++
.../Apache.Ignite.Core.Tests/ExecutableTest.cs | 443 +++
.../Apache.Ignite.Core.Tests/FutureTest.cs | 278 ++
.../IgniteManagerTest.cs | 51 +
.../IgniteStartStopTest.cs | 422 +++
.../Apache.Ignite.Core.Tests/LifecycleTest.cs | 288 ++
.../Apache.Ignite.Core.Tests/LoadDllTest.cs | 243 ++
.../Apache.Ignite.Core.Tests/MarshallerTest.cs | 71 +
.../Memory/InteropMemoryTest.cs | 213 ++
.../Apache.Ignite.Core.Tests/MessagingTest.cs | 646 ++++
.../Portable/PortableApiSelfTest.cs | 1787 ++++++++++
.../Portable/PortableSelfTest.cs | 2078 +++++++++++
.../PortableConfigurationTest.cs | 173 +
.../Process/IIgniteProcessOutputReader.cs | 35 +
.../Process/IgniteProcess.cs | 283 ++
.../Process/IgniteProcessConsoleOutputReader.cs | 40 +
.../Properties/AssemblyInfo.cs | 35 +
.../Query/ImplicitPortablePerson.cs | 46 +
.../Query/NoDefPortablePerson.cs | 35 +
.../Query/PortablePerson.cs | 69 +
.../SerializationTest.cs | 240 ++
.../Services/ServiceProxyTest.cs | 741 ++++
.../Services/ServicesAsyncWrapper.cs | 174 +
.../Services/ServicesTest.cs | 823 +++++
.../Services/ServicesTestAsync.cs | 33 +
.../Apache.Ignite.Core.Tests/TestRunner.cs | 71 +
.../Apache.Ignite.Core.Tests/TestUtils.cs | 292 ++
.../TypeResolverTest.cs | 107 +
.../Apache.Ignite.Core.csproj | 373 ++
.../Cache/CacheAtomicUpdateTimeoutException.cs | 67 +
.../Cache/CacheEntryProcessorException.cs | 79 +
.../Apache.Ignite.Core/Cache/CacheException.cs | 68 +
.../Cache/CachePartialUpdateException.cs | 119 +
.../Apache.Ignite.Core/Cache/CachePeekMode.cs | 68 +
.../Cache/Event/CacheEntryEventType.cs | 41 +
.../Cache/Event/ICacheEntryEvent.cs | 40 +
.../Cache/Event/ICacheEntryEventFilter.cs | 31 +
.../Cache/Event/ICacheEntryEventListener.cs | 33 +
.../Cache/Expiry/ExpiryPolicy.cs | 89 +
.../Cache/Expiry/IExpiryPolicy.cs | 59 +
.../dotnet/Apache.Ignite.Core/Cache/ICache.cs | 542 +++
.../Apache.Ignite.Core/Cache/ICacheAffinity.cs | 158 +
.../Apache.Ignite.Core/Cache/ICacheEntry.cs | 37 +
.../Cache/ICacheEntryFilter.cs | 34 +
.../Cache/ICacheEntryProcessor.cs | 45 +
.../Cache/ICacheEntryProcessorResult.cs | 40 +
.../Apache.Ignite.Core/Cache/ICacheLock.cs | 58 +
.../Apache.Ignite.Core/Cache/ICacheMetrics.cs | 486 +++
.../Cache/IMutableCacheEntry.cs | 47 +
.../Cache/Query/Continuous/ContinuousQuery.cs | 170 +
.../Query/Continuous/IContinuousQueryHandle.cs | 45 +
.../Cache/Query/IQueryCursor.cs | 40 +
.../Apache.Ignite.Core/Cache/Query/QueryBase.cs | 82 +
.../Apache.Ignite.Core/Cache/Query/ScanQuery.cs | 77 +
.../Cache/Query/SqlFieldsQuery.cs | 81 +
.../Apache.Ignite.Core/Cache/Query/SqlQuery.cs | 119 +
.../Apache.Ignite.Core/Cache/Query/TextQuery.cs | 104 +
.../Store/CacheParallelLoadStoreAdapter.cs | 205 ++
.../Cache/Store/CacheStoreAdapter.cs | 146 +
.../Cache/Store/CacheStoreException.cs | 66 +
.../Cache/Store/ICacheStore.cs | 184 +
.../Cache/Store/ICacheStoreSession.cs | 42 +
.../Cluster/ClusterGroupEmptyException.cs | 70 +
.../Cluster/ClusterTopologyException.cs | 69 +
.../Apache.Ignite.Core/Cluster/ICluster.cs | 77 +
.../Apache.Ignite.Core/Cluster/IClusterGroup.cs | 227 ++
.../Cluster/IClusterMetrics.cs | 515 +++
.../Apache.Ignite.Core/Cluster/IClusterNode.cs | 121 +
.../Cluster/IClusterNodeFilter.cs | 32 +
.../Common/AsyncSupportedAttribute.cs | 33 +
.../Apache.Ignite.Core/Common/IAsyncSupport.cs | 52 +
.../dotnet/Apache.Ignite.Core/Common/IFuture.cs | 115 +
.../Common/IgniteException.cs | 66 +
.../Apache.Ignite.Core/Common/IgniteGuid.cs | 138 +
.../ComputeExecutionRejectedException.cs | 69 +
.../Compute/ComputeJobAdapter.cs | 122 +
.../Compute/ComputeJobFailoverException.cs | 72 +
.../Compute/ComputeJobResultPolicy.cs | 45 +
.../Compute/ComputeTaskAdapter.cs | 93 +
.../Compute/ComputeTaskCancelledException.cs | 69 +
.../ComputeTaskNoResultCacheAttribute.cs | 35 +
.../Compute/ComputeTaskSplitAdapter.cs | 95 +
.../Compute/ComputeTaskTimeoutException.cs | 67 +
.../Compute/ComputeUserUndeclaredException.cs | 70 +
.../Apache.Ignite.Core/Compute/ICompute.cs | 271 ++
.../Apache.Ignite.Core/Compute/IComputeFunc.cs | 55 +
.../Apache.Ignite.Core/Compute/IComputeJob.cs | 58 +
.../Compute/IComputeJobResult.cs | 73 +
.../Compute/IComputeReducer.cs | 39 +
.../Apache.Ignite.Core/Compute/IComputeTask.cs | 132 +
.../Datastream/IDataStreamer.cs | 206 ++
.../Datastream/IStreamReceiver.cs | 38 +
.../Datastream/StreamTransformer.cs | 73 +
.../Datastream/StreamVisitor.cs | 55 +
.../Apache.Ignite.Core/Events/CacheEvent.cs | 176 +
.../Events/CacheQueryExecutedEvent.cs | 97 +
.../Events/CacheQueryReadEvent.cs | 134 +
.../Events/CacheRebalancingEvent.cs | 98 +
.../Events/CheckpointEvent.cs | 50 +
.../Apache.Ignite.Core/Events/DiscoveryEvent.cs | 80 +
.../Apache.Ignite.Core/Events/EventBase.cs | 160 +
.../Apache.Ignite.Core/Events/EventReader.cs | 72 +
.../Apache.Ignite.Core/Events/EventType.cs | 514 +++
.../dotnet/Apache.Ignite.Core/Events/IEvent.cs | 74 +
.../Apache.Ignite.Core/Events/IEventFilter.cs | 36 +
.../dotnet/Apache.Ignite.Core/Events/IEvents.cs | 182 +
.../Apache.Ignite.Core/Events/JobEvent.cs | 100 +
.../Apache.Ignite.Core/Events/SwapSpaceEvent.cs | 50 +
.../Apache.Ignite.Core/Events/TaskEvent.cs | 91 +
.../dotnet/Apache.Ignite.Core/IIgnite.cs | 144 +
.../Apache.Ignite.Core/IgniteConfiguration.cs | 140 +
.../dotnet/Apache.Ignite.Core/Ignition.cs | 662 ++++
.../Impl/Cache/CacheAffinityImpl.cs | 275 ++
.../Apache.Ignite.Core/Impl/Cache/CacheEntry.cs | 126 +
.../Impl/Cache/CacheEntryFilterHolder.cs | 147 +
.../Impl/Cache/CacheEntryProcessorHolder.cs | 145 +
.../Impl/Cache/CacheEntryProcessorResult.cs | 65 +
.../Cache/CacheEntryProcessorResultHolder.cs | 127 +
.../Impl/Cache/CacheEnumerable.cs | 82 +
.../Impl/Cache/CacheEnumerator.cs | 117 +
.../Impl/Cache/CacheEnumeratorProxy.cs | 156 +
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 941 +++++
.../Apache.Ignite.Core/Impl/Cache/CacheLock.cs | 171 +
.../Impl/Cache/CacheMetricsImpl.cs | 248 ++
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 63 +
.../Impl/Cache/CacheProxyImpl.cs | 500 +++
.../Impl/Cache/Event/CacheEntryCreateEvent.cs | 74 +
.../Impl/Cache/Event/CacheEntryRemoveEvent.cs | 74 +
.../Impl/Cache/Event/CacheEntryUpdateEvent.cs | 79 +
.../Impl/Cache/MutableCacheEntry.cs | 163 +
.../Impl/Cache/Query/AbstractQueryCursor.cs | 264 ++
.../Query/Continuous/ContinuousQueryFilter.cs | 125 +
.../Continuous/ContinuousQueryFilterHolder.cs | 118 +
.../Continuous/ContinuousQueryHandleImpl.cs | 210 ++
.../Query/Continuous/ContinuousQueryUtils.cs | 115 +
.../Impl/Cache/Query/FieldsQueryCursor.cs | 54 +
.../Impl/Cache/Query/QueryCursor.cs | 50 +
.../Impl/Cache/Store/CacheStore.cs | 263 ++
.../Impl/Cache/Store/CacheStoreSession.cs | 53 +
.../Impl/Cache/Store/CacheStoreSessionProxy.cs | 63 +
.../Impl/Cluster/ClusterGroupImpl.cs | 577 ++++
.../Impl/Cluster/ClusterMetricsImpl.cs | 292 ++
.../Impl/Cluster/ClusterNodeImpl.cs | 221 ++
.../Impl/Cluster/IClusterGroupEx.cs | 35 +
.../Impl/Collections/CollectionExtensions.cs | 45 +
.../Impl/Collections/MultiValueDictionary.cs | 143 +
.../Impl/Collections/ReadOnlyCollection.cs | 102 +
.../Impl/Collections/ReadOnlyDictionary.cs | 149 +
.../Impl/Common/AsyncResult.cs | 71 +
.../Impl/Common/CompletedAsyncResult.cs | 70 +
.../Common/CopyOnWriteConcurrentDictionary.cs | 70 +
.../Impl/Common/DelegateConverter.cs | 253 ++
.../Impl/Common/DelegateTypeDescriptor.cs | 314 ++
.../Apache.Ignite.Core/Impl/Common/Future.cs | 286 ++
.../Impl/Common/FutureConverter.cs | 62 +
.../Impl/Common/FutureType.cs | 52 +
.../Impl/Common/IFutureConverter.cs | 34 +
.../Impl/Common/IFutureInternal.cs | 46 +
.../Impl/Common/IgniteArgumentCheck.cs | 76 +
.../Impl/Common/LoadedAssembliesResolver.cs | 96 +
.../Impl/Common/PortableResultWrapper.cs | 68 +
.../Impl/Common/TypeCaster.cs | 72 +
.../Closure/ComputeAbstractClosureTask.cs | 101 +
.../Impl/Compute/Closure/ComputeActionJob.cs | 83 +
.../Impl/Compute/Closure/ComputeFuncJob.cs | 89 +
.../Compute/Closure/ComputeMultiClosureTask.cs | 56 +
.../Impl/Compute/Closure/ComputeOutFuncJob.cs | 76 +
.../Closure/ComputeReducingClosureTask.cs | 61 +
.../Compute/Closure/ComputeSingleClosureTask.cs | 48 +
.../Compute/Closure/IComputeResourceInjector.cs | 31 +
.../Apache.Ignite.Core/Impl/Compute/Compute.cs | 213 ++
.../Impl/Compute/ComputeAsync.cs | 261 ++
.../Impl/Compute/ComputeFunc.cs | 119 +
.../Impl/Compute/ComputeImpl.cs | 645 ++++
.../Impl/Compute/ComputeJob.cs | 163 +
.../Impl/Compute/ComputeJobHolder.cs | 246 ++
.../Compute/ComputeJobResultGenericWrapper.cs | 70 +
.../Impl/Compute/ComputeJobResultImpl.cs | 96 +
.../Impl/Compute/ComputeOutFunc.cs | 123 +
.../Impl/Compute/ComputeTaskHolder.cs | 484 +++
.../Impl/Datastream/DataStreamerBatch.cs | 269 ++
.../Impl/Datastream/DataStreamerEntry.cs | 64 +
.../Impl/Datastream/DataStreamerImpl.cs | 832 +++++
.../Impl/Datastream/DataStreamerRemoveEntry.cs | 48 +
.../Impl/Datastream/StreamReceiverHolder.cs | 144 +
.../Apache.Ignite.Core/Impl/Events/Events.cs | 498 +++
.../Impl/Events/EventsAsync.cs | 158 +
.../Impl/Events/RemoteListenEventFilter.cs | 85 +
.../Apache.Ignite.Core/Impl/ExceptionUtils.cs | 204 ++
.../Apache.Ignite.Core/Impl/Handle/Handle.cs | 69 +
.../Impl/Handle/HandleRegistry.cs | 340 ++
.../Apache.Ignite.Core/Impl/Handle/IHandle.cs | 35 +
.../Apache.Ignite.Core/Impl/IInteropCallback.cs | 34 +
.../dotnet/Apache.Ignite.Core/Impl/Ignite.cs | 511 +++
.../Impl/IgniteConfigurationEx.cs | 57 +
.../Apache.Ignite.Core/Impl/IgniteManager.cs | 490 +++
.../Apache.Ignite.Core/Impl/IgniteProxy.cs | 333 ++
.../Apache.Ignite.Core/Impl/IgniteUtils.cs | 438 +++
.../Impl/InteropExceptionHolder.cs | 85 +
.../Impl/LifecycleBeanHolder.cs | 66 +
.../Impl/Memory/IPlatformMemory.cs | 65 +
.../Impl/Memory/InteropExternalMemory.cs | 46 +
.../Impl/Memory/InteropMemoryUtils.cs | 38 +
.../Memory/PlatformBigEndianMemoryStream.cs | 483 +++
.../Impl/Memory/PlatformMemory.cs | 78 +
.../Impl/Memory/PlatformMemoryManager.cs | 107 +
.../Impl/Memory/PlatformMemoryPool.cs | 106 +
.../Impl/Memory/PlatformMemoryStream.cs | 677 ++++
.../Impl/Memory/PlatformMemoryUtils.cs | 463 +++
.../Impl/Memory/PlatformPooledMemory.cs | 70 +
.../Impl/Memory/PlatformRawMemory.cs | 89 +
.../Impl/Memory/PlatformUnpooledMemory.cs | 52 +
.../Impl/Messaging/MessageFilterHolder.cs | 179 +
.../Impl/Messaging/Messaging.cs | 262 ++
.../Impl/Messaging/MessagingAsync.cs | 68 +
.../Apache.Ignite.Core/Impl/NativeMethods.cs | 47 +
.../Apache.Ignite.Core/Impl/PlatformTarget.cs | 715 ++++
.../Portable/IPortableSystemTypeSerializer.cs | 34 +
.../Impl/Portable/IPortableTypeDescriptor.cs | 124 +
.../Impl/Portable/IPortableWriteAware.cs | 34 +
.../Impl/Portable/Io/IPortableStream.cs | 320 ++
.../Impl/Portable/Io/PortableAbstractStream.cs | 1298 +++++++
.../Impl/Portable/Io/PortableHeapStream.cs | 447 +++
.../Impl/Portable/Io/PortableStreamAdapter.cs | 114 +
.../Metadata/IPortableMetadataHandler.cs | 41 +
.../Metadata/PortableHashsetMetadataHandler.cs | 69 +
.../Portable/Metadata/PortableMetadataHolder.cs | 149 +
.../Portable/Metadata/PortableMetadataImpl.cs | 200 ++
.../Impl/Portable/PortableBuilderField.cs | 73 +
.../Impl/Portable/PortableBuilderImpl.cs | 923 +++++
.../Impl/Portable/PortableCollectionInfo.cs | 251 ++
.../Impl/Portable/PortableFullTypeDescriptor.cs | 203 ++
.../Impl/Portable/PortableHandleDictionary.cs | 187 +
.../Portable/PortableMarshalAwareSerializer.cs | 45 +
.../Impl/Portable/PortableMarshaller.cs | 599 ++++
.../Impl/Portable/PortableMode.cs | 40 +
.../Impl/Portable/PortableObjectHandle.cs | 59 +
.../PortableOrSerializableObjectHolder.cs | 66 +
.../Portable/PortableReaderHandleDictionary.cs | 42 +
.../Impl/Portable/PortableReaderImpl.cs | 1013 ++++++
.../Impl/Portable/PortableReflectiveRoutines.cs | 483 +++
.../Portable/PortableReflectiveSerializer.cs | 218 ++
.../Portable/PortableSurrogateTypeDescriptor.cs | 133 +
.../Impl/Portable/PortableSystemHandlers.cs | 1336 +++++++
.../Portable/PortableSystemTypeSerializer.cs | 62 +
.../Impl/Portable/PortableUserObject.cs | 385 +++
.../Impl/Portable/PortableUtils.cs | 2130 ++++++++++++
.../Impl/Portable/PortableWriterImpl.cs | 1305 +++++++
.../Impl/Portable/PortablesImpl.cs | 205 ++
.../Impl/Portable/SerializableObjectHolder.cs | 66 +
.../Impl/Portable/TypeResolver.cs | 227 ++
.../Impl/Resource/IResourceInjector.cs | 27 +
.../Impl/Resource/ResourceFieldInjector.cs | 47 +
.../Impl/Resource/ResourceMethodInjector.cs | 48 +
.../Impl/Resource/ResourceProcessor.cs | 105 +
.../Impl/Resource/ResourcePropertyInjector.cs | 47 +
.../Impl/Resource/ResourceTypeDescriptor.cs | 291 ++
.../Impl/Services/ServiceContext.cs | 60 +
.../Impl/Services/ServiceDescriptor.cs | 106 +
.../Impl/Services/ServiceProxy.cs | 71 +
.../Impl/Services/ServiceProxyInvoker.cs | 136 +
.../Impl/Services/ServiceProxySerializer.cs | 140 +
.../Impl/Services/Services.cs | 316 ++
.../Impl/Services/ServicesAsync.cs | 89 +
.../Impl/Transactions/AsyncTransaction.cs | 78 +
.../Impl/Transactions/Transaction.cs | 155 +
.../Impl/Transactions/TransactionImpl.cs | 489 +++
.../Impl/Transactions/TransactionMetricsImpl.cs | 62 +
.../Impl/Transactions/TransactionsImpl.cs | 201 ++
.../Impl/Unmanaged/IUnmanagedTarget.cs | 42 +
.../Impl/Unmanaged/UnmanagedCallbackHandlers.cs | 99 +
.../Impl/Unmanaged/UnmanagedCallbacks.cs | 1154 +++++++
.../Impl/Unmanaged/UnmanagedContext.cs | 53 +
.../Unmanaged/UnmanagedNonReleaseableTarget.cs | 68 +
.../Impl/Unmanaged/UnmanagedTarget.cs | 77 +
.../Impl/Unmanaged/UnmanagedUtils.cs | 1263 +++++++
.../Lifecycle/ILifecycleBean.cs | 64 +
.../Lifecycle/LifecycleEventType.cs | 49 +
.../Messaging/IMessageFilter.cs | 35 +
.../Apache.Ignite.Core/Messaging/IMessaging.cs | 105 +
.../Portable/IPortableBuilder.cs | 77 +
.../Portable/IPortableIdMapper.cs | 40 +
.../Portable/IPortableMarshalAware.cs | 39 +
.../Portable/IPortableMetadata.cs | 52 +
.../Portable/IPortableNameMapper.cs | 39 +
.../Portable/IPortableObject.cs | 56 +
.../Portable/IPortableRawReader.cs | 264 ++
.../Portable/IPortableRawWriter.cs | 221 ++
.../Portable/IPortableReader.cs | 340 ++
.../Portable/IPortableSerializer.cs | 39 +
.../Portable/IPortableWriter.cs | 259 ++
.../Apache.Ignite.Core/Portable/IPortables.cs | 120 +
.../Portable/PortableConfiguration.cs | 122 +
.../Portable/PortableException.cs | 64 +
.../Portable/PortableTypeConfiguration.cs | 162 +
.../Portable/PortableTypeNames.cs | 115 +
.../Properties/AssemblyInfo.cs | 46 +
.../Resource/InstanceResourceAttribute.cs | 35 +
.../Resource/StoreSessionResourceAttribute.cs | 32 +
.../Apache.Ignite.Core/Services/IService.cs | 51 +
.../Services/IServiceContext.cs | 69 +
.../Services/IServiceDescriptor.cs | 96 +
.../Apache.Ignite.Core/Services/IServices.cs | 181 +
.../Services/ServiceConfiguration.cs | 62 +
.../Services/ServiceInvocationException.cs | 101 +
.../Transactions/ITransaction.cs | 230 ++
.../Transactions/ITransactionMetrics.cs | 47 +
.../Transactions/ITransactions.cs | 73 +
.../Transactions/TransactionConcurrency.cs | 36 +
.../TransactionHeuristicException.cs | 72 +
.../Transactions/TransactionIsolation.cs | 41 +
.../TransactionOptimisticException.cs | 69 +
.../TransactionRollbackException.cs | 68 +
.../Transactions/TransactionState.cs | 70 +
.../Transactions/TransactionTimeoutException.cs | 69 +
modules/platforms/dotnet/Apache.Ignite.sln | 91 +
.../dotnet/Apache.Ignite.sln.DotSettings | 4 +
modules/platforms/dotnet/Apache.Ignite.slnrel | 43 +
.../dotnet/Apache.Ignite/Apache.Ignite.csproj | 76 +
.../platforms/dotnet/Apache.Ignite/App.config | 56 +
.../Config/AppSettingsConfigurator.cs | 113 +
.../Apache.Ignite/Config/ArgsConfigurator.cs | 164 +
.../Apache.Ignite/Config/ConfigValueParser.cs | 42 +
.../Apache.Ignite/Config/IConfigurator.cs | 34 +
.../dotnet/Apache.Ignite/IgniteRunner.cs | 171 +
.../Apache.Ignite/Properties/AssemblyInfo.cs | 35 +
.../Apache.Ignite/Service/IgniteService.cs | 219 ++
.../Apache.Ignite/Service/NativeMethods.cs | 57 +
.../Apache.Ignite/Service/ServiceDescription.cs | 32 +
.../platforms/dotnet/Apache.Ignite_x86.slnrel | 43 +
modules/platforms/dotnet/README.txt | 24 +
.../dotnet/examples/Apache.Ignite.Examples.sln | 38 +
.../Apache.Ignite.Examples.csproj | 81 +
.../examples/Apache.Ignite.Examples/App.config | 24 +
.../Compute/ClosureExample.cs | 84 +
.../Compute/TaskExample.cs | 140 +
.../Datagrid/ContinuousQueryExample.cs | 103 +
.../Datagrid/CrossPlatformExample.cs | 208 ++
.../Datagrid/DataStreamerExample.cs | 101 +
.../Datagrid/PutGetExample.cs | 219 ++
.../Datagrid/QueryExample.cs | 226 ++
.../Datagrid/StoreExample.cs | 114 +
.../Datagrid/TransactionExample.cs | 104 +
.../Events/EventsExample.cs | 118 +
.../Messaging/MessagingExample.cs | 112 +
.../Misc/LifecycleExample.cs | 109 +
.../Properties/AssemblyInfo.cs | 35 +
.../Services/IMapService.cs | 56 +
.../Services/ServicesExample.cs | 77 +
.../Apache.Ignite.ExamplesDll.csproj | 74 +
.../Compute/AverageSalaryJob.cs | 65 +
.../Compute/AverageSalaryTask.cs | 84 +
.../Compute/CharacterCountClosure.cs | 43 +
.../Compute/CharacterCountReducer.cs | 51 +
.../Datagrid/ContinuousQueryFilter.cs | 50 +
.../Datagrid/EmployeeStore.cs | 121 +
.../Datagrid/EmployeeStorePredicate.cs | 40 +
.../Events/LocalListener.cs | 55 +
.../Events/RemoteFilter.cs | 42 +
.../Messaging/LocalListener.cs | 59 +
.../Messaging/RemoteOrderedListener.cs | 54 +
.../Messaging/RemoteUnorderedListener.cs | 54 +
.../Messaging/Topic.cs | 28 +
.../Portable/Account.cs | 60 +
.../Portable/Address.cs | 81 +
.../Portable/Employee.cs | 93 +
.../Portable/EmployeeKey.cs | 86 +
.../Portable/Organization.cs | 84 +
.../Portable/OrganizationType.cs | 43 +
.../Properties/AssemblyInfo.cs | 35 +
.../Services/MapService.cs | 119 +
.../examples/Config/example-cache-query.xml | 111 +
.../examples/Config/example-cache-store.xml | 60 +
.../dotnet/examples/Config/example-cache.xml | 83 +
.../dotnet/examples/Config/example-compute.xml | 70 +
modules/platforms/dotnet/examples/README.txt | 14 +
modules/platforms/licenses/apache-2.0.txt | 202 ++
parent/pom.xml | 22 +-
1202 files changed, 115264 insertions(+), 115593 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/assembly/release-fabric.xml
----------------------------------------------------------------------
diff --git a/assembly/release-fabric.xml b/assembly/release-fabric.xml
index 21f6223..8ee65ec 100644
--- a/assembly/release-fabric.xml
+++ b/assembly/release-fabric.xml
@@ -36,55 +36,31 @@
<files>
<!-- Copy CPP files. -->
<file>
- <source>modules/platform/src/main/cpp/project/vs/ignite.slnrel</source>
- <outputDirectory>/platforms/cpp/src/project/vs</outputDirectory>
+ <source>modules/platforms/cpp/project/vs/ignite.slnrel</source>
+ <outputDirectory>/platforms/cpp/project/vs</outputDirectory>
<destName>ignite.sln</destName>
</file>
<file>
- <source>modules/platform/src/main/cpp/project/vs/ignite_x86.slnrel</source>
- <outputDirectory>/platforms/cpp/src/project/vs</outputDirectory>
+ <source>modules/platforms/cpp/project/vs/ignite_x86.slnrel</source>
+ <outputDirectory>/platforms/cpp/project/vs</outputDirectory>
<destName>ignite_x86.sln</destName>
</file>
<!-- Copy .Net files. -->
<file>
- <source>modules/platform/src/main/dotnet/Apache.Ignite.slnrel</source>
+ <source>modules/platforms/dotnet/Apache.Ignite.slnrel</source>
<outputDirectory>/platforms/dotnet</outputDirectory>
<destName>Apache.Ignite.sln</destName>
</file>
<file>
- <source>modules/platform/src/main/dotnet/Apache.Ignite_x86.slnrel</source>
+ <source>modules/platforms/dotnet/Apache.Ignite_x86.slnrel</source>
<outputDirectory>/platforms/dotnet</outputDirectory>
<destName>Apache.Ignite_x86.sln</destName>
</file>
<file>
- <source>modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csprojrel</source>
- <outputDirectory>/platforms/dotnet/Apache.Ignite</outputDirectory>
- <destName>Apache.Ignite.csproj</destName>
- </file>
-
- <file>
- <source>modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.slnrel</source>
- <outputDirectory>/platforms/dotnet/Examples</outputDirectory>
- <destName>Apache.Ignite.Examples.sln</destName>
- </file>
-
- <file>
- <source>modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csprojrel</source>
- <outputDirectory>/platforms/dotnet/Examples/Apache.Ignite.Examples</outputDirectory>
- <destName>Apache.Ignite.Examples.csproj</destName>
- </file>
-
- <file>
- <source>modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel</source>
- <outputDirectory>/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll</outputDirectory>
- <destName>Apache.Ignite.ExamplesDll.csproj</destName>
- </file>
-
- <file>
<source>assembly/LICENSE_FABRIC</source>
<destName>LICENSE</destName>
<outputDirectory>/</outputDirectory>
@@ -106,7 +82,7 @@
<fileSets>
<!-- Move .Net readme. -->
<fileSet>
- <directory>modules/platform/src/main/dotnet</directory>
+ <directory>modules/platforms/dotnet</directory>
<outputDirectory>/platforms/dotnet</outputDirectory>
<includes>
<include>README.txt</include>
@@ -115,38 +91,31 @@
<!-- Move .Net "core" module. -->
<fileSet>
- <directory>modules/platform/src/main/dotnet/Apache.Ignite.Core</directory>
+ <directory>modules/platforms/dotnet/Apache.Ignite.Core</directory>
<outputDirectory>/platforms/dotnet/Apache.Ignite.Core</outputDirectory>
</fileSet>
<!-- Move .Net executable module. -->
<fileSet>
- <directory>modules/platform/src/main/dotnet/Apache.Ignite</directory>
+ <directory>modules/platforms/dotnet/Apache.Ignite</directory>
<outputDirectory>/platforms/dotnet/Apache.Ignite</outputDirectory>
- <excludes>
- <exclude>**/*.csproj*</exclude>
- </excludes>
</fileSet>
<!-- Move .Net examples. -->
<fileSet>
- <directory>modules/platform/src/main/dotnet/Examples</directory>
- <outputDirectory>/platforms/dotnet/Examples</outputDirectory>
- <excludes>
- <exclude>**/*.csproj*</exclude>
- <exclude>**/*.sln*</exclude>
- </excludes>
+ <directory>modules/platforms/dotnet/examples</directory>
+ <outputDirectory>/platforms/dotnet/examples</outputDirectory>
</fileSet>
<!-- Move .Net licenses. -->
<fileSet>
- <directory>modules/platform/licenses</directory>
+ <directory>modules/platforms/licenses</directory>
<outputDirectory>/platforms/dotnet/licenses</outputDirectory>
</fileSet>
<!-- Move CPP readme. -->
<fileSet>
- <directory>modules/platform/src/main/cpp</directory>
+ <directory>modules/platforms/cpp</directory>
<outputDirectory>/platforms/cpp</outputDirectory>
<includes>
<include>README.txt</include>
@@ -155,25 +124,25 @@
<!-- Move CPP "common" module. -->
<fileSet>
- <directory>modules/platform/src/main/cpp/common</directory>
- <outputDirectory>/platforms/cpp/src/common</outputDirectory>
+ <directory>modules/platforms/cpp/common</directory>
+ <outputDirectory>/platforms/cpp/common</outputDirectory>
</fileSet>
<!-- Move CPP "core" module. -->
<fileSet>
- <directory>modules/platform/src/main/cpp/core</directory>
- <outputDirectory>/platforms/cpp/src/core</outputDirectory>
+ <directory>modules/platforms/cpp/core</directory>
+ <outputDirectory>/platforms/cpp/core</outputDirectory>
</fileSet>
<!-- Move CPP examples. -->
<fileSet>
- <directory>modules/platform/src/main/cpp/examples</directory>
+ <directory>modules/platforms/cpp/examples</directory>
<outputDirectory>/platforms/cpp/examples</outputDirectory>
</fileSet>
<!-- Move CPP licenses. -->
<fileSet>
- <directory>modules/platform/licenses</directory>
+ <directory>modules/platforms/licenses</directory>
<outputDirectory>/platforms/cpp/licenses</outputDirectory>
</fileSet>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/licenses/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/modules/platform/licenses/apache-2.0.txt b/modules/platform/licenses/apache-2.0.txt
deleted file mode 100644
index d645695..0000000
--- a/modules/platform/licenses/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
[14/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
deleted file mode 100644
index c55d92f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedUtils.cs
+++ /dev/null
@@ -1,1263 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.InteropServices;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Unmanaged utility classes.
- /// </summary>
- internal static unsafe class UnmanagedUtils
- {
- /** Interop factory ID for .Net. */
- private const int InteropFactoryId = 1;
-
- #region PROCEDURE NAMES
-
- private const string ProcReallocate = "IgniteReallocate";
-
- private const string ProcIgnitionStart = "IgniteIgnitionStart";
- private const string ProcIgnitionStop = "IgniteIgnitionStop";
- private const string ProcIgnitionStopAll = "IgniteIgnitionStopAll";
-
- private const string ProcProcessorReleaseStart = "IgniteProcessorReleaseStart";
- private const string ProcProcessorProjection = "IgniteProcessorProjection";
- private const string ProcProcessorCache = "IgniteProcessorCache";
- private const string ProcProcessorGetOrCreateCache = "IgniteProcessorGetOrCreateCache";
- private const string ProcProcessorCreateCache = "IgniteProcessorCreateCache";
- private const string ProcProcessorAffinity = "IgniteProcessorAffinity";
- private const string ProcProcessorDataStreamer = "IgniteProcessorDataStreamer";
- private const string ProcProcessorTransactions = "IgniteProcessorTransactions";
- private const string ProcProcessorCompute = "IgniteProcessorCompute";
- private const string ProcProcessorMessage = "IgniteProcessorMessage";
- private const string ProcProcessorEvents = "IgniteProcessorEvents";
- private const string ProcProcessorServices = "IgniteProcessorServices";
- private const string ProcProcessorExtensions = "IgniteProcessorExtensions";
-
- private const string ProcTargetInStreamOutLong = "IgniteTargetInStreamOutLong";
- private const string ProcTargetInStreamOutStream = "IgniteTargetInStreamOutStream";
- private const string ProcTargetInStreamOutObject = "IgniteTargetInStreamOutObject";
- private const string ProcTargetInObjectStreamOutStream = "IgniteTargetInObjectStreamOutStream";
- private const string ProcTargetOutLong = "IgniteTargetOutLong";
- private const string ProcTargetOutStream = "IgniteTargetOutStream";
- private const string ProcTargetOutObject = "IgniteTargetOutObject";
- private const string ProcTargetListenFut = "IgniteTargetListenFuture";
- private const string ProcTargetListenFutForOp = "IgniteTargetListenFutureForOperation";
-
- private const string ProcAffinityParts = "IgniteAffinityPartitions";
-
- private const string ProcCacheWithSkipStore = "IgniteCacheWithSkipStore";
- private const string ProcCacheWithNoRetries = "IgniteCacheWithNoRetries";
- private const string ProcCacheWithExpiryPolicy = "IgniteCacheWithExpiryPolicy";
- private const string ProcCacheWithAsync = "IgniteCacheWithAsync";
- private const string ProcCacheWithKeepPortable = "IgniteCacheWithKeepPortable";
- private const string ProcCacheClear = "IgniteCacheClear";
- private const string ProcCacheRemoveAll = "IgniteCacheRemoveAll";
- private const string ProcCacheOutOpQueryCursor = "IgniteCacheOutOpQueryCursor";
- private const string ProcCacheOutOpContinuousQuery = "IgniteCacheOutOpContinuousQuery";
- private const string ProcCacheIterator = "IgniteCacheIterator";
- private const string ProcCacheLocalIterator = "IgniteCacheLocalIterator";
- private const string ProcCacheEnterLock = "IgniteCacheEnterLock";
- private const string ProcCacheExitLock = "IgniteCacheExitLock";
- private const string ProcCacheTryEnterLock = "IgniteCacheTryEnterLock";
- private const string ProcCacheCloseLock = "IgniteCacheCloseLock";
- private const string ProcCacheRebalance = "IgniteCacheRebalance";
- private const string ProcCacheSize = "IgniteCacheSize";
-
- private const string ProcCacheStoreCallbackInvoke = "IgniteCacheStoreCallbackInvoke";
-
- private const string ProcComputeWithNoFailover = "IgniteComputeWithNoFailover";
- private const string ProcComputeWithTimeout = "IgniteComputeWithTimeout";
- private const string ProcComputeExecuteNative = "IgniteComputeExecuteNative";
-
- private const string ProcContinuousQryClose = "IgniteContinuousQueryClose";
- private const string ProcContinuousQryGetInitialQueryCursor = "IgniteContinuousQueryGetInitialQueryCursor";
-
- private const string ProcDataStreamerListenTop = "IgniteDataStreamerListenTopology";
- private const string ProcDataStreamerAllowOverwriteGet = "IgniteDataStreamerAllowOverwriteGet";
- private const string ProcDataStreamerAllowOverwriteSet = "IgniteDataStreamerAllowOverwriteSet";
- private const string ProcDataStreamerSkipStoreGet = "IgniteDataStreamerSkipStoreGet";
- private const string ProcDataStreamerSkipStoreSet = "IgniteDataStreamerSkipStoreSet";
- private const string ProcDataStreamerPerNodeBufferSizeGet = "IgniteDataStreamerPerNodeBufferSizeGet";
- private const string ProcDataStreamerPerNodeBufferSizeSet = "IgniteDataStreamerPerNodeBufferSizeSet";
- private const string ProcDataStreamerPerNodeParallelOpsGet = "IgniteDataStreamerPerNodeParallelOperationsGet";
- private const string ProcDataStreamerPerNodeParallelOpsSet = "IgniteDataStreamerPerNodeParallelOperationsSet";
-
- private const string ProcMessagingWithAsync = "IgniteMessagingWithAsync";
-
- private const string ProcQryCursorIterator = "IgniteQueryCursorIterator";
- private const string ProcQryCursorClose = "IgniteQueryCursorClose";
-
- private const string ProcProjectionForOthers = "IgniteProjectionForOthers";
- private const string ProcProjectionForRemotes = "IgniteProjectionForRemotes";
- private const string ProcProjectionForDaemons = "IgniteProjectionForDaemons";
- private const string ProcProjectionForRandom = "IgniteProjectionForRandom";
- private const string ProcProjectionForOldest = "IgniteProjectionForOldest";
- private const string ProcProjectionForYoungest = "IgniteProjectionForYoungest";
- private const string ProcProjectionResetMetrics = "IgniteProjectionResetMetrics";
- private const string ProcProjectionOutOpRet = "IgniteProjectionOutOpRet";
-
- private const string ProcAcquire = "IgniteAcquire";
- private const string ProcRelease = "IgniteRelease";
-
- private const string ProcTxStart = "IgniteTransactionsStart";
- private const string ProcTxCommit = "IgniteTransactionsCommit";
- private const string ProcTxCommitAsync = "IgniteTransactionsCommitAsync";
- private const string ProcTxRollback = "IgniteTransactionsRollback";
- private const string ProcTxRollbackAsync = "IgniteTransactionsRollbackAsync";
- private const string ProcTxClose = "IgniteTransactionsClose";
- private const string ProcTxState = "IgniteTransactionsState";
- private const string ProcTxSetRollbackOnly = "IgniteTransactionsSetRollbackOnly";
- private const string ProcTxResetMetrics = "IgniteTransactionsResetMetrics";
-
- private const string ProcThrowToJava = "IgniteThrowToJava";
-
- private const string ProcDestroyJvm = "IgniteDestroyJvm";
-
- private const string ProcHandlersSize = "IgniteHandlersSize";
-
- private const string ProcCreateContext = "IgniteCreateContext";
-
- private const string ProcEventsWithAsync = "IgniteEventsWithAsync";
- private const string ProcEventsStopLocalListen = "IgniteEventsStopLocalListen";
- private const string ProcEventsLocalListen = "IgniteEventsLocalListen";
- private const string ProcEventsIsEnabled = "IgniteEventsIsEnabled";
-
- private const string ProcDeleteContext = "IgniteDeleteContext";
-
- private const string ProcServicesWithAsync = "IgniteServicesWithAsync";
- private const string ProcServicesWithServerKeepPortable = "IgniteServicesWithServerKeepPortable";
- private const string ProcServicesCancel = "IgniteServicesCancel";
- private const string ProcServicesCancelAll = "IgniteServicesCancelAll";
- private const string ProcServicesGetServiceProxy = "IgniteServicesGetServiceProxy";
-
- #endregion
-
- #region DELEGATE DEFINITIONS
-
- private delegate int ReallocateDelegate(long memPtr, int cap);
-
- private delegate void* IgnitionStartDelegate(void* ctx, sbyte* cfgPath, sbyte* gridName, int factoryId, long dataPtr);
- private delegate bool IgnitionStopDelegate(void* ctx, sbyte* gridName, bool cancel);
- private delegate void IgnitionStopAllDelegate(void* ctx, bool cancel);
-
- private delegate void ProcessorReleaseStartDelegate(void* ctx, void* obj);
- private delegate void* ProcessorProjectionDelegate(void* ctx, void* obj);
- private delegate void* ProcessorCacheDelegate(void* ctx, void* obj, sbyte* name);
- private delegate void* ProcessorCreateCacheDelegate(void* ctx, void* obj, sbyte* name);
- private delegate void* ProcessorGetOrCreateCacheDelegate(void* ctx, void* obj, sbyte* name);
- private delegate void* ProcessorAffinityDelegate(void* ctx, void* obj, sbyte* name);
- private delegate void* ProcessorDataStreamerDelegate(void* ctx, void* obj, sbyte* name, bool keepPortable);
- private delegate void* ProcessorTransactionsDelegate(void* ctx, void* obj);
- private delegate void* ProcessorComputeDelegate(void* ctx, void* obj, void* prj);
- private delegate void* ProcessorMessageDelegate(void* ctx, void* obj, void* prj);
- private delegate void* ProcessorEventsDelegate(void* ctx, void* obj, void* prj);
- private delegate void* ProcessorServicesDelegate(void* ctx, void* obj, void* prj);
- private delegate void* ProcessorExtensionsDelegate(void* ctx, void* obj);
-
- private delegate long TargetInStreamOutLongDelegate(void* ctx, void* target, int opType, long memPtr);
- private delegate void TargetInStreamOutStreamDelegate(void* ctx, void* target, int opType, long inMemPtr, long outMemPtr);
- private delegate void* TargetInStreamOutObjectDelegate(void* ctx, void* target, int opType, long memPtr);
- private delegate void TargetInObjectStreamOutStreamDelegate(void* ctx, void* target, int opType, void* arg, long inMemPtr, long outMemPtr);
- private delegate long TargetOutLongDelegate(void* ctx, void* target, int opType);
- private delegate void TargetOutStreamDelegate(void* ctx, void* target, int opType, long memPtr);
- private delegate void* TargetOutObjectDelegate(void* ctx, void* target, int opType);
- private delegate void TargetListenFutureDelegate(void* ctx, void* target, long futId, int typ);
- private delegate void TargetListenFutureForOpDelegate(void* ctx, void* target, long futId, int typ, int opId);
-
- private delegate int AffinityPartitionsDelegate(void* ctx, void* target);
-
- private delegate void* CacheWithSkipStoreDelegate(void* ctx, void* obj);
- private delegate void* CacheNoRetriesDelegate(void* ctx, void* obj);
- private delegate void* CacheWithExpiryPolicyDelegate(void* ctx, void* obj, long create, long update, long access);
- private delegate void* CacheWithAsyncDelegate(void* ctx, void* obj);
- private delegate void* CacheWithKeepPortableDelegate(void* ctx, void* obj);
- private delegate void CacheClearDelegate(void* ctx, void* obj);
- private delegate void CacheRemoveAllDelegate(void* ctx, void* obj);
- private delegate void* CacheOutOpQueryCursorDelegate(void* ctx, void* obj, int type, long memPtr);
- private delegate void* CacheOutOpContinuousQueryDelegate(void* ctx, void* obj, int type, long memPtr);
- private delegate void* CacheIteratorDelegate(void* ctx, void* obj);
- private delegate void* CacheLocalIteratorDelegate(void* ctx, void* obj, int peekModes);
- private delegate void CacheEnterLockDelegate(void* ctx, void* obj, long id);
- private delegate void CacheExitLockDelegate(void* ctx, void* obj, long id);
- private delegate bool CacheTryEnterLockDelegate(void* ctx, void* obj, long id, long timeout);
- private delegate void CacheCloseLockDelegate(void* ctx, void* obj, long id);
- private delegate void CacheRebalanceDelegate(void* ctx, void* obj, long futId);
- private delegate int CacheSizeDelegate(void* ctx, void* obj, int peekModes, bool loc);
-
- private delegate void CacheStoreCallbackInvokeDelegate(void* ctx, void* obj, long memPtr);
-
- private delegate void ComputeWithNoFailoverDelegate(void* ctx, void* target);
- private delegate void ComputeWithTimeoutDelegate(void* ctx, void* target, long timeout);
- private delegate void ComputeExecuteNativeDelegate(void* ctx, void* target, long taskPtr, long topVer);
-
- private delegate void ContinuousQueryCloseDelegate(void* ctx, void* target);
- private delegate void* ContinuousQueryGetInitialQueryCursorDelegate(void* ctx, void* target);
-
- private delegate void DataStreamerListenTopologyDelegate(void* ctx, void* obj, long ptr);
- private delegate bool DataStreamerAllowOverwriteGetDelegate(void* ctx, void* obj);
- private delegate void DataStreamerAllowOverwriteSetDelegate(void* ctx, void* obj, bool val);
- private delegate bool DataStreamerSkipStoreGetDelegate(void* ctx, void* obj);
- private delegate void DataStreamerSkipStoreSetDelegate(void* ctx, void* obj, bool val);
- private delegate int DataStreamerPerNodeBufferSizeGetDelegate(void* ctx, void* obj);
- private delegate void DataStreamerPerNodeBufferSizeSetDelegate(void* ctx, void* obj, int val);
- private delegate int DataStreamerPerNodeParallelOperationsGetDelegate(void* ctx, void* obj);
- private delegate void DataStreamerPerNodeParallelOperationsSetDelegate(void* ctx, void* obj, int val);
-
- private delegate void* MessagingWithAsyncDelegate(void* ctx, void* target);
-
- private delegate void* ProjectionForOthersDelegate(void* ctx, void* obj, void* prj);
- private delegate void* ProjectionForRemotesDelegate(void* ctx, void* obj);
- private delegate void* ProjectionForDaemonsDelegate(void* ctx, void* obj);
- private delegate void* ProjectionForRandomDelegate(void* ctx, void* obj);
- private delegate void* ProjectionForOldestDelegate(void* ctx, void* obj);
- private delegate void* ProjectionForYoungestDelegate(void* ctx, void* obj);
- private delegate void ProjectionResetMetricsDelegate(void* ctx, void* obj);
- private delegate void* ProjectionOutOpRetDelegate(void* ctx, void* obj, int type, long memPtr);
-
- private delegate void QueryCursorIteratorDelegate(void* ctx, void* target);
- private delegate void QueryCursorCloseDelegate(void* ctx, void* target);
-
- private delegate void* AcquireDelegate(void* ctx, void* target);
- private delegate void ReleaseDelegate(void* target);
-
- private delegate long TransactionsStartDelegate(void* ctx, void* target, int concurrency, int isolation, long timeout, int txSize);
- private delegate int TransactionsCommitDelegate(void* ctx, void* target, long id);
- private delegate void TransactionsCommitAsyncDelegate(void* ctx, void* target, long id, long futId);
- private delegate int TransactionsRollbackDelegate(void* ctx, void* target, long id);
- private delegate void TransactionsRollbackAsyncDelegate(void* ctx, void* target, long id, long futId);
- private delegate int TransactionsCloseDelegate(void* ctx, void* target, long id);
- private delegate int TransactionsStateDelegate(void* ctx, void* target, long id);
- private delegate bool TransactionsSetRollbackOnlyDelegate(void* ctx, void* target, long id);
- private delegate void TransactionsResetMetricsDelegate(void* ctx, void* target);
-
- private delegate void ThrowToJavaDelegate(void* ctx, char* msg);
-
- private delegate void DestroyJvmDelegate(void* ctx);
-
- private delegate int HandlersSizeDelegate();
-
- private delegate void* CreateContextDelegate(void* opts, int optsLen, void* cbs);
-
- private delegate void* EventsWithAsyncDelegate(void* ctx, void* obj);
- private delegate bool EventsStopLocalListenDelegate(void* ctx, void* obj, long hnd);
- private delegate void EventsLocalListenDelegate(void* ctx, void* obj, long hnd, int type);
- private delegate bool EventsIsEnabledDelegate(void* ctx, void* obj, int type);
-
- private delegate void DeleteContextDelegate(void* ptr);
-
- private delegate void* ServicesWithAsyncDelegate(void* ctx, void* target);
- private delegate void* ServicesWithServerKeepPortableDelegate(void* ctx, void* target);
- private delegate long ServicesCancelDelegate(void* ctx, void* target, char* name);
- private delegate long ServicesCancelAllDelegate(void* ctx, void* target);
- private delegate void* ServicesGetServiceProxyDelegate(void* ctx, void* target, char* name, bool sticky);
-
- #endregion
-
- #region DELEGATE MEMBERS
-
- // ReSharper disable InconsistentNaming
- private static readonly ReallocateDelegate REALLOCATE;
-
- private static readonly IgnitionStartDelegate IGNITION_START;
- private static readonly IgnitionStopDelegate IGNITION_STOP;
- private static readonly IgnitionStopAllDelegate IGNITION_STOP_ALL;
-
- private static readonly ProcessorReleaseStartDelegate PROCESSOR_RELEASE_START;
- private static readonly ProcessorProjectionDelegate PROCESSOR_PROJECTION;
- private static readonly ProcessorCacheDelegate PROCESSOR_CACHE;
- private static readonly ProcessorCreateCacheDelegate PROCESSOR_CREATE_CACHE;
- private static readonly ProcessorGetOrCreateCacheDelegate PROCESSOR_GET_OR_CREATE_CACHE;
- private static readonly ProcessorAffinityDelegate PROCESSOR_AFFINITY;
- private static readonly ProcessorDataStreamerDelegate PROCESSOR_DATA_STREAMER;
- private static readonly ProcessorTransactionsDelegate PROCESSOR_TRANSACTIONS;
- private static readonly ProcessorComputeDelegate PROCESSOR_COMPUTE;
- private static readonly ProcessorMessageDelegate PROCESSOR_MESSAGE;
- private static readonly ProcessorEventsDelegate PROCESSOR_EVENTS;
- private static readonly ProcessorServicesDelegate PROCESSOR_SERVICES;
- private static readonly ProcessorExtensionsDelegate PROCESSOR_EXTENSIONS;
-
- private static readonly TargetInStreamOutLongDelegate TARGET_IN_STREAM_OUT_LONG;
- private static readonly TargetInStreamOutStreamDelegate TARGET_IN_STREAM_OUT_STREAM;
- private static readonly TargetInStreamOutObjectDelegate TARGET_IN_STREAM_OUT_OBJECT;
- private static readonly TargetInObjectStreamOutStreamDelegate TARGET_IN_OBJECT_STREAM_OUT_STREAM;
- private static readonly TargetOutLongDelegate TARGET_OUT_LONG;
- private static readonly TargetOutStreamDelegate TARGET_OUT_STREAM;
- private static readonly TargetOutObjectDelegate TARGET_OUT_OBJECT;
- private static readonly TargetListenFutureDelegate TargetListenFut;
- private static readonly TargetListenFutureForOpDelegate TargetListenFutForOp;
-
- private static readonly AffinityPartitionsDelegate AffinityParts;
-
- private static readonly CacheWithSkipStoreDelegate CACHE_WITH_SKIP_STORE;
- private static readonly CacheNoRetriesDelegate CACHE_WITH_NO_RETRIES;
- private static readonly CacheWithExpiryPolicyDelegate CACHE_WITH_EXPIRY_POLICY;
- private static readonly CacheWithAsyncDelegate CACHE_WITH_ASYNC;
- private static readonly CacheWithKeepPortableDelegate CACHE_WITH_KEEP_PORTABLE;
- private static readonly CacheClearDelegate CACHE_CLEAR;
- private static readonly CacheRemoveAllDelegate CACHE_REMOVE_ALL;
- private static readonly CacheOutOpQueryCursorDelegate CACHE_OUT_OP_QUERY_CURSOR;
- private static readonly CacheOutOpContinuousQueryDelegate CACHE_OUT_OP_CONTINUOUS_QUERY;
- private static readonly CacheIteratorDelegate CACHE_ITERATOR;
- private static readonly CacheLocalIteratorDelegate CACHE_LOCAL_ITERATOR;
- private static readonly CacheEnterLockDelegate CACHE_ENTER_LOCK;
- private static readonly CacheExitLockDelegate CACHE_EXIT_LOCK;
- private static readonly CacheTryEnterLockDelegate CACHE_TRY_ENTER_LOCK;
- private static readonly CacheCloseLockDelegate CACHE_CLOSE_LOCK;
- private static readonly CacheRebalanceDelegate CACHE_REBALANCE;
- private static readonly CacheSizeDelegate CACHE_SIZE;
-
- private static readonly CacheStoreCallbackInvokeDelegate CACHE_STORE_CALLBACK_INVOKE;
-
- private static readonly ComputeWithNoFailoverDelegate COMPUTE_WITH_NO_FAILOVER;
- private static readonly ComputeWithTimeoutDelegate COMPUTE_WITH_TIMEOUT;
- private static readonly ComputeExecuteNativeDelegate COMPUTE_EXECUTE_NATIVE;
-
- private static readonly ContinuousQueryCloseDelegate ContinuousQryClose;
- private static readonly ContinuousQueryGetInitialQueryCursorDelegate ContinuousQryGetInitialQueryCursor;
-
- private static readonly DataStreamerListenTopologyDelegate DataStreamerListenTop;
- private static readonly DataStreamerAllowOverwriteGetDelegate DATA_STREAMER_ALLOW_OVERWRITE_GET;
- private static readonly DataStreamerAllowOverwriteSetDelegate DATA_STREAMER_ALLOW_OVERWRITE_SET;
- private static readonly DataStreamerSkipStoreGetDelegate DATA_STREAMER_SKIP_STORE_GET;
- private static readonly DataStreamerSkipStoreSetDelegate DATA_STREAMER_SKIP_STORE_SET;
- private static readonly DataStreamerPerNodeBufferSizeGetDelegate DATA_STREAMER_PER_NODE_BUFFER_SIZE_GET;
- private static readonly DataStreamerPerNodeBufferSizeSetDelegate DATA_STREAMER_PER_NODE_BUFFER_SIZE_SET;
- private static readonly DataStreamerPerNodeParallelOperationsGetDelegate DataStreamerPerNodeParallelOpsGet;
- private static readonly DataStreamerPerNodeParallelOperationsSetDelegate DataStreamerPerNodeParallelOpsSet;
-
- private static readonly MessagingWithAsyncDelegate MessagingWithAsync;
-
- private static readonly ProjectionForOthersDelegate PROJECTION_FOR_OTHERS;
- private static readonly ProjectionForRemotesDelegate PROJECTION_FOR_REMOTES;
- private static readonly ProjectionForDaemonsDelegate PROJECTION_FOR_DAEMONS;
- private static readonly ProjectionForRandomDelegate PROJECTION_FOR_RANDOM;
- private static readonly ProjectionForOldestDelegate PROJECTION_FOR_OLDEST;
- private static readonly ProjectionForYoungestDelegate PROJECTION_FOR_YOUNGEST;
- private static readonly ProjectionResetMetricsDelegate PROJECTION_RESET_METRICS;
- private static readonly ProjectionOutOpRetDelegate PROJECTION_OUT_OP_RET;
-
- private static readonly QueryCursorIteratorDelegate QryCursorIterator;
- private static readonly QueryCursorCloseDelegate QryCursorClose;
-
- private static readonly AcquireDelegate ACQUIRE;
- private static readonly ReleaseDelegate RELEASE;
-
- private static readonly TransactionsStartDelegate TxStart;
- private static readonly TransactionsCommitDelegate TxCommit;
- private static readonly TransactionsCommitAsyncDelegate TxCommitAsync;
- private static readonly TransactionsRollbackDelegate TxRollback;
- private static readonly TransactionsRollbackAsyncDelegate TxRollbackAsync;
- private static readonly TransactionsCloseDelegate TxClose;
- private static readonly TransactionsStateDelegate TxState;
- private static readonly TransactionsSetRollbackOnlyDelegate TxSetRollbackOnly;
- private static readonly TransactionsResetMetricsDelegate TxResetMetrics;
-
- private static readonly ThrowToJavaDelegate THROW_TO_JAVA;
-
- private static readonly DestroyJvmDelegate DESTROY_JVM;
-
- private static readonly HandlersSizeDelegate HANDLERS_SIZE;
-
- private static readonly CreateContextDelegate CREATE_CONTEXT;
-
- private static readonly EventsWithAsyncDelegate EVENTS_WITH_ASYNC;
- private static readonly EventsStopLocalListenDelegate EVENTS_STOP_LOCAL_LISTEN;
- private static readonly EventsLocalListenDelegate EVENTS_LOCAL_LISTEN;
- private static readonly EventsIsEnabledDelegate EVENTS_IS_ENABLED;
-
- private static readonly DeleteContextDelegate DELETE_CONTEXT;
-
- private static readonly ServicesWithAsyncDelegate SERVICES_WITH_ASYNC;
- private static readonly ServicesWithServerKeepPortableDelegate SERVICES_WITH_SERVER_KEEP_PORTABLE;
- private static readonly ServicesCancelDelegate SERVICES_CANCEL;
- private static readonly ServicesCancelAllDelegate SERVICES_CANCEL_ALL;
- private static readonly ServicesGetServiceProxyDelegate SERVICES_GET_SERVICE_PROXY;
- // ReSharper restore InconsistentNaming
-
- #endregion
-
- /** Library pointer. */
- private static readonly IntPtr Ptr;
-
- /// <summary>
- /// Initializer.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
- static UnmanagedUtils()
- {
- var path = IgniteUtils.UnpackEmbeddedResource(IgniteUtils.FileIgniteJniDll);
-
- Ptr = NativeMethods.LoadLibrary(path);
-
- if (Ptr == IntPtr.Zero)
- throw new IgniteException("Failed to load " + IgniteUtils.FileIgniteJniDll + ": " + Marshal.GetLastWin32Error());
-
- REALLOCATE = CreateDelegate<ReallocateDelegate>(ProcReallocate);
-
- IGNITION_START = CreateDelegate<IgnitionStartDelegate>(ProcIgnitionStart);
- IGNITION_STOP = CreateDelegate<IgnitionStopDelegate>(ProcIgnitionStop);
- IGNITION_STOP_ALL = CreateDelegate<IgnitionStopAllDelegate>(ProcIgnitionStopAll);
-
- PROCESSOR_RELEASE_START = CreateDelegate<ProcessorReleaseStartDelegate>(ProcProcessorReleaseStart);
- PROCESSOR_PROJECTION = CreateDelegate<ProcessorProjectionDelegate>(ProcProcessorProjection);
- PROCESSOR_CACHE = CreateDelegate<ProcessorCacheDelegate>(ProcProcessorCache);
- PROCESSOR_CREATE_CACHE = CreateDelegate<ProcessorCreateCacheDelegate>(ProcProcessorCreateCache);
- PROCESSOR_GET_OR_CREATE_CACHE = CreateDelegate<ProcessorGetOrCreateCacheDelegate>(ProcProcessorGetOrCreateCache);
- PROCESSOR_AFFINITY = CreateDelegate<ProcessorAffinityDelegate>(ProcProcessorAffinity);
- PROCESSOR_DATA_STREAMER = CreateDelegate<ProcessorDataStreamerDelegate>(ProcProcessorDataStreamer);
- PROCESSOR_TRANSACTIONS = CreateDelegate<ProcessorTransactionsDelegate>(ProcProcessorTransactions);
- PROCESSOR_COMPUTE = CreateDelegate<ProcessorComputeDelegate>(ProcProcessorCompute);
- PROCESSOR_MESSAGE = CreateDelegate<ProcessorMessageDelegate>(ProcProcessorMessage);
- PROCESSOR_EVENTS = CreateDelegate<ProcessorEventsDelegate>(ProcProcessorEvents);
- PROCESSOR_SERVICES = CreateDelegate<ProcessorServicesDelegate>(ProcProcessorServices);
- PROCESSOR_EXTENSIONS = CreateDelegate<ProcessorExtensionsDelegate>(ProcProcessorExtensions);
-
- TARGET_IN_STREAM_OUT_LONG = CreateDelegate<TargetInStreamOutLongDelegate>(ProcTargetInStreamOutLong);
- TARGET_IN_STREAM_OUT_STREAM = CreateDelegate<TargetInStreamOutStreamDelegate>(ProcTargetInStreamOutStream);
- TARGET_IN_STREAM_OUT_OBJECT = CreateDelegate<TargetInStreamOutObjectDelegate>(ProcTargetInStreamOutObject);
- TARGET_IN_OBJECT_STREAM_OUT_STREAM = CreateDelegate<TargetInObjectStreamOutStreamDelegate>(ProcTargetInObjectStreamOutStream);
- TARGET_OUT_LONG = CreateDelegate<TargetOutLongDelegate>(ProcTargetOutLong);
- TARGET_OUT_STREAM = CreateDelegate<TargetOutStreamDelegate>(ProcTargetOutStream);
- TARGET_OUT_OBJECT = CreateDelegate<TargetOutObjectDelegate>(ProcTargetOutObject);
- TargetListenFut = CreateDelegate<TargetListenFutureDelegate>(ProcTargetListenFut);
- TargetListenFutForOp = CreateDelegate<TargetListenFutureForOpDelegate>(ProcTargetListenFutForOp);
-
- AffinityParts = CreateDelegate<AffinityPartitionsDelegate>(ProcAffinityParts);
-
- CACHE_WITH_SKIP_STORE = CreateDelegate<CacheWithSkipStoreDelegate>(ProcCacheWithSkipStore);
- CACHE_WITH_NO_RETRIES = CreateDelegate<CacheNoRetriesDelegate>(ProcCacheWithNoRetries);
- CACHE_WITH_EXPIRY_POLICY = CreateDelegate<CacheWithExpiryPolicyDelegate>(ProcCacheWithExpiryPolicy);
- CACHE_WITH_ASYNC = CreateDelegate<CacheWithAsyncDelegate>(ProcCacheWithAsync);
- CACHE_WITH_KEEP_PORTABLE = CreateDelegate<CacheWithKeepPortableDelegate>(ProcCacheWithKeepPortable);
- CACHE_CLEAR = CreateDelegate<CacheClearDelegate>(ProcCacheClear);
- CACHE_REMOVE_ALL = CreateDelegate<CacheRemoveAllDelegate>(ProcCacheRemoveAll);
- CACHE_OUT_OP_QUERY_CURSOR = CreateDelegate<CacheOutOpQueryCursorDelegate>(ProcCacheOutOpQueryCursor);
- CACHE_OUT_OP_CONTINUOUS_QUERY = CreateDelegate<CacheOutOpContinuousQueryDelegate>(ProcCacheOutOpContinuousQuery);
- CACHE_ITERATOR = CreateDelegate<CacheIteratorDelegate>(ProcCacheIterator);
- CACHE_LOCAL_ITERATOR = CreateDelegate<CacheLocalIteratorDelegate>(ProcCacheLocalIterator);
- CACHE_ENTER_LOCK = CreateDelegate<CacheEnterLockDelegate>(ProcCacheEnterLock);
- CACHE_EXIT_LOCK = CreateDelegate<CacheExitLockDelegate>(ProcCacheExitLock);
- CACHE_TRY_ENTER_LOCK = CreateDelegate<CacheTryEnterLockDelegate>(ProcCacheTryEnterLock);
- CACHE_CLOSE_LOCK = CreateDelegate<CacheCloseLockDelegate>(ProcCacheCloseLock);
- CACHE_REBALANCE = CreateDelegate<CacheRebalanceDelegate>(ProcCacheRebalance);
- CACHE_SIZE = CreateDelegate<CacheSizeDelegate>(ProcCacheSize);
-
- CACHE_STORE_CALLBACK_INVOKE = CreateDelegate<CacheStoreCallbackInvokeDelegate>(ProcCacheStoreCallbackInvoke);
-
- COMPUTE_WITH_NO_FAILOVER = CreateDelegate<ComputeWithNoFailoverDelegate>(ProcComputeWithNoFailover);
- COMPUTE_WITH_TIMEOUT = CreateDelegate<ComputeWithTimeoutDelegate>(ProcComputeWithTimeout);
- COMPUTE_EXECUTE_NATIVE = CreateDelegate<ComputeExecuteNativeDelegate>(ProcComputeExecuteNative);
-
- ContinuousQryClose = CreateDelegate<ContinuousQueryCloseDelegate>(ProcContinuousQryClose);
- ContinuousQryGetInitialQueryCursor = CreateDelegate<ContinuousQueryGetInitialQueryCursorDelegate>(ProcContinuousQryGetInitialQueryCursor);
-
- DataStreamerListenTop = CreateDelegate<DataStreamerListenTopologyDelegate>(ProcDataStreamerListenTop);
- DATA_STREAMER_ALLOW_OVERWRITE_GET = CreateDelegate<DataStreamerAllowOverwriteGetDelegate>(ProcDataStreamerAllowOverwriteGet);
- DATA_STREAMER_ALLOW_OVERWRITE_SET = CreateDelegate<DataStreamerAllowOverwriteSetDelegate>(ProcDataStreamerAllowOverwriteSet);
- DATA_STREAMER_SKIP_STORE_GET = CreateDelegate<DataStreamerSkipStoreGetDelegate>(ProcDataStreamerSkipStoreGet);
- DATA_STREAMER_SKIP_STORE_SET = CreateDelegate<DataStreamerSkipStoreSetDelegate>(ProcDataStreamerSkipStoreSet);
- DATA_STREAMER_PER_NODE_BUFFER_SIZE_GET = CreateDelegate<DataStreamerPerNodeBufferSizeGetDelegate>(ProcDataStreamerPerNodeBufferSizeGet);
- DATA_STREAMER_PER_NODE_BUFFER_SIZE_SET = CreateDelegate<DataStreamerPerNodeBufferSizeSetDelegate>(ProcDataStreamerPerNodeBufferSizeSet);
- DataStreamerPerNodeParallelOpsGet = CreateDelegate<DataStreamerPerNodeParallelOperationsGetDelegate>(ProcDataStreamerPerNodeParallelOpsGet);
- DataStreamerPerNodeParallelOpsSet = CreateDelegate<DataStreamerPerNodeParallelOperationsSetDelegate>(ProcDataStreamerPerNodeParallelOpsSet);
-
- MessagingWithAsync = CreateDelegate<MessagingWithAsyncDelegate>(ProcMessagingWithAsync);
-
- PROJECTION_FOR_OTHERS = CreateDelegate<ProjectionForOthersDelegate>(ProcProjectionForOthers);
- PROJECTION_FOR_REMOTES = CreateDelegate<ProjectionForRemotesDelegate>(ProcProjectionForRemotes);
- PROJECTION_FOR_DAEMONS = CreateDelegate<ProjectionForDaemonsDelegate>(ProcProjectionForDaemons);
- PROJECTION_FOR_RANDOM = CreateDelegate<ProjectionForRandomDelegate>(ProcProjectionForRandom);
- PROJECTION_FOR_OLDEST = CreateDelegate<ProjectionForOldestDelegate>(ProcProjectionForOldest);
- PROJECTION_FOR_YOUNGEST = CreateDelegate<ProjectionForYoungestDelegate>(ProcProjectionForYoungest);
- PROJECTION_RESET_METRICS = CreateDelegate<ProjectionResetMetricsDelegate>(ProcProjectionResetMetrics);
- PROJECTION_OUT_OP_RET = CreateDelegate<ProjectionOutOpRetDelegate>(ProcProjectionOutOpRet);
-
- QryCursorIterator = CreateDelegate<QueryCursorIteratorDelegate>(ProcQryCursorIterator);
- QryCursorClose = CreateDelegate<QueryCursorCloseDelegate>(ProcQryCursorClose);
-
- ACQUIRE = CreateDelegate<AcquireDelegate>(ProcAcquire);
- RELEASE = CreateDelegate<ReleaseDelegate>(ProcRelease);
-
- TxStart = CreateDelegate<TransactionsStartDelegate>(ProcTxStart);
- TxCommit = CreateDelegate<TransactionsCommitDelegate>(ProcTxCommit);
- TxCommitAsync = CreateDelegate<TransactionsCommitAsyncDelegate>(ProcTxCommitAsync);
- TxRollback = CreateDelegate<TransactionsRollbackDelegate>(ProcTxRollback);
- TxRollbackAsync = CreateDelegate<TransactionsRollbackAsyncDelegate>(ProcTxRollbackAsync);
- TxClose = CreateDelegate<TransactionsCloseDelegate>(ProcTxClose);
- TxState = CreateDelegate<TransactionsStateDelegate>(ProcTxState);
- TxSetRollbackOnly = CreateDelegate<TransactionsSetRollbackOnlyDelegate>(ProcTxSetRollbackOnly);
- TxResetMetrics = CreateDelegate<TransactionsResetMetricsDelegate>(ProcTxResetMetrics);
-
- THROW_TO_JAVA = CreateDelegate<ThrowToJavaDelegate>(ProcThrowToJava);
-
- HANDLERS_SIZE = CreateDelegate<HandlersSizeDelegate>(ProcHandlersSize);
-
- CREATE_CONTEXT = CreateDelegate<CreateContextDelegate>(ProcCreateContext);
- DELETE_CONTEXT = CreateDelegate<DeleteContextDelegate>(ProcDeleteContext);
-
- DESTROY_JVM = CreateDelegate<DestroyJvmDelegate>(ProcDestroyJvm);
-
- EVENTS_WITH_ASYNC = CreateDelegate<EventsWithAsyncDelegate>(ProcEventsWithAsync);
- EVENTS_STOP_LOCAL_LISTEN = CreateDelegate<EventsStopLocalListenDelegate>(ProcEventsStopLocalListen);
- EVENTS_LOCAL_LISTEN = CreateDelegate<EventsLocalListenDelegate>(ProcEventsLocalListen);
- EVENTS_IS_ENABLED = CreateDelegate<EventsIsEnabledDelegate>(ProcEventsIsEnabled);
-
- SERVICES_WITH_ASYNC = CreateDelegate<ServicesWithAsyncDelegate>(ProcServicesWithAsync);
- SERVICES_WITH_SERVER_KEEP_PORTABLE = CreateDelegate<ServicesWithServerKeepPortableDelegate>(ProcServicesWithServerKeepPortable);
- SERVICES_CANCEL = CreateDelegate<ServicesCancelDelegate>(ProcServicesCancel);
- SERVICES_CANCEL_ALL = CreateDelegate<ServicesCancelAllDelegate>(ProcServicesCancelAll);
- SERVICES_GET_SERVICE_PROXY = CreateDelegate<ServicesGetServiceProxyDelegate>(ProcServicesGetServiceProxy);
- }
-
- #region NATIVE METHODS: PROCESSOR
-
- internal static IUnmanagedTarget IgnitionStart(UnmanagedContext ctx, string cfgPath, string gridName,
- bool clientMode)
- {
- using (var mem = IgniteManager.Memory.Allocate().Stream())
- {
- mem.WriteBool(clientMode);
-
- sbyte* cfgPath0 = IgniteUtils.StringToUtf8Unmanaged(cfgPath);
- sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);
-
- try
- {
- void* res = IGNITION_START(ctx.NativeContext, cfgPath0, gridName0, InteropFactoryId,
- mem.SynchronizeOutput());
-
- return new UnmanagedTarget(ctx, res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(cfgPath0));
- Marshal.FreeHGlobal(new IntPtr(gridName0));
- }
- }
- }
-
- internal static bool IgnitionStop(void* ctx, string gridName, bool cancel)
- {
- sbyte* gridName0 = IgniteUtils.StringToUtf8Unmanaged(gridName);
-
- try
- {
- return IGNITION_STOP(ctx, gridName0, cancel);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(gridName0));
- }
- }
-
- internal static void IgnitionStopAll(void* ctx, bool cancel)
- {
- IGNITION_STOP_ALL(ctx, cancel);
- }
-
- internal static void ProcessorReleaseStart(IUnmanagedTarget target)
- {
- PROCESSOR_RELEASE_START(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget ProcessorProjection(IUnmanagedTarget target)
- {
- void* res = PROCESSOR_PROJECTION(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = PROCESSOR_CACHE(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorCreateCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = PROCESSOR_CREATE_CACHE(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorGetOrCreateCache(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = PROCESSOR_GET_OR_CREATE_CACHE(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorAffinity(IUnmanagedTarget target, string name)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = PROCESSOR_AFFINITY(target.Context, target.Target, name0);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorDataStreamer(IUnmanagedTarget target, string name, bool keepPortable)
- {
- sbyte* name0 = IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- void* res = PROCESSOR_DATA_STREAMER(target.Context, target.Target, name0, keepPortable);
-
- return target.ChangeTarget(res);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(name0));
- }
- }
-
- internal static IUnmanagedTarget ProcessorTransactions(IUnmanagedTarget target)
- {
- void* res = PROCESSOR_TRANSACTIONS(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorCompute(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = PROCESSOR_COMPUTE(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorMessage(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = PROCESSOR_MESSAGE(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorEvents(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = PROCESSOR_EVENTS(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorServices(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = PROCESSOR_SERVICES(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProcessorExtensions(IUnmanagedTarget target)
- {
- void* res = PROCESSOR_EXTENSIONS(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- #endregion
-
- #region NATIVE METHODS: TARGET
-
- internal static long TargetInStreamOutLong(IUnmanagedTarget target, int opType, long memPtr)
- {
- return TARGET_IN_STREAM_OUT_LONG(target.Context, target.Target, opType, memPtr);
- }
-
- internal static void TargetInStreamOutStream(IUnmanagedTarget target, int opType, long inMemPtr, long outMemPtr)
- {
- TARGET_IN_STREAM_OUT_STREAM(target.Context, target.Target, opType, inMemPtr, outMemPtr);
- }
-
- internal static IUnmanagedTarget TargetInStreamOutObject(IUnmanagedTarget target, int opType, long inMemPtr)
- {
- void* res = TARGET_IN_STREAM_OUT_OBJECT(target.Context, target.Target, opType, inMemPtr);
-
- return target.ChangeTarget(res);
- }
-
- internal static void TargetInObjectStreamOutStream(IUnmanagedTarget target, int opType, void* arg, long inMemPtr, long outMemPtr)
- {
- TARGET_IN_OBJECT_STREAM_OUT_STREAM(target.Context, target.Target, opType, arg, inMemPtr, outMemPtr);
- }
-
- internal static long TargetOutLong(IUnmanagedTarget target, int opType)
- {
- return TARGET_OUT_LONG(target.Context, target.Target, opType);
- }
-
- internal static void TargetOutStream(IUnmanagedTarget target, int opType, long memPtr)
- {
- TARGET_OUT_STREAM(target.Context, target.Target, opType, memPtr);
- }
-
- internal static IUnmanagedTarget TargetOutObject(IUnmanagedTarget target, int opType)
- {
- void* res = TARGET_OUT_OBJECT(target.Context, target.Target, opType);
-
- return target.ChangeTarget(res);
- }
-
- internal static void TargetListenFuture(IUnmanagedTarget target, long futId, int typ)
- {
- TargetListenFut(target.Context, target.Target, futId, typ);
- }
-
- internal static void TargetListenFutureForOperation(IUnmanagedTarget target, long futId, int typ, int opId)
- {
- TargetListenFutForOp(target.Context, target.Target, futId, typ, opId);
- }
-
- #endregion
-
- #region NATIVE METHODS: AFFINITY
-
- internal static int AffinityPartitions(IUnmanagedTarget target)
- {
- return AffinityParts(target.Context, target.Target);
- }
-
- #endregion
-
- #region NATIVE METHODS: CACHE
-
- internal static IUnmanagedTarget CacheWithSkipStore(IUnmanagedTarget target)
- {
- void* res = CACHE_WITH_SKIP_STORE(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheWithNoRetries(IUnmanagedTarget target)
- {
- void* res = CACHE_WITH_NO_RETRIES(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheWithExpiryPolicy(IUnmanagedTarget target, long create, long update, long access)
- {
- void* res = CACHE_WITH_EXPIRY_POLICY(target.Context, target.Target, create, update, access);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheWithAsync(IUnmanagedTarget target)
- {
- void* res = CACHE_WITH_ASYNC(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheWithKeepPortable(IUnmanagedTarget target)
- {
- void* res = CACHE_WITH_KEEP_PORTABLE(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static void CacheClear(IUnmanagedTarget target)
- {
- CACHE_CLEAR(target.Context, target.Target);
- }
-
- internal static void CacheRemoveAll(IUnmanagedTarget target)
- {
- CACHE_REMOVE_ALL(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget CacheOutOpQueryCursor(IUnmanagedTarget target, int type, long memPtr)
- {
- void* res = CACHE_OUT_OP_QUERY_CURSOR(target.Context, target.Target, type, memPtr);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheOutOpContinuousQuery(IUnmanagedTarget target, int type, long memPtr)
- {
- void* res = CACHE_OUT_OP_CONTINUOUS_QUERY(target.Context, target.Target, type, memPtr);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheIterator(IUnmanagedTarget target)
- {
- void* res = CACHE_ITERATOR(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget CacheLocalIterator(IUnmanagedTarget target, int peekModes)
- {
- void* res = CACHE_LOCAL_ITERATOR(target.Context, target.Target, peekModes);
-
- return target.ChangeTarget(res);
- }
-
- internal static void CacheEnterLock(IUnmanagedTarget target, long id)
- {
- CACHE_ENTER_LOCK(target.Context, target.Target, id);
- }
-
- internal static void CacheExitLock(IUnmanagedTarget target, long id)
- {
- CACHE_EXIT_LOCK(target.Context, target.Target, id);
- }
-
- internal static bool CacheTryEnterLock(IUnmanagedTarget target, long id, long timeout)
- {
- return CACHE_TRY_ENTER_LOCK(target.Context, target.Target, id, timeout);
- }
-
- internal static void CacheCloseLock(IUnmanagedTarget target, long id)
- {
- CACHE_CLOSE_LOCK(target.Context, target.Target, id);
- }
-
- internal static void CacheRebalance(IUnmanagedTarget target, long futId)
- {
- CACHE_REBALANCE(target.Context, target.Target, futId);
- }
-
- internal static void CacheStoreCallbackInvoke(IUnmanagedTarget target, long memPtr)
- {
- CACHE_STORE_CALLBACK_INVOKE(target.Context, target.Target, memPtr);
- }
-
- internal static int CacheSize(IUnmanagedTarget target, int modes, bool loc)
- {
- return CACHE_SIZE(target.Context, target.Target, modes, loc);
- }
-
- #endregion
-
- #region NATIVE METHODS: COMPUTE
-
- internal static void ComputeWithNoFailover(IUnmanagedTarget target)
- {
- COMPUTE_WITH_NO_FAILOVER(target.Context, target.Target);
- }
-
- internal static void ComputeWithTimeout(IUnmanagedTarget target, long timeout)
- {
- COMPUTE_WITH_TIMEOUT(target.Context, target.Target, timeout);
- }
-
- internal static void ComputeExecuteNative(IUnmanagedTarget target, long taskPtr, long topVer)
- {
- COMPUTE_EXECUTE_NATIVE(target.Context, target.Target, taskPtr, topVer);
- }
-
- #endregion
-
- #region NATIVE METHODS: CONTINUOUS QUERY
-
- internal static void ContinuousQueryClose(IUnmanagedTarget target)
- {
- ContinuousQryClose(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget ContinuousQueryGetInitialQueryCursor(IUnmanagedTarget target)
- {
- void* res = ContinuousQryGetInitialQueryCursor(target.Context, target.Target);
-
- return res == null ? null : target.ChangeTarget(res);
- }
-
- #endregion
-
- #region NATIVE METHODS: DATA STREAMER
-
- internal static void DataStreamerListenTopology(IUnmanagedTarget target, long ptr)
- {
- DataStreamerListenTop(target.Context, target.Target, ptr);
- }
-
- internal static bool DataStreamerAllowOverwriteGet(IUnmanagedTarget target)
- {
- return DATA_STREAMER_ALLOW_OVERWRITE_GET(target.Context, target.Target);
- }
-
- internal static void DataStreamerAllowOverwriteSet(IUnmanagedTarget target, bool val)
- {
- DATA_STREAMER_ALLOW_OVERWRITE_SET(target.Context, target.Target, val);
- }
-
- internal static bool DataStreamerSkipStoreGet(IUnmanagedTarget target)
- {
- return DATA_STREAMER_SKIP_STORE_GET(target.Context, target.Target);
- }
-
- internal static void DataStreamerSkipStoreSet(IUnmanagedTarget target, bool val)
- {
- DATA_STREAMER_SKIP_STORE_SET(target.Context, target.Target, val);
- }
-
- internal static int DataStreamerPerNodeBufferSizeGet(IUnmanagedTarget target)
- {
- return DATA_STREAMER_PER_NODE_BUFFER_SIZE_GET(target.Context, target.Target);
- }
-
- internal static void DataStreamerPerNodeBufferSizeSet(IUnmanagedTarget target, int val)
- {
- DATA_STREAMER_PER_NODE_BUFFER_SIZE_SET(target.Context, target.Target, val);
- }
-
- internal static int DataStreamerPerNodeParallelOperationsGet(IUnmanagedTarget target)
- {
- return DataStreamerPerNodeParallelOpsGet(target.Context, target.Target);
- }
-
- internal static void DataStreamerPerNodeParallelOperationsSet(IUnmanagedTarget target, int val)
- {
- DataStreamerPerNodeParallelOpsSet(target.Context, target.Target, val);
- }
-
- #endregion
-
- #region NATIVE METHODS: MESSAGING
-
- internal static IUnmanagedTarget MessagingWithASync(IUnmanagedTarget target)
- {
- void* res = MessagingWithAsync(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- #endregion
-
- #region NATIVE METHODS: PROJECTION
-
- internal static IUnmanagedTarget ProjectionForOthers(IUnmanagedTarget target, IUnmanagedTarget prj)
- {
- void* res = PROJECTION_FOR_OTHERS(target.Context, target.Target, prj.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProjectionForRemotes(IUnmanagedTarget target)
- {
- void* res = PROJECTION_FOR_REMOTES(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProjectionForDaemons(IUnmanagedTarget target)
- {
- void* res = PROJECTION_FOR_DAEMONS(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProjectionForRandom(IUnmanagedTarget target)
- {
- void* res = PROJECTION_FOR_RANDOM(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProjectionForOldest(IUnmanagedTarget target)
- {
- void* res = PROJECTION_FOR_OLDEST(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static IUnmanagedTarget ProjectionForYoungest(IUnmanagedTarget target)
- {
- void* res = PROJECTION_FOR_YOUNGEST(target.Context, target.Target);
-
- return target.ChangeTarget(res);
- }
-
- internal static void ProjectionResetMetrics(IUnmanagedTarget target)
- {
- PROJECTION_RESET_METRICS(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget ProjectionOutOpRet(IUnmanagedTarget target, int type, long memPtr)
- {
- void* res = PROJECTION_OUT_OP_RET(target.Context, target.Target, type, memPtr);
-
- return target.ChangeTarget(res);
- }
-
- #endregion
-
- #region NATIVE METHODS: QUERY CURSOR
-
- internal static void QueryCursorIterator(IUnmanagedTarget target)
- {
- QryCursorIterator(target.Context, target.Target);
- }
-
- internal static void QueryCursorClose(IUnmanagedTarget target)
- {
- QryCursorClose(target.Context, target.Target);
- }
-
- #endregion
-
- #region NATIVE METHODS: TRANSACTIONS
-
- internal static long TransactionsStart(IUnmanagedTarget target, int concurrency, int isolation, long timeout, int txSize)
- {
- return TxStart(target.Context, target.Target, concurrency, isolation, timeout, txSize);
- }
-
- internal static int TransactionsCommit(IUnmanagedTarget target, long id)
- {
- return TxCommit(target.Context, target.Target, id);
- }
-
- internal static void TransactionsCommitAsync(IUnmanagedTarget target, long id, long futId)
- {
- TxCommitAsync(target.Context, target.Target, id, futId);
- }
-
- internal static int TransactionsRollback(IUnmanagedTarget target, long id)
- {
- return TxRollback(target.Context, target.Target, id);
- }
-
- internal static void TransactionsRollbackAsync(IUnmanagedTarget target, long id, long futId)
- {
- TxRollbackAsync(target.Context, target.Target, id, futId);
- }
-
- internal static int TransactionsClose(IUnmanagedTarget target, long id)
- {
- return TxClose(target.Context, target.Target, id);
- }
-
- internal static int TransactionsState(IUnmanagedTarget target, long id)
- {
- return TxState(target.Context, target.Target, id);
- }
-
- internal static bool TransactionsSetRollbackOnly(IUnmanagedTarget target, long id)
- {
- return TxSetRollbackOnly(target.Context, target.Target, id);
- }
-
- internal static void TransactionsResetMetrics(IUnmanagedTarget target)
- {
- TxResetMetrics(target.Context, target.Target);
- }
-
- #endregion
-
- #region NATIVE METHODS: MISCELANNEOUS
-
- internal static void Reallocate(long memPtr, int cap)
- {
- int res = REALLOCATE(memPtr, cap);
-
- if (res != 0)
- throw new IgniteException("Failed to reallocate external memory [ptr=" + memPtr +
- ", capacity=" + cap + ']');
- }
-
- internal static IUnmanagedTarget Acquire(UnmanagedContext ctx, void* target)
- {
- void* target0 = ACQUIRE(ctx.NativeContext, target);
-
- return new UnmanagedTarget(ctx, target0);
- }
-
- internal static void Release(IUnmanagedTarget target)
- {
- RELEASE(target.Target);
- }
-
- internal static void ThrowToJava(void* ctx, Exception e)
- {
- char* msgChars = (char*)IgniteUtils.StringToUtf8Unmanaged(e.Message);
-
- try
- {
- THROW_TO_JAVA(ctx, msgChars);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(msgChars));
- }
- }
-
-
-
- internal static int HandlersSize()
- {
- return HANDLERS_SIZE();
- }
-
- internal static void* CreateContext(void* opts, int optsLen, void* cbs)
- {
- return CREATE_CONTEXT(opts, optsLen, cbs);
- }
-
- internal static void DeleteContext(void* ctx)
- {
- DELETE_CONTEXT(ctx);
- }
-
- internal static void DestroyJvm(void* ctx)
- {
- DESTROY_JVM(ctx);
- }
-
- #endregion
-
- #region NATIVE METHODS: EVENTS
-
- internal static IUnmanagedTarget EventsWithAsync(IUnmanagedTarget target)
- {
- return target.ChangeTarget(EVENTS_WITH_ASYNC(target.Context, target.Target));
- }
-
- internal static bool EventsStopLocalListen(IUnmanagedTarget target, long handle)
- {
- return EVENTS_STOP_LOCAL_LISTEN(target.Context, target.Target, handle);
- }
-
- internal static bool EventsIsEnabled(IUnmanagedTarget target, int type)
- {
- return EVENTS_IS_ENABLED(target.Context, target.Target, type);
- }
-
- internal static void EventsLocalListen(IUnmanagedTarget target, long handle, int type)
- {
- EVENTS_LOCAL_LISTEN(target.Context, target.Target, handle, type);
- }
-
- #endregion
-
- #region NATIVE METHODS: SERVICES
-
- internal static IUnmanagedTarget ServicesWithAsync(IUnmanagedTarget target)
- {
- return target.ChangeTarget(SERVICES_WITH_ASYNC(target.Context, target.Target));
- }
-
- internal static IUnmanagedTarget ServicesWithServerKeepPortable(IUnmanagedTarget target)
- {
- return target.ChangeTarget(SERVICES_WITH_SERVER_KEEP_PORTABLE(target.Context, target.Target));
- }
-
- internal static void ServicesCancel(IUnmanagedTarget target, string name)
- {
- var nameChars = (char*)IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- SERVICES_CANCEL(target.Context, target.Target, nameChars);
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(nameChars));
- }
- }
-
- internal static void ServicesCancelAll(IUnmanagedTarget target)
- {
- SERVICES_CANCEL_ALL(target.Context, target.Target);
- }
-
- internal static IUnmanagedTarget ServicesGetServiceProxy(IUnmanagedTarget target, string name, bool sticky)
- {
- var nameChars = (char*)IgniteUtils.StringToUtf8Unmanaged(name);
-
- try
- {
- return target.ChangeTarget(
- SERVICES_GET_SERVICE_PROXY(target.Context, target.Target, nameChars, sticky));
- }
- finally
- {
- Marshal.FreeHGlobal(new IntPtr(nameChars));
- }
- }
-
- #endregion
-
- /// <summary>
- /// No-op initializer used to force type loading and static constructor call.
- /// </summary>
- internal static void Initialize()
- {
- // No-op.
- }
-
- /// <summary>
- /// Create delegate for the given procedure.
- /// </summary>
- /// <typeparam name="T">Delegate type.</typeparam>
- /// <param name="procName">Procedure name.</param>
- /// <returns></returns>
- private static T CreateDelegate<T>(string procName)
- {
- var procPtr = NativeMethods.GetProcAddress(Ptr, procName);
-
- if (procPtr == IntPtr.Zero)
- throw new IgniteException(string.Format("Unable to find native function: {0} (Error code: {1}). " +
- "Make sure that module.def is up to date",
- procName, Marshal.GetLastWin32Error()));
-
- return TypeCaster<T>.Cast(Marshal.GetDelegateForFunctionPointer(procPtr, typeof (T)));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/ILifecycleBean.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/ILifecycleBean.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/ILifecycleBean.cs
deleted file mode 100644
index 06cb523..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/ILifecycleBean.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Lifecycle
-{
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// A bean that reacts to Ignite lifecycle events defined in <see cref="LifecycleEventType"/>.
- /// Use this bean whenever you need to plug some custom logic before or after
- /// Ignite startup and stopping routines.
- /// <para />
- /// There are four events you can react to:
- /// <list type="bullet">
- /// <item>
- /// <term>BeforeNodeStart</term>
- /// <description>Invoked before Ignite startup routine is initiated. Note that Ignite
- /// is not available during this event, therefore if you injected an Ignite instance
- /// via <see cref="InstanceResourceAttribute"/> attribute, you cannot
- /// use it yet.</description>
- /// </item>
- /// <item>
- /// <term>AfterNodeStart</term>
- /// <description>Invoked right after Ignite has started. At this point, if you injected
- /// an Ignite instance via <see cref="InstanceResourceAttribute"/> attribute,
- /// you can start using it.</description>
- /// </item>
- /// <item>
- /// <term>BeforeNodeStop</term>
- /// <description>Invoked right before Ignite stop routine is initiated. Ignite is still
- /// available at this stage, so if you injected an Ignite instance via
- /// <see cref="InstanceResourceAttribute"/> attribute, you can use it.
- /// </description>
- /// </item>
- /// <item>
- /// <term>AfterNodeStop</term>
- /// <description>Invoked right after Ignite has stopped. Note that Ignite is not available
- /// during this event.</description>
- /// </item>
- /// </list>
- /// </summary>
- public interface ILifecycleBean
- {
- /// <summary>
- /// This method is called when lifecycle event occurs.
- /// </summary>
- /// <param name="evt">Lifecycle event.</param>
- void OnLifecycleEvent(LifecycleEventType evt);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/LifecycleEventType.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/LifecycleEventType.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/LifecycleEventType.cs
deleted file mode 100644
index beea555..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Lifecycle/LifecycleEventType.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Lifecycle
-{
- /// <summary>
- /// Ignite lifecycle event types. These events are used to notify lifecycle beans
- /// about changes in Ignite lifecycle state.
- /// <para />
- /// For more information and detailed examples refer to <see cref="ILifecycleBean"/>
- /// documentation.
- /// </summary>
- public enum LifecycleEventType
- {
- /// <summary>
- /// Invoked before node startup routine. Node is not initialized and cannot be used.
- /// </summary>
- BeforeNodeStart,
-
- /// <summary>
- /// Invoked after node startup is complete. Node is fully initialized and fully functional.
- /// </summary>
- AfterNodeStart,
-
- /// <summary>
- /// Invoked before node stopping routine. Node is fully functional at this point.
- /// </summary>
- BeforeNodeStop,
-
- /// <summary>
- /// Invoked after node had stopped. Node is stopped and cannot be used.
- /// </summary>
- AfterNodeStop
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessageFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessageFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessageFilter.cs
deleted file mode 100644
index 456c5e6..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessageFilter.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Messaging
-{
- using System;
-
- /// <summary>
- /// Represents messaging filter predicate.
- /// </summary>
- public interface IMessageFilter<in T>
- {
- /// <summary>
- /// Returns a value indicating whether provided message and node id satisfy this predicate.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="message">Message.</param>
- /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns>
- bool Invoke(Guid nodeId, T message);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessaging.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessaging.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessaging.cs
deleted file mode 100644
index 96f46b9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Messaging/IMessaging.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Messaging
-{
- using System;
- using System.Collections;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Provides functionality for topic-based message exchange among nodes defined by <see cref="IClusterGroup"/>.
- /// Users can send ordered and unordered messages to various topics. Note that same topic name
- /// cannot be reused between ordered and unordered messages.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IMessaging : IAsyncSupport<IMessaging>
- {
- /// <summary>
- /// Gets the cluster group to which this instance belongs.
- /// </summary>
- IClusterGroup ClusterGroup { get; }
-
- /// <summary>
- /// Sends a message with specified topic to the nodes in the underlying cluster group.
- /// </summary>
- /// <param name="message">Message to send.</param>
- /// <param name="topic">Topic to send to, null for default topic.</param>
- void Send(object message, object topic = null);
-
- /// <summary>
- /// Sends messages with specified topic to the nodes in the underlying cluster group.
- /// </summary>
- /// <param name="messages">Messages to send.</param>
- /// <param name="topic">Topic to send to, null for default topic.</param>
- void Send(IEnumerable messages, object topic = null);
-
- /// <summary>
- /// Sends a message with specified topic to the nodes in the underlying cluster group.
- /// Messages sent with this method will arrive in the same order they were sent. Note that if a topic is used
- /// for ordered messages, then it cannot be reused for non-ordered messages.
- /// </summary>
- /// <param name="message">Message to send.</param>
- /// <param name="topic">Topic to send to, null for default topic.</param>
- /// <param name="timeout">
- /// Message timeout, null for for default value from configuration (IgniteConfiguration.getNetworkTimeout).
- /// </param>
- void SendOrdered(object message, object topic = null, TimeSpan? timeout = null);
-
- /// <summary>
- /// Adds local listener for given topic on local node only. This listener will be notified whenever any
- /// node within the cluster group will send a message for a given topic to this node. Local listen
- /// subscription will happen regardless of whether local node belongs to this cluster group or not.
- /// </summary>
- /// <param name="filter">
- /// Predicate that is called on each received message. If predicate returns false,
- /// then it will be unsubscribed from any further notifications.
- /// </param>
- /// <param name="topic">Topic to subscribe to.</param>
- void LocalListen<T>(IMessageFilter<T> filter, object topic = null);
-
- /// <summary>
- /// Unregisters local listener for given topic on local node only.
- /// </summary>
- /// <param name="filter">Listener predicate.</param>
- /// <param name="topic">Topic to unsubscribe from.</param>
- void StopLocalListen<T>(IMessageFilter<T> filter, object topic = null);
-
- /// <summary>
- /// Adds a message listener for a given topic to all nodes in the cluster group (possibly including
- /// this node if it belongs to the cluster group as well). This means that any node within this cluster
- /// group can send a message for a given topic and all nodes within the cluster group will receive
- /// listener notifications.
- /// </summary>
- /// <param name="filter">Listener predicate.</param>
- /// <param name="topic">Topic to unsubscribe from.</param>
- /// <returns>
- /// Operation ID that can be passed to <see cref="StopRemoteListen"/> method to stop listening.
- /// </returns>
- [AsyncSupported]
- Guid RemoteListen<T>(IMessageFilter<T> filter, object topic = null);
-
- /// <summary>
- /// Unregisters all listeners identified with provided operation ID on all nodes in the cluster group.
- /// </summary>
- /// <param name="opId">Operation ID that was returned from <see cref="RemoteListen{T}"/> method.</param>
- [AsyncSupported]
- void StopRemoteListen(Guid opId);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableBuilder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableBuilder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableBuilder.cs
deleted file mode 100644
index 4f65840..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableBuilder.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Portable object builder. Provides ability to build portable objects dynamically
- /// without having class definitions.
- /// <para />
- /// Note that type ID is required in order to build portable object. Usually it is
- /// enough to provide a simple type name and Ignite will generate the type ID
- /// automatically.
- /// </summary>
- public interface IPortableBuilder
- {
- /// <summary>
- /// Get object field value. If value is another portable object, then
- /// builder for this object will be returned. If value is a container
- /// for other objects (array, ICollection, IDictionary), then container
- /// will be returned with primitive types in deserialized form and
- /// portable objects as builders. Any change in builder or collection
- /// returned through this method will be reflected in the resulting
- /// portable object after build.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Field value.</returns>
- T GetField<T>(string fieldName);
-
- /// <summary>
- /// Set object field value. Value can be of any type including other
- /// <see cref="IPortableObject"/> and other builders.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Field value.</param>
- /// <returns>Current builder instance.</returns>
- IPortableBuilder SetField<T>(string fieldName, T val);
-
- /// <summary>
- /// Remove object field.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Current builder instance.</returns>
- IPortableBuilder RemoveField(string fieldName);
-
- /// <summary>
- /// Set explicit hash code. If builder creating object from scratch,
- /// then hash code initially set to 0. If builder is created from
- /// exising portable object, then hash code of that object is used
- /// as initial value.
- /// </summary>
- /// <param name="hashCode">Hash code.</param>
- /// <returns>Current builder instance.</returns>
- IPortableBuilder SetHashCode(int hashCode);
-
- /// <summary>
- /// Build the object.
- /// </summary>
- /// <returns>Resulting portable object.</returns>
- IPortableObject Build();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableIdMapper.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableIdMapper.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableIdMapper.cs
deleted file mode 100644
index 0c18eb9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableIdMapper.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Maps class name and class field names to integer identifiers.
- /// </summary>
- public interface IPortableIdMapper
- {
- /// <summary>
- /// Gets type ID for the given type.
- /// </summary>
- /// <param name="typeName">Full type name.</param>
- /// <returns>ID of the class or 0 in case hash code is to be used.</returns>
- int GetTypeId(string typeName);
-
- /// <summary>
- /// Gets field ID for the given field of the given class.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <param name="fieldName">Field name.</param>
- /// <returns>ID of the field or null in case hash code is to be used.</returns>
- int GetFieldId(int typeId, string fieldName);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMarshalAware.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMarshalAware.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMarshalAware.cs
deleted file mode 100644
index 2795db4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMarshalAware.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Interface to implement custom portable serialization logic.
- /// </summary>
- public interface IPortableMarshalAware
- {
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <exception cref="System.IO.IOException">If write failed.</exception>
- void WritePortable(IPortableWriter writer);
-
- /// <summary>
- /// Reads this object from the given reader.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <exception cref="System.IO.IOException">If read failed.</exception>
- void ReadPortable(IPortableReader reader);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMetadata.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMetadata.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMetadata.cs
deleted file mode 100644
index 5bfa340..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableMetadata.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Portable type metadata.
- /// </summary>
- public interface IPortableMetadata
- {
- /// <summary>
- /// Gets type name.
- /// </summary>
- /// <returns>Type name.</returns>
- string TypeName { get; }
-
- /// <summary>
- /// Gets field names for that type.
- /// </summary>
- /// <returns>Field names.</returns>
- ICollection<string> Fields { get; }
-
- /// <summary>
- /// Gets field type for the given field name.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Field type.</returns>
- string GetFieldTypeName(string fieldName);
-
- /// <summary>
- /// Gets optional affinity key field name.
- /// </summary>
- /// <returns>Affinity key field name or null in case it is not provided.</returns>
- string AffinityKeyFieldName { get; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableNameMapper.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableNameMapper.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableNameMapper.cs
deleted file mode 100644
index 96a9d38..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableNameMapper.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Maps type and field names to different names.
- /// </summary>
- public interface IPortableNameMapper
- {
- /// <summary>
- /// Gets the type name.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <returns>Type name.</returns>
- string GetTypeName(string name);
-
- /// <summary>
- /// Gets the field name.
- /// </summary>
- /// <param name="name">The name.</param>
- /// <returns>Field name.</returns>
- string GetFieldName(string name);
- }
-}
[12/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServices.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServices.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServices.cs
deleted file mode 100644
index fff25c3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServices.cs
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Defines functionality to deploy distributed services in the Ignite.
- /// </summary>
- public interface IServices : IAsyncSupport<IServices>
- {
- /// <summary>
- /// Gets the cluster group to which this instance belongs.
- /// </summary>
- /// <value>
- /// The cluster group to which this instance belongs.
- /// </value>
- IClusterGroup ClusterGroup { get; }
-
- /// <summary>
- /// Deploys a cluster-wide singleton service. Ignite guarantees that there is always
- /// one instance of the service in the cluster. In case if Ignite node on which the service
- /// was deployed crashes or stops, Ignite will automatically redeploy it on another node.
- /// However, if the node on which the service is deployed remains in topology, then the
- /// service will always be deployed on that node only, regardless of topology changes.
- /// <para />
- /// Note that in case of topology changes, due to network delays, there may be a temporary situation
- /// when a singleton service instance will be active on more than one node (e.g. crash detection delay).
- /// </summary>
- /// <param name="name">Service name.</param>
- /// <param name="service">Service instance.</param>
- [AsyncSupported]
- void DeployClusterSingleton(string name, IService service);
-
- /// <summary>
- /// Deploys a per-node singleton service. Ignite guarantees that there is always
- /// one instance of the service running on each node. Whenever new nodes are started
- /// within the underlying cluster group, Ignite will automatically deploy one instance of
- /// the service on every new node.
- /// </summary>
- /// <param name="name">Service name.</param>
- /// <param name="service">Service instance.</param>
- [AsyncSupported]
- void DeployNodeSingleton(string name, IService service);
-
- /// <summary>
- /// Deploys one instance of this service on the primary node for a given affinity key.
- /// Whenever topology changes and primary node assignment changes, Ignite will always
- /// make sure that the service is undeployed on the previous primary node and deployed
- /// on the new primary node.
- /// <para />
- /// Note that in case of topology changes, due to network delays, there may be a temporary situation
- /// when a service instance will be active on more than one node (e.g. crash detection delay).
- /// </summary>
- /// <param name="name">Service name.</param>
- /// <param name="service">Service instance.</param>
- /// <param name="cacheName">Name of the cache on which affinity for key should be calculated, null for
- /// default cache.</param>
- /// <param name="affinityKey">Affinity cache key.</param>
- [AsyncSupported]
- void DeployKeyAffinitySingleton<TK>(string name, IService service, string cacheName, TK affinityKey);
-
- /// <summary>
- /// Deploys multiple instances of the service on the grid. Ignite will deploy a
- /// maximum amount of services equal to <paramref name="totalCount" /> parameter making sure that
- /// there are no more than <paramref name="maxPerNodeCount" /> service instances running
- /// on each node. Whenever topology changes, Ignite will automatically rebalance
- /// the deployed services within cluster to make sure that each node will end up with
- /// about equal number of deployed instances whenever possible.
- /// </summary>
- /// <param name="name">Service name.</param>
- /// <param name="service">Service instance.</param>
- /// <param name="totalCount">Maximum number of deployed services in the grid, 0 for unlimited.</param>
- /// <param name="maxPerNodeCount">Maximum number of deployed services on each node, 0 for unlimited.</param>
- [AsyncSupported]
- void DeployMultiple(string name, IService service, int totalCount, int maxPerNodeCount);
-
- /// <summary>
- /// Deploys instances of the service in the Ignite according to provided configuration.
- /// </summary>
- /// <param name="configuration">Service configuration.</param>
- [AsyncSupported]
- void Deploy(ServiceConfiguration configuration);
-
- /// <summary>
- /// Cancels service deployment. If a service with specified name was deployed on the grid,
- /// then <see cref="IService.Cancel"/> method will be called on it.
- /// <para/>
- /// Note that Ignite cannot guarantee that the service exits from <see cref="IService.Execute"/>
- /// method whenever <see cref="IService.Cancel"/> is called. It is up to the user to
- /// make sure that the service code properly reacts to cancellations.
- /// </summary>
- /// <param name="name">Name of the service to cancel.</param>
- [AsyncSupported]
- void Cancel(string name);
-
- /// <summary>
- /// Cancels all deployed services.
- /// <para/>
- /// Note that depending on user logic, it may still take extra time for a service to
- /// finish execution, even after it was cancelled.
- /// </summary>
- [AsyncSupported]
- void CancelAll();
-
- /// <summary>
- /// Gets metadata about all deployed services.
- /// </summary>
- /// <returns>Metadata about all deployed services.</returns>
- ICollection<IServiceDescriptor> GetServiceDescriptors();
-
- /// <summary>
- /// Gets deployed service with specified name.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="name">Service name.</param>
- /// <returns>Deployed service with specified name.</returns>
- T GetService<T>(string name);
-
- /// <summary>
- /// Gets all deployed services with specified name.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="name">Service name.</param>
- /// <returns>All deployed services with specified name.</returns>
- ICollection<T> GetServices<T>(string name);
-
- /// <summary>
- /// Gets a remote handle on the service. If service is available locally,
- /// then local instance is returned, otherwise, a remote proxy is dynamically
- /// created and provided for the specified service.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="name">Service name.</param>
- /// <returns>Either proxy over remote service or local service if it is deployed locally.</returns>
- T GetServiceProxy<T>(string name) where T : class;
-
- /// <summary>
- /// Gets a remote handle on the service. If service is available locally,
- /// then local instance is returned, otherwise, a remote proxy is dynamically
- /// created and provided for the specified service.
- /// </summary>
- /// <typeparam name="T">Service type.</typeparam>
- /// <param name="name">Service name.</param>
- /// <param name="sticky">Whether or not Ignite should always contact the same remote
- /// service or try to load-balance between services.</param>
- /// <returns>Either proxy over remote service or local service if it is deployed locally.</returns>
- T GetServiceProxy<T>(string name, bool sticky) where T : class;
-
- /// <summary>
- /// Returns an instance with portable mode enabled.
- /// Service method results will be kept in portable form.
- /// </summary>
- /// <returns>Instance with portable mode enabled.</returns>
- IServices WithKeepPortable();
-
- /// <summary>
- /// Returns an instance with server-side portable mode enabled.
- /// Service method arguments will be kept in portable form.
- /// </summary>
- /// <returns>Instance with server-side portable mode enabled.</returns>
- IServices WithServerKeepPortable();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceConfiguration.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceConfiguration.cs
deleted file mode 100644
index e91656f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceConfiguration.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- using Apache.Ignite.Core.Cluster;
-
- /// <summary>
- /// Service configuration.
- /// </summary>
- public class ServiceConfiguration
- {
- /// <summary>
- /// Gets or sets the service name.
- /// </summary>
- public string Name { get; set; }
-
- /// <summary>
- /// Gets or sets the service instance.
- /// </summary>
- public IService Service { get; set; }
-
- /// <summary>
- /// Gets or sets the total number of deployed service instances in the cluster, 0 for unlimited.
- /// </summary>
- public int TotalCount { get; set; }
-
- /// <summary>
- /// Gets or sets maximum number of deployed service instances on each node, 0 for unlimited.
- /// </summary>
- public int MaxPerNodeCount { get; set; }
-
- /// <summary>
- /// Gets or sets cache name used for key-to-node affinity calculation.
- /// </summary>
- public string CacheName { get; set; }
-
- /// <summary>
- /// Gets or sets affinity key used for key-to-node affinity calculation.
- /// </summary>
- public object AffinityKey { get; set; }
-
- /// <summary>
- /// Gets or sets node filter used to filter nodes on which the service will be deployed.
- /// </summary>
- public IClusterNodeFilter NodeFilter { get; set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs
deleted file mode 100644
index fe83cbc..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/ServiceInvocationException.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Indicates an error during Grid Services invocation.
- /// </summary>
- [Serializable]
- public class ServiceInvocationException : IgniteException
- {
- /** Serializer key. */
- private const string KeyPortableCause = "PortableCause";
-
- /** Cause. */
- private readonly IPortableObject _portableCause;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class.
- /// </summary>
- public ServiceInvocationException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ServiceInvocationException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ServiceInvocationException(string message, Exception cause) : base(message, cause)
- {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceInvocationException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="portableCause">The portable cause.</param>
- public ServiceInvocationException(string message, IPortableObject portableCause)
- :base(message)
- {
- _portableCause = portableCause;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ServiceInvocationException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- _portableCause = (IPortableObject) info.GetValue(KeyPortableCause, typeof (IPortableObject));
- }
-
- /// <summary>
- /// Gets the portable cause.
- /// </summary>
- public IPortableObject PortableCause
- {
- get { return _portableCause; }
- }
-
- /** <inheritdoc /> */
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue(KeyPortableCause, _portableCause);
-
- base.GetObjectData(info, context);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransaction.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransaction.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransaction.cs
deleted file mode 100644
index e85d577..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransaction.cs
+++ /dev/null
@@ -1,230 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Grid cache transaction.
- /// <para />
- /// Cache transactions support the following isolation levels:
- /// <list type="bullet">
- /// <item>
- /// <description><see cref="TransactionIsolation.ReadCommitted"/> isolation level
- /// means that always a committed value will be provided for read operations. With this isolation
- /// level values are always read from cache global memory or persistent store every time a value
- /// is accessed. In other words, if the same key is accessed more than once within the same transaction,
- /// it may have different value every time since global cache memory may be updated concurrently by
- /// other threads.</description>
- /// </item>
- /// <item>
- /// <description><see cref="TransactionIsolation.RepeatableRead"/> isolation level
- /// means that if a value was read once within transaction, then all consecutive reads will provide
- /// the same in-transaction value. With this isolation level accessed values are stored within
- /// in-transaction memory, so consecutive access to the same key within the same transaction will always
- /// return the value that was previously read or updated within this transaction. If concurrency is
- /// <see cref="TransactionConcurrency.Pessimistic"/>, then a lock on the key will be
- /// acquired prior to accessing the value.</description>
- /// </item>
- /// <item>
- /// <description><see cref="TransactionIsolation.Serializable"/> isolation level means
- /// that all transactions occur in a completely isolated fashion, as if all transactions in the system
- /// had executed serially, one after the other. Read access with this level happens the same way as with
- /// <see cref="TransactionIsolation.RepeatableRead"/> level. However, in
- /// <see cref="TransactionConcurrency.Optimistic"/> mode, if some transactions cannot be
- /// serially isolated from each other, then one winner will be picked and the other transactions in
- /// conflict will result in <c>TransactionOptimisticException</c> being thrown on Java side.</description>
- /// </item>
- /// </list>
- /// Cache transactions support the following concurrency models:
- /// <list type="bullet">
- /// <item>
- /// <description><see cref="TransactionConcurrency.Optimistic"/> - in this mode all cache
- /// operations
- /// are not distributed to other nodes until <see cref="ITransaction.Commit()"/>.
- /// In this mode one <c>PREPARE</c> message will
- /// be sent to participating cache nodes to start acquiring per-transaction locks, and once all nodes
- /// reply <c>OK</c> (i.e. <c>Phase 1</c> completes successfully), a one-way <c>COMMIT</c> message is sent
- /// without waiting for reply. If it is necessary to know whenever remote nodes have committed as well,
- /// synchronous commit or synchronous rollback should be enabled via
- /// <c>CacheConfiguration.setWriteSynchronizationMode</c>.
- /// <para />
- /// Note that in this mode, optimistic failures are only possible in conjunction with
- /// <see cref="TransactionIsolation.Serializable"/> isolation level. In all other cases,
- /// optimistic transactions will never fail optimistically and will always be identically ordered on all
- /// participating Ignite nodes.</description>
- /// </item>
- /// <item>
- /// <description><see cref="TransactionConcurrency.Pessimistic"/> - in this mode a lock is
- /// acquired on all cache operations with exception of read operations in
- /// <see cref="TransactionIsolation.ReadCommitted"/> mode. All optional filters passed
- /// into cache operations will be evaluated after successful lock acquisition. Whenever
- /// <see cref="ITransaction.Commit()"/> is called, a single one-way <c>COMMIT</c>
- /// message is sent to participating cache nodes without waiting for reply. Note that there is no reason
- /// for distributed <c>PREPARE</c> step, as all locks have been already acquired. Just like with
- /// optimistic mode, it is possible to configure synchronous commit or rollback and wait till
- /// transaction commits on all participating remote nodes.</description>
- /// </item>
- /// </list>
- /// <para />
- /// In addition to standard <c>CacheAtomicityMode.TRANSACTIONAL</c> behavior, Ignite also supports
- /// a lighter <c>CacheAtomicityMode.ATOMIC</c> mode as well. In this mode distributed transactions
- /// and distributed locking are not supported. Disabling transactions and locking allows to achieve much higher
- /// performance and throughput ratios. It is recommended that <c>CacheAtomicityMode.TRANSACTIONAL</c> mode
- /// is used whenever full <c>ACID</c>-compliant transactions are not needed.
- /// <example>
- /// You can use cache transactions as follows:
- /// <code>
- /// ICacheTx tx = cache.TxStart();
- ///
- /// try
- /// {
- /// int v1 = cache<string, int>.Get("k1");
- ///
- /// // Check if v1 satisfies some condition before doing a put.
- /// if (v1 > 0)
- /// cache.Put<string, int>("k1", 2);
- ///
- /// cache.Removex("k2);
- ///
- /// // Commit the transaction.
- /// tx.Commit();
- /// }
- /// finally
- /// {
- /// tx.Dispose();
- /// }
- ///
- /// </code>
- /// </example>
- /// </summary>
- public interface ITransaction : IDisposable, IAsyncSupport<ITransaction>
- {
- /// <summary>
- /// ID of the node on which this transaction started.
- /// </summary>
- /// <value>
- /// Originating node ID.
- /// </value>
- Guid NodeId { get; }
-
- /// <summary>
- /// ID of the thread in which this transaction started.
- /// </summary>
- long ThreadId
- {
- get;
- }
-
- /// <summary>
- /// Start time of this transaction on this node.
- /// </summary>
- DateTime StartTime
- {
- get;
- }
-
- /// <summary>
- /// Transaction isolation level.
- /// </summary>
- TransactionIsolation Isolation
- {
- get;
- }
-
- /// <summary>
- /// Transaction concurrency mode.
- /// </summary>
- TransactionConcurrency Concurrency
- {
- get;
- }
-
- /// <summary>
- /// Current transaction state.
- /// </summary>
- TransactionState State
- {
- get;
- }
-
- /// <summary>
- /// Timeout value in milliseconds for this transaction. If transaction times
- /// out prior to it's completion, an exception will be thrown.
- /// </summary>
- TimeSpan Timeout
- {
- get;
- }
-
- /// <summary>
- /// Gets a value indicating whether this transaction was marked as rollback-only.
- /// </summary>
- bool IsRollbackOnly
- {
- get;
- }
-
- /// <summary>
- /// Modify the transaction associated with the current thread such that the
- /// only possible outcome of the transaction is to roll back the transaction.
- /// </summary>
- /// <returns>
- /// True if rollback-only flag was set as a result of this operation,
- /// false if it was already set prior to this call or could not be set
- /// because transaction is already finishing up committing or rolling back.
- /// </returns>
- bool SetRollbackonly();
-
- /// <summary>
- /// Commits this transaction.
- /// </summary>
- [AsyncSupported]
- void Commit();
-
- /// <summary>
- /// Rolls back this transaction.
- /// </summary>
- [AsyncSupported]
- void Rollback();
-
- /// <summary>
- /// Adds a new metadata.
- /// </summary>
- /// <param name="name">Metadata name.</param>
- /// <param name="val">Metadata value.</param>
- void AddMeta<TV>(string name, TV val);
-
- /// <summary>
- /// Gets metadata by name.
- /// </summary>
- /// <param name="name">Metadata name.</param>
- /// <returns>Metadata value.</returns>
- /// <exception cref="KeyNotFoundException">If metadata key was not found.</exception>
- TV Meta<TV>(string name);
-
- /// <summary>
- /// Removes metadata by name.
- /// </summary>
- /// <param name="name">Metadata name.</param>
- /// <returns>Value of removed metadata or default value for <code>V</code> type.</returns>
- TV RemoveMeta<TV>(string name);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactionMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactionMetrics.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactionMetrics.cs
deleted file mode 100644
index 565dd34..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactionMetrics.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
-
- /// <summary>
- /// Transaction metrics, shared across all caches.
- /// </summary>
- public interface ITransactionMetrics
- {
- /// <summary>
- /// Gets the last time transaction was committed.
- /// </summary>
- DateTime CommitTime { get; }
-
- /// <summary>
- /// Gets the last time transaction was rolled back.
- /// </summary>
- DateTime RollbackTime { get; }
-
- /// <summary>
- /// Gets the total number of transaction commits.
- /// </summary>
- int TxCommits { get; }
-
- /// <summary>
- /// Gets the total number of transaction rollbacks.
- /// </summary>
- int TxRollbacks { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
deleted file mode 100644
index 83f12a5..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/ITransactions.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
-
- /// <summary>
- /// Transactions facade.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface ITransactions
- {
- /// <summary>
- /// Starts a transaction with default isolation, concurrency, timeout, and invalidation policy.
- /// All defaults are set in CacheConfiguration at startup.
- /// </summary>
- /// <returns>New transaction.</returns>
- ITransaction TxStart();
-
- /// <summary>
- /// Starts new transaction with the specified concurrency and isolation.
- /// </summary>
- /// <param name="concurrency">Concurrency.</param>
- /// <param name="isolation">Isolation.</param>
- /// <returns>New transaction.</returns>
- ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation);
-
- /// <summary>
- /// Starts new transaction with the specified concurrency and isolation.
- /// </summary>
- /// <param name="concurrency">Concurrency.</param>
- /// <param name="isolation">Isolation.</param>
- /// <param name="timeout">Timeout.</param>
- /// <param name="txSize">Number of entries participating in transaction (may be approximate).</param>
- /// <returns>New transaction.</returns>
- ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation,
- TimeSpan timeout, int txSize);
-
- /// <summary>
- /// Gets transaction started by this thread or null if this thread does not have a transaction.
- /// </summary>
- /// <value>
- /// Transaction started by this thread or null if this thread does not have a transaction.
- /// </value>
- ITransaction Tx { get; }
-
- /// <summary>
- /// Gets the metrics.
- /// </summary>
- ITransactionMetrics GetMetrics();
-
- /// <summary>
- /// Resets the metrics.
- /// </summary>
- void ResetMetrics();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionConcurrency.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionConcurrency.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionConcurrency.cs
deleted file mode 100644
index 4025607..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionConcurrency.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- /// <summary>
- /// Transaction concurrency control. See <see cref="ITransaction"/> for more
- /// information on transaction concurrency controls.
- /// </summary>
- public enum TransactionConcurrency
- {
- /// <summary>
- /// Optimistic concurrency control.
- /// </summary>
- Optimistic = 0,
-
- /// <summary>
- /// Pessimistic concurrency control.
- /// </summary>
- Pessimistic = 1
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionHeuristicException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionHeuristicException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionHeuristicException.cs
deleted file mode 100644
index cb46902..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionHeuristicException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Exception thrown whenever Ignite transaction enters an unknown state.
- /// This exception is usually thrown whenever commit partially succeeds.
- /// Cache will still resolve this situation automatically to ensure data
- /// integrity, by invalidating all values participating in this transaction
- /// on remote nodes.
- /// </summary>
- [Serializable]
- public class TransactionHeuristicException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionHeuristicException"/> class.
- /// </summary>
- public TransactionHeuristicException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionHeuristicException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public TransactionHeuristicException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionHeuristicException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected TransactionHeuristicException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionHeuristicException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public TransactionHeuristicException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionIsolation.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionIsolation.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionIsolation.cs
deleted file mode 100644
index 2a7723f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionIsolation.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- /// <summary>
- /// Defines different cache transaction isolation levels. See <see cref="ITransaction"/>
- /// documentation for more information about cache transaction isolation levels.
- /// </summary>
- public enum TransactionIsolation
- {
- /// <summary>
- /// Read committed isolation level.
- /// </summary>
- ReadCommitted = 0,
-
- /// <summary>
- /// Repeatable read isolation level.
- /// </summary>
- RepeatableRead = 1,
-
- /// <summary>
- /// Serializable isolation level.
- /// </summary>
- Serializable = 2
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionOptimisticException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionOptimisticException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionOptimisticException.cs
deleted file mode 100644
index 2b64370..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionOptimisticException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Exception thrown whenever Ignite transactions fail optimistically.
- /// </summary>
- [Serializable]
- public class TransactionOptimisticException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionOptimisticException"/> class.
- /// </summary>
- public TransactionOptimisticException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionOptimisticException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public TransactionOptimisticException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionOptimisticException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public TransactionOptimisticException(string message, Exception cause)
- : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionOptimisticException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected TransactionOptimisticException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionRollbackException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionRollbackException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionRollbackException.cs
deleted file mode 100644
index c1f25c8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionRollbackException.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Exception thrown whenever Ignite transactions has been automatically rolled back.
- /// </summary>
- [Serializable]
- public class TransactionRollbackException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionRollbackException"/> class.
- /// </summary>
- public TransactionRollbackException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionRollbackException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public TransactionRollbackException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionRollbackException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected TransactionRollbackException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionRollbackException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public TransactionRollbackException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionState.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionState.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionState.cs
deleted file mode 100644
index eecf72b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionState.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- /// <summary>
- /// Cache transaction state.
- /// </summary>
- public enum TransactionState
- {
- /// <summary>
- /// Transaction started.
- /// </summary>
- Active,
-
- /// <summary>
- /// Transaction validating.
- /// </summary>
- Preparing,
-
- /// <summary>
- /// Transaction validation succeeded.
- /// </summary>
- Prepared,
-
- /// <summary>
- /// Transaction is marked for rollback.
- /// </summary>
- MarkedRollback,
-
- /// <summary>
- /// Transaction commit started (validating finished).
- /// </summary>
- Committing,
-
- /// <summary>
- /// Transaction commit succeeded.
- /// </summary>
- Committed,
-
- /// <summary>
- /// Transaction rollback started (validation failed).
- /// </summary>
- RollingBack,
-
- /// <summary>
- /// Transaction rollback succeeded.
- /// </summary>
- RolledBack,
-
- /// <summary>
- /// Transaction rollback failed or is otherwise unknown state.
- /// </summary>
- Unknown
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionTimeoutException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionTimeoutException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionTimeoutException.cs
deleted file mode 100644
index f1e492a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Transactions/TransactionTimeoutException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Transactions
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Exception thrown whenever Ignite transactions time out.
- /// </summary>
- [Serializable]
- public class TransactionTimeoutException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionTimeoutException"/> class.
- /// </summary>
- public TransactionTimeoutException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public TransactionTimeoutException(string message)
- : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionTimeoutException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected TransactionTimeoutException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public TransactionTimeoutException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.sln
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.sln b/modules/platform/src/main/dotnet/Apache.Ignite.sln
deleted file mode 100644
index ebde1a8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.sln
+++ /dev/null
@@ -1,86 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core", "Apache.Ignite.Core\Apache.Ignite.Core.csproj", "{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core.Tests", "..\..\test\dotnet\Apache.Ignite.Core.Tests\Apache.Ignite.Core.Tests.csproj", "{6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\cpp\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core.Tests.TestDll", "..\..\test\dotnet\Apache.Ignite.Core.Tests.TestDll\Apache.Ignite.Core.Tests.TestDll.csproj", "{F4A69E2D-908E-4F0F-A794-84D508D60E5F}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite", "Apache.Ignite\Apache.Ignite.csproj", "{27F7F3C6-BDDE-43A9-B565-856F8395A04B}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Examples", "Examples\Apache.Ignite.Examples\Apache.Ignite.Examples.csproj", "{069FA680-3C4D-43A9-B84F-E67513B87827}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.ExamplesDll", "Examples\Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj", "{DFB08363-202E-412D-8812-349EF10A8702}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.ActiveCfg = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.Build.0 = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.ActiveCfg = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.Build.0 = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.ActiveCfg = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.Build.0 = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.ActiveCfg = Release|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.Build.0 = Release|x86
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Debug|x64.ActiveCfg = Debug|x64
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Debug|x64.Build.0 = Debug|x64
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Debug|x86.ActiveCfg = Debug|x86
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Debug|x86.Build.0 = Debug|x86
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Release|x64.ActiveCfg = Release|x64
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Release|x64.Build.0 = Release|x64
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Release|x86.ActiveCfg = Release|x86
- {6A62F66C-DA5B-4FBB-8CE7-A95F740FDC7A}.Release|x86.Build.0 = Release|x86
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.Build.0 = Release|Win32
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Debug|x64.ActiveCfg = Debug|x64
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Debug|x64.Build.0 = Debug|x64
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Debug|x86.ActiveCfg = Debug|x86
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Debug|x86.Build.0 = Debug|x86
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x64.ActiveCfg = Release|x64
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x64.Build.0 = Release|x64
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x86.ActiveCfg = Release|x86
- {F4A69E2D-908E-4F0F-A794-84D508D60E5F}.Release|x86.Build.0 = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.ActiveCfg = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.Build.0 = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.ActiveCfg = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.Build.0 = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.ActiveCfg = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.Build.0 = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.ActiveCfg = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.Build.0 = Release|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.ActiveCfg = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.Build.0 = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.ActiveCfg = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.Build.0 = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.ActiveCfg = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.Build.0 = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.ActiveCfg = Release|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.Build.0 = Release|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x64.ActiveCfg = Debug|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x64.Build.0 = Debug|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x86.ActiveCfg = Debug|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x86.Build.0 = Debug|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x64.ActiveCfg = Release|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x64.Build.0 = Release|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x86.ActiveCfg = Release|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.sln.DotSettings
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.sln.DotSettings b/modules/platform/src/main/dotnet/Apache.Ignite.sln.DotSettings
deleted file mode 100644
index 187a909..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.sln.DotSettings
+++ /dev/null
@@ -1,4 +0,0 @@
-<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
- <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
-
- <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean></wpf:ResourceDictionary>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.slnrel b/modules/platform/src/main/dotnet/Apache.Ignite.slnrel
deleted file mode 100644
index 0229623..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.slnrel
+++ /dev/null
@@ -1,43 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core", "Apache.Ignite.Core\Apache.Ignite.Core.csproj", "{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\cpp\src\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite", "Apache.Ignite\Apache.Ignite.csproj", "{27F7F3C6-BDDE-43A9-B565-856F8395A04B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|x64 = Release|x64
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.ActiveCfg = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.Build.0 = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.ActiveCfg = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.Build.0 = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.ActiveCfg = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.Build.0 = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.ActiveCfg = Release|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.Build.0 = Release|x86
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.Build.0 = Release|Win32
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.ActiveCfg = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.Build.0 = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.ActiveCfg = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.Build.0 = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.ActiveCfg = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.Build.0 = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.ActiveCfg = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj b/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj
deleted file mode 100644
index 7f6db3a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csproj
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{27F7F3C6-BDDE-43A9-B565-856F8395A04B}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite</RootNamespace>
- <AssemblyName>Apache.Ignite</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Release\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Core" />
- <Reference Include="System.ServiceProcess" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Config\AppSettingsConfigurator.cs" />
- <Compile Include="Config\ArgsConfigurator.cs" />
- <Compile Include="Config\ConfigValueParser.cs" />
- <Compile Include="Config\IConfigurator.cs" />
- <Compile Include="IgniteRunner.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Service\IgniteService.cs">
- <SubType>Component</SubType>
- </Compile>
- <Compile Include="Service\NativeMethods.cs" />
- <Compile Include="Service\ServiceDescription.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
- <Project>{4cd2f726-7e2b-46c4-a5ba-057bb82eecb6}</Project>
- <Name>Apache.Ignite.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PostBuildEvent>copy $(TargetPath) $(SolutionDir)..\..\test\dotnet\Apache.Ignite.Core.Tests\$(OutDir)
-copy $(TargetPath).config $(SolutionDir)..\..\test\dotnet\Apache.Ignite.Core.Tests\$(OutDir)</PostBuildEvent>
- </PropertyGroup>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csprojrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csprojrel b/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csprojrel
deleted file mode 100644
index 0883660..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Apache.Ignite.csprojrel
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{27F7F3C6-BDDE-43A9-B565-856F8395A04B}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite</RootNamespace>
- <AssemblyName>Apache.Ignite</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Release\</OutputPath>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Configuration" />
- <Reference Include="System.Core" />
- <Reference Include="System.ServiceProcess" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Config\AppSettingsConfigurator.cs" />
- <Compile Include="Config\ArgsConfigurator.cs" />
- <Compile Include="Config\ConfigValueParser.cs" />
- <Compile Include="Config\IConfigurator.cs" />
- <Compile Include="IgniteRunner.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Service\IgniteService.cs">
- <SubType>Component</SubType>
- </Compile>
- <Compile Include="Service\NativeMethods.cs" />
- <Compile Include="Service\ServiceDescription.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
- <Project>{4cd2f726-7e2b-46c4-a5ba-057bb82eecb6}</Project>
- <Name>Apache.Ignite.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <PropertyGroup>
- <PostBuildEvent>
- </PostBuildEvent>
- </PropertyGroup>
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/App.config
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/App.config b/modules/platform/src/main/dotnet/Apache.Ignite/App.config
deleted file mode 100644
index a9e8c39..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/App.config
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- 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.
--->
-
-
-<!--
- Apache Ignite .Net startup application configuration file.
--->
-
-<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
- </startup>
-
- <runtime>
- <gcServer enabled="true" />
- </runtime>
-
- <appSettings>
- <!-- Path to spring configuration file relative from IGNITE_HOME (if not provided "config/default-config.xml" is used) -->
- <!-- <add key="Ignite.SpringConfigUrl" value="my-config.xml"/> -->
-
- <!-- Absolute path to spring configuration file (if not provided "config/default-config.xml" is used) -->
- <!-- <add key="Ignite.SpringConfigUrl" value="C:\my-dir\my-config.xml"/> -->
-
- <!-- Path to Java library jvm.dll (if not provided JAVA_HOME environment variable is used to find jvm.dll) -->
- <!-- <add key="Ignite.JvmDllPath" value="C:\Program Files\Java\jdk1.7.0_45\jre\bin\server\jvm.dll"/> -->
-
- <!-- Additional classpath passed to JVM (enlist additional jar files here) -->
- <!-- <add key="Ignite.JvmClasspath" value="c:\my-dir\my-lib1.jar;c:\my-dir\my-lib2.jar"/> -->
-
- <!-- JVM Options passed to JVM -->
- <!-- <add key="Ignite.JvmOption.1" value="-Xmx512m"/> -->
- <!-- <add key="Ignite.JvmOption.2" value="-DIGNITE_QUIET=false"/> -->
-
- <!-- Additional .Net assemblies to be loaded on startup. -->
- <!-- <add key="Ignite.Assembly.1" value="System.Data.Linq,Culture=neutral,Version=1.0.0.0,PublicKeyToken=b77a5c561934e089"/> -->
- <!-- <add key="Ignite.Assembly.2" value="my-assembly.dll"/> -->
- </appSettings>
-
-</configuration>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
deleted file mode 100644
index b2e827e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Config/AppSettingsConfigurator.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Config
-{
- using System.Collections.Generic;
- using System.Collections.Specialized;
- using Apache.Ignite.Core;
-
- /// <summary>
- /// Configurator which uses application configuration.
- /// </summary>
- internal class AppSettingsConfigurator : IConfigurator<NameValueCollection>
- {
- /** Common configuration property prefix. */
- private static readonly string CfgPrefix = "Ignite.".ToLower();
-
- /** Configuration property: Ignite home. */
- private static readonly string CfgHome = "Home".ToLower();
-
- /** Configuration property: Spring config URL. */
- private static readonly string CfgSpringCfgUrl = "SpringConfigUrl".ToLower();
-
- /** Configuration property: Path to JVM dll. */
- private static readonly string CfgJvmDll = "JvmDll".ToLower();
-
- /** Configuration property: JVM classpath. */
- private static readonly string CfgJvmClasspath = "JvmClasspath".ToLower();
-
- /** Configuration property: suppress warnings flag. */
- private static readonly string CfgSuppressWarn = "SuppressWarnings".ToLower();
-
- /** Configuration property: JVM option prefix. */
- private static readonly string CfgJvmOptPrefix = "JvmOption".ToLower();
-
- /** Configuration property: assembly prefix. */
- private static readonly string CfgAssemblyPrefix = "Assembly".ToLower();
-
- /** Configuration property: JVM min memory. */
- private static readonly string CfgJvmMinMem = "JvmInitialMemoryMB".ToLower();
-
- /** Configuration property: JVM max memory. */
- private static readonly string CfgJvmMaxMem = "JvmMaxMemoryMB".ToLower();
-
- /** <inheritDoc /> */
- public void Configure(IgniteConfiguration cfg, NameValueCollection src)
- {
- var jvmOpts = new List<string>();
- var assemblies = new List<string>();
-
- foreach (string key in src.Keys)
- {
- var key0 = key.ToLower();
-
- if (key0.StartsWith(CfgPrefix))
- {
- key0 = key0.Substring(CfgPrefix.Length);
-
- var val = src[key];
-
- if (CfgHome.Equals(key0))
- cfg.IgniteHome = val;
- else if (CfgSpringCfgUrl.Equals(key0))
- cfg.SpringConfigUrl = val;
- else if (CfgJvmDll.Equals(key0))
- cfg.JvmDllPath = val;
- else if (CfgJvmClasspath.Equals(key0))
- cfg.JvmClasspath = val;
- else if (CfgSuppressWarn.Equals(key0))
- cfg.SuppressWarnings = val != null && bool.TrueString.ToLower().Equals(val.ToLower());
- else if (key0.StartsWith(CfgJvmOptPrefix))
- jvmOpts.Add(val);
- else if (key0.StartsWith(CfgAssemblyPrefix))
- assemblies.Add(val);
- else if (CfgJvmMinMem.Equals(key0))
- cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(val, key);
- else if (CfgJvmMaxMem.Equals(key0))
- cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(val, key);
- }
- }
-
- if (jvmOpts.Count > 0)
- {
- if (cfg.JvmOptions == null)
- cfg.JvmOptions = jvmOpts;
- else
- jvmOpts.ForEach(val => cfg.JvmOptions.Add(val));
- }
-
- if (assemblies.Count > 0)
- {
- if (cfg.Assemblies == null)
- cfg.Assemblies = assemblies;
- else
- assemblies.ForEach(val => cfg.Assemblies.Add(val));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
deleted file mode 100644
index b0651d7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ArgsConfigurator.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Config
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core;
-
- /// <summary>
- /// Configurator which uses arguments array.
- /// </summary>
- internal class ArgsConfigurator : IConfigurator<string[]>
- {
- /** Command line argument: Ignite home. */
- private static readonly string CmdIgniteHome = "-IgniteHome=".ToLower();
-
- /** Command line argument: Spring config URL. */
- private static readonly string CmdSpringCfgUrl = "-SpringConfigUrl=".ToLower();
-
- /** Command line argument: Path to JVM dll. */
- private static readonly string CmdJvmDll = "-JvmDll=".ToLower();
-
- /** Command line argument: JVM classpath. */
- private static readonly string CmdJvmClasspath = "-JvmClasspath=".ToLower();
-
- /** Command line argument: suppress warnings flag. */
- private static readonly string CmdSuppressWarn = "-SuppressWarnings=".ToLower();
-
- /** Command line argument: JVM option prefix. */
- private static readonly string CmdJvmOpt = "-J".ToLower();
-
- /** Command line argument: assembly. */
- private static readonly string CmdAssembly = "-Assembly=".ToLower();
-
- /** Command line argument: JvmInitialMemoryMB. */
- private static readonly string CmdJvmMinMem = "-JvmInitialMemoryMB=".ToLower();
-
- /** Command line argument: JvmMaxMemoryMB. */
- private static readonly string CmdJvmMaxMem = "-JvmMaxMemoryMB=".ToLower();
-
- /// <summary>
- /// Convert configuration to arguments.
- /// </summary>
- /// <param name="cfg"></param>
- /// <returns></returns>
- internal static string[] ToArgs(IgniteConfiguration cfg)
- {
- var args = new List<string>();
-
- if (cfg.IgniteHome != null)
- args.Add(CmdIgniteHome + cfg.IgniteHome);
-
- if (cfg.SpringConfigUrl != null)
- args.Add(CmdSpringCfgUrl + cfg.SpringConfigUrl);
-
- if (cfg.JvmDllPath != null)
- args.Add(CmdJvmDll + cfg.JvmDllPath);
-
- if (cfg.JvmClasspath != null)
- args.Add(CmdJvmClasspath + cfg.JvmClasspath);
-
- if (cfg.SuppressWarnings)
- args.Add(CmdSuppressWarn + bool.TrueString);
-
- if (cfg.JvmOptions != null)
- {
- foreach (var jvmOpt in cfg.JvmOptions)
- args.Add(CmdJvmOpt + jvmOpt);
- }
-
- if (cfg.Assemblies != null)
- {
- foreach (var assembly in cfg.Assemblies)
- args.Add(CmdAssembly + assembly);
- }
-
- args.Add(CmdJvmMinMem + cfg.JvmInitialMemoryMb);
- args.Add(CmdJvmMaxMem + cfg.JvmMaxMemoryMb);
-
- return args.ToArray();
- }
-
- /// <summary>
- /// Convert arguments to configuration.
- /// </summary>
- /// <param name="args">Arguments.</param>
- /// <returns>Configuration.</returns>
- internal static IgniteConfiguration FromArgs(string[] args)
- {
- var cfg = new IgniteConfiguration();
-
- new ArgsConfigurator().Configure(cfg, args);
-
- return cfg;
- }
-
- /** <inheritDoc /> */
- public void Configure(IgniteConfiguration cfg, string[] src)
- {
- var jvmOpts = new List<string>();
- var assemblies = new List<string>();
-
- foreach (var arg in src)
- {
- var argLow = arg.ToLower();
-
- if (argLow.StartsWith(CmdIgniteHome))
- cfg.IgniteHome = arg.Substring(CmdIgniteHome.Length);
- else if (argLow.StartsWith(CmdSpringCfgUrl))
- cfg.SpringConfigUrl = arg.Substring(CmdSpringCfgUrl.Length);
- else if (argLow.StartsWith(CmdJvmDll))
- cfg.JvmDllPath = arg.Substring(CmdJvmDll.Length);
- else if (argLow.StartsWith(CmdJvmClasspath))
- cfg.JvmClasspath = arg.Substring(CmdJvmClasspath.Length);
- else if (argLow.StartsWith(CmdSuppressWarn))
- {
- var val = arg.Substring(CmdSuppressWarn.Length);
-
- cfg.SuppressWarnings = bool.TrueString.ToLower().Equals(val.ToLower());
- }
- else if (argLow.StartsWith(CmdJvmMinMem))
- cfg.JvmInitialMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMinMem.Length),
- CmdJvmMinMem);
- else if (argLow.StartsWith(CmdJvmMaxMem))
- cfg.JvmMaxMemoryMb = ConfigValueParser.ParseInt(arg.Substring(CmdJvmMaxMem.Length),
- CmdJvmMaxMem);
- else if (argLow.StartsWith(CmdJvmOpt))
- jvmOpts.Add(arg.Substring(CmdJvmOpt.Length));
- else if (argLow.StartsWith(CmdAssembly))
- assemblies.Add(arg.Substring(CmdAssembly.Length));
- }
-
- if (jvmOpts.Count > 0)
- {
- if (cfg.JvmOptions == null)
- cfg.JvmOptions = jvmOpts;
- else
- jvmOpts.ForEach(val => cfg.JvmOptions.Add(val));
- }
-
- if (assemblies.Count > 0)
- {
- if (cfg.Assemblies == null)
- cfg.Assemblies = assemblies;
- else
- assemblies.ForEach(val => cfg.Assemblies.Add(val));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs
deleted file mode 100644
index 796b8e1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Config/ConfigValueParser.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Config
-{
- using System;
-
- /// <summary>
- /// Parses Ignite config values.
- /// </summary>
- internal class ConfigValueParser
- {
- /// <summary>
- /// Parses provided string to int. Throws a custom exception if failed.
- /// </summary>
- public static int ParseInt(string value, string propertyName)
- {
- int result;
-
- if (int.TryParse(value, out result))
- return result;
-
- throw new InvalidOperationException(
- string.Format("Failed to configure Ignite: property '{0}' has value '{1}', which is not an integer.",
- propertyName, value));
- }
- }
-}
[34/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreException.cs
deleted file mode 100644
index f5f398b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreException.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Store
-{
- using System;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Indicates an error during CacheStore operation.
- /// </summary>
- [Serializable]
- public class CacheStoreException : CacheException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheStoreException"/> class.
- /// </summary>
- public CacheStoreException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheStoreException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public CacheStoreException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheStoreException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public CacheStoreException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheStoreException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected CacheStoreException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
deleted file mode 100644
index 4660dab..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStore.cs
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Store
-{
- using System;
- using System.Collections;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// API for cache persistent storage for read-through and write-through behavior.
- ///
- /// Persistent store is configured in Ignite's Spring XML configuration file via
- /// <c>CacheConfiguration.setStore()</c> property. If you have an implementation
- /// of cache store in .NET, you should use special Java wrapper which accepts assembly name and
- /// class name of .NET store implementation (both properties are mandatory).
- ///
- /// Optionally, you may specify "properies" property to set any property values on an instance of your store.
- /// <example>
- /// Here is an example:
- /// <code>
- /// <bean class="org.apache.ignite.configuration.CacheConfiguration">
- /// ...
- /// <property name="cacheStoreFactory">
- /// <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- /// <property name="assemblyName" value="MyAssembly"/>
- /// <property name="className" value="MyApp.MyCacheStore"/>
- /// <property name="properties">
- /// <map>
- /// <entry key="IntProperty">
- /// <value type="java.lang.Integer">42</value>
- /// </entry>
- /// <entry key="StringProperty" value="String value"/>
- /// </map>
- /// </property>
- /// </bean>
- /// </property>
- /// ...
- /// </bean>
- /// </code>
- /// </example>
- /// Assemply name and class name are passed to <a target="_blank" href="http://msdn.microsoft.com/en-us/library/d133hta4.aspx"><b>System.Activator.CreateInstance(String, String)</b></a>
- /// method during node startup to create an instance of cache store. Refer to its documentation for details.
- /// <para/>
- /// All transactional operations of this API are provided with ongoing <see cref="ITransaction"/>,
- /// if any. You can attach any metadata to transaction, e.g. to recognize if several operations
- /// belong to the same transaction or not.
- /// <example>
- /// Here is an example of how attach a ODBC connection as transaction metadata:
- /// <code>
- /// OdbcConnection conn = tx.Meta("some.name");
- ///
- /// if (conn == null)
- /// {
- /// conn = ...; // Create or get connection.
- ///
- /// // Store connection in transaction metadata, so it can be accessed
- /// // for other operations on the same transaction.
- /// tx.AddMeta("some.name", conn);
- /// }
- /// </code>
- /// </example>
- /// </summary>
- public interface ICacheStore
- {
- /// <summary>
- /// Loads all values from underlying persistent storage. Note that keys are
- /// not passed, so it is up to implementation to figure out what to load.
- /// This method is called whenever <see cref="ICache{K,V}.LocalLoadCache"/>
- /// method is invoked which is usually to preload the cache from persistent storage.
- /// <para/>
- /// This method is optional, and cache implementation
- /// does not depend on this method to do anything.
- /// <para/>
- /// For every loaded value method provided action should be called.
- /// The action will then make sure that the loaded value is stored in cache.
- /// </summary>
- /// <param name="act">Action for loaded values.</param>
- /// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache"/> method.</param>
- /// <exception cref="CacheStoreException" />
- void LoadCache(Action<object, object> act, params object[] args);
-
- /// <summary>
- /// Loads an object. Application developers should implement this method to customize the loading
- /// of a value for a cache entry.
- /// This method is called by a cache when a requested entry is not in the cache.
- /// If the object can't be loaded <code>null</code> should be returned.
- /// </summary>
- /// <param name="key">The key identifying the object being loaded.</param>
- /// <returns>The value for the entry that is to be stored in the cache
- /// or <code>null</code> if the object can't be loaded</returns>
- /// <exception cref="CacheStoreException" />
- object Load(object key);
-
- /// <summary>
- /// Loads multiple objects. Application developers should implement this method to customize
- /// the loading of cache entries. This method is called when the requested object is not in the cache.
- /// If an object can't be loaded, it is not returned in the resulting map.
- /// </summary>
- /// <param name="keys">Keys identifying the values to be loaded.</param>
- /// <returns>A map of key, values to be stored in the cache.</returns>
- /// <exception cref="CacheStoreException" />
- IDictionary LoadAll(ICollection keys);
-
- /// <summary>
- /// Write the specified value under the specified key to the external resource.
- /// <para />
- /// This method is intended to support both key/value creation and value update.
- /// </summary>
- /// <param name="key">Key to write.</param>
- /// <param name="val">Value to write.</param>
- /// <exception cref="CacheStoreException" />
- void Write(object key, object val);
-
- /// <summary>
- /// Write the specified entries to the external resource.
- /// This method is intended to support both insert and update.
- /// <para />
- /// The order that individual writes occur is undefined.
- /// <para />
- /// If this operation fails (by throwing an exception) after a partial success,
- /// the writer must remove any successfully written entries from the entries collection
- /// so that the caching implementation knows what succeeded and can mutate the cache.
- /// </summary>
- /// <param name="entries">a mutable collection to write. Upon invocation, it contains the entries
- /// to write for write-through. Upon return the collection must only contain entries
- /// that were not successfully written. (see partial success above).</param>
- /// <exception cref="CacheStoreException" />
- void WriteAll(IDictionary entries);
-
- /// <summary>
- /// Delete the cache entry from the external resource.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method is invoked even if no mapping for the key exists.
- /// </summary>
- /// <param name="key">The key that is used for the delete operation.</param>
- /// <exception cref="CacheStoreException" />
- void Delete(object key);
-
- /// <summary>
- /// Remove data and keys from the external resource for the given collection of keys, if present.
- /// <para />
- /// The order that individual deletes occur is undefined.
- /// <para />
- /// If this operation fails (by throwing an exception) after a partial success,
- /// the writer must remove any successfully written entries from the entries collection
- /// so that the caching implementation knows what succeeded and can mutate the cache.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method may include keys even if there is no mapping for that key,
- /// in which case the data represented by that key should be removed from the underlying resource.
- /// </summary>
- /// <param name="keys">a mutable collection of keys for entries to delete. Upon invocation,
- /// it contains the keys to delete for write-through. Upon return the collection must only contain
- /// the keys that were not successfully deleted.</param>
- /// <exception cref="CacheStoreException" />
- void DeleteAll(ICollection keys);
-
- /// <summary>
- /// Tells store to commit or rollback a transaction depending on the value of the
- /// <c>commit</c> parameter.
- /// </summary>
- /// <param name="commit"><c>True</c> if transaction should commit, <c>false</c> for rollback.</param>
- /// <exception cref="CacheStoreException" />
- void SessionEnd(bool commit);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
deleted file mode 100644
index e20a660..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/ICacheStoreSession.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Store
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Session for the cache store operations. The main purpose of cache store session
- /// is to hold context between multiple store invocations whenever in transaction. For example,
- /// you can save current database connection in the session <see cref="Properties"/> map. You can then
- /// commit this connection in the <see cref="ICacheStore.SessionEnd(bool)"/> method.
- /// </summary>
- public interface ICacheStoreSession
- {
- /// <summary>
- /// Cache name for the current store operation. Note that if the same store
- /// is reused between different caches, then the cache name will change between
- /// different store operations.
- /// </summary>
- string CacheName { get; }
-
- /// <summary>
- /// Current session properties. You can add properties directly to the returned map.
- /// </summary>
- IDictionary<object, object> Properties { get; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterGroupEmptyException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterGroupEmptyException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterGroupEmptyException.cs
deleted file mode 100644
index 81e4a56..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterGroupEmptyException.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates an illegal call on empty projection. Thrown by projection when operation
- /// that requires at least one node is called on empty projection.
- /// </summary>
- [Serializable]
- public class ClusterGroupEmptyException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterGroupEmptyException"/> class.
- /// </summary>
- public ClusterGroupEmptyException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterGroupEmptyException"/> class.
- /// </summary>
- /// <param name="msg">Exception message.</param>
- public ClusterGroupEmptyException(string msg) : base(msg)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterGroupEmptyException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ClusterGroupEmptyException(string message, Exception cause)
- : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterGroupEmptyException"/> class.
- /// </summary>
- /// <param name="info">Serialization info.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ClusterGroupEmptyException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterTopologyException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterTopologyException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterTopologyException.cs
deleted file mode 100644
index ba30f51..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ClusterTopologyException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates an error with grid topology (e.g., crashed node, etc.)
- /// </summary>
- [Serializable]
- public class ClusterTopologyException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterTopologyException"/> class.
- /// </summary>
- public ClusterTopologyException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterTopologyException"/> class.
- /// </summary>
- /// <param name="msg">Exception message.</param>
- public ClusterTopologyException(string msg) : base(msg)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterTopologyException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ClusterTopologyException(string message, Exception cause)
- : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterTopologyException"/> class.
- /// </summary>
- /// <param name="info">Serialization info.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ClusterTopologyException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
deleted file mode 100644
index 02d9a78..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/ICluster.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Represents whole cluster (group of all nodes in a cluster).
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface ICluster : IClusterGroup
- {
- /// <summary>
- /// Gets monadic projection consisting from the local node.
- /// </summary>
- /// <returns>Monadic projection consisting from the local node.</returns>
- IClusterGroup ForLocal();
-
- /// <summary>
- /// Gets local Ignite node.
- /// </summary>
- /// <returns>Local Ignite node.</returns>
- IClusterNode GetLocalNode();
-
- /// <summary>
- /// Pings a remote node.
- /// </summary>
- /// <param name="nodeId">ID of a node to ping.</param>
- /// <returns>True if node for a given ID is alive, false otherwise.</returns>
- bool PingNode(Guid nodeId);
-
- /// <summary>
- /// Gets current topology version. In case of TCP discovery topology versions are sequential
- /// - they start from 1 and get incremented every time whenever a node joins or leaves.
- /// For other discovery SPIs topology versions may not be (and likely are not) sequential.
- /// </summary>
- /// <value>
- /// Current topology version.
- /// </value>
- long TopologyVersion { get; }
-
- /// <summary>
- /// Gets a topology by version. Returns null if topology history storage doesn't contain
- /// specified topology version (history currently keeps the last 1000 snapshots).
- /// </summary>
- /// <param name="ver">Topology version.</param>
- /// <returns>Collection of Ignite nodes which represented by specified topology version,
- /// if it is present in history storage, null otherwise.</returns>
- /// <exception cref="IgniteException">If underlying SPI implementation does not support
- /// topology history. Currently only <code>org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi</code>
- /// supports topology history.</exception>
- ICollection<IClusterNode> GetTopology(long ver);
-
- /// <summary>
- /// Resets local I/O, job, and task execution metrics.
- /// </summary>
- void ResetMetrics();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs
deleted file mode 100644
index 433ba40..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterGroup.cs
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Services;
-
- /// <summary>
- /// Defines grid projection which represents a common functionality over a group of nodes.
- /// Grid projection allows to group Ignite nodes into various subgroups to perform distributed
- /// operations on them. All ForXXX(...)' methods will create a child grid projection
- /// from existing projection. If you create a new projection from current one, then the resulting
- /// projection will include a subset of nodes from current projection. The following code snippet
- /// shows how to create grid projections:
- /// <code>
- /// var g = Ignition.GetIgnite();
- ///
- /// // Projection over remote nodes.
- /// var remoteNodes = g.ForRemotes();
- ///
- /// // Projection over random remote node.
- /// var randomNode = g.ForRandom();
- ///
- /// // Projection over all nodes with cache named "myCache" enabled.
- /// var cacheNodes = g.ForCacheNodes("myCache");
- ///
- /// // Projection over all nodes that have user attribute "group" set to value "worker".
- /// var workerNodes = g.ForAttribute("group", "worker");
- /// </code>
- /// Grid projection provides functionality for executing tasks and closures over
- /// nodes in this projection using <see cref="GetCompute"/>.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IClusterGroup
- {
- /// <summary>
- /// Instance of Ignite.
- /// </summary>
- IIgnite Ignite { get; }
-
- /// <summary>
- /// Gets compute functionality over this grid projection. All operations
- /// on the returned ICompute instance will only include nodes from
- /// this projection.
- /// </summary>
- /// <returns>Compute instance over this grid projection.</returns>
- ICompute GetCompute();
-
- /// <summary>
- /// Creates a grid projection over a given set of nodes.
- /// </summary>
- /// <param name="nodes">Collection of nodes to create a projection from.</param>
- /// <returns>Projection over provided Ignite nodes.</returns>
- IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes);
-
- /// <summary>
- /// Creates a grid projection over a given set of nodes.
- /// </summary>
- /// <param name="nodes">Collection of nodes to create a projection from.</param>
- /// <returns>Projection over provided Ignite nodes.</returns>
- IClusterGroup ForNodes(params IClusterNode[] nodes);
-
- /// <summary>
- /// Creates a grid projection over a given set of node IDs.
- /// </summary>
- /// <param name="ids">Collection of node IDs to create a projection from.</param>
- /// <returns>Projection over provided Ignite node IDs.</returns>
- IClusterGroup ForNodeIds(IEnumerable<Guid> ids);
-
- /// <summary>
- /// Creates a grid projection over a given set of node IDs.
- /// </summary>
- /// <param name="ids">Collection of node IDs to create a projection from.</param>
- /// <returns>Projection over provided Ignite node IDs.</returns>
- IClusterGroup ForNodeIds(params Guid[] ids);
-
- /// <summary>
- /// Creates a grid projection which includes all nodes that pass the given predicate filter.
- /// </summary>
- /// <param name="p">Predicate filter for nodes to include into this projection.</param>
- /// <returns>Grid projection for nodes that passed the predicate filter.</returns>
- IClusterGroup ForPredicate(Func<IClusterNode, bool> p);
-
- /// <summary>
- /// Creates projection for nodes containing given name and value
- /// specified in user attributes.
- /// </summary>
- /// <param name="name">Name of the attribute.</param>
- /// <param name="val">Optional attribute value to match.</param>
- /// <returns>Grid projection for nodes containing specified attribute.</returns>
- IClusterGroup ForAttribute(string name, string val);
-
- /// <summary>
- /// Creates projection for all nodes that have cache with specified name running.
- /// </summary>
- /// <param name="name">Cache name to include into projection.</param>
- /// <returns>Projection over nodes that have specified cache running.</returns>
- IClusterGroup ForCacheNodes(string name);
-
- /// <summary>
- /// Creates projection for all nodes that have cache with specified name running
- /// and cache distribution mode is PARTITIONED_ONLY or NEAR_PARTITIONED.
- /// </summary>
- /// <param name="name">Cache name to include into projection.</param>
- /// <returns>Projection over nodes that have specified cache running.</returns>
- IClusterGroup ForDataNodes(string name);
-
- /// <summary>
- /// Creates projection for all nodes that have cache with specified name running
- /// and cache distribution mode is CLIENT_ONLY or NEAR_ONLY.
- /// </summary>
- /// <param name="name">Cache name to include into projection.</param>
- /// <returns>Projection over nodes that have specified cache running.</returns>
- IClusterGroup ForClientNodes(string name);
-
- /// <summary>
- /// Gets grid projection consisting from the nodes in this projection excluding the local node.
- /// </summary>
- /// <returns>Grid projection consisting from the nodes in this projection excluding the local node.</returns>
- IClusterGroup ForRemotes();
-
- /// <summary>
- /// Gets grid projection consisting from the nodes in this projection residing on the
- /// same host as given node.
- /// </summary>
- /// <param name="node">Node residing on the host for which projection is created.</param>
- /// <returns>Projection for nodes residing on the same host as passed in node.</returns>
- IClusterGroup ForHost(IClusterNode node);
-
- /// <summary>
- /// Creates grid projection with one random node from current projection.
- /// </summary>
- /// <returns>Grid projection with one random node from current projection.</returns>
- IClusterGroup ForRandom();
-
- /// <summary>
- /// Creates grid projection with one oldest node in the current projection.
- /// The resulting projection is dynamic and will always pick the next oldest
- /// node if the previous one leaves topology even after the projection has
- /// been created.
- /// </summary>
- /// <returns>Grid projection with one oldest node from the current projection.</returns>
- IClusterGroup ForOldest();
-
- /// <summary>
- /// Creates grid projection with one youngest node in the current projection.
- /// The resulting projection is dynamic and will always pick the newest
- /// node in the topology, even if more nodes entered after the projection
- /// has been created.
- /// </summary>
- /// <returns>Grid projection with one youngest node from the current projection.</returns>
- IClusterGroup ForYoungest();
-
- /// <summary>
- /// Creates grid projection for nodes supporting .Net, i.e. for nodes started with Apache.Ignite.exe.
- /// </summary>
- /// <returns>Grid projection for nodes supporting .Net.</returns>
- IClusterGroup ForDotNet();
-
- /// <summary>
- /// Gets read-only collections of nodes in this projection.
- /// </summary>
- /// <returns>All nodes in this projection.</returns>
- ICollection<IClusterNode> GetNodes();
-
- /// <summary>
- /// Gets a node for given ID from this grid projection.
- /// </summary>
- /// <param name="id">Node ID.</param>
- /// <returns>Node with given ID from this projection or null if such node does not
- /// exist in this projection.</returns>
- IClusterNode GetNode(Guid id);
-
- /// <summary>
- /// Gets first node from the list of nodes in this projection.
- /// </summary>
- /// <returns>Node.</returns>
- IClusterNode GetNode();
-
- /// <summary>
- /// Gets a metrics snapshot for this projection
- /// </summary>
- /// <returns>Grid projection metrics snapshot.</returns>
- IClusterMetrics GetMetrics();
-
- /// <summary>
- /// Gets messaging facade over nodes within this cluster group. All operations on the returned
- /// <see cref="IMessaging"/>> instance will only include nodes from current cluster group.
- /// </summary>
- /// <returns>Messaging instance over this cluster group.</returns>
- IMessaging GetMessaging();
-
- /// <summary>
- /// Gets events facade over nodes within this cluster group. All operations on the returned
- /// <see cref="IEvents"/>> instance will only include nodes from current cluster group.
- /// </summary>
- /// <returns>Events instance over this cluster group.</returns>
- IEvents GetEvents();
-
- /// <summary>
- /// Gets services facade over nodes within this cluster group. All operations on the returned
- /// <see cref="IServices"/>> instance will only include nodes from current cluster group.
- /// </summary>
- /// <returns>Services instance over this cluster group.</returns>
- IServices GetServices();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
deleted file mode 100644
index 4ea690c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterMetrics.cs
+++ /dev/null
@@ -1,515 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
-
- /// <summary>
- /// Represents runtime information of a cluster. Apart from obvious
- /// statistical value, this information is used for implementation of
- /// load balancing, failover, and collision SPIs. For example, collision SPI
- /// in combination with fail-over SPI could check if other nodes don't have
- /// any active or waiting jobs and fail-over some jobs to those nodes.
- /// <para />
- /// Node metrics for any node can be accessed via <see cref="IClusterNode.GetMetrics"/>
- /// method. Keep in mind that there will be a certain network delay (usually
- /// equal to heartbeat delay) for the accuracy of node metrics. However, when accessing
- /// metrics on local node the metrics are always accurate and up to date.
- /// </summary>
- public interface IClusterMetrics
- {
- /// <summary>
- /// Last update time of this node metrics.
- /// </summary>
- DateTime LastUpdateTime
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of jobs that ever ran concurrently on this node.
- /// </summary>
- int MaximumActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of currently active jobs concurrently executing on the node.
- /// </summary>
- int CurrentActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of active jobs.
- /// </summary>
- float AverageActiveJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of waiting jobs.
- /// </summary>
- int MaximumWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of queued jobs currently waiting to be executed.
- /// </summary>
- int CurrentWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of waiting jobs.
- /// </summary>
- float AverageWaitingJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of jobs rejected at once.
- /// </summary>
- int MaximumRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of jobs rejected after more recent collision resolution operation.
- /// </summary>
- int CurrentRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of jobs this node rejects during collision resolution operations.
- /// </summary>
- float AverageRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs this node rejects during collision resolution operations since node startup.
- /// </summary>
- int TotalRejectedJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum number of cancelled jobs ever had running concurrently.
- /// </summary>
- int MaximumCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Number of cancelled jobs that are still running.
- /// </summary>
- int CurrentCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Average number of cancelled jobs.
- /// </summary>
- float AverageCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of cancelled jobs since node startup.
- /// </summary>
- int TotalCancelledJobs
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs handled by the node since node startup.
- /// </summary>
- int TotalExecutedJobs
- {
- get;
- }
-
- /// <summary>
- /// Maximum time a job ever spent waiting in a queue to be executed.
- /// </summary>
- long MaximumJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Current time an oldest jobs has spent waiting to be executed.
- /// </summary>
- long CurrentJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Average time jobs spend waiting in the queue to be executed.
- /// </summary>
- double AverageJobWaitTime
- {
- get;
- }
-
- /// <summary>
- /// Time it took to execute the longest job on the node.
- /// </summary>
- long MaximumJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Longest time a current job has been executing for.
- /// </summary>
- long CurrentJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Average job execution time.
- /// </summary>
- double AverageJobExecuteTime
- {
- get;
- }
-
- /// <summary>
- /// Total number of jobs handled by the node.
- /// </summary>
- int TotalExecutedTasks
- {
- get;
- }
-
- /// <summary>
- /// Total time this node spent executing jobs.
- /// </summary>
- long TotalBusyTime
- {
- get;
- }
-
- /// <summary>
- /// Total time this node spent idling.
- /// </summary>
- long TotalIdleTime
- {
- get;
- }
-
- /// <summary>
- /// Time this node spend idling since executing last job.
- /// </summary>
- long CurrentIdleTime
- {
- get;
- }
-
- /// <summary>
- /// Percentage of time this node is busy.
- /// </summary>
- float BusyTimePercentage
- {
- get;
- }
-
- /// <summary>
- /// Percentage of time this node is idle
- /// </summary>
- float IdleTimePercentage
- {
- get;
- }
-
- /// <summary>
- /// Returns the number of CPUs available to the Java Virtual Machine.
- /// </summary>
- int TotalCpus
- {
- get;
- }
-
- /// <summary>
- /// Returns the CPU usage usage in [0, 1] range.
- /// </summary>
- double CurrentCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Average of CPU load values in [0, 1] range over all metrics kept in the history.
- /// </summary>
- double AverageCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Average time spent in CG since the last update.
- /// </summary>
- double CurrentGcCpuLoad
- {
- get;
- }
-
- /// <summary>
- /// Amount of heap memory in bytes that the JVM
- /// initially requests from the operating system for memory management.
- /// This method returns <code>-1</code> if the initial memory size is undefined.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryInitialized
- {
- get;
- }
-
- /// <summary>
- /// Current heap size that is used for object allocation.
- /// The heap consists of one or more memory pools. This value is
- /// the sum of used heap memory values of all heap memory pools.
- /// <para />
- /// The amount of used memory in the returned is the amount of memory
- /// occupied by both live objects and garbage objects that have not
- /// been collected, if any.
- /// </summary>
- long HeapMemoryUsed
- {
- get;
- }
-
- /// <summary>
- /// Amount of heap memory in bytes that is committed for the JVM to use. This amount of memory is
- /// guaranteed for the JVM to use. The heap consists of one or more memory pools. This value is
- /// the sum of committed heap memory values of all heap memory pools.
- /// </summary>
- long HeapMemoryCommitted
- {
- get;
- }
-
- /// <summary>
- /// Mmaximum amount of heap memory in bytes that can be used for memory management.
- /// This method returns <code>-1</code> if the maximum memory size is undefined.
- /// <para />
- /// This amount of memory is not guaranteed to be available for memory management if
- /// it is greater than the amount of committed memory. The JVM may fail to allocate
- /// memory even if the amount of used memory does not exceed this maximum size.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryMaximum
- {
- get;
- }
-
- /// <summary>
- /// Total amount of heap memory in bytes. This method returns <code>-1</code>
- /// if the total memory size is undefined.
- /// <para />
- /// This amount of memory is not guaranteed to be available for memory management if it is
- /// greater than the amount of committed memory. The JVM may fail to allocate memory even
- /// if the amount of used memory does not exceed this maximum size.
- /// <para />
- /// This value represents a setting of the heap memory for Java VM and is
- /// not a sum of all initial heap values for all memory pools.
- /// </summary>
- long HeapMemoryTotal
- {
- get;
- }
-
- /// <summary>
- /// Amount of non-heap memory in bytes that the JVM initially requests from the operating
- /// system for memory management.
- /// </summary>
- long NonHeapMemoryInitialized
- {
- get;
- }
-
- /// <summary>
- /// Current non-heap memory size that is used by Java VM.
- /// </summary>
- long NonHeapMemoryUsed
- {
- get;
- }
-
- /// <summary>
- /// Amount of non-heap memory in bytes that is committed for the JVM to use.
- /// </summary>
- long NonHeapMemoryCommitted
- {
- get;
- }
-
- /// <summary>
- /// Maximum amount of non-heap memory in bytes that can be used for memory management.
- /// </summary>
- long NonHeapMemoryMaximum
- {
- get;
- }
-
- /// <summary>
- /// Total amount of non-heap memory in bytes that can be used for memory management.
- /// </summary>
- long NonHeapMemoryTotal
- {
- get;
- }
-
- /// <summary>
- /// Uptime of the JVM in milliseconds.
- /// </summary>
- long UpTime
- {
- get;
- }
-
- /// <summary>
- /// Start time of the JVM in milliseconds.
- /// </summary>
- DateTime StartTime
- {
- get;
- }
-
- /// <summary>
- /// Start time of the Ignite node in milliseconds.
- /// </summary>
- DateTime NodeStartTime
- {
- get;
- }
-
- /// <summary>
- /// Current number of live threads.
- /// </summary>
- int CurrentThreadCount
- {
- get;
- }
-
- /// <summary>
- /// The peak live thread count.
- /// </summary>
- int MaximumThreadCount
- {
- get;
- }
-
- /// <summary>
- /// The total number of threads started.
- /// </summary>
- long TotalStartedThreadCount
- {
- get;
- }
-
- /// <summary>
- /// Current number of live daemon threads.
- /// </summary>
- int CurrentDaemonThreadCount
- {
- get;
- }
-
- /// <summary>
- /// Ignite assigns incremental versions to all cache operations. This property provides
- /// the latest data version on the node.
- /// </summary>
- long LastDataVersion
- {
- get;
- }
-
- /// <summary>
- /// Sent messages count
- /// </summary>
- int SentMessagesCount
- {
- get;
- }
-
- /// <summary>
- /// Sent bytes count.
- /// </summary>
- long SentBytesCount
- {
- get;
- }
-
- /// <summary>
- /// Received messages count.
- /// </summary>
- int ReceivedMessagesCount
- {
- get;
- }
-
- /// <summary>
- /// Received bytes count.
- /// </summary>
- long ReceivedBytesCount
- {
- get;
- }
-
- /// <summary>
- /// Outbound messages queue size.
- /// </summary>
- int OutboundMessagesQueueSize
- {
- get;
- }
-
- /// <summary>
- /// Gets total number of nodes.
- /// </summary>
- int TotalNodes
- {
- get;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
deleted file mode 100644
index 11b4c4a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNode.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Interface representing a single cluster node. Use <see cref="GetAttribute{T}"/> or
- /// <see cref="GetMetrics"/> to get static and dynamic information about remote nodes.
- /// You can get a list of all nodes in grid by calling <see cref="IClusterGroup.GetNodes"/>
- /// on <see cref="IIgnite"/> instance.
- /// <para />
- /// You can use Ignite node attributes to provide static information about a node.
- /// This information is initialized once within grid, during node startup, and
- /// remains the same throughout the lifetime of a node.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IClusterNode
- {
- /// <summary>
- /// Globally unique node ID. A new ID is generated every time a node restarts.
- /// </summary>
- Guid Id { get; }
-
- /// <summary>
- /// Gets node's attribute. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <param name="name">Attribute name.</param>
- /// <returns>Attribute value.</returns>
- T GetAttribute<T>(string name);
-
- /// <summary>
- /// Try getting node's attribute. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <param name="name">Attribute name.</param>
- /// <param name="attr">Attribute value.</param>
- /// <returns><code>true</code> in case such attribute exists.</returns>
- bool TryGetAttribute<T>(string name, out T attr);
-
- /// <summary>
- /// Gets all node attributes. Attributes are assigned to nodes at startup.
- /// <para />
- /// Note that attributes cannot be changed at runtime.
- /// </summary>
- /// <returns>All node attributes.</returns>
- IDictionary<string, object> GetAttributes();
-
- /// <summary>
- /// Collection of addresses this node is known by.
- /// </summary>
- /// <returns>Collection of addresses.</returns>
- ICollection<string> Addresses { get; }
-
- /// <summary>
- /// Collection of host names this node is known by.
- /// </summary>
- /// <returns>Collection of host names.</returns>
- ICollection<string> HostNames { get; }
-
- /// <summary>
- /// Node order within grid topology. Discovery SPIs that support node ordering will
- /// assign a proper order to each node and will guarantee that discovery event notifications
- /// for new nodes will come in proper order. All other SPIs not supporting ordering
- /// may choose to return node startup time here.
- /// </summary>
- long Order { get; }
-
- /// <summary>
- /// Tests whether or not this node is a local node.
- /// </summary>
- bool IsLocal { get; }
-
- /// <summary>
- /// Tests whether or not this node is a daemon.
- /// <p/>
- /// Daemon nodes are the usual Ignite nodes that participate in topology but not
- /// visible on the main APIs, i.e. they are not part of any projections.
- /// <p/>
- /// Daemon nodes are used primarily for management and monitoring functionality that
- /// is build on Ignite and needs to participate in the topology but should be
- /// excluded from "normal" topology so that it won't participate in task execution
- /// or in-memory database.
- /// <p/>
- /// Application code should never use daemon nodes.
- /// </summary>
- bool IsDaemon { get; }
-
- /// <summary>
- /// Gets metrics snapshot for this node. Note that node metrics are constantly updated
- /// and provide up to date information about nodes. For example, you can get
- /// an idea about CPU load on remote node via <see cref="IClusterMetrics.CurrentCpuLoad"/>.
- /// <para/>
- /// Node metrics are updated with some delay which is directly related to heartbeat
- /// frequency. For example, when used with default <code>GridTcpDiscoverySpi</code> the
- /// update will happen every <code>2</code> seconds.
- /// </summary>
- /// <returns>Runtime metrics snapshot for this node.</returns>
- IClusterMetrics GetMetrics();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
deleted file mode 100644
index 77eefbb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cluster/IClusterNodeFilter.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cluster
-{
- /// <summary>
- /// Represents cluster node filter.
- /// </summary>
- public interface IClusterNodeFilter
- {
- /// <summary>
- /// Returns a value indicating whether provided node satisfies this predicate.
- /// </summary>
- /// <param name="node">Cluster node.</param>
- /// <returns>Value indicating whether provided node satisfies this predicate.</returns>
- bool Invoke(IClusterNode node);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
deleted file mode 100644
index 094a93c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/AsyncSupportedAttribute.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Common
-{
- using System;
-
- /// <summary>
- /// Attribute to indicate that method can be executed asynchronously if async mode is enabled.
- /// To enable async mode, invoke <see cref="IAsyncSupport{TWithAsync}.WithAsync"/> method on the API.
- /// The future for the async method can be retrieved via
- /// <see cref="IFuture{T}"/> right after the execution of an asynchronous method.
- /// </summary>
- [AttributeUsage(AttributeTargets.Method)]
- public sealed class AsyncSupportedAttribute : Attribute
- {
- // No-op.
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
deleted file mode 100644
index ee98c5a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IAsyncSupport.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Common
-{
- /// <summary>
- /// Allows to enable asynchronous mode on Ignite APIs.
- /// </summary>
- /// <typeparam name="TWithAsync">Type of WithAsync method result.</typeparam>
- public interface IAsyncSupport<out TWithAsync> where TWithAsync : IAsyncSupport<TWithAsync>
- {
- /// <summary>
- /// Gets component with asynchronous mode enabled.
- /// </summary>
- /// <returns>Component with asynchronous mode enabled.</returns>
- TWithAsync WithAsync();
-
- /// <summary>
- /// Gets a value indicating whether this instance is in asynchronous mode.
- /// </summary>
- /// <value>
- /// <c>true</c> if asynchronous mode is enabled.
- /// </value>
- bool IsAsync { get; }
-
- /// <summary>
- /// Gets and resets future for previous asynchronous operation.
- /// </summary>
- /// <returns>Future for previous asynchronous operation.</returns>
- IFuture GetFuture();
-
- /// <summary>
- /// Gets and resets future for previous asynchronous operation.
- /// </summary>
- /// <returns>Future for previous asynchronous operation.</returns>
- IFuture<TResult> GetFuture<TResult>();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
deleted file mode 100644
index 2e94cd4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IFuture.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Common
-{
- using System;
- using System.Threading.Tasks;
-
- /// <summary>
- /// Non-generic Future. Represents an asynchronous operation that can return a value.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IFuture
- {
- /// <summary>
- /// Gets a value indicating whether this instance is done.
- /// </summary>
- bool IsDone
- {
- get;
- }
-
- /// <summary>
- /// Gets the future result.
- /// </summary>
- /// <returns>Future result.</returns>
- object Get();
-
- /// <summary>
- /// Gets the future result with a timeout.
- /// </summary>
- /// <param name="timeout">The timeout.</param>
- /// <returns>
- /// Future result, if it is obtained within specified timeout; otherwise, throws <see cref="TimeoutException"/>
- /// </returns>
- /// <exception cref="TimeoutException">Thrown if Get operation exceeded specified timeout.</exception>
- object Get(TimeSpan timeout);
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action callback);
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action<IFuture> callback);
-
- /// <summary>
- /// Gets an IAsyncResult indicating the state of this Future.
- /// </summary>
- /// <returns>Future state representation in form of IAsyncResult.</returns>
- IAsyncResult ToAsyncResult();
-
- /// <summary>
- /// Gets a Task that returns the result of this Future.
- /// </summary>
- /// <returns>Task that completes when this future gets done and returns the result.</returns>
- Task<object> ToTask();
- }
-
- /// <summary>
- /// Generic Future. Represents an asynchronous operation that can return a value.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- /// <typeparam name="T">Future result type.</typeparam>
- public interface IFuture<T> : IFuture
- {
- /// <summary>
- /// Gets the future result.
- /// </summary>
- /// <returns>Future result.</returns>
- new T Get();
-
- /// <summary>
- /// Gets the future result with a timeout.
- /// </summary>
- /// <param name="timeout">The timeout.</param>
- /// <returns>
- /// Future result, if it is obtained within specified timeout; otherwise, throws <see cref="TimeoutException"/>
- /// </returns>
- /// <exception cref="TimeoutException">Thrown if Get operation exceeded specified timeout.</exception>
- new T Get(TimeSpan timeout);
-
- /// <summary>
- /// Gets a Task that returns the result of this Future.
- /// </summary>
- /// <returns>Task that completes when this future gets done and returns the result.</returns>
- new Task<T> ToTask();
-
- /// <summary>
- /// Listens this instance and invokes callback upon future completion.
- /// </summary>
- /// <param name="callback">The callback to execute upon future completion.</param>
- void Listen(Action<IFuture<T>> callback);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
deleted file mode 100644
index 98e5389..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteException.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Common
-{
- using System;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// General Ignite exception. Indicates any error condition within Ignite.
- /// </summary>
- [Serializable]
- public class IgniteException : Exception
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException"/> class.
- /// </summary>
- public IgniteException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public IgniteException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException" /> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public IgniteException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected IgniteException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
deleted file mode 100644
index 53c7151..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Common/IgniteGuid.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Common
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Ignite guid with additional local ID.
- /// </summary>
- public struct IgniteGuid : IEquatable<IgniteGuid>
- {
- /** Global id. */
- private readonly Guid _globalId;
-
- /** Local id. */
- private readonly long _localId;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="IgniteGuid"/> struct.
- /// </summary>
- /// <param name="globalId">The global id.</param>
- /// <param name="localId">The local id.</param>
- public IgniteGuid(Guid globalId, long localId)
- {
- _globalId = globalId;
- _localId = localId;
- }
-
- /// <summary>
- /// Gets the global id.
- /// </summary>
- public Guid GlobalId
- {
- get { return _globalId; }
- }
-
- /// <summary>
- /// Gets the local id.
- /// </summary>
- public long LocalId
- {
- get { return _localId; }
- }
-
- /** <inheritDoc /> */
- public bool Equals(IgniteGuid other)
- {
- return _globalId.Equals(other._globalId) && _localId == other._localId;
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- return obj is IgniteGuid && Equals((IgniteGuid) obj);
- }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- unchecked
- {
- return (_globalId.GetHashCode() * 397) ^ _localId.GetHashCode();
- }
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- return string.Format("IgniteGuid [GlobalId={0}, LocalId={1}]", GlobalId, LocalId);
- }
-
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="w">Writer.</param>
- public void WritePortable(IPortableRawWriter w)
- {
- w.WriteGuid(GlobalId);
- w.WriteLong(LocalId);
- }
-
- /// <summary>
- /// Reads this object from the given reader.
- /// </summary>
- /// <param name="r">Reader.</param>
- public static IgniteGuid ReadPortable(IPortableRawReader r)
- {
- var guid = r.ReadGuid();
-
- return guid == null
- ? new IgniteGuid(Guid.Empty, 0)
- : new IgniteGuid(guid.Value, r.ReadLong());
- }
-
- /// <summary>
- /// Implements the operator ==.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator ==(IgniteGuid a, IgniteGuid b)
- {
- return a.Equals(b);
- }
-
- /// <summary>
- /// Implements the operator !=.
- /// </summary>
- /// <param name="a">First item.</param>
- /// <param name="b">Second item.</param>
- /// <returns>
- /// The result of the operator.
- /// </returns>
- public static bool operator !=(IgniteGuid a, IgniteGuid b)
- {
- return !(a == b);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
deleted file mode 100644
index 108d396..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeExecutionRejectedException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates a situation when execution service provided by the user in configuration rejects execution.
- /// </summary>
- [Serializable]
- public class ComputeExecutionRejectedException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- public ComputeExecutionRejectedException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeExecutionRejectedException(string message)
- : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeExecutionRejectedException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeExecutionRejectedException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeExecutionRejectedException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
deleted file mode 100644
index 92c6492..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobAdapter.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
-
- /// <summary>
- /// Convenience adapter for <see cref="IComputeJob{T}"/> implementations. It provides the following functionality:
- /// <ul>
- /// <li>
- /// Default implementation of <see cref="IComputeJob{T}.Cancel()"/> method and ability
- /// to check whether cancellation occurred with <see cref="ComputeJobAdapter{T}.IsCancelled()"/> method.
- /// </li>
- /// <li>
- /// Ability to set and get job arguments via <see cref="ComputeJobAdapter{T}.SetArguments(object[])"/>
- /// and <see cref="ComputeJobAdapter{T}.Argument{T}(int)"/> methods.
- /// </li>
- /// </ul>
- /// </summary>
- [Serializable]
- public abstract class ComputeJobAdapter<T> : IComputeJob<T>
- {
- /** Cancelled flag */
- [NonSerialized]
- private volatile bool _cancelled;
-
- /** Arguments. */
- protected object[] Args;
-
- /// <summary>
- /// No-arg constructor.
- /// </summary>
- protected ComputeJobAdapter()
- {
- // No-op.
- }
-
- /// <summary>
- /// Creates job with specified arguments.
- /// </summary>
- /// <param name="args">Optional job arguments.</param>
- protected ComputeJobAdapter(params object[] args)
- {
- Args = args;
- }
-
- /// <summary>
- /// This method is called when system detects that completion of this
- /// job can no longer alter the overall outcome (for example, when parent task
- /// has already reduced the results).
- /// <para />
- /// Note that job cancellation is only a hint, and it is really up to the actual job
- /// instance to gracefully finish execution and exit.
- /// </summary>
- public void Cancel()
- {
- _cancelled = true;
- }
-
- /// <summary>
- /// Sets given arguments.
- /// </summary>
- /// <param name="args">Optional job arguments to set.</param>
- public void SetArguments(params object[] args)
- {
- Args = args;
- }
-
- /// <summary>
- /// Sets given arguments.
- /// </summary>
- /// <param name="idx">Index of the argument.</param>
- public TArg Argument<TArg>(int idx)
- {
- if (idx < 0 || idx >= Args.Length)
- throw new ArgumentException("Invalid argument index: " + idx);
-
- return (TArg)Args[idx];
- }
-
- /// <summary>
- /// This method tests whether or not this job was cancelled. This method
- /// is thread-safe and can be called without extra synchronization.
- /// <p/>
- /// This method can be periodically called in <see cref="IComputeJob{T}.Execute()"/> method
- /// implementation to check whether or not this job cancelled. Note that system
- /// calls <see cref="IComputeJob{T}.Cancel()"/> method only as a hint and this is a responsibility of
- /// the implementation of the job to properly cancel its execution.
- /// </summary>
- /// <returns><c>True</c> if this job was cancelled, <c>false</c> otherwise.</returns>
- protected bool IsCancelled()
- {
- return _cancelled;
- }
-
- /// <summary>
- /// Executes this job.
- /// </summary>
- /// <returns>
- /// Job execution result (possibly <c>null</c>). This result will be returned
- /// in <see cref="IComputeJobResult{T}" /> object passed into
- /// <see cref="IComputeTask{A,T,R}.Result" />
- /// on caller node.
- /// </returns>
- public abstract T Execute();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
deleted file mode 100644
index 970bd43..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobFailoverException.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This runtime exception can be thrown from <see cref="IComputeJob{T}.Execute()"/>
- /// method to force job failover to another node within task topology.
- /// <see cref="IComputeFunc{T,R}"/> or <see cref="IComputeFunc{T}"/>
- /// passed into any of the <see cref="ICompute"/> methods can also throw this exception
- /// to force failover.
- /// </summary>
- [Serializable]
- public class ComputeJobFailoverException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- public ComputeJobFailoverException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException" /> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeJobFailoverException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeJobFailoverException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobFailoverException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeJobFailoverException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
[48/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/src/java.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/java.cpp b/modules/platform/src/main/cpp/common/src/java.cpp
deleted file mode 100644
index d08a90d..0000000
--- a/modules/platform/src/main/cpp/common/src/java.cpp
+++ /dev/null
@@ -1,2205 +0,0 @@
-/*
- * 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.
- */
-
-#include <cstring>
-#include <string>
-#include <exception>
-
-#include "ignite/common/concurrent.h"
-#include "ignite/common/java.h"
-
-#define IGNITE_SAFE_PROC_NO_ARG(jniEnv, envPtr, type, field) { \
- JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \
- type hnd = hnds->field; \
- if (hnd) \
- hnd(hnds->target); \
- else \
- ThrowOnMissingHandler(jniEnv); \
-}
-
-#define IGNITE_SAFE_PROC(jniEnv, envPtr, type, field, ...) { \
- JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \
- type hnd = hnds->field; \
- if (hnd) \
- hnd(hnds->target, __VA_ARGS__); \
- else \
- ThrowOnMissingHandler(jniEnv); \
-}
-
-#define IGNITE_SAFE_FUNC(jniEnv, envPtr, type, field, ...) { \
- JniHandlers* hnds = reinterpret_cast<JniHandlers*>(envPtr); \
- type hnd = hnds->field; \
- if (hnd) \
- return hnd(hnds->target, __VA_ARGS__); \
- else \
- { \
- ThrowOnMissingHandler(jniEnv); \
- return 0; \
- }\
-}
-
-namespace ignite
-{
- namespace common
- {
- namespace java
- {
- namespace gcc = ignite::common::concurrent;
-
- /* --- Startup exception. --- */
- class JvmException : public std::exception {
- // No-op.
- };
-
- /* --- JNI method definitions. --- */
- struct JniMethod {
- char* name;
- char* sign;
- bool isStatic;
-
- JniMethod(const char* name, const char* sign, bool isStatic) {
- this->name = const_cast<char*>(name);
- this->sign = const_cast<char*>(sign);
- this->isStatic = isStatic;
- }
- };
-
- /*
- * Heloper function to copy characters.
- *
- * @param src Source.
- * @return Result.
- */
- char* CopyChars(const char* src)
- {
- if (src)
- {
- size_t len = strlen(src);
- char* dest = new char[len + 1];
- strcpy(dest, src);
- *(dest + len) = 0;
- return dest;
- }
- else
- return NULL;
- }
-
- JniErrorInfo::JniErrorInfo() : code(IGNITE_JNI_ERR_SUCCESS), errCls(NULL), errMsg(NULL)
- {
- // No-op.
- }
-
- JniErrorInfo::JniErrorInfo(int code, const char* errCls, const char* errMsg) : code(code)
- {
- this->errCls = CopyChars(errCls);
- this->errMsg = CopyChars(errMsg);
- }
-
- JniErrorInfo::JniErrorInfo(const JniErrorInfo& other) : code(other.code)
- {
- this->errCls = CopyChars(other.errCls);
- this->errMsg = CopyChars(other.errMsg);
- }
-
- JniErrorInfo& JniErrorInfo::operator=(const JniErrorInfo& other)
- {
- if (this != &other)
- {
- // 1. Create new instance, exception could occur at this point.
- JniErrorInfo tmp(other);
-
- // 2. Swap with temp.
- int code0 = code;
- char* errCls0 = errCls;
- char* errMsg0 = errMsg;
-
- code = tmp.code;
- errCls = tmp.errCls;
- errMsg = tmp.errMsg;
-
- tmp.code = code0;
- tmp.errCls = errCls0;
- tmp.errMsg = errMsg0;
- }
-
- return *this;
- }
-
- JniErrorInfo::~JniErrorInfo()
- {
- if (errCls)
- delete[] errCls;
-
- if (errMsg)
- delete[] errMsg;
- }
-
- const char* C_THROWABLE = "java/lang/Throwable";
- JniMethod M_THROWABLE_GET_MESSAGE = JniMethod("getMessage", "()Ljava/lang/String;", false);
- JniMethod M_THROWABLE_PRINT_STACK_TRACE = JniMethod("printStackTrace", "()V", false);
-
- const char* C_CLASS = "java/lang/Class";
- JniMethod M_CLASS_GET_NAME = JniMethod("getName", "()Ljava/lang/String;", false);
-
- const char* C_IGNITE_EXCEPTION = "org/apache/ignite/IgniteException";
-
- const char* C_PLATFORM_NO_CALLBACK_EXCEPTION = "org/apache/ignite/internal/processors/platform/PlatformNoCallbackException";
-
- const char* C_PLATFORM_PROCESSOR = "org/apache/ignite/internal/processors/platform/PlatformProcessor";
- JniMethod M_PLATFORM_PROCESSOR_RELEASE_START = JniMethod("releaseStart", "()V", false);
- JniMethod M_PLATFORM_PROCESSOR_PROJECTION = JniMethod("projection", "()Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_CACHE = JniMethod("cache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_CREATE_CACHE = JniMethod("createCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE = JniMethod("getOrCreateCache", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_AFFINITY = JniMethod("affinity", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_DATA_STREAMER = JniMethod("dataStreamer", "(Ljava/lang/String;Z)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_TRANSACTIONS = JniMethod("transactions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_COMPUTE = JniMethod("compute", "(Lorg/apache/ignite/internal/processors/platform/PlatformTarget;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_MESSAGE = JniMethod("message", "(Lorg/apache/ignite/internal/processors/platform/PlatformTarget;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_EVENTS = JniMethod("events", "(Lorg/apache/ignite/internal/processors/platform/PlatformTarget;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_SERVICES = JniMethod("services", "(Lorg/apache/ignite/internal/processors/platform/PlatformTarget;)Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
- JniMethod M_PLATFORM_PROCESSOR_EXTENSIONS = JniMethod("extensions", "()Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
-
- const char* C_PLATFORM_TARGET = "org/apache/ignite/internal/processors/platform/PlatformTarget";
- JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_LONG = JniMethod("inStreamOutLong", "(IJ)J", false);
- JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT = JniMethod("inStreamOutObject", "(IJ)Ljava/lang/Object;", false);
- JniMethod M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM = JniMethod("inStreamOutStream", "(IJJ)V", false);
- JniMethod M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM = JniMethod("inObjectStreamOutStream", "(ILjava/lang/Object;JJ)V", false);
- JniMethod M_PLATFORM_TARGET_OUT_LONG = JniMethod("outLong", "(I)J", false);
- JniMethod M_PLATFORM_TARGET_OUT_STREAM = JniMethod("outStream", "(IJ)V", false);
- JniMethod M_PLATFORM_TARGET_OUT_OBJECT = JniMethod("outObject", "(I)Ljava/lang/Object;", false);
- JniMethod M_PLATFORM_TARGET_LISTEN_FUTURE = JniMethod("listenFuture", "(JI)V", false);
- JniMethod M_PLATFORM_TARGET_LISTEN_FOR_OPERATION = JniMethod("listenFutureForOperation", "(JII)V", false);
-
- const char* C_PLATFORM_CLUSTER_GRP = "org/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup";
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_OTHERS = JniMethod("forOthers", "(Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;)Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_REMOTES = JniMethod("forRemotes", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_DAEMONS = JniMethod("forDaemons", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_RANDOM = JniMethod("forRandom", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_OLDEST = JniMethod("forOldest", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_FOR_YOUNGEST = JniMethod("forYoungest", "()Lorg/apache/ignite/internal/processors/platform/cluster/PlatformClusterGroup;", false);
- JniMethod M_PLATFORM_CLUSTER_GRP_RESET_METRICS = JniMethod("resetMetrics", "()V", false);
-
- const char* C_PLATFORM_MESSAGING = "org/apache/ignite/internal/processors/platform/messaging/PlatformMessaging";
- JniMethod M_PLATFORM_MESSAGING_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/messaging/PlatformMessaging;", false);
-
- const char* C_PLATFORM_COMPUTE = "org/apache/ignite/internal/processors/platform/compute/PlatformCompute";
- JniMethod M_PLATFORM_COMPUTE_WITH_NO_FAILOVER = JniMethod("withNoFailover", "()V", false);
- JniMethod M_PLATFORM_COMPUTE_WITH_TIMEOUT = JniMethod("withTimeout", "(J)V", false);
- JniMethod M_PLATFORM_COMPUTE_EXECUTE_NATIVE = JniMethod("executeNative", "(JJ)V", false);
-
- const char* C_PLATFORM_CACHE = "org/apache/ignite/internal/processors/platform/cache/PlatformCache";
- JniMethod M_PLATFORM_CACHE_WITH_SKIP_STORE = JniMethod("withSkipStore", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
- JniMethod M_PLATFORM_CACHE_WITH_NO_RETRIES = JniMethod("withNoRetries", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
- JniMethod M_PLATFORM_CACHE_WITH_EXPIRY_PLC = JniMethod("withExpiryPolicy", "(JJJ)Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
- JniMethod M_PLATFORM_CACHE_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
- JniMethod M_PLATFORM_CACHE_WITH_KEEP_PORTABLE = JniMethod("withKeepPortable", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCache;", false);
- JniMethod M_PLATFORM_CACHE_CLEAR = JniMethod("clear", "()V", false);
- JniMethod M_PLATFORM_CACHE_REMOVE_ALL = JniMethod("removeAll", "()V", false);
- JniMethod M_PLATFORM_CACHE_ITERATOR = JniMethod("iterator", "()Lorg/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator;", false);
- JniMethod M_PLATFORM_CACHE_LOCAL_ITERATOR = JniMethod("localIterator", "(I)Lorg/apache/ignite/internal/processors/platform/cache/PlatformCacheIterator;", false);
- JniMethod M_PLATFORM_CACHE_ENTER_LOCK = JniMethod("enterLock", "(J)V", false);
- JniMethod M_PLATFORM_CACHE_EXIT_LOCK = JniMethod("exitLock", "(J)V", false);
- JniMethod M_PLATFORM_CACHE_TRY_ENTER_LOCK = JniMethod("tryEnterLock", "(JJ)Z", false);
- JniMethod M_PLATFORM_CACHE_CLOSE_LOCK = JniMethod("closeLock", "(J)V", false);
- JniMethod M_PLATFORM_CACHE_REBALANCE = JniMethod("rebalance", "(J)V", false);
- JniMethod M_PLATFORM_CACHE_SIZE = JniMethod("size", "(IZ)I", false);
-
- const char* C_PLATFORM_AFFINITY = "org/apache/ignite/internal/processors/platform/cache/affinity/PlatformAffinity";
- JniMethod C_PLATFORM_AFFINITY_PARTITIONS = JniMethod("partitions", "()I", false);
-
- const char* C_PLATFORM_DATA_STREAMER = "org/apache/ignite/internal/processors/platform/datastreamer/PlatformDataStreamer";
- JniMethod M_PLATFORM_DATA_STREAMER_LISTEN_TOPOLOGY = JniMethod("listenTopology", "(J)V", false);
- JniMethod M_PLATFORM_DATA_STREAMER_GET_ALLOW_OVERWRITE = JniMethod("allowOverwrite", "()Z", false);
- JniMethod M_PLATFORM_DATA_STREAMER_SET_ALLOW_OVERWRITE = JniMethod("allowOverwrite", "(Z)V", false);
- JniMethod M_PLATFORM_DATA_STREAMER_GET_SKIP_STORE = JniMethod("skipStore", "()Z", false);
- JniMethod M_PLATFORM_DATA_STREAMER_SET_SKIP_STORE = JniMethod("skipStore", "(Z)V", false);
- JniMethod M_PLATFORM_DATA_STREAMER_GET_PER_NODE_BUFFER_SIZE = JniMethod("perNodeBufferSize", "()I", false);
- JniMethod M_PLATFORM_DATA_STREAMER_SET_PER_NODE_BUFFER_SIZE = JniMethod("perNodeBufferSize", "(I)V", false);
- JniMethod M_PLATFORM_DATA_STREAMER_GET_PER_NODE_PARALLEL_OPS = JniMethod("perNodeParallelOperations", "()I", false);
- JniMethod M_PLATFORM_DATA_STREAMER_SET_PER_NODE_PARALLEL_OPS = JniMethod("perNodeParallelOperations", "(I)V", false);
-
- const char* C_PLATFORM_TRANSACTIONS = "org/apache/ignite/internal/processors/platform/transactions/PlatformTransactions";
- JniMethod M_PLATFORM_TRANSACTIONS_TX_START = JniMethod("txStart", "(IIJI)J", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_COMMIT = JniMethod("txCommit", "(J)I", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_ROLLBACK = JniMethod("txRollback", "(J)I", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_COMMIT_ASYNC = JniMethod("txCommitAsync", "(JJ)V", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_ROLLBACK_ASYNC = JniMethod("txRollbackAsync", "(JJ)V", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_STATE = JniMethod("txState", "(J)I", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_SET_ROLLBACK_ONLY = JniMethod("txSetRollbackOnly", "(J)Z", false);
- JniMethod M_PLATFORM_TRANSACTIONS_TX_CLOSE = JniMethod("txClose", "(J)I", false);
- JniMethod M_PLATFORM_TRANSACTIONS_RESET_METRICS = JniMethod("resetMetrics", "()V", false);
-
- const char* C_PLATFORM_CACHE_STORE_CALLBACK = "org/apache/ignite/internal/processors/platform/cache/store/PlatformCacheStoreCallback";
- JniMethod M_PLATFORM_CACHE_STORE_CALLBACK_INVOKE = JniMethod("invoke", "(J)V", false);
-
- const char* C_PLATFORM_CALLBACK_UTILS = "org/apache/ignite/internal/processors/platform/callback/PlatformCallbackUtils";
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_CREATE = JniMethod("cacheStoreCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_INVOKE = JniMethod("cacheStoreInvoke", "(JJJLjava/lang/Object;)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_DESTROY = JniMethod("cacheStoreDestroy", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_SESSION_CREATE = JniMethod("cacheStoreSessionCreate", "(JJ)J", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_CREATE = JniMethod("cacheEntryFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_APPLY = JniMethod("cacheEntryFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_DESTROY = JniMethod("cacheEntryFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CACHE_INVOKE = JniMethod("cacheInvoke", "(JJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_MAP = JniMethod("computeTaskMap", "(JJJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_JOB_RESULT = JniMethod("computeTaskJobResult", "(JJJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_REDUCE = JniMethod("computeTaskReduce", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_COMPLETE = JniMethod("computeTaskComplete", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_SERIALIZE = JniMethod("computeJobSerialize", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CREATE = JniMethod("computeJobCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_EXECUTE = JniMethod("computeJobExecute", "(JJIJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_DESTROY = JniMethod("computeJobDestroy", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CANCEL = JniMethod("computeJobCancel", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_LSNR_APPLY = JniMethod("continuousQueryListenerApply", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_CREATE = JniMethod("continuousQueryFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_EVAL = JniMethod("continuousQueryFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_RELEASE = JniMethod("continuousQueryFilterRelease", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_TOPOLOGY_UPDATE = JniMethod("dataStreamerTopologyUpdate", "(JJJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_STREAM_RECEIVER_INVOKE = JniMethod("dataStreamerStreamReceiverInvoke", "(JJLjava/lang/Object;JZ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BYTE_RES = JniMethod("futureByteResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_BOOL_RES = JniMethod("futureBoolResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_SHORT_RES = JniMethod("futureShortResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_CHAR_RES = JniMethod("futureCharResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_INT_RES = JniMethod("futureIntResult", "(JJI)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_FLOAT_RES = JniMethod("futureFloatResult", "(JJF)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_LONG_RES = JniMethod("futureLongResult", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_DOUBLE_RES = JniMethod("futureDoubleResult", "(JJD)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_OBJ_RES = JniMethod("futureObjectResult", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_NULL_RES = JniMethod("futureNullResult", "(JJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_FUTURE_ERR = JniMethod("futureError", "(JJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_LIFECYCLE_EVENT = JniMethod("lifecycleEvent", "(JJI)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_CREATE = JniMethod("messagingFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_APPLY = JniMethod("messagingFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_DESTROY = JniMethod("messagingFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_CREATE = JniMethod("eventFilterCreate", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_APPLY = JniMethod("eventFilterApply", "(JJJ)I", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_DESTROY = JniMethod("eventFilterDestroy", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INIT = JniMethod("serviceInit", "(JJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_EXECUTE = JniMethod("serviceExecute", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_CANCEL = JniMethod("serviceCancel", "(JJJ)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_SERVICE_INVOKE_METHOD = JniMethod("serviceInvokeMethod", "(JJJJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_CLUSTER_NODE_FILTER_APPLY = JniMethod("clusterNodeFilterApply", "(JJ)I", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_NODE_INFO = JniMethod("nodeInfo", "(JJ)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_MEMORY_REALLOCATE = JniMethod("memoryReallocate", "(JJI)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_START = JniMethod("onStart", "(JLjava/lang/Object;J)V", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_ON_STOP = JniMethod("onStop", "(J)V", true);
-
- JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG = JniMethod("extensionCallbackInLongOutLong", "(JIJ)J", true);
- JniMethod M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG = JniMethod("extensionCallbackInLongLongOutLong", "(JIJJ)J", true);
-
- const char* C_PLATFORM_UTILS = "org/apache/ignite/internal/processors/platform/utils/PlatformUtils";
- JniMethod M_PLATFORM_UTILS_REALLOC = JniMethod("reallocate", "(JI)V", true);
- JniMethod M_PLATFORM_UTILS_ERR_DATA = JniMethod("errorData", "(Ljava/lang/Throwable;)[B", true);
-
- const char* C_PLATFORM_IGNITION = "org/apache/ignite/internal/processors/platform/PlatformIgnition";
- JniMethod M_PLATFORM_IGNITION_START = JniMethod("start", "(Ljava/lang/String;Ljava/lang/String;IJJ)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true);
- JniMethod M_PLATFORM_IGNITION_INSTANCE = JniMethod("instance", "(Ljava/lang/String;)Lorg/apache/ignite/internal/processors/platform/PlatformProcessor;", true);
- JniMethod M_PLATFORM_IGNITION_ENVIRONMENT_POINTER = JniMethod("environmentPointer", "(Ljava/lang/String;)J", true);
- JniMethod M_PLATFORM_IGNITION_STOP = JniMethod("stop", "(Ljava/lang/String;Z)Z", true);
- JniMethod M_PLATFORM_IGNITION_STOP_ALL = JniMethod("stopAll", "(Z)V", true);
-
- const char* C_PLATFORM_ABSTRACT_QRY_CURSOR = "org/apache/ignite/internal/processors/platform/cache/query/PlatformAbstractQueryCursor";
- JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER = JniMethod("iterator", "()V", false);
- JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER_HAS_NEXT = JniMethod("iteratorHasNext", "()Z", false);
- JniMethod M_PLATFORM_ABSTRACT_QRY_CURSOR_CLOSE = JniMethod("close", "()V", false);
-
- const char* C_PLATFORM_CONT_QRY = "org/apache/ignite/internal/processors/platform/cache/query/PlatformContinuousQuery";
- JniMethod M_PLATFORM_CONT_QRY_CLOSE = JniMethod("close", "()V", false);
- JniMethod M_PLATFORM_CONT_QRY_GET_INITIAL_QUERY_CURSOR = JniMethod("getInitialQueryCursor", "()Lorg/apache/ignite/internal/processors/platform/PlatformTarget;", false);
-
- const char* C_PLATFORM_EVENTS = "org/apache/ignite/internal/processors/platform/events/PlatformEvents";
- JniMethod M_PLATFORM_EVENTS_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/events/PlatformEvents;", false);
- JniMethod M_PLATFORM_EVENTS_STOP_LOCAL_LISTEN = JniMethod("stopLocalListen", "(J)Z", false);
- JniMethod M_PLATFORM_EVENTS_LOCAL_LISTEN = JniMethod("localListen", "(JI)V", false);
- JniMethod M_PLATFORM_EVENTS_IS_ENABLED = JniMethod("isEnabled", "(I)Z", false);
-
- const char* C_PLATFORM_SERVICES = "org/apache/ignite/internal/processors/platform/services/PlatformServices";
- JniMethod M_PLATFORM_SERVICES_WITH_ASYNC = JniMethod("withAsync", "()Lorg/apache/ignite/internal/processors/platform/services/PlatformServices;", false);
- JniMethod M_PLATFORM_SERVICES_WITH_SERVER_KEEP_PORTABLE = JniMethod("withServerKeepPortable", "()Lorg/apache/ignite/internal/processors/platform/services/PlatformServices;", false);
- JniMethod M_PLATFORM_SERVICES_CANCEL = JniMethod("cancel", "(Ljava/lang/String;)V", false);
- JniMethod M_PLATFORM_SERVICES_CANCEL_ALL = JniMethod("cancelAll", "()V", false);
- JniMethod M_PLATFORM_SERVICES_SERVICE_PROXY = JniMethod("dotNetServiceProxy", "(Ljava/lang/String;Z)Ljava/lang/Object;", false);
-
- /* STATIC STATE. */
- gcc::CriticalSection JVM_LOCK;
- JniJvm JVM;
- bool PRINT_EXCEPTION = false;
-
- /* HELPER METHODS. */
-
- /*
- * Throw exception to Java in case of missing callback pointer. It means that callback is not implemented in
- * native platform and Java -> platform operation cannot proceede further. As JniContext is not available at
- * this point, we have to obtain exception details from scratch. This is not critical from performance
- * perspective because missing handler usually denotes fatal condition.
- *
- * @param env JNI environment.
- */
- int ThrowOnMissingHandler(JNIEnv* env)
- {
- jclass cls = env->FindClass(C_PLATFORM_NO_CALLBACK_EXCEPTION);
-
- env->ThrowNew(cls, "Callback handler is not set in native platform.");
-
- return 0;
- }
-
- char* StringToChars(JNIEnv* env, jstring str, int* len) {
- if (!str) {
- *len = 0;
- return NULL;
- }
-
- const char* strChars = env->GetStringUTFChars(str, 0);
- const int strCharsLen = env->GetStringUTFLength(str);
-
- char* strChars0 = new char[strCharsLen + 1];
- std::strcpy(strChars0, strChars);
- *(strChars0 + strCharsLen) = 0;
-
- env->ReleaseStringUTFChars(str, strChars);
-
- if (len)
- *len = strCharsLen;
-
- return strChars0;
- }
-
- std::string JavaStringToCString(JNIEnv* env, jstring str, int* len)
- {
- char* resChars = StringToChars(env, str, len);
-
- if (resChars)
- {
- std::string res = std::string(resChars, *len);
-
- delete[] resChars;
-
- return res;
- }
- else
- return std::string();
- }
-
- jclass FindClass(JNIEnv* env, const char *name) {
- jclass res = env->FindClass(name);
-
- if (!res)
- throw JvmException();
-
- jclass res0 = static_cast<jclass>(env->NewGlobalRef(res));
-
- env->DeleteLocalRef(res);
-
- return res0;
- }
-
- void DeleteClass(JNIEnv* env, jclass cls) {
- if (cls)
- env->DeleteGlobalRef(cls);
- }
-
- void CheckClass(JNIEnv* env, const char *name)
- {
- jclass res = env->FindClass(name);
-
- if (!res)
- throw JvmException();
- }
-
- jmethodID FindMethod(JNIEnv* env, jclass cls, JniMethod mthd) {
- jmethodID mthd0 = mthd.isStatic ?
- env->GetStaticMethodID(cls, mthd.name, mthd.sign) : env->GetMethodID(cls, mthd.name, mthd.sign);
-
- if (!mthd0)
- throw JvmException();
-
- return mthd0;
- }
-
- void AddNativeMethod(JNINativeMethod* mthd, JniMethod jniMthd, void* fnPtr) {
- mthd->name = jniMthd.name;
- mthd->signature = jniMthd.sign;
- mthd->fnPtr = fnPtr;
- }
-
- void JniJavaMembers::Initialize(JNIEnv* env) {
- c_Class = FindClass(env, C_CLASS);
- m_Class_getName = FindMethod(env, c_Class, M_CLASS_GET_NAME);
-
- c_Throwable = FindClass(env, C_THROWABLE);
- m_Throwable_getMessage = FindMethod(env, c_Throwable, M_THROWABLE_GET_MESSAGE);
- m_Throwable_printStackTrace = FindMethod(env, c_Throwable, M_THROWABLE_PRINT_STACK_TRACE);
- }
-
- void JniJavaMembers::Destroy(JNIEnv* env) {
- DeleteClass(env, c_Class);
- DeleteClass(env, c_Throwable);
- }
-
- bool JniJavaMembers::WriteErrorInfo(JNIEnv* env, char** errClsName, int* errClsNameLen, char** errMsg, int* errMsgLen) {
- if (env && env->ExceptionCheck()) {
- if (m_Class_getName && m_Throwable_getMessage) {
- jthrowable err = env->ExceptionOccurred();
-
- env->ExceptionClear();
-
- jclass errCls = env->GetObjectClass(err);
-
- jstring clsName = static_cast<jstring>(env->CallObjectMethod(errCls, m_Class_getName));
- *errClsName = StringToChars(env, clsName, errClsNameLen);
-
- jstring msg = static_cast<jstring>(env->CallObjectMethod(err, m_Throwable_getMessage));
- *errMsg = StringToChars(env, msg, errMsgLen);
-
- if (errCls)
- env->DeleteLocalRef(errCls);
-
- if (clsName)
- env->DeleteLocalRef(clsName);
-
- if (msg)
- env->DeleteLocalRef(msg);
-
- return true;
- }
- else {
- env->ExceptionClear();
- }
- }
-
- return false;
- }
-
- void JniMembers::Initialize(JNIEnv* env) {
- c_PlatformAbstractQryCursor = FindClass(env, C_PLATFORM_ABSTRACT_QRY_CURSOR);
- m_PlatformAbstractQryCursor_iter = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER);
- m_PlatformAbstractQryCursor_iterHasNext = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_ITER_HAS_NEXT);
- m_PlatformAbstractQryCursor_close = FindMethod(env, c_PlatformAbstractQryCursor, M_PLATFORM_ABSTRACT_QRY_CURSOR_CLOSE);
-
- c_PlatformAffinity = FindClass(env, C_PLATFORM_AFFINITY);
- m_PlatformAffinity_partitions = FindMethod(env, c_PlatformAffinity, C_PLATFORM_AFFINITY_PARTITIONS);
-
- c_PlatformCache = FindClass(env, C_PLATFORM_CACHE);
- m_PlatformCache_withSkipStore = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_SKIP_STORE);
- m_PlatformCache_withNoRetries = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_NO_RETRIES);
- m_PlatformCache_withExpiryPolicy = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_EXPIRY_PLC);
- m_PlatformCache_withAsync = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_ASYNC);
- m_PlatformCache_withKeepPortable = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_WITH_KEEP_PORTABLE);
- m_PlatformCache_clear = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_CLEAR);
- m_PlatformCache_removeAll = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_REMOVE_ALL);
- m_PlatformCache_iterator = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_ITERATOR);
- m_PlatformCache_localIterator = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_LOCAL_ITERATOR);
- m_PlatformCache_enterLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_ENTER_LOCK);
- m_PlatformCache_exitLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_EXIT_LOCK);
- m_PlatformCache_tryEnterLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_TRY_ENTER_LOCK);
- m_PlatformCache_closeLock = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_CLOSE_LOCK);
- m_PlatformCache_rebalance = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_REBALANCE);
- m_PlatformCache_size = FindMethod(env, c_PlatformCache, M_PLATFORM_CACHE_SIZE);
-
- c_PlatformCacheStoreCallback = FindClass(env, C_PLATFORM_CACHE_STORE_CALLBACK);
- m_PlatformCacheStoreCallback_invoke = FindMethod(env, c_PlatformCacheStoreCallback, M_PLATFORM_CACHE_STORE_CALLBACK_INVOKE);
-
- c_IgniteException = FindClass(env, C_IGNITE_EXCEPTION);
-
- c_PlatformClusterGroup = FindClass(env, C_PLATFORM_CLUSTER_GRP);
- m_PlatformClusterGroup_forOthers = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_OTHERS);
- m_PlatformClusterGroup_forRemotes = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_REMOTES);
- m_PlatformClusterGroup_forDaemons = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_DAEMONS);
- m_PlatformClusterGroup_forRandom = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_RANDOM);
- m_PlatformClusterGroup_forOldest = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_OLDEST);
- m_PlatformClusterGroup_forYoungest = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_FOR_YOUNGEST);
- m_PlatformClusterGroup_resetMetrics = FindMethod(env, c_PlatformClusterGroup, M_PLATFORM_CLUSTER_GRP_RESET_METRICS);
-
- c_PlatformCompute = FindClass(env, C_PLATFORM_COMPUTE);
- m_PlatformCompute_withNoFailover = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_WITH_NO_FAILOVER);
- m_PlatformCompute_withTimeout = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_WITH_TIMEOUT);
- m_PlatformCompute_executeNative = FindMethod(env, c_PlatformCompute, M_PLATFORM_COMPUTE_EXECUTE_NATIVE);
-
- c_PlatformContinuousQuery = FindClass(env, C_PLATFORM_CONT_QRY);
- m_PlatformContinuousQuery_close = FindMethod(env, c_PlatformContinuousQuery, M_PLATFORM_CONT_QRY_CLOSE);
- m_PlatformContinuousQuery_getInitialQueryCursor = FindMethod(env, c_PlatformContinuousQuery, M_PLATFORM_CONT_QRY_GET_INITIAL_QUERY_CURSOR);
-
- c_PlatformDataStreamer = FindClass(env, C_PLATFORM_DATA_STREAMER);
- m_PlatformDataStreamer_listenTopology = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_LISTEN_TOPOLOGY);
- m_PlatformDataStreamer_getAllowOverwrite = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_ALLOW_OVERWRITE);
- m_PlatformDataStreamer_setAllowOverwrite = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_ALLOW_OVERWRITE);
- m_PlatformDataStreamer_getSkipStore = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_SKIP_STORE);
- m_PlatformDataStreamer_setSkipStore = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_SKIP_STORE);
- m_PlatformDataStreamer_getPerNodeBufSize = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_PER_NODE_BUFFER_SIZE);
- m_PlatformDataStreamer_setPerNodeBufSize = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_PER_NODE_BUFFER_SIZE);
- m_PlatformDataStreamer_getPerNodeParallelOps = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_GET_PER_NODE_PARALLEL_OPS);
- m_PlatformDataStreamer_setPerNodeParallelOps = FindMethod(env, c_PlatformDataStreamer, M_PLATFORM_DATA_STREAMER_SET_PER_NODE_PARALLEL_OPS);
-
- c_PlatformEvents = FindClass(env, C_PLATFORM_EVENTS);
- m_PlatformEvents_withAsync = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_WITH_ASYNC);
- m_PlatformEvents_stopLocalListen = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_STOP_LOCAL_LISTEN);
- m_PlatformEvents_localListen = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_LOCAL_LISTEN);
- m_PlatformEvents_isEnabled = FindMethod(env, c_PlatformEvents, M_PLATFORM_EVENTS_IS_ENABLED);
-
- c_PlatformServices = FindClass(env, C_PLATFORM_SERVICES);
- m_PlatformServices_withAsync = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_WITH_ASYNC);
- m_PlatformServices_withServerKeepPortable = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_WITH_SERVER_KEEP_PORTABLE);
- m_PlatformServices_cancel = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_CANCEL);
- m_PlatformServices_cancelAll = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_CANCEL_ALL);
- m_PlatformServices_serviceProxy = FindMethod(env, c_PlatformServices, M_PLATFORM_SERVICES_SERVICE_PROXY);
-
- c_PlatformIgnition = FindClass(env, C_PLATFORM_IGNITION);
- m_PlatformIgnition_start = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_START);
- m_PlatformIgnition_instance = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_INSTANCE);
- m_PlatformIgnition_environmentPointer = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_ENVIRONMENT_POINTER);
- m_PlatformIgnition_stop = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_STOP);
- m_PlatformIgnition_stopAll = FindMethod(env, c_PlatformIgnition, M_PLATFORM_IGNITION_STOP_ALL);
-
- c_PlatformMessaging = FindClass(env, C_PLATFORM_MESSAGING);
- m_PlatformMessaging_withAsync = FindMethod(env, c_PlatformMessaging, M_PLATFORM_MESSAGING_WITH_ASYNC);
-
- c_PlatformProcessor = FindClass(env, C_PLATFORM_PROCESSOR);
- m_PlatformProcessor_releaseStart = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_RELEASE_START);
- m_PlatformProcessor_cache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CACHE);
- m_PlatformProcessor_createCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_CREATE_CACHE);
- m_PlatformProcessor_getOrCreateCache = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_GET_OR_CREATE_CACHE);
- m_PlatformProcessor_affinity = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_AFFINITY);
- m_PlatformProcessor_dataStreamer = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_DATA_STREAMER);
- m_PlatformProcessor_transactions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_TRANSACTIONS);
- m_PlatformProcessor_projection = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_PROJECTION);
- m_PlatformProcessor_compute = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_COMPUTE);
- m_PlatformProcessor_message = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_MESSAGE);
- m_PlatformProcessor_events = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EVENTS);
- m_PlatformProcessor_services = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_SERVICES);
- m_PlatformProcessor_extensions = FindMethod(env, c_PlatformProcessor, M_PLATFORM_PROCESSOR_EXTENSIONS);
-
- c_PlatformTarget = FindClass(env, C_PLATFORM_TARGET);
- m_PlatformTarget_inStreamOutLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_LONG);
- m_PlatformTarget_inStreamOutObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_OBJECT);
- m_PlatformTarget_outLong = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_LONG);
- m_PlatformTarget_outStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_STREAM);
- m_PlatformTarget_outObject = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_OUT_OBJECT);
- m_PlatformTarget_inStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_STREAM_OUT_STREAM);
- m_PlatformTarget_inObjectStreamOutStream = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_IN_OBJECT_STREAM_OUT_STREAM);
- m_PlatformTarget_listenFuture = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FUTURE);
- m_PlatformTarget_listenFutureForOperation = FindMethod(env, c_PlatformTarget, M_PLATFORM_TARGET_LISTEN_FOR_OPERATION);
-
- c_PlatformTransactions = FindClass(env, C_PLATFORM_TRANSACTIONS);
- m_PlatformTransactions_txStart = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_START);
- m_PlatformTransactions_txCommit = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_COMMIT);
- m_PlatformTransactions_txRollback = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_ROLLBACK);
- m_PlatformTransactions_txCommitAsync = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_COMMIT_ASYNC);
- m_PlatformTransactions_txRollbackAsync = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_ROLLBACK_ASYNC);
- m_PlatformTransactions_txState = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_STATE);
- m_PlatformTransactions_txSetRollbackOnly = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_SET_ROLLBACK_ONLY);
- m_PlatformTransactions_txClose = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_TX_CLOSE);
- m_PlatformTransactions_resetMetrics = FindMethod(env, c_PlatformTransactions, M_PLATFORM_TRANSACTIONS_RESET_METRICS);
-
- c_PlatformUtils = FindClass(env, C_PLATFORM_UTILS);
- m_PlatformUtils_reallocate = FindMethod(env, c_PlatformUtils, M_PLATFORM_UTILS_REALLOC);
- m_PlatformUtils_errData = FindMethod(env, c_PlatformUtils, M_PLATFORM_UTILS_ERR_DATA);
-
- // Find utility classes which are not used from context, but are still required in other places.
- CheckClass(env, C_PLATFORM_NO_CALLBACK_EXCEPTION);
- }
-
- void JniMembers::Destroy(JNIEnv* env) {
- DeleteClass(env, c_PlatformAbstractQryCursor);
- DeleteClass(env, c_PlatformAffinity);
- DeleteClass(env, c_PlatformCache);
- DeleteClass(env, c_PlatformCacheStoreCallback);
- DeleteClass(env, c_IgniteException);
- DeleteClass(env, c_PlatformClusterGroup);
- DeleteClass(env, c_PlatformCompute);
- DeleteClass(env, c_PlatformContinuousQuery);
- DeleteClass(env, c_PlatformDataStreamer);
- DeleteClass(env, c_PlatformEvents);
- DeleteClass(env, c_PlatformIgnition);
- DeleteClass(env, c_PlatformMessaging);
- DeleteClass(env, c_PlatformProcessor);
- DeleteClass(env, c_PlatformTarget);
- DeleteClass(env, c_PlatformTransactions);
- DeleteClass(env, c_PlatformUtils);
- }
-
- JniJvm::JniJvm() : jvm(NULL), javaMembers(JniJavaMembers()), members(JniMembers())
- {
- // No-op.
- }
-
- JniJvm::JniJvm(JavaVM* jvm, JniJavaMembers javaMembers, JniMembers members) :
- jvm(jvm), javaMembers(javaMembers), members(members)
- {
- // No-op.
- }
-
- JavaVM* JniJvm::GetJvm()
- {
- return jvm;
- }
-
- JniJavaMembers& JniJvm::GetJavaMembers()
- {
- return javaMembers;
- }
-
- JniMembers& JniJvm::GetMembers()
- {
- return members;
- }
-
- /*
- * Create JVM.
- */
- void CreateJvm(char** opts, int optsLen, JavaVM** jvm, JNIEnv** env) {
- JavaVMOption* opts0 = new JavaVMOption[optsLen];
-
- for (int i = 0; i < optsLen; i++)
- opts0[i].optionString = *(opts + i);
-
- JavaVMInitArgs args;
-
- args.version = JNI_VERSION_1_6;
- args.nOptions = optsLen;
- args.options = opts0;
- args.ignoreUnrecognized = 0;
-
- jint res = JNI_CreateJavaVM(jvm, reinterpret_cast<void**>(env), &args);
-
- delete[] opts0;
-
- if (res != JNI_OK)
- throw JvmException();
- }
-
- void RegisterNatives(JNIEnv* env) {
- {
- JNINativeMethod methods[52];
-
- int idx = 0;
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_CREATE, reinterpret_cast<void*>(JniCacheStoreCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_INVOKE, reinterpret_cast<void*>(JniCacheStoreInvoke));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_DESTROY, reinterpret_cast<void*>(JniCacheStoreDestroy));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_STORE_SESSION_CREATE, reinterpret_cast<void*>(JniCacheStoreSessionCreate));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_CREATE, reinterpret_cast<void*>(JniCacheEntryFilterCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_APPLY, reinterpret_cast<void*>(JniCacheEntryFilterApply));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_ENTRY_FILTER_DESTROY, reinterpret_cast<void*>(JniCacheEntryFilterDestroy));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CACHE_INVOKE, reinterpret_cast<void*>(JniCacheInvoke));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_MAP, reinterpret_cast<void*>(JniComputeTaskMap));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_JOB_RESULT, reinterpret_cast<void*>(JniComputeTaskJobResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_REDUCE, reinterpret_cast<void*>(JniComputeTaskReduce));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_TASK_COMPLETE, reinterpret_cast<void*>(JniComputeTaskComplete));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_SERIALIZE, reinterpret_cast<void*>(JniComputeJobSerialize));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CREATE, reinterpret_cast<void*>(JniComputeJobCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_EXECUTE, reinterpret_cast<void*>(JniComputeJobExecute));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_DESTROY, reinterpret_cast<void*>(JniComputeJobDestroy));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_COMPUTE_JOB_CANCEL, reinterpret_cast<void*>(JniComputeJobCancel));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_LSNR_APPLY, reinterpret_cast<void*>(JniContinuousQueryListenerApply));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_CREATE, reinterpret_cast<void*>(JniContinuousQueryFilterCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_EVAL, reinterpret_cast<void*>(JniContinuousQueryFilterApply));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CONTINUOUS_QUERY_FILTER_RELEASE, reinterpret_cast<void*>(JniContinuousQueryFilterRelease));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_TOPOLOGY_UPDATE, reinterpret_cast<void*>(JniDataStreamerTopologyUpdate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_DATA_STREAMER_STREAM_RECEIVER_INVOKE, reinterpret_cast<void*>(JniDataStreamerStreamReceiverInvoke));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_BYTE_RES, reinterpret_cast<void*>(JniFutureByteResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_BOOL_RES, reinterpret_cast<void*>(JniFutureBoolResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_SHORT_RES, reinterpret_cast<void*>(JniFutureShortResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_CHAR_RES, reinterpret_cast<void*>(JniFutureCharResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_INT_RES, reinterpret_cast<void*>(JniFutureIntResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_FLOAT_RES, reinterpret_cast<void*>(JniFutureFloatResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_LONG_RES, reinterpret_cast<void*>(JniFutureLongResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_DOUBLE_RES, reinterpret_cast<void*>(JniFutureDoubleResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_OBJ_RES, reinterpret_cast<void*>(JniFutureObjectResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_NULL_RES, reinterpret_cast<void*>(JniFutureNullResult));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_FUTURE_ERR, reinterpret_cast<void*>(JniFutureError));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_LIFECYCLE_EVENT, reinterpret_cast<void*>(JniLifecycleEvent));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_CREATE, reinterpret_cast<void*>(JniMessagingFilterCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_APPLY, reinterpret_cast<void*>(JniMessagingFilterApply));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_MESSAGING_FILTER_DESTROY, reinterpret_cast<void*>(JniMessagingFilterDestroy));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_CREATE, reinterpret_cast<void*>(JniEventFilterCreate));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_APPLY, reinterpret_cast<void*>(JniEventFilterApply));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EVENT_FILTER_DESTROY, reinterpret_cast<void*>(JniEventFilterDestroy));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_SERVICE_INIT, reinterpret_cast<void*>(JniServiceInit));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_SERVICE_EXECUTE, reinterpret_cast<void*>(JniServiceExecute));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_SERVICE_CANCEL, reinterpret_cast<void*>(JniServiceCancel));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_SERVICE_INVOKE_METHOD, reinterpret_cast<void*>(JniServiceInvokeMethod));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_CLUSTER_NODE_FILTER_APPLY, reinterpret_cast<void*>(JniClusterNodeFilterApply));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_NODE_INFO, reinterpret_cast<void*>(JniNodeInfo));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_MEMORY_REALLOCATE, reinterpret_cast<void*>(JniMemoryReallocate));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_ON_START, reinterpret_cast<void*>(JniOnStart));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_ON_STOP, reinterpret_cast<void*>(JniOnStop));
-
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_OUT_LONG, reinterpret_cast<void*>(JniExtensionCallbackInLongOutLong));
- AddNativeMethod(methods + idx++, M_PLATFORM_CALLBACK_UTILS_EXTENSION_CALLBACK_IN_LONG_LONG_OUT_LONG, reinterpret_cast<void*>(JniExtensionCallbackInLongLongOutLong));
-
- jint res = env->RegisterNatives(FindClass(env, C_PLATFORM_CALLBACK_UTILS), methods, idx);
-
- if (res != JNI_OK)
- throw JvmException();
- }
- }
-
- JniContext::JniContext(JniJvm* jvm, JniHandlers hnds) : jvm(jvm), hnds(hnds) {
- // No-op.
- }
-
- JniContext* JniContext::Create(char** opts, int optsLen, JniHandlers hnds) {
- return Create(opts, optsLen, hnds, NULL);
- }
-
- JniContext* JniContext::Create(char** opts, int optsLen, JniHandlers hnds, JniErrorInfo* errInfo)
- {
- // Acquire global lock to instantiate the JVM.
- JVM_LOCK.Enter();
-
- // Define local variables.
- JavaVM* jvm = NULL;
- JNIEnv* env = NULL;
-
- JniJavaMembers javaMembers;
- memset(&javaMembers, 0, sizeof(javaMembers));
-
- JniMembers members;
- memset(&members, 0, sizeof(members));
-
- JniContext* ctx = NULL;
-
- std::string errClsName;
- int errClsNameLen = 0;
- std::string errMsg;
- int errMsgLen = 0;
-
- try {
- if (!JVM.GetJvm()) {
- // 1. Create JVM itself.
- CreateJvm(opts, optsLen, &jvm, &env);
-
- // 2. Populate members;
- javaMembers.Initialize(env);
- members.Initialize(env);
-
- // 3. Register native functions.
- RegisterNatives(env);
-
- // 4. Create JNI JVM.
- JVM = JniJvm(jvm, javaMembers, members);
-
- char* printStack = getenv("IGNITE_CPP_PRINT_STACK");
- PRINT_EXCEPTION = printStack && strcmp("true", printStack) == 0;
- }
-
- ctx = new JniContext(&JVM, hnds);
- }
- catch (JvmException)
- {
- char* errClsNameChars = NULL;
- char* errMsgChars = NULL;
-
- // Read error info if possible.
- javaMembers.WriteErrorInfo(env, &errClsNameChars, &errClsNameLen, &errMsgChars, &errMsgLen);
-
- if (errClsNameChars) {
- errClsName = errClsNameChars;
-
- delete[] errClsNameChars;
- }
-
- if (errMsgChars)
- {
- errMsg = errMsgChars;
-
- delete[] errMsgChars;
- }
-
- // Destroy mmebers.
- if (env) {
- members.Destroy(env);
- javaMembers.Destroy(env);
- }
-
- // Destroy faulty JVM.
- if (jvm)
- jvm->DestroyJavaVM();
- }
-
- // It safe to release the lock at this point.
- JVM_LOCK.Leave();
-
- // Notify err callback if needed.
- if (!ctx) {
- if (errInfo) {
- JniErrorInfo errInfo0(IGNITE_JNI_ERR_JVM_INIT, errClsName.c_str(), errMsg.c_str());
-
- *errInfo = errInfo0;
- }
-
- if (hnds.error)
- hnds.error(hnds.target, IGNITE_JNI_ERR_JVM_INIT, errClsName.c_str(), errClsNameLen,
- errMsg.c_str(), errMsgLen, NULL, 0);
- }
-
- return ctx;
- }
-
- int JniContext::Reallocate(long long memPtr, int cap) {
- JavaVM* jvm = JVM.GetJvm();
-
- JNIEnv* env;
-
- int attachRes = jvm->AttachCurrentThread(reinterpret_cast<void**>(&env), NULL);
-
- if (attachRes == JNI_OK)
- AttachHelper::OnThreadAttach();
- else
- return -1;
-
- env->CallStaticVoidMethod(JVM.GetMembers().c_PlatformUtils, JVM.GetMembers().m_PlatformUtils_reallocate, memPtr, cap);
-
- if (env->ExceptionCheck()) {
- env->ExceptionClear();
-
- return -1;
- }
-
- return 0;
- }
-
- void JniContext::Detach() {
- gcc::Memory::Fence();
-
- if (JVM.GetJvm()) {
- JNIEnv* env;
-
- JVM.GetJvm()->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
-
- if (env)
- JVM.GetJvm()->DetachCurrentThread();
- }
- }
-
- jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr) {
- return IgnitionStart(cfgPath, name, factoryId, dataPtr, NULL);
- }
-
- jobject JniContext::IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring cfgPath0 = env->NewStringUTF(cfgPath);
- jstring name0 = env->NewStringUTF(name);
-
- jobject interop = env->CallStaticObjectMethod(
- jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_start,
- cfgPath0,
- name0,
- factoryId,
- reinterpret_cast<long long>(&hnds),
- dataPtr
- );
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, interop);
- }
-
-
- jobject JniContext::IgnitionInstance(char* name)
- {
- return IgnitionInstance(name, NULL);
- }
-
- jobject JniContext::IgnitionInstance(char* name, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = env->NewStringUTF(name);
-
- jobject interop = env->CallStaticObjectMethod(jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_instance, name0);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, interop);
- }
-
- long long JniContext::IgnitionEnvironmentPointer(char* name)
- {
- return IgnitionEnvironmentPointer(name, NULL);
- }
-
- long long JniContext::IgnitionEnvironmentPointer(char* name, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = env->NewStringUTF(name);
-
- long long res = env->CallStaticLongMethod(jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_environmentPointer, name0);
-
- ExceptionCheck(env, errInfo);
-
- return res;
- }
-
- bool JniContext::IgnitionStop(char* name, bool cancel)
- {
- return IgnitionStop(name, cancel, NULL);
- }
-
- bool JniContext::IgnitionStop(char* name, bool cancel, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = env->NewStringUTF(name);
-
- jboolean res = env->CallStaticBooleanMethod(jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_stop, name0, cancel);
-
- ExceptionCheck(env, errInfo);
-
- return res != 0;
- }
-
- void JniContext::IgnitionStopAll(bool cancel)
- {
- return IgnitionStopAll(cancel, NULL);
- }
-
- void JniContext::IgnitionStopAll(bool cancel, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- env->CallStaticVoidMethod(jvm->GetMembers().c_PlatformIgnition,
- jvm->GetMembers().m_PlatformIgnition_stopAll, cancel);
-
- ExceptionCheck(env, errInfo);
- }
-
- void JniContext::ProcessorReleaseStart(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformProcessor_releaseStart);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::ProcessorProjection(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject prj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_projection);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, prj);
- }
-
- jobject JniContext::ProcessorCache0(jobject obj, const char* name, jmethodID mthd, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject cache = env->CallObjectMethod(obj, mthd, name0);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env, errInfo);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::ProcessorCache(jobject obj, const char* name) {
- return ProcessorCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorCache(jobject obj, const char* name, JniErrorInfo* errInfo) {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_cache, errInfo);
- }
-
- jobject JniContext::ProcessorCreateCache(jobject obj, const char* name) {
- return ProcessorCreateCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo)
- {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_createCache, errInfo);
- }
-
- jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name) {
- return ProcessorGetOrCreateCache(obj, name, NULL);
- }
-
- jobject JniContext::ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo)
- {
- return ProcessorCache0(obj, name, jvm->GetMembers().m_PlatformProcessor_getOrCreateCache, errInfo);
- }
-
- jobject JniContext::ProcessorAffinity(jobject obj, const char* name) {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject aff = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_affinity, name0);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, aff);
- }
-
- jobject JniContext::ProcessorDataStreamer(jobject obj, const char* name, bool keepPortable) {
- JNIEnv* env = Attach();
-
- jstring name0 = name != NULL ? env->NewStringUTF(name) : NULL;
-
- jobject ldr = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_dataStreamer, name0,
- keepPortable);
-
- if (name0)
- env->DeleteLocalRef(name0);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, ldr);
- }
-
- jobject JniContext::ProcessorTransactions(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject tx = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_transactions);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, tx);
- }
-
- jobject JniContext::ProcessorCompute(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_compute, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorMessage(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_message, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorEvents(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_events, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorServices(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_services, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::ProcessorExtensions(jobject obj)
- {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformProcessor_extensions);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- long long JniContext::TargetInStreamOutLong(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- long long res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTarget_inStreamOutLong, opType, memPtr);
-
- ExceptionCheck(env, err);
-
- return res;
- }
-
- void JniContext::TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_inStreamOutStream, opType, inMemPtr, outMemPtr);
-
- ExceptionCheck(env, err);
- }
-
- jobject JniContext::TargetInStreamOutObject(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformTarget_inStreamOutObject, opType, memPtr);
-
- ExceptionCheck(env, err);
-
- return LocalToGlobal(env, res);
- }
-
- void JniContext::TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_inObjectStreamOutStream, opType, arg, inMemPtr, outMemPtr);
-
- ExceptionCheck(env, err);
- }
-
- long long JniContext::TargetOutLong(jobject obj, int opType, JniErrorInfo* err)
- {
- JNIEnv* env = Attach();
-
- jlong res = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTarget_outLong, opType);
-
- ExceptionCheck(env, err);
-
- return res;
- }
-
- void JniContext::TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_outStream, opType, memPtr);
-
- ExceptionCheck(env, err);
- }
-
- jobject JniContext::TargetOutObject(jobject obj, int opType, JniErrorInfo* err)
- {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformTarget_outObject, opType);
-
- ExceptionCheck(env, err);
-
- return LocalToGlobal(env, res);
- }
-
- void JniContext::TargetListenFuture(jobject obj, long long futId, int typ) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_listenFuture, futId, typ);
-
- ExceptionCheck(env);
- }
-
- void JniContext::TargetListenFutureForOperation(jobject obj, long long futId, int typ, int opId) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTarget_listenFutureForOperation, futId, typ, opId);
-
- ExceptionCheck(env);
- }
-
- int JniContext::AffinityPartitions(jobject obj) {
- JNIEnv* env = Attach();
-
- jint parts = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformAffinity_partitions);
-
- ExceptionCheck(env);
-
- return parts;
- }
-
- jobject JniContext::CacheWithSkipStore(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withSkipStore);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::CacheWithNoRetries(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withNoRetries);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::CacheWithExpiryPolicy(jobject obj, long long create, long long update, long long access) {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withExpiryPolicy,
- create, update, access);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::CacheWithAsync(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withAsync);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- jobject JniContext::CacheWithKeepPortable(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject cache = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_withKeepPortable);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, cache);
- }
-
- void JniContext::CacheClear(jobject obj, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_clear);
-
- ExceptionCheck(env, err);
- }
-
- void JniContext::CacheRemoveAll(jobject obj, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_removeAll);
-
- ExceptionCheck(env, err);
- }
-
- jobject JniContext::CacheOutOpQueryCursor(jobject obj, int type, long long memPtr, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(
- obj, jvm->GetMembers().m_PlatformTarget_inStreamOutObject, type, memPtr);
-
- ExceptionCheck(env, err);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::CacheOutOpContinuousQuery(jobject obj, int type, long long memPtr) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(
- obj, jvm->GetMembers().m_PlatformTarget_inStreamOutObject, type, memPtr);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::CacheIterator(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_iterator);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- jobject JniContext::CacheLocalIterator(jobject obj, int peekModes) {
- JNIEnv*env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformCache_localIterator, peekModes);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
- void JniContext::CacheEnterLock(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_enterLock, id);
-
- ExceptionCheck(env);
- }
-
- void JniContext::CacheExitLock(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_exitLock, id);
-
- ExceptionCheck(env);
- }
-
- bool JniContext::CacheTryEnterLock(jobject obj, long long id, long long timeout) {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformCache_tryEnterLock, id, timeout);
-
- ExceptionCheck(env);
-
- return res != 0;
- }
-
- void JniContext::CacheCloseLock(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_closeLock, id);
-
- ExceptionCheck(env);
- }
-
- void JniContext::CacheRebalance(jobject obj, long long futId) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCache_rebalance, futId);
-
- ExceptionCheck(env);
- }
-
- int JniContext::CacheSize(jobject obj, int peekModes, bool loc, JniErrorInfo* err) {
- JNIEnv* env = Attach();
-
- jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformCache_size, peekModes, loc);
-
- ExceptionCheck(env, err);
-
- return res;
- }
-
- void JniContext::CacheStoreCallbackInvoke(jobject obj, long long memPtr) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCacheStoreCallback_invoke, memPtr);
-
- ExceptionCheck(env);
- }
-
- void JniContext::ComputeWithNoFailover(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCompute_withNoFailover);
-
- ExceptionCheck(env);
- }
-
- void JniContext::ComputeWithTimeout(jobject obj, long long timeout) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCompute_withTimeout, timeout);
-
- ExceptionCheck(env);
- }
-
- void JniContext::ComputeExecuteNative(jobject obj, long long taskPtr, long long topVer) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformCompute_executeNative, taskPtr, topVer);
-
- ExceptionCheck(env);
- }
-
- void JniContext::ContinuousQueryClose(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformContinuousQuery_close);
-
- ExceptionCheck(env);
- }
-
- void* JniContext::ContinuousQueryGetInitialQueryCursor(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformContinuousQuery_getInitialQueryCursor);
-
- ExceptionCheck(env);
-
- return res;
- }
-
- void JniContext::DataStreamerListenTopology(jobject obj, long long ptr) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_listenTopology, ptr);
-
- ExceptionCheck(env);
- }
-
- bool JniContext::DataStreamerAllowOverwriteGet(jobject obj) {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getAllowOverwrite);
-
- ExceptionCheck(env);
-
- return res != 0;
- }
-
- void JniContext::DataStreamerAllowOverwriteSet(jobject obj, bool val) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setAllowOverwrite, val);
-
- ExceptionCheck(env);
- }
-
- bool JniContext::DataStreamerSkipStoreGet(jobject obj) {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getSkipStore);
-
- ExceptionCheck(env);
-
- return res != 0;
- }
-
- void JniContext::DataStreamerSkipStoreSet(jobject obj, bool val) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setSkipStore, val);
-
- ExceptionCheck(env);
- }
-
- int JniContext::DataStreamerPerNodeBufferSizeGet(jobject obj) {
- JNIEnv* env = Attach();
-
- jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getPerNodeBufSize);
-
- ExceptionCheck(env);
-
- return res;
- }
-
- void JniContext::DataStreamerPerNodeBufferSizeSet(jobject obj, int val) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setPerNodeBufSize, val);
-
- ExceptionCheck(env);
- }
-
- int JniContext::DataStreamerPerNodeParallelOperationsGet(jobject obj) {
- JNIEnv* env = Attach();
-
- jint res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_getPerNodeParallelOps);
-
- ExceptionCheck(env);
-
- return res;
- }
-
- void JniContext::DataStreamerPerNodeParallelOperationsSet(jobject obj, int val) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformDataStreamer_setPerNodeParallelOps, val);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::MessagingWithAsync(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject msg = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformMessaging_withAsync);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, msg);
- }
-
- jobject JniContext::ProjectionForOthers(jobject obj, jobject prj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forOthers, prj);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- jobject JniContext::ProjectionForRemotes(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forRemotes);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- jobject JniContext::ProjectionForDaemons(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forDaemons);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- jobject JniContext::ProjectionForRandom(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forRandom);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- jobject JniContext::ProjectionForOldest(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forOldest);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- jobject JniContext::ProjectionForYoungest(jobject obj) {
- JNIEnv* env = Attach();
-
- jobject newPrj = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_forYoungest);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, newPrj);
- }
-
- void JniContext::ProjectionResetMetrics(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformClusterGroup_resetMetrics);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::ProjectionOutOpRet(jobject obj, int type, long long memPtr) {
- JNIEnv* env = Attach();
-
- jobject res = env->CallObjectMethod(
- obj, jvm->GetMembers().m_PlatformTarget_inStreamOutObject, type, memPtr);
-
- ExceptionCheck(env);
-
- return LocalToGlobal(env, res);
- }
-
-
- void JniContext::QueryCursorIterator(jobject obj, JniErrorInfo* errInfo) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_iter);
-
- ExceptionCheck(env, errInfo);
- }
-
- bool JniContext::QueryCursorIteratorHasNext(jobject obj, JniErrorInfo* errInfo)
- {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_iterHasNext);
-
- ExceptionCheck(env, errInfo);
-
- return res != 0;
- }
-
- void JniContext::QueryCursorClose(jobject obj, JniErrorInfo* errInfo) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformAbstractQryCursor_close);
-
- ExceptionCheck(env, errInfo);
- }
-
- long long JniContext::TransactionsStart(jobject obj, int concurrency, int isolation, long long timeout, int txSize) {
- JNIEnv* env = Attach();
-
- long long id = env->CallLongMethod(obj, jvm->GetMembers().m_PlatformTransactions_txStart, concurrency, isolation, timeout, txSize);
-
- ExceptionCheck(env);
-
- return id;
- }
-
- int JniContext::TransactionsCommit(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- int res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txCommit, id);
-
- ExceptionCheck(env);
-
- return res;
- }
-
- void JniContext::TransactionsCommitAsync(jobject obj, long long id, long long futId) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_txCommitAsync, id, futId);
-
- ExceptionCheck(env);
- }
-
- int JniContext::TransactionsRollback(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- int res = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txRollback, id);
-
- ExceptionCheck(env);
-
- return res;
- }
-
- void JniContext::TransactionsRollbackAsync(jobject obj, long long id, long long futId) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_txRollbackAsync, id, futId);
-
- ExceptionCheck(env);
- }
-
- int JniContext::TransactionsClose(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- jint state = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txClose, id);
-
- ExceptionCheck(env);
-
- return state;
- }
-
- int JniContext::TransactionsState(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- jint state = env->CallIntMethod(obj, jvm->GetMembers().m_PlatformTransactions_txState, id);
-
- ExceptionCheck(env);
-
- return state;
- }
-
- bool JniContext::TransactionsSetRollbackOnly(jobject obj, long long id) {
- JNIEnv* env = Attach();
-
- jboolean res = env->CallBooleanMethod(obj, jvm->GetMembers().m_PlatformTransactions_txSetRollbackOnly, id);
-
- ExceptionCheck(env);
-
- return res != 0;
- }
-
- void JniContext::TransactionsResetMetrics(jobject obj) {
- JNIEnv* env = Attach();
-
- env->CallVoidMethod(obj, jvm->GetMembers().m_PlatformTransactions_resetMetrics);
-
- ExceptionCheck(env);
- }
-
- jobject JniContext::EventsWithAsync(jobject obj) {
- JNIEnv * env = Attach();
-
- jobject res = env->CallObjectMethod(obj, jvm->GetMembers().m_PlatformEvents_withAsync);
-
<TRUNCATED>
[42/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/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
deleted file mode 100644
index 8f32922..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/operations.h
+++ /dev/null
@@ -1,452 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 622cb54..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_common.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index d8f7883..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_id_resolver.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index a557129..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_handler.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 3e2b770..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_manager.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 1e000fc..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_snapshot.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index a734db7..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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/f0bac562/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
deleted file mode 100644
index 832c2a3..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_metadata_updater_impl.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h b/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
deleted file mode 100644
index 7d82aa2..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/impl/portable/portable_reader_impl.h
+++ /dev/null
@@ -1,1130 +0,0 @@
-/*
- * 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_READER
-#define _IGNITE_IMPL_PORTABLE_READER
-
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-#include "ignite/impl/interop/interop_input_stream.h"
-#include "ignite/impl/portable/portable_common.h"
-#include "ignite/impl/portable/portable_id_resolver.h"
-#include "ignite/impl/portable/portable_utils.h"
-#include "ignite/impl/utils.h"
-#include "ignite/portable/portable_consts.h"
-#include "ignite/portable/portable_type.h"
-#include "ignite/guid.h"
-
-namespace ignite
-{
- namespace impl
- {
- namespace portable
- {
- /**
- * Internal implementation of portable reader.
- */
- class IGNITE_IMPORT_EXPORT PortableReaderImpl
- {
- public:
- /**
- * Constructor.
- *
- * @param stream Interop stream.
- * @param idRslvr Portable ID resolver.
- * @param pos Object position in the stream.
- * @param usrType user type flag.
- * @param typeId Type ID.
- * @param hashcode Hash code.
- * @param len Length in bytes.
- * @param rawOff Raw data offset.
- */
- PortableReaderImpl(interop::InteropInputStream* stream, PortableIdResolver* idRslvr,
- int32_t pos, bool usrType, int32_t typeId, int32_t hashCode, int32_t len, int32_t rawOff);
-
- /**
- * Constructor used to construct light-weight reader allowing only raw operations
- * and read of primitives.
- *
- * @param stream Interop stream.
- */
- PortableReaderImpl(interop::InteropInputStream* stream);
-
- /**
- * Read 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @return Result.
- */
- int8_t ReadInt8();
-
- /**
- * Read array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt8Array(int8_t* res, const int32_t len);
-
- /**
- * Read 8-byte signed integer. Maps to "byte" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int8_t ReadInt8(const char* fieldName);
-
- /**
- * Read array of 8-byte signed integers. Maps to "byte[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt8Array(const char* fieldName, int8_t* res, const int32_t len);
-
- /**
- * Read bool. Maps to "boolean" type in Java.
- *
- * @return Result.
- */
- bool ReadBool();
-
- /**
- * Read bool array. Maps to "boolean[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadBoolArray(bool* res, const int32_t len);
-
- /**
- * Read bool. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- bool ReadBool(const char* fieldName);
-
- /**
- * Read bool array. Maps to "bool[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadBoolArray(const char* fieldName, bool* res, const int32_t len);
-
- /**
- * Read 16-byte signed integer. Maps to "short" type in Java.
- *
- * @return Result.
- */
- int16_t ReadInt16();
-
- /**
- * Read array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt16Array(int16_t* res, const int32_t len);
-
- /**
- * Read 16-byte signed integer. Maps to "short" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int16_t ReadInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte signed integers. Maps to "short[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt16Array(const char* fieldName, int16_t* res, const int32_t len);
-
- /**
- * Read 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @return Result.
- */
- uint16_t ReadUInt16();
-
- /**
- * Read array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadUInt16Array(uint16_t* res, const int32_t len);
-
- /**
- * Read 16-byte unsigned integer. Maps to "char" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- uint16_t ReadUInt16(const char* fieldName);
-
- /**
- * Read array of 16-byte unsigned integers. Maps to "char[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadUInt16Array(const char* fieldName, uint16_t* res, const int32_t len);
-
- /**
- * Read 32-byte signed integer. Maps to "int" type in Java.
- *
- * @return Result.
- */
- int32_t ReadInt32();
-
- /**
- * Read array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt32Array(int32_t* res, const int32_t len);
-
- /**
- * Read 32-byte signed integer. Maps to "int" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int32_t ReadInt32(const char* fieldName);
-
- /**
- * Read array of 32-byte signed integers. Maps to "int[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt32Array(const char* fieldName, int32_t* res, const int32_t len);
-
- /**
- * Read 64-byte signed integer. Maps to "long" type in Java.
- *
- * @return Result.
- */
- int64_t ReadInt64();
-
- /**
- * Read array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt64Array(int64_t* res, const int32_t len);
-
- /**
- * Read 64-byte signed integer. Maps to "long" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- int64_t ReadInt64(const char* fieldName);
-
- /**
- * Read array of 64-byte signed integers. Maps to "long[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadInt64Array(const char* fieldName, int64_t* res, const int32_t len);
-
- /**
- * Read float. Maps to "float" type in Java.
- *
- * @return Result.
- */
- float ReadFloat();
-
- /**
- * Read float array. Maps to "float[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadFloatArray(float* res, const int32_t len);
-
- /**
- * Read float. Maps to "float" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- float ReadFloat(const char* fieldName);
-
- /**
- * Read float array. Maps to "float[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadFloatArray(const char* fieldName, float* res, const int32_t len);
-
- /**
- * Read double. Maps to "double" type in Java.
- *
- * @return Result.
- */
- double ReadDouble();
-
- /**
- * Read double array. Maps to "double[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadDoubleArray(double* res, const int32_t len);
-
- /**
- * Read double. Maps to "double" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- double ReadDouble(const char* fieldName);
-
- /**
- * Read double array. Maps to "double[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadDoubleArray(const char* fieldName, double* res, const int32_t len);
-
- /**
- * Read Guid. Maps to "UUID" type in Java.
- *
- * @return Result.
- */
- Guid ReadGuid();
-
- /**
- * Read array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadGuidArray(Guid* res, const int32_t len);
-
- /**
- * Read Guid. Maps to "UUID" type in Java.
- *
- * @param fieldName Field name.
- * @return Result.
- */
- Guid ReadGuid(const char* fieldName);
-
- /**
- * Read array of Guids. Maps to "UUID[]" type in Java.
- *
- * @param fieldName Field name.
- * @param res Array to store data to.
- * @param len Expected length of array.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadGuidArray(const char* fieldName, Guid* res, const int32_t len);
-
- /**
- * Read string.
- *
- * @param len Expected length of string.
- * @param res Array to store data to (should be able to acocmodate null-terminator).
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadString(char* res, const int32_t len);
-
- /**
- * Read string.
- *
- * @param fieldName Field name.
- * @param res Array to store data to (should be able to acocmodate null-terminator).
- * @param len Expected length of string.
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadString(const char* fieldName, char* res, const int32_t len);
-
- /**
- * Start string array read.
- *
- * @param size Array size.
- * @return Read session ID.
- */
- int32_t ReadStringArray(int32_t* size);
-
- /**
- * Start string array read.
- *
- * @param fieldName Field name.
- * @param size Array size.
- * @return Read session ID.
- */
- int32_t ReadStringArray(const char* fieldName, int32_t* size);
-
- /**
- * Read string element.
- *
- * @param id Session ID.
- * @param len Expected length of string.
- * @param res Array to store data to (should be able to acocmodate null-terminator).
- * @return Actual amount of elements read. If "len" argument is less than actual
- * array size or resulting array is set to null, nothing will be written
- * to resulting array and returned value will contain required array length.
- * -1 will be returned in case array in stream was null.
- */
- int32_t ReadStringElement(int32_t id, char* res, const int32_t len);
-
- /**
- * Start array read.
- *
- * @param size Array size.
- * @return Read session ID.
- */
- int32_t ReadArray(int32_t* size);
-
- /**
- * Start array read.
- *
- * @param fieldName Field name.
- * @param size Array size.
- * @return Read session ID.
- */
- int32_t ReadArray(const char* fieldName, int32_t* size);
-
- /**
- * Start collection read.
- *
- * @param typ Collection type.
- * @param size Collection size.
- * @return Read session ID.
- */
- int32_t ReadCollection(ignite::portable::CollectionType* typ, int32_t* size);
-
- /**
- * Start collection read.
- *
- * @param fieldName Field name.
- * @param typ Collection type.
- * @param size Collection size.
- * @return Read session ID.
- */
- int32_t ReadCollection(const char* fieldName, ignite::portable::CollectionType* typ, int32_t* size);
-
- /**
- * Start map read.
- *
- * @param typ Map type.
- * @param size Map size.
- * @return Read session ID.
- */
- int32_t ReadMap(ignite::portable::MapType* typ, int32_t* size);
-
- /**
- * Start map read.
- *
- * @param fieldName Field name.
- * @param typ Map type.
- * @param size Map size.
- * @return Read session ID.
- */
- int32_t ReadMap(const char* fieldName, ignite::portable::MapType* typ, int32_t* size);
-
- /**
- * Check whether next value exists.
- *
- * @param id Session ID.
- * @return True if next element exists for the given session.
- */
- bool HasNextElement(int32_t id);
-
- /**
- * Read element.
- *
- * @param id Session ID.
- * @return Value.
- */
- template<typename T>
- T ReadElement(const int32_t id)
- {
- CheckSession(id);
-
- if (++elemRead == elemCnt) {
- elemId = 0;
- elemCnt = -1;
- elemRead = 0;
- }
-
- return ReadTopObject<T>();
- }
-
- /**
- * Read element.
- *
- * @param id Session ID.
- * @param key Key.
- * @param val Value.
- */
- template<typename K, typename V>
- void ReadElement(const int32_t id, K* key, V* val)
- {
- CheckSession(id);
-
- if (++elemRead == elemCnt) {
- elemId = 0;
- elemCnt = -1;
- elemRead = 0;
- }
-
- *key = ReadTopObject<K>();
- *val = ReadTopObject<V>();
- }
-
- /**
- * Read object.
- *
- * @return Object.
- */
- template<typename T>
- T ReadObject()
- {
- CheckRawMode(true);
-
- return ReadTopObject<T>();
- }
-
- /**
- * Read object.
- *
- * @param fieldName Field name.
- * @return Object.
- */
- template<typename T>
- T ReadObject(const char* fieldName)
- {
- CheckRawMode(false);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
-
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- return ReadTopObject<T>();
-
- return GetNull<T>();
- }
-
- /**
- * Set raw mode.
- */
- void SetRawMode();
-
- /**
- * Read object.
- *
- * @param obj Object to write.
- */
- template<typename T>
- T ReadTopObject()
- {
- int32_t pos = stream->Position();
- int8_t hdr = stream->ReadInt8();
-
- if (hdr == IGNITE_HDR_NULL)
- return GetNull<T>();
- else if (hdr == IGNITE_HDR_HND) {
- IGNITE_ERROR_1(ignite::IgniteError::IGNITE_ERR_PORTABLE, "Circular references are not supported.");
- }
- else if (hdr == IGNITE_TYPE_PORTABLE)
- {
- int32_t portLen = stream->ReadInt32(); // Total length of portable object.
- int32_t curPos = stream->Position();
- int32_t portOff = stream->ReadInt32(curPos + portLen);
-
- stream->Position(curPos + portOff); // Position stream right on the object.
-
- T val = ReadTopObject<T>();
-
- stream->Position(curPos + portLen + 4); // Position stream after portable.
-
- return val;
- }
- else
- {
- bool usrType = stream->ReadBool();
- int32_t typeId = stream->ReadInt32();
- int32_t hashCode = stream->ReadInt32();
- int32_t len = stream->ReadInt32();
- int32_t rawOff = stream->ReadInt32();
-
- ignite::portable::PortableType<T> type;
- TemplatedPortableIdResolver<T> idRslvr(type);
- PortableReaderImpl readerImpl(stream, &idRslvr, pos, usrType, typeId, hashCode, len, rawOff);
- ignite::portable::PortableReader reader(&readerImpl);
-
- T val = type.Read(reader);
-
- stream->Position(pos + len);
-
- return val;
- }
- }
-
- /**
- * Get NULL value for the given type.
- */
- template<typename T>
- T GetNull()
- {
- ignite::portable::PortableType<T> type;
-
- return type.GetNull();
- }
-
- /**
- * Get underlying stream.
- *
- * @return Stream.
- */
- impl::interop::InteropInputStream* GetStream();
- private:
- /** Underlying stream. */
- interop::InteropInputStream* stream;
-
- /** ID resolver. */
- PortableIdResolver* idRslvr;
-
- /** Position in the stream where this object starts. */
- int32_t pos;
-
- /** Whether this is user type or system type. */
- bool usrType;
-
- /** Type ID as defined in the stream. */
- int32_t typeId;
-
- /** Hash code. */
- int32_t hashCode;
-
- /** Total object length in the stream. */
- int32_t len;
-
- /** Raw data offset. */
- int32_t rawOff;
-
- /** Raw mode flag. */
- bool rawMode;
-
- /** Elements read session ID generator. */
- int32_t elemIdGen;
-
- /** Elements read session ID. */
- int32_t elemId;
-
- /** Total amount of elements in collection. */
- int32_t elemCnt;
-
- /** Amount of elements read. */
- int32_t elemRead;
-
- IGNITE_NO_COPY_ASSIGNMENT(PortableReaderImpl)
-
- /**
- * Internal routine to read Guid array.
- *
- * @param stream Stream.
- * @param res Resulting array.
- * @param len Length.
- */
- static void ReadGuidArrayInternal(
- interop::InteropInputStream* stream,
- Guid* res,
- const int32_t len
- );
-
- /**
- * Read single value in raw mode.
- *
- * @param stream Stream.
- * @param func Function to be invoked on stream.
- * @return Result.
- */
- template<typename T>
- T ReadRaw(
- T(*func) (interop::InteropInputStream*)
- )
- {
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- return func(stream);
- }
- }
-
- /**
- * Read single value.
- *
- * @param fieldName Field name.
- * @param func Function to be invoked on stream.
- * @param epxHdr Expected header.
- * @param dflt Default value returned if field is not found.
- * @return Result.
- */
- template<typename T>
- T Read(
- const char* fieldName,
- T(*func) (interop::InteropInputStream*),
- const int8_t expHdr,
- T dflt
- )
- {
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0)
- {
- int8_t typeId = stream->ReadInt8();
-
- if (typeId == expHdr)
- return func(stream);
- else if (typeId != IGNITE_HDR_NULL)
- {
- int32_t pos = stream->Position();
-
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid type ID",
- "position", pos, "expected", expHdr, "actual", typeId)
- }
- }
-
- return dflt;
- }
- }
-
- /**
- * Read array in raw mode.
- *
- * @param res Resulting array.
- * @param len Length.
- * @param func Function to be invoked on stream.
- * @param expHdr Expected header.
- * @return Length.
- */
- template<typename T>
- int32_t ReadRawArray(
- T* res,
- const int32_t len,
- void(*func)(interop::InteropInputStream*, T* const, const int32_t),
- const int8_t expHdr
- )
- {
- {
- CheckRawMode(true);
- CheckSingleMode(true);
-
- return ReadArrayInternal(res, len, stream, func, expHdr);
- }
- }
-
- /**
- * Read array.
- *
- * @param fieldName Field name.
- * @param res Resulting array.
- * @param len Length.
- * @param func Function to be invoked on stream.
- * @param expHdr Expected header.
- * @return Length.
- */
- template<typename T>
- int32_t ReadArray(
- const char* fieldName,
- T* res,
- const int32_t len,
- void(*func)(interop::InteropInputStream*, T* const, const int32_t),
- const int8_t expHdr
- )
- {
- {
- CheckRawMode(false);
- CheckSingleMode(true);
-
- int32_t pos = stream->Position();
-
- int32_t fieldId = idRslvr->GetFieldId(typeId, fieldName);
- int32_t fieldLen = SeekField(fieldId);
-
- if (fieldLen > 0) {
- int32_t realLen = ReadArrayInternal(res, len, stream, func, expHdr);
-
- // If actual read didn't occur return to initial position so that we do not perform
- // N jumps to find the field again, where N is total amount of fields.
- if (realLen != -1 && (!res || realLen > len))
- stream->Position(pos);
-
- return realLen;
- }
-
- return -1;
- }
- }
-
- /**
- * Internal read array routine.
- *
- * @param res Resulting array.
- * @param len Length.
- * @param stream Stream.
- * @param func Function to be invoked on stream.
- * @param expHdr Expected header.
- * @return Length.
- */
- template<typename T>
- static int32_t ReadArrayInternal(
- T* res,
- const int32_t len,
- interop::InteropInputStream* stream,
- void(*func)(interop::InteropInputStream*, T* const, const int32_t),
- const int8_t expHdr
- )
- {
- {
- int8_t hdr = stream->ReadInt8();
-
- if (hdr == expHdr)
- {
- int32_t realLen = stream->ReadInt32();
-
- if (realLen == 0 || (res && len >= realLen))
- func(stream, res, realLen);
- else
- stream->Position(stream->Position() - 5);
-
- return realLen;
- }
- else if (hdr != IGNITE_HDR_NULL)
- ThrowOnInvalidHeader(stream->Position() - 1, expHdr, hdr);
-
- return -1;
- }
- }
-
- /**
- * Read nullable value.
- *
- * @param stream Stream.
- * @param func Function to be invoked on stream.
- * @param expHdr Expected header.
- */
- template<typename T>
- static T ReadNullable(
- interop::InteropInputStream* stream,
- T(*func)(interop::InteropInputStream*),
- const int8_t expHdr
- )
- {
- {
- int8_t hdr = stream->ReadInt8();
-
- if (hdr == expHdr)
- return func(stream);
- else if (hdr == IGNITE_HDR_NULL)
- return Guid();
- else {
- ThrowOnInvalidHeader(stream->Position() - 1, expHdr, hdr);
-
- return Guid();
- }
- }
- }
-
- /**
- * Seek field with the given ID.
- *
- * @param fieldId Field ID.
- * @return Field length or -1 if field is not found.
- */
- int32_t SeekField(const int32_t fieldId);
-
- /**
- * Check raw mode.
- *
- * @param expected Expected raw mode of the reader.
- */
- void CheckRawMode(bool expected);
-
- /**
- * Check whether reader is currently operating in single mode.
- *
- * @param expected Expected value.
- */
- void CheckSingleMode(bool expected);
-
- /**
- * Start new container reader session.
- *
- * @param expRawMode Expected raw mode.
- * @param expHdr Expected header.
- * @param size Container size.
- * @return Session ID.
- */
- int32_t StartContainerSession(const bool expRawMode, const int8_t expHdr, int32_t* size);
-
- /**
- * Check whether session ID matches.
- *
- * @param ses Expected session ID.
- */
- void CheckSession(int32_t expSes);
-
- /**
- * Throw an error due to invalid header.
- *
- * @param pos Position in the stream.
- * @param expHdr Expected header.
- * @param hdr Actual header.
- */
- static void ThrowOnInvalidHeader(int32_t pos, int8_t expHdr, int8_t hdr);
-
- /**
- * Throw an error due to invalid header.
- *
- * @param expHdr Expected header.
- * @param hdr Actual header.
- */
- void ThrowOnInvalidHeader(int8_t expHdr, int8_t hdr);
-
- /**
- * Internal string read routine.
- *
- * @param res Resulting array.
- * @param len Length of array.
- * @return Real array length.
- */
- int32_t ReadStringInternal(char* res, const int32_t len);
-
- /**
- * Read value.
- *
- * @param expHdr Expected header.
- * @param func Function to be applied to the stream.
- */
- template<typename T>
- T ReadTopObject0(const int8_t expHdr, T(*func) (ignite::impl::interop::InteropInputStream*))
- {
- int8_t typeId = stream->ReadInt8();
-
- if (typeId == expHdr)
- return func(stream);
- else if (typeId == IGNITE_HDR_NULL)
- return GetNull<T>();
- else {
- int32_t pos = stream->Position() - 1;
-
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid header", "position", pos, "expected", expHdr, "actual", typeId)
- }
- }
-
- /**
- * Read value.
- *
- * @param expHdr Expected header.
- * @param func Function to be applied to the stream.
- * @param dflt Default value.
- */
- template<typename T>
- T ReadTopObject0(const int8_t expHdr, T(*func) (ignite::impl::interop::InteropInputStream*), T dflt)
- {
- int8_t typeId = stream->ReadInt8();
-
- if (typeId == expHdr)
- return func(stream);
- else if (typeId == IGNITE_HDR_NULL)
- return dflt;
- else {
- int32_t pos = stream->Position() - 1;
-
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid header", "position", pos, "expected", expHdr, "actual", typeId)
- }
- }
- };
-
- template<>
- int8_t IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<int8_t>();
-
- template<>
- bool IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<bool>();
-
- template<>
- int16_t IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<int16_t>();
-
- template<>
- uint16_t IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<uint16_t>();
-
- template<>
- int32_t IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<int32_t>();
-
- template<>
- int64_t IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<int64_t>();
-
- template<>
- float IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<float>();
-
- template<>
- double IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<double>();
-
-
- template<>
- Guid IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<Guid>();
-
- template<>
- inline std::string IGNITE_IMPORT_EXPORT PortableReaderImpl::ReadTopObject<std::string>()
- {
- int8_t typeId = stream->ReadInt8();
-
- if (typeId == IGNITE_TYPE_STRING)
- {
- bool utf8Mode = stream->ReadBool();
- int32_t realLen = stream->ReadInt32();
-
- ignite::impl::utils::SafeArray<char> arr(realLen + 1);
-
- if (utf8Mode)
- {
- for (int i = 0; i < realLen; i++)
- *(arr.target + i) = static_cast<char>(stream->ReadInt8());
- }
- else
- {
- for (int i = 0; i < realLen; i++)
- *(arr.target + i) = static_cast<char>(stream->ReadUInt16());
- }
-
- *(arr.target + realLen) = 0;
-
- return std::string(arr.target);
- }
-
- else if (typeId == IGNITE_HDR_NULL)
- return std::string();
- else {
- int32_t pos = stream->Position() - 1;
-
- IGNITE_ERROR_FORMATTED_3(IgniteError::IGNITE_ERR_PORTABLE, "Invalid header", "position", pos, "expected", IGNITE_TYPE_STRING, "actual", typeId)
- }
- }
- }
- }
-}
-
-#endif
\ No newline at end of file
[36/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
deleted file mode 100644
index 3f20324..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ /dev/null
@@ -1,373 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.Core</RootNamespace>
- <AssemblyName>Apache.Ignite.Core</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants>DEBUG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- <DefineConstants>DEBUG</DefineConstants>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <PlatformTarget>x86</PlatformTarget>
- <OutputPath>bin\x86\Release\</OutputPath>
- <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
- </PropertyGroup>
- <PropertyGroup>
- <SignAssembly>false</SignAssembly>
- </PropertyGroup>
- <PropertyGroup>
- <AssemblyOriginatorKeyFile>
- </AssemblyOriginatorKeyFile>
- </PropertyGroup>
- <PropertyGroup>
- <DelaySign>false</DelaySign>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Cache\CacheAtomicUpdateTimeoutException.cs" />
- <Compile Include="Cache\CacheEntryProcessorException.cs" />
- <Compile Include="Cache\CacheException.cs" />
- <Compile Include="Cache\CachePartialUpdateException.cs" />
- <Compile Include="Cache\CachePeekMode.cs" />
- <Compile Include="Cache\Event\CacheEntryEventType.cs" />
- <Compile Include="Cache\Event\ICacheEntryEvent.cs" />
- <Compile Include="Cache\Event\ICacheEntryEventFilter.cs" />
- <Compile Include="Cache\Event\ICacheEntryEventListener.cs" />
- <Compile Include="Cache\Expiry\ExpiryPolicy.cs" />
- <Compile Include="Cache\Expiry\IExpiryPolicy.cs" />
- <Compile Include="Cache\ICache.cs" />
- <Compile Include="Cache\ICacheAffinity.cs" />
- <Compile Include="Cache\ICacheEntry.cs" />
- <Compile Include="Cache\ICacheEntryFilter.cs" />
- <Compile Include="Cache\ICacheEntryProcessor.cs" />
- <Compile Include="Cache\ICacheEntryProcessorResult.cs" />
- <Compile Include="Cache\ICacheLock.cs" />
- <Compile Include="Cache\ICacheMetrics.cs" />
- <Compile Include="Cache\IMutableCacheEntry.cs" />
- <Compile Include="Cache\Query\Continuous\ContinuousQuery.cs" />
- <Compile Include="Cache\Query\Continuous\IContinuousQueryHandle.cs" />
- <Compile Include="Cache\Query\IQueryCursor.cs" />
- <Compile Include="Cache\Query\QueryBase.cs" />
- <Compile Include="Cache\Query\ScanQuery.cs" />
- <Compile Include="Cache\Query\SqlFieldsQuery.cs" />
- <Compile Include="Cache\Query\SqlQuery.cs" />
- <Compile Include="Cache\Query\TextQuery.cs" />
- <Compile Include="Cache\Store\CacheParallelLoadStoreAdapter.cs" />
- <Compile Include="Cache\Store\CacheStoreAdapter.cs" />
- <Compile Include="Cache\Store\CacheStoreException.cs" />
- <Compile Include="Cache\Store\ICacheStore.cs" />
- <Compile Include="Cache\Store\ICacheStoreSession.cs" />
- <Compile Include="Cluster\ClusterGroupEmptyException.cs" />
- <Compile Include="Cluster\ClusterTopologyException.cs" />
- <Compile Include="Cluster\ICluster.cs" />
- <Compile Include="Cluster\IClusterGroup.cs" />
- <Compile Include="Cluster\IClusterMetrics.cs" />
- <Compile Include="Cluster\IClusterNode.cs" />
- <Compile Include="Cluster\IClusterNodeFilter.cs" />
- <Compile Include="Common\IgniteException.cs" />
- <Compile Include="Common\IAsyncSupport.cs" />
- <Compile Include="Common\IFuture.cs" />
- <Compile Include="Common\IgniteGuid.cs" />
- <Compile Include="Compute\ComputeExecutionRejectedException.cs" />
- <Compile Include="Compute\ComputeJobAdapter.cs" />
- <Compile Include="Compute\ComputeJobFailoverException.cs" />
- <Compile Include="Compute\ComputeJobResultPolicy.cs" />
- <Compile Include="Compute\ComputeTaskAdapter.cs" />
- <Compile Include="Compute\ComputeTaskCancelledException.cs" />
- <Compile Include="Compute\ComputeTaskNoResultCacheAttribute.cs" />
- <Compile Include="Compute\ComputeTaskSplitAdapter.cs" />
- <Compile Include="Compute\ComputeTaskTimeoutException.cs" />
- <Compile Include="Compute\ComputeUserUndeclaredException.cs" />
- <Compile Include="Compute\ICompute.cs" />
- <Compile Include="Compute\IComputeFunc.cs" />
- <Compile Include="Compute\IComputeJob.cs" />
- <Compile Include="Compute\IComputeJobResult.cs" />
- <Compile Include="Compute\IComputeReducer.cs" />
- <Compile Include="Compute\IComputeTask.cs" />
- <Compile Include="Datastream\IDataStreamer.cs" />
- <Compile Include="Datastream\IStreamReceiver.cs" />
- <Compile Include="Datastream\StreamTransformer.cs" />
- <Compile Include="Datastream\StreamVisitor.cs" />
- <Compile Include="Events\CacheEvent.cs" />
- <Compile Include="Events\CacheQueryExecutedEvent.cs" />
- <Compile Include="Events\CacheQueryReadEvent.cs" />
- <Compile Include="Events\CacheRebalancingEvent.cs" />
- <Compile Include="Events\CheckpointEvent.cs" />
- <Compile Include="Events\DiscoveryEvent.cs" />
- <Compile Include="Events\EventBase.cs" />
- <Compile Include="Events\EventReader.cs" />
- <Compile Include="Events\EventType.cs" />
- <Compile Include="Events\IEvent.cs" />
- <Compile Include="Events\IEventFilter.cs" />
- <Compile Include="Events\IEvents.cs" />
- <Compile Include="Events\JobEvent.cs" />
- <Compile Include="Events\SwapSpaceEvent.cs" />
- <Compile Include="Events\TaskEvent.cs" />
- <Compile Include="IgniteConfiguration.cs" />
- <Compile Include="Ignition.cs" />
- <Compile Include="Common\AsyncSupportedAttribute.cs" />
- <Compile Include="IIgnite.cs" />
- <Compile Include="Impl\Cache\CacheAffinityImpl.cs" />
- <Compile Include="Impl\Cache\CacheEntry.cs" />
- <Compile Include="Impl\Cache\CacheEntryFilterHolder.cs" />
- <Compile Include="Impl\Cache\CacheEntryProcessorHolder.cs" />
- <Compile Include="Impl\Cache\CacheEntryProcessorResult.cs" />
- <Compile Include="Impl\Cache\CacheEntryProcessorResultHolder.cs" />
- <Compile Include="Impl\Cache\CacheEnumerable.cs" />
- <Compile Include="Impl\Cache\CacheEnumerator.cs" />
- <Compile Include="Impl\Cache\CacheEnumeratorProxy.cs" />
- <Compile Include="Impl\Cache\CacheImpl.cs" />
- <Compile Include="Impl\Cache\CacheLock.cs" />
- <Compile Include="Impl\Cache\CacheMetricsImpl.cs" />
- <Compile Include="Impl\Cache\CacheOp.cs" />
- <Compile Include="Impl\Cache\CacheProxyImpl.cs" />
- <Compile Include="Impl\Cache\Event\CacheEntryCreateEvent.cs" />
- <Compile Include="Impl\Cache\Event\CacheEntryRemoveEvent.cs" />
- <Compile Include="Impl\Cache\Event\CacheEntryUpdateEvent.cs" />
- <Compile Include="Impl\Cache\MutableCacheEntry.cs" />
- <Compile Include="Impl\Cache\Query\AbstractQueryCursor.cs" />
- <Compile Include="Impl\Cache\Query\Continuous\ContinuousQueryFilter.cs" />
- <Compile Include="Impl\Cache\Query\Continuous\ContinuousQueryFilterHolder.cs" />
- <Compile Include="Impl\Cache\Query\Continuous\ContinuousQueryHandleImpl.cs" />
- <Compile Include="Impl\Cache\Query\Continuous\ContinuousQueryUtils.cs" />
- <Compile Include="Impl\Cache\Query\FieldsQueryCursor.cs" />
- <Compile Include="Impl\Cache\Query\QueryCursor.cs" />
- <Compile Include="Impl\Cache\Store\CacheStore.cs" />
- <Compile Include="Impl\Cache\Store\CacheStoreSession.cs" />
- <Compile Include="Impl\Cache\Store\CacheStoreSessionProxy.cs" />
- <Compile Include="Impl\Cluster\ClusterGroupImpl.cs" />
- <Compile Include="Impl\Cluster\ClusterMetricsImpl.cs" />
- <Compile Include="Impl\Cluster\ClusterNodeImpl.cs" />
- <Compile Include="Impl\Cluster\IClusterGroupEx.cs" />
- <Compile Include="Impl\Collections\CollectionExtensions.cs" />
- <Compile Include="Impl\Collections\MultiValueDictionary.cs" />
- <Compile Include="Impl\Collections\ReadOnlyCollection.cs" />
- <Compile Include="Impl\Collections\ReadOnlyDictionary.cs" />
- <Compile Include="Impl\Common\AsyncResult.cs" />
- <Compile Include="Impl\Common\CompletedAsyncResult.cs" />
- <Compile Include="Impl\Common\CopyOnWriteConcurrentDictionary.cs" />
- <Compile Include="Impl\Common\DelegateConverter.cs" />
- <Compile Include="Impl\Common\DelegateTypeDescriptor.cs" />
- <Compile Include="Impl\Common\Future.cs" />
- <Compile Include="Impl\Common\FutureConverter.cs" />
- <Compile Include="Impl\Common\FutureType.cs" />
- <Compile Include="Impl\Common\IgniteArgumentCheck.cs" />
- <Compile Include="Impl\Common\IFutureConverter.cs" />
- <Compile Include="Impl\Common\IFutureInternal.cs" />
- <Compile Include="Impl\Common\LoadedAssembliesResolver.cs" />
- <Compile Include="Impl\Common\PortableResultWrapper.cs" />
- <Compile Include="Impl\Common\TypeCaster.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeAbstractClosureTask.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeActionJob.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeFuncJob.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeMultiClosureTask.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeOutFuncJob.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeReducingClosureTask.cs" />
- <Compile Include="Impl\Compute\Closure\ComputeSingleClosureTask.cs" />
- <Compile Include="Impl\Compute\Closure\IComputeResourceInjector.cs" />
- <Compile Include="Impl\Compute\Compute.cs" />
- <Compile Include="Impl\Compute\ComputeAsync.cs" />
- <Compile Include="Impl\Compute\ComputeFunc.cs" />
- <Compile Include="Impl\Compute\ComputeImpl.cs" />
- <Compile Include="Impl\Compute\ComputeJob.cs" />
- <Compile Include="Impl\Compute\ComputeJobHolder.cs" />
- <Compile Include="Impl\Compute\ComputeJobResultGenericWrapper.cs" />
- <Compile Include="Impl\Compute\ComputeJobResultImpl.cs" />
- <Compile Include="Impl\Compute\ComputeOutFunc.cs" />
- <Compile Include="Impl\Compute\ComputeTaskHolder.cs" />
- <Compile Include="Impl\Datastream\DataStreamerBatch.cs" />
- <Compile Include="Impl\Datastream\DataStreamerEntry.cs" />
- <Compile Include="Impl\Datastream\DataStreamerImpl.cs" />
- <Compile Include="Impl\Datastream\DataStreamerRemoveEntry.cs" />
- <Compile Include="Impl\Datastream\StreamReceiverHolder.cs" />
- <Compile Include="Impl\Events\Events.cs" />
- <Compile Include="Impl\Events\EventsAsync.cs" />
- <Compile Include="Impl\Events\RemoteListenEventFilter.cs" />
- <Compile Include="Impl\ExceptionUtils.cs" />
- <Compile Include="Impl\IgniteConfigurationEx.cs" />
- <Compile Include="Impl\Ignite.cs" />
- <Compile Include="Impl\IgniteManager.cs" />
- <Compile Include="Impl\IgniteProxy.cs" />
- <Compile Include="Impl\PlatformTarget.cs" />
- <Compile Include="Impl\IgniteUtils.cs" />
- <Compile Include="Impl\Handle\Handle.cs" />
- <Compile Include="Impl\Handle\HandleRegistry.cs" />
- <Compile Include="Impl\Handle\IHandle.cs" />
- <Compile Include="Impl\IInteropCallback.cs" />
- <Compile Include="Impl\InteropExceptionHolder.cs" />
- <Compile Include="Impl\LifecycleBeanHolder.cs" />
- <Compile Include="Impl\Memory\InteropExternalMemory.cs" />
- <Compile Include="Impl\Memory\InteropMemoryUtils.cs" />
- <Compile Include="Impl\Memory\IPlatformMemory.cs" />
- <Compile Include="Impl\Memory\PlatformBigEndianMemoryStream.cs" />
- <Compile Include="Impl\Memory\PlatformMemory.cs" />
- <Compile Include="Impl\Memory\PlatformMemoryManager.cs" />
- <Compile Include="Impl\Memory\PlatformMemoryPool.cs" />
- <Compile Include="Impl\Memory\PlatformMemoryStream.cs" />
- <Compile Include="Impl\Memory\PlatformMemoryUtils.cs" />
- <Compile Include="Impl\Memory\PlatformPooledMemory.cs" />
- <Compile Include="Impl\Memory\PlatformRawMemory.cs" />
- <Compile Include="Impl\Memory\PlatformUnpooledMemory.cs" />
- <Compile Include="Impl\Messaging\MessageFilterHolder.cs" />
- <Compile Include="Impl\Messaging\Messaging.cs" />
- <Compile Include="Impl\Messaging\MessagingAsync.cs" />
- <Compile Include="Impl\NativeMethods.cs" />
- <Compile Include="Impl\Portable\IO\IPortableStream.cs" />
- <Compile Include="Impl\Portable\IO\PortableAbstractStream.cs" />
- <Compile Include="Impl\Portable\IO\PortableHeapStream.cs" />
- <Compile Include="Impl\Portable\IO\PortableStreamAdapter.cs" />
- <Compile Include="Impl\Portable\IPortableSystemTypeSerializer.cs" />
- <Compile Include="Impl\Portable\IPortableTypeDescriptor.cs" />
- <Compile Include="Impl\Portable\IPortableWriteAware.cs" />
- <Compile Include="Impl\Portable\Metadata\IPortableMetadataHandler.cs" />
- <Compile Include="Impl\Portable\Metadata\PortableHashsetMetadataHandler.cs" />
- <Compile Include="Impl\Portable\Metadata\PortableMetadataHolder.cs" />
- <Compile Include="Impl\Portable\Metadata\PortableMetadataImpl.cs" />
- <Compile Include="Impl\Portable\PortableBuilderField.cs" />
- <Compile Include="Impl\Portable\PortableBuilderImpl.cs" />
- <Compile Include="Impl\Portable\PortableCollectionInfo.cs" />
- <Compile Include="Impl\Portable\PortableFullTypeDescriptor.cs" />
- <Compile Include="Impl\Portable\PortableHandleDictionary.cs" />
- <Compile Include="Impl\Portable\PortableMarshalAwareSerializer.cs" />
- <Compile Include="Impl\Portable\PortableMarshaller.cs" />
- <Compile Include="Impl\Portable\PortableMode.cs" />
- <Compile Include="Impl\Portable\PortableObjectHandle.cs" />
- <Compile Include="Impl\Portable\PortableOrSerializableObjectHolder.cs" />
- <Compile Include="Impl\Portable\PortableReaderHandleDictionary.cs" />
- <Compile Include="Impl\Portable\PortableReaderImpl.cs" />
- <Compile Include="Impl\Portable\PortableReflectiveRoutines.cs" />
- <Compile Include="Impl\Portable\PortableReflectiveSerializer.cs" />
- <Compile Include="Impl\Portable\PortablesImpl.cs" />
- <Compile Include="Impl\Portable\PortableSurrogateTypeDescriptor.cs" />
- <Compile Include="Impl\Portable\PortableSystemHandlers.cs" />
- <Compile Include="Impl\Portable\PortableSystemTypeSerializer.cs" />
- <Compile Include="Impl\Portable\PortableUserObject.cs" />
- <Compile Include="Impl\Portable\PortableUtils.cs" />
- <Compile Include="Impl\Portable\PortableWriterImpl.cs" />
- <Compile Include="Impl\Portable\SerializableObjectHolder.cs" />
- <Compile Include="Impl\Portable\TypeResolver.cs" />
- <Compile Include="Impl\Resource\IResourceInjector.cs" />
- <Compile Include="Impl\Resource\ResourceFieldInjector.cs" />
- <Compile Include="Impl\Resource\ResourceMethodInjector.cs" />
- <Compile Include="Impl\Resource\ResourceProcessor.cs" />
- <Compile Include="Impl\Resource\ResourcePropertyInjector.cs" />
- <Compile Include="Impl\Resource\ResourceTypeDescriptor.cs" />
- <Compile Include="Impl\Services\ServiceContext.cs" />
- <Compile Include="Impl\Services\ServiceDescriptor.cs" />
- <Compile Include="Impl\Services\ServiceProxy.cs" />
- <Compile Include="Impl\Services\ServiceProxyInvoker.cs" />
- <Compile Include="Impl\Services\ServiceProxySerializer.cs" />
- <Compile Include="Impl\Services\Services.cs" />
- <Compile Include="Impl\Services\ServicesAsync.cs" />
- <Compile Include="Impl\Transactions\AsyncTransaction.cs" />
- <Compile Include="Impl\Transactions\Transaction.cs" />
- <Compile Include="Impl\Transactions\TransactionImpl.cs" />
- <Compile Include="Impl\Transactions\TransactionMetricsImpl.cs" />
- <Compile Include="Impl\Transactions\TransactionsImpl.cs" />
- <Compile Include="Impl\Unmanaged\IUnmanagedTarget.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedCallbackHandlers.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedCallbacks.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedContext.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedNonReleaseableTarget.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedTarget.cs" />
- <Compile Include="Impl\Unmanaged\UnmanagedUtils.cs" />
- <Compile Include="Lifecycle\ILifecycleBean.cs" />
- <Compile Include="Lifecycle\LifecycleEventType.cs" />
- <Compile Include="Messaging\IMessageFilter.cs" />
- <Compile Include="Messaging\IMessaging.cs" />
- <Compile Include="Portable\IPortableBuilder.cs" />
- <Compile Include="Portable\IPortableIdMapper.cs" />
- <Compile Include="Portable\IPortableMarshalAware.cs" />
- <Compile Include="Portable\IPortableMetadata.cs" />
- <Compile Include="Portable\IPortableNameMapper.cs" />
- <Compile Include="Portable\IPortableObject.cs" />
- <Compile Include="Portable\IPortableRawReader.cs" />
- <Compile Include="Portable\IPortableRawWriter.cs" />
- <Compile Include="Portable\IPortableReader.cs" />
- <Compile Include="Portable\IPortables.cs" />
- <Compile Include="Portable\IPortableSerializer.cs" />
- <Compile Include="Portable\IPortableWriter.cs" />
- <Compile Include="Portable\PortableConfiguration.cs" />
- <Compile Include="Portable\PortableException.cs" />
- <Compile Include="Portable\PortableTypeConfiguration.cs" />
- <Compile Include="Portable\PortableTypeNames.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Resource\InstanceResourceAttribute.cs" />
- <Compile Include="Resource\StoreSessionResourceAttribute.cs" />
- <Compile Include="Services\IService.cs" />
- <Compile Include="Services\IServiceContext.cs" />
- <Compile Include="Services\IServiceDescriptor.cs" />
- <Compile Include="Services\IServices.cs" />
- <Compile Include="Services\ServiceConfiguration.cs" />
- <Compile Include="Services\ServiceInvocationException.cs" />
- <Compile Include="Transactions\ITransaction.cs" />
- <Compile Include="Transactions\ITransactionMetrics.cs" />
- <Compile Include="Transactions\ITransactions.cs" />
- <Compile Include="Transactions\TransactionConcurrency.cs" />
- <Compile Include="Transactions\TransactionHeuristicException.cs" />
- <Compile Include="Transactions\TransactionIsolation.cs" />
- <Compile Include="Transactions\TransactionOptimisticException.cs" />
- <Compile Include="Transactions\TransactionRollbackException.cs" />
- <Compile Include="Transactions\TransactionState.cs" />
- <Compile Include="Transactions\TransactionTimeoutException.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\cpp\common\project\vs\common.vcxproj">
- <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project>
- <Name>common</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <EmbeddedResource Include="$(SolutionDir)\x64\Debug\ignite.common.dll">
- <Link>resources\debug\x64\ignite.common.dll</Link>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <EmbeddedResource Include="$(SolutionDir)\x64\Release\ignite.common.dll">
- <Link>resources\release\x64\ignite.common.dll</Link>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <EmbeddedResource Include="$(SolutionDir)\Win32\Debug\ignite.common.dll">
- <Link>resources\debug\x86\ignite.common.dll</Link>
- </EmbeddedResource>
- </ItemGroup>
- <ItemGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <EmbeddedResource Include="$(SolutionDir)\Win32\Release\ignite.common.dll">
- <Link>resources\release\x86\ignite.common.dll</Link>
- </EmbeddedResource>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheAtomicUpdateTimeoutException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheAtomicUpdateTimeoutException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheAtomicUpdateTimeoutException.cs
deleted file mode 100644
index f0b5987..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheAtomicUpdateTimeoutException.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Indicates atomic operation timeout.
- /// </summary>
- [Serializable]
- public class CacheAtomicUpdateTimeoutException : CacheException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheAtomicUpdateTimeoutException"/> class.
- /// </summary>
- public CacheAtomicUpdateTimeoutException()
- {
- // No-op.
- }
-
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheAtomicUpdateTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public CacheAtomicUpdateTimeoutException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheAtomicUpdateTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public CacheAtomicUpdateTimeoutException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheAtomicUpdateTimeoutException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected CacheAtomicUpdateTimeoutException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheEntryProcessorException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheEntryProcessorException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheEntryProcessorException.cs
deleted file mode 100644
index 341c713..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheEntryProcessorException.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// An exception to indicate a problem occurred attempting to execute an
- /// <see cref="ICacheEntryProcessor{K, V, A, R}"/> against an entry.
- /// </summary>
- [Serializable]
- public class CacheEntryProcessorException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorException"/> class.
- /// </summary>
- public CacheEntryProcessorException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public CacheEntryProcessorException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public CacheEntryProcessorException(string message, Exception cause)
- : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorException"/> class.
- /// </summary>
- /// <param name="innerException">The inner exception.</param>
- public CacheEntryProcessorException(Exception innerException)
- : base("Error occurred in CacheEntryProcessor, see InnerException for details.", innerException)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheEntryProcessorException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected CacheEntryProcessorException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheException.cs
deleted file mode 100644
index c00f115..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CacheException.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates an error during Cache operation.
- /// </summary>
- [Serializable]
- public class CacheException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheException"/> class.
- /// </summary>
- public CacheException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public CacheException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public CacheException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected CacheException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
deleted file mode 100644
index b3ed537..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePartialUpdateException.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
-
- /// <summary>
- /// Exception thrown from non-transactional cache in case when update succeeded only partially.
- /// </summary>
- [Serializable]
- public class CachePartialUpdateException : CacheException
- {
- /** Serializer key. */
- private const string KeyFailedKeys = "FailedKeys";
-
- /** Failed keys. */
- private readonly IList<object> _failedKeys;
-
- /** Failed keys exception. */
- private readonly Exception _failedKeysException;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePartialUpdateException"/> class.
- /// </summary>
- public CachePartialUpdateException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePartialUpdateException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public CachePartialUpdateException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CachePartialUpdateException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected CachePartialUpdateException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- _failedKeys = (IList<object>) info.GetValue(KeyFailedKeys, typeof (IList<object>));
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="msg">Exception message.</param>
- /// <param name="failedKeysException">Exception occurred during failed keys read/write.</param>
- public CachePartialUpdateException(string msg, Exception failedKeysException) : this(msg, null, failedKeysException)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="msg">Exception message.</param>
- /// <param name="failedKeys">Failed keys.</param>
- public CachePartialUpdateException(string msg, IList<object> failedKeys) : this(msg, failedKeys, null)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="msg">Exception message.</param>
- /// <param name="failedKeys">Failed keys.</param>
- /// <param name="failedKeysException">Exception occurred during failed keys read/write.</param>
- private CachePartialUpdateException(string msg, IList<object> failedKeys, Exception failedKeysException) : base(msg)
- {
- _failedKeys = failedKeys;
- _failedKeysException = failedKeysException;
- }
-
- /// <summary>
- /// Gets the failed keys.
- /// </summary>
- public IEnumerable<T> GetFailedKeys<T>()
- {
- if (_failedKeysException != null)
- throw _failedKeysException;
-
- return _failedKeys == null ? null : _failedKeys.Cast<T>();
- }
-
- /** <inheritdoc /> */
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue(KeyFailedKeys, _failedKeys);
-
- base.GetObjectData(info, context);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePeekMode.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePeekMode.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePeekMode.cs
deleted file mode 100644
index 0a089ad..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/CachePeekMode.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Enumeration of all supported cache peek modes.
- /// </summary>
- [Flags]
- [SuppressMessage("Microsoft.Naming", "CA1714:FlagsEnumsShouldHavePluralNames")]
- public enum CachePeekMode
- {
- /// <summary>
- /// Peeks into all available cache storages.
- /// </summary>
- All = 0x01,
-
- /// <summary>
- /// Peek into near cache only (don't peek into partitioned cache).
- /// In case of LOCAL cache, behaves as <see cref="All"/> mode.
- /// </summary>
- Near = 0x02,
-
- /// <summary>
- /// Peek value from primary copy of partitioned cache only (skip near cache).
- /// In case of LOCAL cache, behaves as <see cref="All"/> mode.
- /// </summary>
- Primary = 0x04,
-
- /// <summary>
- /// Peek value from backup copies of partitioned cache only (skip near cache).
- /// In case of LOCAL cache, behaves as <see cref="All"/> mode.
- /// </summary>
- Backup = 0x08,
-
- /// <summary>
- /// Peeks value from the on-heap storage only.
- /// </summary>
- Onheap = 0x10,
-
- /// <summary>
- /// Peeks value from the off-heap storage only, without loading off-heap value into cache.
- /// </summary>
- Offheap = 0x20,
-
- /// <summary>
- /// Peeks value from the swap storage only, without loading swapped value into cache.
- /// </summary>
- Swap = 0x40
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/CacheEntryEventType.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/CacheEntryEventType.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/CacheEntryEventType.cs
deleted file mode 100644
index 8339257..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/CacheEntryEventType.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Event
-{
- /// <summary>
- /// Cache event type.
- /// </summary>
- public enum CacheEntryEventType
- {
- /// <summary>
- /// An event type indicating that the cache entry was created.
- /// </summary>
- Created,
-
- /// <summary>
- /// An event type indicating that the cache entry was updated. i.e. a previous
- /// mapping existed.
- /// </summary>
- Updated,
-
- /// <summary>
- /// An event type indicating that the cache entry was removed.
- /// </summary>
- Removed
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
deleted file mode 100644
index 9c2665e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEvent.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Event
-{
- /// <summary>
- /// Cache entry event.
- /// </summary>
- public interface ICacheEntryEvent<TK, TV> : ICacheEntry<TK, TV>
- {
- /// <summary>
- /// Event type.
- /// </summary>
- CacheEntryEventType EventType { get; }
-
- /// <summary>
- /// Gets old the value.
- /// </summary>
- TV OldValue { get; }
-
- /// <summary>
- /// Whether old value exists.
- /// </summary>
- bool HasOldValue { get; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
deleted file mode 100644
index 98f5c5a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventFilter.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Event
-{
- /// <summary>
- /// Cache entry event filter.
- /// </summary>
- public interface ICacheEntryEventFilter<TK, TV>
- {
- /// <summary>
- /// Evaluates cache entry event.
- /// </summary>
- /// <param name="evt">Event.</param>
- bool Evaluate(ICacheEntryEvent<TK, TV> evt);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
deleted file mode 100644
index 76ae04c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Event/ICacheEntryEventListener.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Event
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Cache entry event listener.
- /// </summary>
- public interface ICacheEntryEventListener<TK, TV>
- {
- /// <summary>
- /// Event callback.
- /// </summary>
- /// <param name="evts">Events.</param>
- void OnEvent(IEnumerable<ICacheEntryEvent<TK, TV>> evts);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/ExpiryPolicy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/ExpiryPolicy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/ExpiryPolicy.cs
deleted file mode 100644
index 1feccbd..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/ExpiryPolicy.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Expiry
-{
- using System;
-
- /// <summary>
- /// Default expiry policy implementation with all durations deinfed explicitly.
- /// </summary>
- public class ExpiryPolicy : IExpiryPolicy
- {
- /** Expiry for create. */
- private readonly TimeSpan? _create;
-
- /** Expiry for update. */
- private readonly TimeSpan? _update;
-
- /** Expiry for access. */
- private readonly TimeSpan? _access;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="create">Expiry for create.</param>
- /// <param name="update">Expiry for udpate.</param>
- /// <param name="access">Expiry for access.</param>
- public ExpiryPolicy(TimeSpan? create, TimeSpan? update, TimeSpan? access)
- {
- _create = create;
- _update = update;
- _access = access;
- }
-
- /// <summary>
- /// Gets expiry for create operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired
- /// and will not be added to cache.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for create opeartion.</returns>
- public TimeSpan? GetExpiryForCreate()
- {
- return _create;
- }
-
- /// <summary>
- /// Gets expiry for update operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for update operation.</returns>
- public TimeSpan? GetExpiryForUpdate()
- {
- return _update;
- }
-
- /// <summary>
- /// Gets expiry for access operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for access operation.</returns>
- public TimeSpan? GetExpiryForAccess()
- {
- return _access;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/IExpiryPolicy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/IExpiryPolicy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/IExpiryPolicy.cs
deleted file mode 100644
index ff627ae..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Expiry/IExpiryPolicy.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Expiry
-{
- using System;
-
- /// <summary>
- /// Defines functions to determine when cache entries will expire based on
- /// creation, access and modification operations.
- /// </summary>
- public interface IExpiryPolicy
- {
- /// <summary>
- /// Gets expiry for create operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired
- /// and will not be added to cache.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for create opeartion.</returns>
- TimeSpan? GetExpiryForCreate();
-
- /// <summary>
- /// Gets expiry for update operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for update operation.</returns>
- TimeSpan? GetExpiryForUpdate();
-
- /// <summary>
- /// Gets expiry for access operation.
- /// <para />
- /// If <c>TimeSpan.ZERO</c> is returned, cache entry is considered immediately expired.
- /// <para />
- /// If <c>null</c> is returned, no change to previously understood expiry is performed.
- /// </summary>
- /// <returns>Expiry for access operation.</returns>
- TimeSpan? GetExpiryForAccess();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICache.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICache.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICache.cs
deleted file mode 100644
index 5116839..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICache.cs
+++ /dev/null
@@ -1,542 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache.Expiry;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Main entry point for Ignite cache APIs. You can get a named cache by calling
- /// <see cref="IIgnite.GetCache{TK,TV}"/> method.
- /// <para />
- /// Cache API supports distributed transactions. All <c>Get(...)</c>, <c>Put(...)</c>, <c>Replace(...)</c>,
- /// and <c>Remove(...)</c> operations are transactional and will participate in an ongoing transaction,
- /// if any. Other methods like <c>Peek(...)</c> or various <c>Contains(...)</c> methods may
- /// be transaction-aware, i.e. check in-transaction entries first, but will not affect the current
- /// state of transaction. See <see cref="ITransaction"/> documentation for more information
- /// about transactions.
- /// <para />
- /// Neither <c>null</c> keys or values are allowed to be stored in cache. If a <c>null</c> value
- /// happens to be in cache (e.g. after invalidation or remove), then cache will treat this case
- /// as there is no value at all.
- /// <para />
- /// Note that cache is generic and you can only work with provided key and value types. If cache also
- /// contains keys or values of other types, any attempt to retrieve them will result in
- /// <see cref="InvalidCastException"/>. Use <see cref="ICache{Object, Object}"/> in order to work with entries
- /// of arbitrary types.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- public interface ICache<TK, TV> : IAsyncSupport<ICache<TK, TV>>, IEnumerable<ICacheEntry<TK, TV>>
- {
- /// <summary>
- /// Name of this cache (<c>null</c> for default cache).
- /// </summary>
- string Name { get; }
-
- /// <summary>
- /// Ignite hosting this cache.
- /// </summary>
- IIgnite Ignite { get; }
-
- /// <summary>
- /// Checks whether this cache contains no key-value mappings.
- /// <para />
- /// Semantically equals to <c>ICache.Size(CachePeekMode.PRIMARY) == 0</c>.
- /// </summary>
- bool IsEmpty();
-
- /// <summary>
- /// Gets a value indicating whether to keep values in portable form.
- /// </summary>
- bool IsKeepPortable { get; }
-
- /// <summary>
- /// Get another cache instance with read-through and write-through behavior disabled.
- /// </summary>
- /// <returns>Cache with read-through and write-through behavior disabled.</returns>
- ICache<TK, TV> WithSkipStore();
-
- /// <summary>
- /// Returns cache with the specified expired policy set. This policy will be used for each operation
- /// invoked on the returned cache.
- /// <para />
- /// Expiry durations for each operation are calculated only once and then used as constants. Please
- /// consider this when implementing customg expiry policy implementations.
- /// </summary>
- /// <param name="plc">Expiry policy to use.</param>
- /// <returns>Cache instance with the specified expiry policy set.</returns>
- ICache<TK, TV> WithExpiryPolicy(IExpiryPolicy plc);
-
- /// <summary>
- /// Gets cache with KeepPortable mode enabled, changing key and/or value types if necessary.
- /// You can only change key/value types when transitioning from non-portable to portable cache;
- /// Changing type of portable cache is not allowed and will throw an <see cref="InvalidOperationException"/>
- /// </summary>
- /// <typeparam name="TK1">Key type in portable mode.</typeparam>
- /// <typeparam name="TV1">Value type in protable mode.</typeparam>
- /// <returns>Cache instance with portable mode enabled.</returns>
- ICache<TK1, TV1> WithKeepPortable<TK1, TV1>();
-
- /// <summary>
- /// Executes <see cref="LocalLoadCache"/> on all cache nodes.
- /// </summary>
- /// <param name="p">
- /// Optional predicate. If provided, will be used to filter values to be put into cache.
- /// </param>
- /// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
- /// </param>
- [AsyncSupported]
- void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args);
-
- /// <summary>
- /// Delegates to <see cref="ICacheStore.LoadCache" /> method to load state
- /// from the underlying persistent storage. The loaded values will then be given
- /// to the optionally passed in predicate, and, if the predicate returns true,
- /// will be stored in cache. If predicate is null, then all loaded values will be stored in cache.
- /// </summary>
- /// <param name="p">
- /// Optional predicate. If provided, will be used to filter values to be put into cache.
- /// </param>
- /// <param name="args">
- /// Optional user arguments to be passed into <see cref="ICacheStore.LoadCache" />.
- /// </param>
- [AsyncSupported]
- void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args);
-
- /// <summary>
- /// Check if cache contains mapping for this key.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <returns>True if cache contains mapping for this key.</returns>
- [AsyncSupported]
- bool ContainsKey(TK key);
-
- /// <summary>
- /// Check if cache contains mapping for these keys.
- /// </summary>
- /// <param name="keys">Keys.</param>
- /// <returns>True if cache contains mapping for all these keys.</returns>
- [AsyncSupported]
- bool ContainsKeys(IEnumerable<TK> keys);
-
- /// <summary>
- /// Peeks at cached value using optional set of peek modes. This method will sequentially
- /// iterate over given peek modes, and try to peek at value using each peek mode. Once a
- /// non-null value is found, it will be immediately returned.
- /// This method does not participate in any transactions, however, it may peek at transactional
- /// value depending on the peek modes used.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="modes">Peek modes.</param>
- /// <returns>Peeked value.</returns>
- TV LocalPeek(TK key, params CachePeekMode[] modes);
-
- /// <summary>
- /// Retrieves value mapped to the specified key from cache.
- /// If the value is not present in cache, then it will be looked up from swap storage. If
- /// it's not present in swap, or if swap is disable, and if read-through is allowed, value
- /// will be loaded from persistent store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <returns>Value.</returns>
- [AsyncSupported]
- TV Get(TK key);
-
- /// <summary>
- /// Retrieves values mapped to the specified keys from cache.
- /// If some value is not present in cache, then it will be looked up from swap storage. If
- /// it's not present in swap, or if swap is disabled, and if read-through is allowed, value
- /// will be loaded from persistent store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="keys">Keys.</param>
- /// <returns>Map of key-value pairs.</returns>
- [AsyncSupported]
- IDictionary<TK, TV> GetAll(IEnumerable<TK> keys);
-
- /// <summary>
- /// Associates the specified value with the specified key in the cache.
- /// <para />
- /// If the cache previously contained a mapping for the key,
- /// the old value is replaced by the specified value.
- /// </summary>
- /// <param name="key">Key with which the specified value is to be associated.</param>
- /// <param name="val">Value to be associated with the specified key.</param>
- [AsyncSupported]
- void Put(TK key, TV val);
-
- /// <summary>
- /// Associates the specified value with the specified key in this cache,
- /// returning an existing value if one existed.
- /// </summary>
- /// <param name="key">Key with which the specified value is to be associated.</param>
- /// <param name="val">Value to be associated with the specified key.</param>
- /// <returns>
- /// The value associated with the key at the start of the operation or null if none was associated.
- /// </returns>
- [AsyncSupported]
- TV GetAndPut(TK key, TV val);
-
- /// <summary>
- /// Atomically replaces the value for a given key if and only if there is a value currently mapped by the key.
- /// </summary>
- /// <param name="key">Key with which the specified value is to be associated.</param>
- /// <param name="val">Value to be associated with the specified key.</param>
- /// <returns>
- /// The previous value associated with the specified key, or null if there was no mapping for the key.
- /// </returns>
- [AsyncSupported]
- TV GetAndReplace(TK key, TV val);
-
- /// <summary>
- /// Atomically removes the entry for a key only if currently mapped to some value.
- /// </summary>
- /// <param name="key">Key with which the specified value is associated.</param>
- /// <returns>The value if one existed or null if no mapping existed for this key.</returns>
- [AsyncSupported]
- TV GetAndRemove(TK key);
-
- /// <summary>
- /// Atomically associates the specified key with the given value if it is not already associated with a value.
- /// </summary>
- /// <param name="key">Key with which the specified value is to be associated.</param>
- /// <param name="val">Value to be associated with the specified key.</param>
- /// <returns>True if a value was set.</returns>
- [AsyncSupported]
- bool PutIfAbsent(TK key, TV val);
-
- /// <summary>
- /// Stores given key-value pair in cache only if cache had no previous mapping for it.
- /// If cache previously contained value for the given key, then this value is returned.
- /// In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- /// which in its turn may load the value from the swap storage, and consecutively, if it's not
- /// in swap, from the underlying persistent storage.
- /// If the returned value is not needed, method putxIfAbsent() should be used instead of this one to
- /// avoid the overhead associated with returning of the previous value.
- /// If write-through is enabled, the stored value will be persisted to store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key to store in cache.</param>
- /// <param name="val">Value to be associated with the given key.</param>
- /// <returns>
- /// Previously contained value regardless of whether put happened or not (null if there was no previous value).
- /// </returns>
- [AsyncSupported]
- TV GetAndPutIfAbsent(TK key, TV val);
-
- /// <summary>
- /// Stores given key-value pair in cache only if there is a previous mapping for it.
- /// If cache previously contained value for the given key, then this value is returned.
- /// In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- /// which in its turn may load the value from the swap storage, and consecutively, if it's not
- /// in swap, rom the underlying persistent storage.
- /// If write-through is enabled, the stored value will be persisted to store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key to store in cache.</param>
- /// <param name="val">Value to be associated with the given key.</param>
- /// <returns>True if the value was replaced.</returns>
- [AsyncSupported]
- bool Replace(TK key, TV val);
-
- /// <summary>
- /// Stores given key-value pair in cache only if only if the previous value is equal to the
- /// old value passed as argument.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key to store in cache.</param>
- /// <param name="oldVal">Old value to match.</param>
- /// <param name="newVal">Value to be associated with the given key.</param>
- /// <returns>True if replace happened, false otherwise.</returns>
- [AsyncSupported]
- bool Replace(TK key, TV oldVal, TV newVal);
-
- /// <summary>
- /// Stores given key-value pairs in cache.
- /// If write-through is enabled, the stored values will be persisted to store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="vals">Key-value pairs to store in cache.</param>
- [AsyncSupported]
- void PutAll(IDictionary<TK, TV> vals);
-
- /// <summary>
- /// Attempts to evict all entries associated with keys. Note, that entry will be evicted only
- /// if it's not used (not participating in any locks or transactions).
- /// </summary>
- /// <param name="keys">Keys to evict from cache.</param>
- void LocalEvict(IEnumerable<TK> keys);
-
- /// <summary>
- /// Clears the contents of the cache, without notifying listeners or CacheWriters.
- /// </summary>
- [AsyncSupported]
- void Clear();
-
- /// <summary>
- /// Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- /// Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- /// </summary>
- /// <param name="key">Key to clear.</param>
- [AsyncSupported]
- void Clear(TK key);
-
- /// <summary>
- /// Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- /// Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- /// </summary>
- /// <param name="keys">Keys to clear.</param>
- [AsyncSupported]
- void ClearAll(IEnumerable<TK> keys);
-
- /// <summary>
- /// Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- /// Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- /// <para />
- /// Note that this operation is local as it merely clears
- /// an entry from local cache, it does not remove entries from remote caches.
- /// </summary>
- /// <param name="key">Key to clear.</param>
- void LocalClear(TK key);
-
- /// <summary>
- /// Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- /// Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- /// <para />
- /// Note that this operation is local as it merely clears
- /// entries from local cache, it does not remove entries from remote caches.
- /// </summary>
- /// <param name="keys">Keys to clear.</param>
- void LocalClearAll(IEnumerable<TK> keys);
-
- /// <summary>
- /// Removes given key mapping from cache. If cache previously contained value for the given key,
- /// then this value is returned. In case of PARTITIONED or REPLICATED caches, the value will be
- /// loaded from the primary node, which in its turn may load the value from the disk-based swap
- /// storage, and consecutively, if it's not in swap, from the underlying persistent storage.
- /// If the returned value is not needed, method removex() should always be used instead of this
- /// one to avoid the overhead associated with returning of the previous value.
- /// If write-through is enabled, the value will be removed from store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key whose mapping is to be removed from cache.</param>
- /// <returns>False if there was no matching key.</returns>
- [AsyncSupported]
- bool Remove(TK key);
-
- /// <summary>
- /// Removes given key mapping from cache if one exists and value is equal to the passed in value.
- /// If write-through is enabled, the value will be removed from store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="key">Key whose mapping is to be removed from cache.</param>
- /// <param name="val">Value to match against currently cached value.</param>
- /// <returns>True if entry was removed, false otherwise.</returns>
- [AsyncSupported]
- bool Remove(TK key, TV val);
-
- /// <summary>
- /// Removes given key mappings from cache.
- /// If write-through is enabled, the value will be removed from store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- /// <param name="keys">Keys whose mappings are to be removed from cache.</param>
- [AsyncSupported]
- void RemoveAll(IEnumerable<TK> keys);
-
- /// <summary>
- /// Removes all mappings from cache.
- /// If write-through is enabled, the value will be removed from store.
- /// This method is transactional and will enlist the entry into ongoing transaction if there is one.
- /// </summary>
- [AsyncSupported]
- void RemoveAll();
-
- /// <summary>
- /// Gets the number of all entries cached on this node.
- /// </summary>
- /// <param name="modes">Optional peek modes. If not provided, then total cache size is returned.</param>
- /// <returns>Cache size on this node.</returns>
- int GetLocalSize(params CachePeekMode[] modes);
-
- /// <summary>
- /// Gets the number of all entries cached across all nodes.
- /// <para />
- /// NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
- /// </summary>
- /// <param name="modes">Optional peek modes. If not provided, then total cache size is returned.</param>
- /// <returns>Cache size across all nodes.</returns>
- [AsyncSupported]
- int GetSize(params CachePeekMode[] modes);
-
- /// <summary>
- /// This method unswaps cache entries by given keys, if any, from swap storage into memory.
- /// </summary>
- /// <param name="keys">Keys to promote entries for.</param>
- void LocalPromote(IEnumerable<TK> keys);
-
- /// <summary>
- /// Queries cache.
- /// </summary>
- /// <param name="qry">Query.</param>
- /// <returns>Cursor.</returns>
- IQueryCursor<ICacheEntry<TK, TV>> Query(QueryBase qry);
-
- /// <summary>
- /// Queries separate entry fields.
- /// </summary>
- /// <param name="qry">SQL fields query.</param>
- /// <returns>Cursor.</returns>
- IQueryCursor<IList> QueryFields(SqlFieldsQuery qry);
-
- /// <summary>
- /// Start continuous query execution.
- /// </summary>
- /// <param name="qry">Continuous query.</param>
- /// <returns>Handle to stop query execution.</returns>
- IContinuousQueryHandle QueryContinuous(ContinuousQuery<TK, TV> qry);
-
- /// <summary>
- /// Start continuous query execution.
- /// </summary>
- /// <param name="qry">Continuous query.</param>
- /// <param name="initialQry">
- /// The initial query. This query will be executed before continuous listener is registered which allows
- /// to iterate through entries which have already existed at the time continuous query is executed.
- /// </param>
- /// <returns>
- /// Handle to get initial query cursor or stop query execution.
- /// </returns>
- IContinuousQueryHandle<ICacheEntry<TK, TV>> QueryContinuous(ContinuousQuery<TK, TV> qry, QueryBase initialQry);
-
- /// <summary>
- /// Get local cache entries.
- /// </summary>
- /// <param name="peekModes">Peek modes.</param>
- /// <returns>Enumerable instance.</returns>
- IEnumerable<ICacheEntry<TK, TV>> GetLocalEntries(params CachePeekMode[] peekModes);
-
- /// <summary>
- /// Invokes an <see cref="ICacheEntryProcessor{K, V, A, R}"/> against the
- /// <see cref="IMutableCacheEntry{K, V}"/> specified by the provided key.
- /// If an entry does not exist for the specified key, an attempt is made to load it (if a loader is configured)
- /// or a surrogate entry, consisting of the key with a null value is used instead.
- /// </summary>
- /// <typeparam name="TR">The type of the result.</typeparam>
- /// <typeparam name="TA">The type of the argument.</typeparam>
- /// <param name="key">The key.</param>
- /// <param name="processor">The processor.</param>
- /// <param name="arg">The argument.</param>
- /// <returns>Result of the processing.</returns>
- /// <exception cref="CacheEntryProcessorException">If an exception has occured during processing.</exception>
- [AsyncSupported]
- TR Invoke<TR, TA>(TK key, ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg);
-
- /// <summary>
- /// Invokes an <see cref="ICacheEntryProcessor{K, V, A, R}"/> against a set of keys.
- /// If an entry does not exist for the specified key, an attempt is made to load it (if a loader is configured)
- /// or a surrogate entry, consisting of the key with a null value is used instead.
- ///
- /// The order that the entries for the keys are processed is undefined.
- /// Implementations may choose to process the entries in any order, including concurrently.
- /// Furthermore there is no guarantee implementations will use the same processor instance
- /// to process each entry, as the case may be in a non-local cache topology.
- /// </summary>
- /// <typeparam name="TR">The type of the result.</typeparam>
- /// <typeparam name="TA">The type of the argument.</typeparam>
- /// <param name="keys">The keys.</param>
- /// <param name="processor">The processor.</param>
- /// <param name="arg">The argument.</param>
- /// <returns>
- /// Map of <see cref="ICacheEntryProcessorResult{R}" /> of the processing per key, if any,
- /// defined by the <see cref="ICacheEntryProcessor{K,V,A,R}"/> implementation.
- /// No mappings will be returned for processors that return a null value for a key.
- /// </returns>
- /// <exception cref="CacheEntryProcessorException">If an exception has occured during processing.</exception>
- [AsyncSupported]
- IDictionary<TK, ICacheEntryProcessorResult<TR>> InvokeAll<TR, TA>(IEnumerable<TK> keys,
- ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg);
-
- /// <summary>
- /// Creates an <see cref="ICacheLock"/> instance associated with passed key.
- /// This method does not acquire lock immediately, you have to call appropriate method on returned instance.
- /// </summary>
- /// <param name="key">Key for lock.</param>
- /// <returns>New <see cref="ICacheLock"/> instance associated with passed key.</returns>
- ICacheLock Lock(TK key);
-
- /// <summary>
- /// Creates an <see cref="ICacheLock"/> instance associated with passed keys.
- /// This method does not acquire lock immediately, you have to call appropriate method on returned instance.
- /// </summary>
- /// <param name="keys">Keys for lock.</param>
- /// <returns>New <see cref="ICacheLock"/> instance associated with passed keys.</returns>
- ICacheLock LockAll(IEnumerable<TK> keys);
-
- /// <summary>
- /// Checks if specified key is locked.
- /// <para />
- /// This is a local operation and does not involve any network trips
- /// or access to persistent storage in any way.
- /// </summary>
- /// <param name="key">Key to check.</param>
- /// <param name="byCurrentThread">
- /// If true, checks that current thread owns a lock on this key;
- /// otherwise, checks that any thread on any node owns a lock on this key.
- /// </param>
- /// <returns>True if specified key is locked; otherwise, false.</returns>
- bool IsLocalLocked(TK key, bool byCurrentThread);
-
- /// <summary>
- /// Gets snapshot metrics (statistics) for this cache.
- /// </summary>
- /// <returns>Cache metrics.</returns>
- ICacheMetrics GetMetrics();
-
- /// <summary>
- /// Rebalances cache partitions. This method is usually used when rebalanceDelay configuration parameter
- /// has non-zero value. When many nodes are started or stopped almost concurrently,
- /// it is more efficient to delay rebalancing until the node topology is stable to make sure that no redundant
- /// re-partitioning happens.
- /// <para />
- /// In case of partitioned caches, for better efficiency user should usually make sure that new nodes get
- /// placed on the same place of consistent hash ring as the left nodes, and that nodes are restarted before
- /// rebalanceDelay expires.
- /// </summary>
- /// <returns>Future that will be completed when rebalancing is finished.</returns>
- IFuture Rebalance();
-
- /// <summary>
- /// Get another cache instance with no-retries behavior enabled.
- /// </summary>
- /// <returns>Cache with no-retries behavior enabled.</returns>
- ICache<TK, TV> WithNoRetries();
- }
-}
[23/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformPooledMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformPooledMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformPooledMemory.cs
deleted file mode 100644
index 206df4b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformPooledMemory.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- /// <summary>
- /// Platform pooled memory chunk.
- /// </summary>
- internal class PlatformPooledMemory : PlatformMemory
- {
- /** Pool. */
- private readonly PlatformMemoryPool _pool;
-
- /** Cached stream. */
- private PlatformMemoryStream _stream;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="pool">Pool.</param>
- /// <param name="memPtr">Memory pointer.</param>
- public PlatformPooledMemory(PlatformMemoryPool pool, long memPtr) : base(memPtr)
- {
- _pool = pool;
- }
-
- /** <inheritdoc /> */
- public override PlatformMemoryStream Stream()
- {
- if (_stream == null)
- _stream = base.Stream();
- else
- _stream.Reuse();
-
- return _stream;
- }
-
- /** <inheritdoc /> */
- public override void Reallocate(int cap)
- {
- // Try doubling capacity to avoid excessive allocations.
- int doubledCap = PlatformMemoryUtils.Capacity(MemPtr) << 1;
-
- if (doubledCap > cap)
- cap = doubledCap;
-
- _pool.Reallocate(MemPtr, cap);
- }
-
- /** <inheritdoc /> */
- public override void Release()
- {
- _pool.Release(MemPtr); // Return to the pool.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
deleted file mode 100644
index 59c915b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformRawMemory.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- using System;
-
- /// <summary>
- /// Non-resizeable raw memory chunk without metadata header.
- /// </summary>
- [CLSCompliant(false)]
- public class PlatformRawMemory : IPlatformMemory
- {
- /** */
- private readonly long _memPtr;
-
- /** */
- private readonly int _size;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PlatformRawMemory"/> class.
- /// </summary>
- /// <param name="memPtr">Heap pointer.</param>
- /// <param name="size">Size.</param>
- public unsafe PlatformRawMemory(void* memPtr, int size)
- {
- _memPtr = (long) memPtr;
- _size = size;
- }
-
- /** <inheritdoc /> */
- public PlatformMemoryStream Stream()
- {
- return BitConverter.IsLittleEndian ? new PlatformMemoryStream(this) :
- new PlatformBigEndianMemoryStream(this);
- }
-
- /** <inheritdoc /> */
- public long Pointer
- {
- get { throw new NotSupportedException(); }
- }
-
- /** <inheritdoc /> */
- public long Data
- {
- get { return _memPtr; }
- }
-
- /** <inheritdoc /> */
- public int Capacity
- {
- get { return _size; }
- }
-
- /** <inheritdoc /> */
- public int Length
- {
- get { return _size; }
- set { throw new NotSupportedException(); }
- }
-
- /** <inheritdoc /> */
- public void Reallocate(int cap)
- {
- throw new NotSupportedException();
- }
-
- /** <inheritdoc /> */
- public void Release()
- {
- throw new NotSupportedException();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformUnpooledMemory.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformUnpooledMemory.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformUnpooledMemory.cs
deleted file mode 100644
index 26c1bc1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Memory/PlatformUnpooledMemory.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Memory
-{
- /// <summary>
- /// Platform unpooled memory chunk.
- /// </summary>
- internal class PlatformUnpooledMemory : PlatformMemory
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- public PlatformUnpooledMemory(long memPtr) : base(memPtr)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public override void Reallocate(int cap)
- {
- // Try doubling capacity to avoid excessive allocations.
- int doubledCap = ((PlatformMemoryUtils.Capacity(MemPtr) + 16) << 1) - 16;
-
- if (doubledCap > cap)
- cap = doubledCap;
-
- PlatformMemoryUtils.ReallocateUnpooled(MemPtr, cap);
- }
-
- /** <inheritdoc /> */
- public override void Release()
- {
- PlatformMemoryUtils.ReleaseUnpooled(MemPtr);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageFilterHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageFilterHolder.cs
deleted file mode 100644
index 21c66bf..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessageFilterHolder.cs
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Messaging
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Non-generic portable filter wrapper.
- /// </summary>
- internal class MessageFilterHolder : IPortableWriteAware, IHandle
- {
- /** Invoker function that takes key and value and invokes wrapped IMessageFilter */
- private readonly Func<Guid, object, bool> _invoker;
-
- /** Current Ignite instance. */
- private readonly Ignite _ignite;
-
- /** Underlying filter. */
- private readonly object _filter;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MessageFilterHolder" /> class.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="filter">The <see cref="IMessageFilter{T}" /> to wrap.</param>
- /// <param name="invoker">The invoker func that takes key and value and invokes wrapped IMessageFilter.</param>
- private MessageFilterHolder(Ignite grid, object filter, Func<Guid, object, bool> invoker)
- {
- Debug.Assert(filter != null);
- Debug.Assert(invoker != null);
-
- _invoker = invoker;
-
- _filter = filter;
-
- // 1. Set fields.
- Debug.Assert(grid != null);
-
- _ignite = grid;
- _invoker = invoker;
-
- // 2. Perform injections.
- ResourceProcessor.Inject(filter, grid);
- }
-
- /// <summary>
- /// Invoke the filter.
- /// </summary>
- /// <param name="input">Input.</param>
- /// <returns></returns>
- public int Invoke(IPortableStream input)
- {
- var rawReader = _ignite.Marshaller.StartUnmarshal(input).RawReader();
-
- var nodeId = rawReader.ReadGuid();
-
- Debug.Assert(nodeId != null);
-
- return _invoker(nodeId.Value, rawReader.ReadObject<object>()) ? 1 : 0;
- }
-
- /// <summary>
- /// Wrapped <see cref="IMessageFilter{T}" />.
- /// </summary>
- public object Filter
- {
- get { return _filter; }
- }
-
- /// <summary>
- /// Destroy callback.
- /// </summary>
- public Action DestroyAction { private get; set; }
-
- /** <inheritDoc /> */
- public void Release()
- {
- if (DestroyAction != null)
- DestroyAction();
- }
-
- /** <inheritDoc /> */
- public bool Released
- {
- get { return false; } // Multiple releases are allowed.
- }
-
- /// <summary>
- /// Creates local holder instance.
- /// </summary>
- /// <param name="grid">Ignite instance.</param>
- /// <param name="filter">Filter.</param>
- /// <returns>
- /// New instance of <see cref="MessageFilterHolder" />
- /// </returns>
- public static MessageFilterHolder CreateLocal<T>(Ignite grid, IMessageFilter<T> filter)
- {
- Debug.Assert(filter != null);
-
- return new MessageFilterHolder(grid, filter, (id, msg) => filter.Invoke(id, (T)msg));
- }
-
- /// <summary>
- /// Creates remote holder instance.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="memPtr">Memory pointer.</param>
- /// <returns>Deserialized instance of <see cref="MessageFilterHolder"/></returns>
- public static MessageFilterHolder CreateRemote(Ignite grid, long memPtr)
- {
- Debug.Assert(grid != null);
-
- var stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- var holder = grid.Marshaller.Unmarshal<MessageFilterHolder>(stream);
-
- return holder;
- }
-
- /// <summary>
- /// Gets the invoker func.
- /// </summary>
- private static Func<Guid, object, bool> GetInvoker(object pred)
- {
- var func = DelegateTypeDescriptor.GetMessageFilter(pred.GetType());
-
- return (id, msg) => func(pred, id, msg);
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, Filter);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MessageFilterHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public MessageFilterHolder(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _filter = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- _invoker = GetInvoker(_filter);
-
- _ignite = reader0.Marshaller.Ignite;
-
- ResourceProcessor.Inject(_filter, _ignite);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs
deleted file mode 100644
index e8c4b4b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/Messaging.cs
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Messaging
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Collections;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Messaging;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Messaging functionality.
- /// </summary>
- internal class Messaging : PlatformTarget, IMessaging
- {
- /// <summary>
- /// Opcodes.
- /// </summary>
- private enum Op
- {
- LocalListen = 1,
- RemoteListen = 2,
- Send = 3,
- SendMulti = 4,
- SendOrdered = 5,
- StopLocalListen = 6,
- StopRemoteListen = 7
- }
-
- /** Map from user (func+topic) -> id, needed for unsubscription. */
- private readonly MultiValueDictionary<KeyValuePair<object, object>, long> _funcMap =
- new MultiValueDictionary<KeyValuePair<object, object>, long>();
-
- /** Grid */
- private readonly Ignite _ignite;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Messaging" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="prj">Cluster group.</param>
- public Messaging(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup prj)
- : base(target, marsh)
- {
- Debug.Assert(prj != null);
-
- ClusterGroup = prj;
-
- _ignite = (Ignite) prj.Ignite;
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ClusterGroup { get; private set; }
-
- /** <inheritdoc /> */
- public void Send(object message, object topic = null)
- {
- IgniteArgumentCheck.NotNull(message, "message");
-
- DoOutOp((int) Op.Send, topic, message);
- }
-
- /** <inheritdoc /> */
- public void Send(IEnumerable messages, object topic = null)
- {
- IgniteArgumentCheck.NotNull(messages, "messages");
-
- DoOutOp((int) Op.SendMulti, writer =>
- {
- writer.Write(topic);
-
- WriteEnumerable(writer, messages.OfType<object>());
- });
- }
-
- /** <inheritdoc /> */
- public void SendOrdered(object message, object topic = null, TimeSpan? timeout = null)
- {
- IgniteArgumentCheck.NotNull(message, "message");
-
- DoOutOp((int) Op.SendOrdered, writer =>
- {
- writer.Write(topic);
- writer.Write(message);
-
- writer.WriteLong((long)(timeout == null ? 0 : timeout.Value.TotalMilliseconds));
- });
- }
-
- /** <inheritdoc /> */
- public void LocalListen<T>(IMessageFilter<T> filter, object topic = null)
- {
- IgniteArgumentCheck.NotNull(filter, "filter");
-
- ResourceProcessor.Inject(filter, _ignite);
-
- lock (_funcMap)
- {
- var key = GetKey(filter, topic);
-
- MessageFilterHolder filter0 = MessageFilterHolder.CreateLocal(_ignite, filter);
-
- var filterHnd = _ignite.HandleRegistry.Allocate(filter0);
-
- filter0.DestroyAction = () =>
- {
- lock (_funcMap)
- {
- _funcMap.Remove(key, filterHnd);
- }
- };
-
- try
- {
- DoOutOp((int) Op.LocalListen, writer =>
- {
- writer.WriteLong(filterHnd);
- writer.Write(topic);
- });
- }
- catch (Exception)
- {
- _ignite.HandleRegistry.Release(filterHnd);
-
- throw;
- }
-
- _funcMap.Add(key, filterHnd);
- }
- }
-
- /** <inheritdoc /> */
- public void StopLocalListen<T>(IMessageFilter<T> filter, object topic = null)
- {
- IgniteArgumentCheck.NotNull(filter, "filter");
-
- long filterHnd;
- bool removed;
-
- lock (_funcMap)
- {
- removed = _funcMap.TryRemove(GetKey(filter, topic), out filterHnd);
- }
-
- if (removed)
- {
- DoOutOp((int) Op.StopLocalListen, writer =>
- {
- writer.WriteLong(filterHnd);
- writer.Write(topic);
- });
- }
- }
-
- /** <inheritdoc /> */
- public Guid RemoteListen<T>(IMessageFilter<T> filter, object topic = null)
- {
- IgniteArgumentCheck.NotNull(filter, "filter");
-
- var filter0 = MessageFilterHolder.CreateLocal(_ignite, filter);
- var filterHnd = _ignite.HandleRegistry.AllocateSafe(filter0);
-
- try
- {
- Guid id = Guid.Empty;
-
- DoOutInOp((int) Op.RemoteListen, writer =>
- {
- writer.Write(filter0);
- writer.WriteLong(filterHnd);
- writer.Write(topic);
- },
- input =>
- {
- var id0 = Marshaller.StartUnmarshal(input).RawReader().ReadGuid();
-
- Debug.Assert(IsAsync || id0.HasValue);
-
- if (id0.HasValue)
- id = id0.Value;
- });
-
- return id;
- }
- catch (Exception)
- {
- _ignite.HandleRegistry.Release(filterHnd);
-
- throw;
- }
- }
-
- /** <inheritdoc /> */
- public void StopRemoteListen(Guid opId)
- {
- DoOutOp((int) Op.StopRemoteListen, writer =>
- {
- writer.WriteGuid(opId);
- });
- }
-
- /** <inheritdoc /> */
- public virtual IMessaging WithAsync()
- {
- return new MessagingAsync(UU.MessagingWithASync(Target), Marshaller, ClusterGroup);
- }
-
- /** <inheritdoc /> */
- public virtual bool IsAsync
- {
- get { return false; }
- }
-
- /** <inheritdoc /> */
- public virtual IFuture GetFuture()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritdoc /> */
- public virtual IFuture<TResult> GetFuture<TResult>()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /// <summary>
- /// Gets the key for user-provided filter and topic.
- /// </summary>
- /// <param name="filter">Filter.</param>
- /// <param name="topic">Topic.</param>
- /// <returns>Compound dictionary key.</returns>
- private static KeyValuePair<object, object> GetKey(object filter, object topic)
- {
- return new KeyValuePair<object, object>(filter, topic);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessagingAsync.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessagingAsync.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessagingAsync.cs
deleted file mode 100644
index e899d4e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Messaging/MessagingAsync.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Messaging
-{
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Messaging;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Async messaging implementation.
- /// </summary>
- internal class MessagingAsync : Messaging
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="MessagingAsync" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="prj">Cluster group.</param>
- public MessagingAsync(IUnmanagedTarget target, PortableMarshaller marsh,
- IClusterGroup prj) : base(target, marsh, prj)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public override IMessaging WithAsync()
- {
- return this;
- }
-
- /** <inheritdoc /> */
- public override bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public override IFuture GetFuture()
- {
- return GetFuture<object>();
- }
-
- /** <inheritdoc /> */
- public override IFuture<T> GetFuture<T>()
- {
- return GetFuture<T>((futId, futTyp) => UU.TargetListenFuture(Target, futId, futTyp));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs
deleted file mode 100644
index 6e25e7e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/NativeMethods.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Native methods.
- /// </summary>
- internal static class NativeMethods
- {
- /// <summary>
- /// Load DLL with WinAPI.
- /// </summary>
- /// <param name="path">Path to dll.</param>
- /// <returns></returns>
- [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, BestFitMapping = false,
- ThrowOnUnmappableChar = true)]
- internal static extern IntPtr LoadLibrary(string path);
-
- /// <summary>
- /// Get procedure address with WinAPI.
- /// </summary>
- /// <param name="ptr">DLL pointer.</param>
- /// <param name="name">Procedure name.</param>
- /// <returns>Procedure address.</returns>
- [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, BestFitMapping = false,
- ThrowOnUnmappableChar = true)]
- internal static extern IntPtr GetProcAddress(IntPtr ptr, string name);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
deleted file mode 100644
index 67f631a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/PlatformTarget.cs
+++ /dev/null
@@ -1,715 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Portable.Metadata;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Base class for interop targets.
- /// </summary>
- [SuppressMessage("ReSharper", "LocalVariableHidesMember")]
- internal abstract class PlatformTarget
- {
- /** */
- protected const int True = 1;
-
- /** */
- private const int OpMeta = -1;
-
- /** */
- public const int OpNone = -2;
-
- /** */
- private static readonly Dictionary<Type, FutureType> IgniteFutureTypeMap
- = new Dictionary<Type, FutureType>
- {
- {typeof(bool), FutureType.Bool},
- {typeof(byte), FutureType.Byte},
- {typeof(char), FutureType.Char},
- {typeof(double), FutureType.Double},
- {typeof(float), FutureType.Float},
- {typeof(int), FutureType.Int},
- {typeof(long), FutureType.Long},
- {typeof(short), FutureType.Short}
- };
-
- /** Unmanaged target. */
- private readonly IUnmanagedTarget _target;
-
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- protected PlatformTarget(IUnmanagedTarget target, PortableMarshaller marsh)
- {
- _target = target;
- _marsh = marsh;
- }
-
- /// <summary>
- /// Unmanaged target.
- /// </summary>
- internal IUnmanagedTarget Target
- {
- get { return _target; }
- }
-
- /// <summary>
- /// Marshaller.
- /// </summary>
- internal PortableMarshaller Marshaller
- {
- get { return _marsh; }
- }
-
- #region Static Helpers
-
- /// <summary>
- /// Write collection.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteCollection<T>(PortableWriterImpl writer, ICollection<T> vals)
- {
- return WriteCollection<T, T>(writer, vals, null);
- }
-
- /// <summary>
- /// Write nullable collection.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteNullableCollection<T>(PortableWriterImpl writer, ICollection<T> vals)
- {
- return WriteNullable(writer, vals, WriteCollection);
- }
-
- /// <summary>
- /// Write collection.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteCollection<T1, T2>(PortableWriterImpl writer,
- ICollection<T1> vals, Func<T1, T2> selector)
- {
- writer.WriteInt(vals.Count);
-
- if (selector == null)
- {
- foreach (var val in vals)
- writer.Write(val);
- }
- else
- {
- foreach (var val in vals)
- writer.Write(selector(val));
- }
-
- return writer;
- }
-
- /// <summary>
- /// Write enumerable.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteEnumerable<T>(PortableWriterImpl writer, IEnumerable<T> vals)
- {
- return WriteEnumerable<T, T>(writer, vals, null);
- }
-
- /// <summary>
- /// Write enumerable.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <param name="selector">A transform function to apply to each element.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteEnumerable<T1, T2>(PortableWriterImpl writer,
- IEnumerable<T1> vals, Func<T1, T2> selector)
- {
- var col = vals as ICollection<T1>;
-
- if (col != null)
- return WriteCollection(writer, col, selector);
-
- var stream = writer.Stream;
-
- var pos = stream.Position;
-
- stream.Seek(4, SeekOrigin.Current);
-
- var size = 0;
-
- if (selector == null)
- {
- foreach (var val in vals)
- {
- writer.Write(val);
-
- size++;
- }
- }
- else
- {
- foreach (var val in vals)
- {
- writer.Write(selector(val));
-
- size++;
- }
- }
-
- stream.WriteInt(pos, size);
-
- return writer;
- }
-
- /// <summary>
- /// Write dictionary.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="vals">Values.</param>
- /// <returns>The same writer.</returns>
- protected static PortableWriterImpl WriteDictionary<T1, T2>(PortableWriterImpl writer,
- IDictionary<T1, T2> vals)
- {
- writer.WriteInt(vals.Count);
-
- foreach (KeyValuePair<T1, T2> pair in vals)
- {
- writer.Write(pair.Key);
- writer.Write(pair.Value);
- }
-
- return writer;
- }
-
- /// <summary>
- /// Write a nullable item.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- /// <param name="item">Item.</param>
- /// <param name="writeItem">Write action to perform on item when it is not null.</param>
- /// <returns>The same writer for chaining.</returns>
- protected static PortableWriterImpl WriteNullable<T>(PortableWriterImpl writer, T item,
- Func<PortableWriterImpl, T, PortableWriterImpl> writeItem)
- {
- if (item == null)
- {
- writer.WriteBoolean(false);
-
- return writer;
- }
-
- writer.WriteBoolean(true);
-
- return writeItem(writer, item);
- }
-
- #endregion
-
- #region OUT operations
-
- /// <summary>
- /// Perform out operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="action">Action to be performed on the stream.</param>
- /// <returns></returns>
- protected long DoOutOp(int type, Action<IPortableStream> action)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- action(stream);
-
- return UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput());
- }
- }
-
- /// <summary>
- /// Perform out operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="action">Action to be performed on the stream.</param>
- /// <returns></returns>
- protected long DoOutOp(int type, Action<PortableWriterImpl> action)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- var writer = _marsh.StartMarshal(stream);
-
- action(writer);
-
- FinishMarshal(writer);
-
- return UU.TargetInStreamOutLong(_target, type, stream.SynchronizeOutput());
- }
- }
-
- /// <summary>
- /// Perform simple output operation accepting single argument.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="val1">Value.</param>
- /// <returns>Result.</returns>
- protected long DoOutOp<T1>(int type, T1 val1)
- {
- return DoOutOp(type, writer =>
- {
- writer.Write(val1);
- });
- }
-
- /// <summary>
- /// Perform simple output operation accepting two arguments.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="val1">Value 1.</param>
- /// <param name="val2">Value 2.</param>
- /// <returns>Result.</returns>
- protected long DoOutOp<T1, T2>(int type, T1 val1, T2 val2)
- {
- return DoOutOp(type, writer =>
- {
- writer.Write(val1);
- writer.Write(val2);
- });
- }
-
- /// <summary>
- /// Perform simple output operation accepting three arguments.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="val1">Value 1.</param>
- /// <param name="val2">Value 2.</param>
- /// <param name="val3">Value 3.</param>
- /// <returns>Result.</returns>
- protected long DoOutOp<T1, T2, T3>(int type, T1 val1, T2 val2, T3 val3)
- {
- return DoOutOp(type, writer =>
- {
- writer.Write(val1);
- writer.Write(val2);
- writer.Write(val3);
- });
- }
-
- #endregion
-
- #region IN operations
-
- /// <summary>
- /// Perform in operation.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="action">Action.</param>
- protected void DoInOp(int type, Action<IPortableStream> action)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- UU.TargetOutStream(_target, type, stream.MemoryPointer);
-
- stream.SynchronizeInput();
-
- action(stream);
- }
- }
-
- /// <summary>
- /// Perform in operation.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="action">Action.</param>
- /// <returns>Result.</returns>
- protected T DoInOp<T>(int type, Func<IPortableStream, T> action)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- UU.TargetOutStream(_target, type, stream.MemoryPointer);
-
- stream.SynchronizeInput();
-
- return action(stream);
- }
- }
-
- /// <summary>
- /// Perform simple in operation returning immediate result.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Result.</returns>
- protected T DoInOp<T>(int type)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- UU.TargetOutStream(_target, type, stream.MemoryPointer);
-
- stream.SynchronizeInput();
-
- return Unmarshal<T>(stream);
- }
- }
-
- #endregion
-
- #region OUT-IN operations
-
- /// <summary>
- /// Perform out-in operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="outAction">Out action.</param>
- /// <param name="inAction">In action.</param>
- protected void DoOutInOp(int type, Action<PortableWriterImpl> outAction, Action<IPortableStream> inAction)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- outAction(writer);
-
- FinishMarshal(writer);
-
- UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- inAction(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform out-in operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="outAction">Out action.</param>
- /// <param name="inAction">In action.</param>
- /// <returns>Result.</returns>
- protected TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction, Func<IPortableStream, TR> inAction)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- outAction(writer);
-
- FinishMarshal(writer);
-
- UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return inAction(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform out-in operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="outAction">Out action.</param>
- /// <param name="inAction">In action.</param>
- /// <param name="arg">Argument.</param>
- /// <returns>Result.</returns>
- protected unsafe TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction, Func<IPortableStream, TR> inAction, void* arg)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- outAction(writer);
-
- FinishMarshal(writer);
-
- UU.TargetInObjectStreamOutStream(_target, type, arg, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return inAction(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform out-in operation.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="outAction">Out action.</param>
- /// <returns>Result.</returns>
- protected TR DoOutInOp<TR>(int type, Action<PortableWriterImpl> outAction)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- outAction(writer);
-
- FinishMarshal(writer);
-
- UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return Unmarshal<TR>(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform simple out-in operation accepting single argument.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="val">Value.</param>
- /// <returns>Result.</returns>
- protected TR DoOutInOp<T1, TR>(int type, T1 val)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- writer.WriteObject(val);
-
- FinishMarshal(writer);
-
- UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return Unmarshal<TR>(inStream);
- }
- }
- }
-
- /// <summary>
- /// Perform simple out-in operation accepting two arguments.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="val1">Value.</param>
- /// <param name="val2">Value.</param>
- /// <returns>Result.</returns>
- protected TR DoOutInOp<T1, T2, TR>(int type, T1 val1, T2 val2)
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Allocate().Stream())
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = _marsh.StartMarshal(outStream);
-
- writer.WriteObject(val1);
- writer.WriteObject(val2);
-
- FinishMarshal(writer);
-
- UU.TargetInStreamOutStream(_target, type, outStream.SynchronizeOutput(), inStream.MemoryPointer);
-
- inStream.SynchronizeInput();
-
- return Unmarshal<TR>(inStream);
- }
- }
- }
-
- #endregion
-
- #region Miscelanneous
-
- /// <summary>
- /// Finish marshaling.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- internal void FinishMarshal(PortableWriterImpl writer)
- {
- _marsh.FinishMarshal(writer);
- }
-
- /// <summary>
- /// Put metadata to Grid.
- /// </summary>
- /// <param name="metas">Metadatas.</param>
- internal void PutMetadata(IDictionary<int, IPortableMetadata> metas)
- {
- DoOutOp(OpMeta, stream =>
- {
- PortableWriterImpl metaWriter = _marsh.StartMarshal(stream);
-
- metaWriter.WriteInt(metas.Count);
-
- foreach (var meta in metas.Values)
- {
- PortableMetadataImpl meta0 = (PortableMetadataImpl)meta;
-
- metaWriter.WriteInt(meta0.TypeId);
- metaWriter.WriteString(meta0.TypeName);
- metaWriter.WriteString(meta0.AffinityKeyFieldName);
-
- IDictionary<string, int> fields = meta0.FieldsMap();
-
- metaWriter.WriteInt(fields.Count);
-
- foreach (var field in fields)
- {
- metaWriter.WriteString(field.Key);
- metaWriter.WriteInt(field.Value);
- }
- }
-
- _marsh.FinishMarshal(metaWriter);
- });
-
- _marsh.OnMetadataSent(metas);
- }
-
- /// <summary>
- /// Unmarshal object using the given stream.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Unmarshalled object.</returns>
- protected virtual T Unmarshal<T>(IPortableStream stream)
- {
- return _marsh.Unmarshal<T>(stream);
- }
-
- /// <summary>
- /// Creates a future and starts listening.
- /// </summary>
- /// <typeparam name="T">Future result type</typeparam>
- /// <param name="listenAction">The listen action.</param>
- /// <param name="keepPortable">Keep portable flag, only applicable to object futures. False by default.</param>
- /// <param name="convertFunc">The function to read future result from stream.</param>
- /// <returns>Created future.</returns>
- protected IFuture<T> GetFuture<T>(Action<long, int> listenAction, bool keepPortable = false,
- Func<PortableReaderImpl, T> convertFunc = null)
- {
- var futType = FutureType.Object;
-
- var type = typeof(T);
-
- if (type.IsPrimitive)
- IgniteFutureTypeMap.TryGetValue(type, out futType);
-
- var fut = convertFunc == null && futType != FutureType.Object
- ? new Future<T>()
- : new Future<T>(new FutureConverter<T>(_marsh, keepPortable, convertFunc));
-
- var futHnd = _marsh.Ignite.HandleRegistry.Allocate(fut);
-
- listenAction(futHnd, (int)futType);
-
- return fut;
- }
-
- #endregion
- }
-
- /// <summary>
- /// PlatformTarget with IDisposable pattern.
- /// </summary>
- internal abstract class PlatformDisposableTarget : PlatformTarget, IDisposable
- {
- /** Disposed flag. */
- private volatile bool _disposed;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- protected PlatformDisposableTarget(IUnmanagedTarget target, PortableMarshaller marsh) : base(target, marsh)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- lock (this)
- {
- if (_disposed)
- return;
-
- Dispose(true);
-
- GC.SuppressFinalize(this);
-
- _disposed = true;
- }
- }
-
- /// <summary>
- /// Releases unmanaged and - optionally - managed resources.
- /// </summary>
- /// <param name="disposing">
- /// <c>true</c> when called from Dispose; <c>false</c> when called from finalizer.
- /// </param>
- protected virtual void Dispose(bool disposing)
- {
- Target.Dispose();
- }
-
- /// <summary>
- /// Throws <see cref="ObjectDisposedException"/> if this instance has been disposed.
- /// </summary>
- protected void ThrowIfDisposed()
- {
- if (_disposed)
- throw new ObjectDisposedException(GetType().Name, "Object has been disposed.");
- }
-
- /// <summary>
- /// Gets a value indicating whether this instance is disposed.
- /// </summary>
- protected bool IsDisposed
- {
- get { return _disposed; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs
deleted file mode 100644
index 3fee3ca..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableSystemTypeSerializer.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Serializer for system types that can create instances directly from a stream and does not support handles.
- /// </summary>
- internal interface IPortableSystemTypeSerializer : IPortableSerializer
- {
- /// <summary>
- /// Reads the instance from a reader.
- /// </summary>
- /// <param name="reader">The reader.</param>
- /// <returns>Deserialized instance.</returns>
- object ReadInstance(PortableReaderImpl reader);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs
deleted file mode 100644
index 4a4f0dc..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableTypeDescriptor.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Type descriptor.
- /// </summary>
- internal interface IPortableTypeDescriptor
- {
- /// <summary>
- /// Type.
- /// </summary>
- Type Type
- {
- get;
- }
-
- /// <summary>
- /// Type ID.
- /// </summary>
- int TypeId
- {
- get;
- }
-
- /// <summary>
- /// Type name.
- /// </summary>
- string TypeName
- {
- get;
- }
-
- /// <summary>
- /// User type flag.
- /// </summary>
- bool UserType
- {
- get;
- }
-
- /// <summary>
- /// Metadata enabled flag.
- /// </summary>
- bool MetadataEnabled
- {
- get;
- }
-
- /// <summary>
- /// Whether to cache deserialized value in IPortableObject
- /// </summary>
- bool KeepDeserialized
- {
- get;
- }
-
- /// <summary>
- /// Name converter.
- /// </summary>
- IPortableNameMapper NameConverter
- {
- get;
- }
-
- /// <summary>
- /// Mapper.
- /// </summary>
- IPortableIdMapper Mapper
- {
- get;
- }
-
- /// <summary>
- /// Serializer.
- /// </summary>
- IPortableSerializer Serializer
- {
- get;
- }
-
- /// <summary>
- /// Affinity key field name.
- /// </summary>
- string AffinityKeyFieldName
- {
- get;
- }
-
- /// <summary>
- /// Typed handler.
- /// </summary>
- object TypedHandler
- {
- get;
- }
-
- /// <summary>
- /// Untyped handler.
- /// </summary>
- PortableSystemWriteDelegate UntypedHandler
- {
- get;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs
deleted file mode 100644
index d3c1521..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/IPortableWriteAware.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Represents an object that can write itself to a portable writer.
- /// </summary>
- internal interface IPortableWriteAware
- {
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <exception cref="System.IO.IOException">If write failed.</exception>
- void WritePortable(IPortableWriter writer);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs
deleted file mode 100644
index 8111117..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/IPortableStream.cs
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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.
- */
-
-
-namespace Apache.Ignite.Core.Impl.Portable.IO
-{
- using System;
- using System.IO;
- using System.Text;
-
- /// <summary>
- /// Stream capable of working with portable objects.
- /// </summary>
- [CLSCompliant(false)]
- public unsafe interface IPortableStream : IDisposable
- {
- /// <summary>
- /// Write bool.
- /// </summary>
- /// <param name="val">Bool value.</param>
- void WriteBool(bool val);
-
- /// <summary>
- /// Read bool.
- /// </summary>
- /// <returns>Bool value.</returns>
- bool ReadBool();
-
- /// <summary>
- /// Write bool array.
- /// </summary>
- /// <param name="val">Bool array.</param>
- void WriteBoolArray(bool[] val);
-
- /// <summary>
- /// Read bool array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Bool array.</returns>
- bool[] ReadBoolArray(int cnt);
-
- /// <summary>
- /// Write byte.
- /// </summary>
- /// <param name="val">Byte value.</param>
- void WriteByte(byte val);
-
- /// <summary>
- /// Read byte.
- /// </summary>
- /// <returns>Byte value.</returns>
- byte ReadByte();
-
- /// <summary>
- /// Write byte array.
- /// </summary>
- /// <param name="val">Byte array.</param>
- void WriteByteArray(byte[] val);
-
- /// <summary>
- /// Read byte array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Byte array.</returns>
- byte[] ReadByteArray(int cnt);
-
- /// <summary>
- /// Write short.
- /// </summary>
- /// <param name="val">Short value.</param>
- void WriteShort(short val);
-
- /// <summary>
- /// Read short.
- /// </summary>
- /// <returns>Short value.</returns>
- short ReadShort();
-
- /// <summary>
- /// Write short array.
- /// </summary>
- /// <param name="val">Short array.</param>
- void WriteShortArray(short[] val);
-
- /// <summary>
- /// Read short array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Short array.</returns>
- short[] ReadShortArray(int cnt);
-
- /// <summary>
- /// Write char.
- /// </summary>
- /// <param name="val">Char value.</param>
- void WriteChar(char val);
-
- /// <summary>
- /// Read char.
- /// </summary>
- /// <returns>Char value.</returns>
- char ReadChar();
-
- /// <summary>
- /// Write char array.
- /// </summary>
- /// <param name="val">Char array.</param>
- void WriteCharArray(char[] val);
-
- /// <summary>
- /// Read char array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Char array.</returns>
- char[] ReadCharArray(int cnt);
-
- /// <summary>
- /// Write int.
- /// </summary>
- /// <param name="val">Int value.</param>
- void WriteInt(int val);
-
- /// <summary>
- /// Write int to specific position.
- /// </summary>
- /// <param name="writePos">Position.</param>
- /// <param name="val">Value.</param>
- void WriteInt(int writePos, int val);
-
- /// <summary>
- /// Read int.
- /// </summary>
- /// <returns>Int value.</returns>
- int ReadInt();
-
- /// <summary>
- /// Write int array.
- /// </summary>
- /// <param name="val">Int array.</param>
- void WriteIntArray(int[] val);
-
- /// <summary>
- /// Read int array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Int array.</returns>
- int[] ReadIntArray(int cnt);
-
- /// <summary>
- /// Write long.
- /// </summary>
- /// <param name="val">Long value.</param>
- void WriteLong(long val);
-
- /// <summary>
- /// Read long.
- /// </summary>
- /// <returns>Long value.</returns>
- long ReadLong();
-
- /// <summary>
- /// Write long array.
- /// </summary>
- /// <param name="val">Long array.</param>
- void WriteLongArray(long[] val);
-
- /// <summary>
- /// Read long array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Long array.</returns>
- long[] ReadLongArray(int cnt);
-
- /// <summary>
- /// Write float.
- /// </summary>
- /// <param name="val">Float value.</param>
- void WriteFloat(float val);
-
- /// <summary>
- /// Read float.
- /// </summary>
- /// <returns>Float value.</returns>
- float ReadFloat();
-
- /// <summary>
- /// Write float array.
- /// </summary>
- /// <param name="val">Float array.</param>
- void WriteFloatArray(float[] val);
-
- /// <summary>
- /// Read float array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Float array.</returns>
- float[] ReadFloatArray(int cnt);
-
- /// <summary>
- /// Write double.
- /// </summary>
- /// <param name="val">Double value.</param>
- void WriteDouble(double val);
-
- /// <summary>
- /// Read double.
- /// </summary>
- /// <returns>Double value.</returns>
- double ReadDouble();
-
- /// <summary>
- /// Write double array.
- /// </summary>
- /// <param name="val">Double array.</param>
- void WriteDoubleArray(double[] val);
-
- /// <summary>
- /// Read double array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>Double array.</returns>
- double[] ReadDoubleArray(int cnt);
-
- /// <summary>
- /// Write string.
- /// </summary>
- /// <param name="chars">Characters.</param>
- /// <param name="charCnt">Char count.</param>
- /// <param name="byteCnt">Byte count.</param>
- /// <param name="encoding">Encoding.</param>
- /// <returns>Amounts of bytes written.</returns>
- int WriteString(char* chars, int charCnt, int byteCnt, Encoding encoding);
-
- /// <summary>
- /// Write arbitrary data.
- /// </summary>
- /// <param name="src">Source array.</param>
- /// <param name="off">Offset</param>
- /// <param name="cnt">Count.</param>
- void Write(byte[] src, int off, int cnt);
-
- /// <summary>
- /// Read arbitrary data.
- /// </summary>
- /// <param name="dest">Destination array.</param>
- /// <param name="off">Offset.</param>
- /// <param name="cnt">Count.</param>
- /// <returns>Amount of bytes read.</returns>
- void Read(byte[] dest, int off, int cnt);
-
- /// <summary>
- /// Write arbitrary data.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="cnt">Count.</param>
- void Write(byte* src, int cnt);
-
- /// <summary>
- /// Read arbitrary data.
- /// </summary>
- /// <param name="dest">Destination.</param>
- /// <param name="cnt">Count.</param>
- void Read(byte* dest, int cnt);
-
- /// <summary>
- /// Position.
- /// </summary>
- int Position
- {
- get;
- }
-
- /// <summary>
- /// Gets remaining bytes in the stream.
- /// </summary>
- /// <returns>Remaining bytes.</returns>
- int Remaining();
-
- /// <summary>
- /// Gets underlying array, avoiding copying if possible.
- /// </summary>
- /// <returns>Underlying array.</returns>
- byte[] Array();
-
- /// <summary>
- /// Gets underlying data in a new array.
- /// </summary>
- /// <returns>New array with data.</returns>
- byte[] ArrayCopy();
-
- /// <summary>
- /// Check whether array passed as argument is the same as the stream hosts.
- /// </summary>
- /// <param name="arr">Array.</param>
- /// <returns><c>True</c> if they are same.</returns>
- bool IsSameArray(byte[] arr);
-
- /// <summary>
- /// Seek to the given positoin.
- /// </summary>
- /// <param name="offset">Offset.</param>
- /// <param name="origin">Seek origin.</param>
- /// <returns>Position.</returns>
- int Seek(int offset, SeekOrigin origin);
- }
-}
[19/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
deleted file mode 100644
index 95a6ef8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemHandlers.cs
+++ /dev/null
@@ -1,1336 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Write delegate.
- /// </summary>
- /// <param name="writer">Write context.</param>
- /// <param name="obj">Object to write.</param>
- internal delegate void PortableSystemWriteDelegate(PortableWriterImpl writer, object obj);
-
- /// <summary>
- /// Typed write delegate.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="obj">Object to write.</param>
- // ReSharper disable once TypeParameterCanBeVariant
- // Generic variance in a delegate causes performance hit
- internal delegate void PortableSystemTypedWriteDelegate<T>(IPortableStream stream, T obj);
-
- /**
- * <summary>Collection of predefined handlers for various system types.</summary>
- */
- internal static class PortableSystemHandlers
- {
- /** Write handlers. */
- private static readonly Dictionary<Type, PortableSystemWriteDelegate> WriteHandlers =
- new Dictionary<Type, PortableSystemWriteDelegate>();
-
- /** Read handlers. */
- private static readonly IPortableSystemReader[] ReadHandlers = new IPortableSystemReader[255];
-
- /** Typed write handler: boolean. */
- public static readonly PortableSystemTypedWriteDelegate<bool> WriteHndBoolTyped = WriteBoolTyped;
-
- /** Typed write handler: byte. */
- public static readonly PortableSystemTypedWriteDelegate<byte> WriteHndByteTyped = WriteByteTyped;
-
- /** Typed write handler: short. */
- public static readonly PortableSystemTypedWriteDelegate<short> WriteHndShortTyped = WriteShortTyped;
-
- /** Typed write handler: char. */
- public static readonly PortableSystemTypedWriteDelegate<char> WriteHndCharTyped = WriteCharTyped;
-
- /** Typed write handler: int. */
- public static readonly PortableSystemTypedWriteDelegate<int> WriteHndIntTyped = WriteIntTyped;
-
- /** Typed write handler: long. */
- public static readonly PortableSystemTypedWriteDelegate<long> WriteHndLongTyped = WriteLongTyped;
-
- /** Typed write handler: float. */
- public static readonly PortableSystemTypedWriteDelegate<float> WriteHndFloatTyped = WriteFloatTyped;
-
- /** Typed write handler: double. */
- public static readonly PortableSystemTypedWriteDelegate<double> WriteHndDoubleTyped = WriteDoubleTyped;
-
- /** Typed write handler: decimal. */
- public static readonly PortableSystemTypedWriteDelegate<decimal> WriteHndDecimalTyped = WriteDecimalTyped;
-
- /** Typed write handler: Date. */
- public static readonly PortableSystemTypedWriteDelegate<DateTime?> WriteHndDateTyped = WriteDateTyped;
-
- /** Typed write handler: string. */
- public static readonly PortableSystemTypedWriteDelegate<string> WriteHndStringTyped = WriteStringTyped;
-
- /** Typed write handler: Guid. */
- public static readonly PortableSystemTypedWriteDelegate<Guid?> WriteHndGuidTyped = WriteGuidTyped;
-
- /** Typed write handler: Portable. */
- public static readonly PortableSystemTypedWriteDelegate<PortableUserObject> WriteHndPortableTyped = WritePortableTyped;
-
- /** Typed write handler: boolean array. */
- public static readonly PortableSystemTypedWriteDelegate<bool[]> WriteHndBoolArrayTyped = WriteBoolArrayTyped;
-
- /** Typed write handler: byte array. */
- public static readonly PortableSystemTypedWriteDelegate<byte[]> WriteHndByteArrayTyped = WriteByteArrayTyped;
-
- /** Typed write handler: short array. */
- public static readonly PortableSystemTypedWriteDelegate<short[]> WriteHndShortArrayTyped = WriteShortArrayTyped;
-
- /** Typed write handler: char array. */
- public static readonly PortableSystemTypedWriteDelegate<char[]> WriteHndCharArrayTyped = WriteCharArrayTyped;
-
- /** Typed write handler: int array. */
- public static readonly PortableSystemTypedWriteDelegate<int[]> WriteHndIntArrayTyped = WriteIntArrayTyped;
-
- /** Typed write handler: long array. */
- public static readonly PortableSystemTypedWriteDelegate<long[]> WriteHndLongArrayTyped = WriteLongArrayTyped;
-
- /** Typed write handler: float array. */
- public static readonly PortableSystemTypedWriteDelegate<float[]> WriteHndFloatArrayTyped = WriteFloatArrayTyped;
-
- /** Typed write handler: double array. */
- public static readonly PortableSystemTypedWriteDelegate<double[]> WriteHndDoubleArrayTyped = WriteDoubleArrayTyped;
-
- /** Typed write handler: decimal array. */
- public static readonly PortableSystemTypedWriteDelegate<decimal[]> WriteHndDecimalArrayTyped = WriteDecimalArrayTyped;
-
- /** Typed write handler: Date array. */
- public static readonly PortableSystemTypedWriteDelegate<DateTime?[]> WriteHndDateArrayTyped = WriteDateArrayTyped;
-
- /** Typed write handler: string array. */
- public static readonly PortableSystemTypedWriteDelegate<string[]> WriteHndStringArrayTyped = WriteStringArrayTyped;
-
- /** Typed write handler: Guid array. */
- public static readonly PortableSystemTypedWriteDelegate<Guid?[]> WriteHndGuidArrayTyped = WriteGuidArrayTyped;
-
- /** Write handler: boolean. */
- public static readonly PortableSystemWriteDelegate WriteHndBool = WriteBool;
-
- /** Write handler: sbyte. */
- public static readonly PortableSystemWriteDelegate WriteHndSbyte = WriteSbyte;
-
- /** Write handler: byte. */
- public static readonly PortableSystemWriteDelegate WriteHndByte = WriteByte;
-
- /** Write handler: short. */
- public static readonly PortableSystemWriteDelegate WriteHndShort = WriteShort;
-
- /** Write handler: ushort. */
- public static readonly PortableSystemWriteDelegate WriteHndUshort = WriteUshort;
-
- /** Write handler: char. */
- public static readonly PortableSystemWriteDelegate WriteHndChar = WriteChar;
-
- /** Write handler: int. */
- public static readonly PortableSystemWriteDelegate WriteHndInt = WriteInt;
-
- /** Write handler: uint. */
- public static readonly PortableSystemWriteDelegate WriteHndUint = WriteUint;
-
- /** Write handler: long. */
- public static readonly PortableSystemWriteDelegate WriteHndLong = WriteLong;
-
- /** Write handler: ulong. */
- public static readonly PortableSystemWriteDelegate WriteHndUlong = WriteUlong;
-
- /** Write handler: float. */
- public static readonly PortableSystemWriteDelegate WriteHndFloat = WriteFloat;
-
- /** Write handler: double. */
- public static readonly PortableSystemWriteDelegate WriteHndDouble = WriteDouble;
-
- /** Write handler: decimal. */
- public static readonly PortableSystemWriteDelegate WriteHndDecimal = WriteDecimal;
-
- /** Write handler: Date. */
- public static readonly PortableSystemWriteDelegate WriteHndDate = WriteDate;
-
- /** Write handler: string. */
- public static readonly PortableSystemWriteDelegate WriteHndString = WriteString;
-
- /** Write handler: Guid. */
- public static readonly PortableSystemWriteDelegate WriteHndGuid = WriteGuid;
-
- /** Write handler: Portable. */
- public static readonly PortableSystemWriteDelegate WriteHndPortable = WritePortable;
-
- /** Write handler: Enum. */
- public static readonly PortableSystemWriteDelegate WriteHndEnum = WriteEnum;
-
- /** Write handler: boolean array. */
- public static readonly PortableSystemWriteDelegate WriteHndBoolArray = WriteBoolArray;
-
- /** Write handler: sbyte array. */
- public static readonly PortableSystemWriteDelegate WriteHndSbyteArray = WriteSbyteArray;
-
- /** Write handler: byte array. */
- public static readonly PortableSystemWriteDelegate WriteHndByteArray = WriteByteArray;
-
- /** Write handler: short array. */
- public static readonly PortableSystemWriteDelegate WriteHndShortArray = WriteShortArray;
-
- /** Write handler: ushort array. */
- public static readonly PortableSystemWriteDelegate WriteHndUshortArray = WriteUshortArray;
-
- /** Write handler: char array. */
- public static readonly PortableSystemWriteDelegate WriteHndCharArray = WriteCharArray;
-
- /** Write handler: int array. */
- public static readonly PortableSystemWriteDelegate WriteHndIntArray = WriteIntArray;
-
- /** Write handler: uint array. */
- public static readonly PortableSystemWriteDelegate WriteHndUintArray = WriteUintArray;
-
- /** Write handler: long array. */
- public static readonly PortableSystemWriteDelegate WriteHndLongArray = WriteLongArray;
-
- /** Write handler: ulong array. */
- public static readonly PortableSystemWriteDelegate WriteHndUlongArray = WriteUlongArray;
-
- /** Write handler: float array. */
- public static readonly PortableSystemWriteDelegate WriteHndFloatArray = WriteFloatArray;
-
- /** Write handler: double array. */
- public static readonly PortableSystemWriteDelegate WriteHndDoubleArray = WriteDoubleArray;
-
- /** Write handler: decimal array. */
- public static readonly PortableSystemWriteDelegate WriteHndDecimalArray = WriteDecimalArray;
-
- /** Write handler: date array. */
- public static readonly PortableSystemWriteDelegate WriteHndDateArray = WriteDateArray;
-
- /** Write handler: string array. */
- public static readonly PortableSystemWriteDelegate WriteHndStringArray = WriteStringArray;
-
- /** Write handler: Guid array. */
- public static readonly PortableSystemWriteDelegate WriteHndGuidArray = WriteGuidArray;
-
- /** Write handler: Enum array. */
- public static readonly PortableSystemWriteDelegate WriteHndEnumArray = WriteEnumArray;
-
- /** Write handler: object array. */
- public static readonly PortableSystemWriteDelegate WriteHndArray = WriteArray;
-
- /** Write handler: collection. */
- public static readonly PortableSystemWriteDelegate WriteHndCollection = WriteCollection;
-
- /** Write handler: dictionary. */
- public static readonly PortableSystemWriteDelegate WriteHndDictionary = WriteDictionary;
-
- /** Write handler: generic collection. */
- public static readonly PortableSystemWriteDelegate WriteHndGenericCollection =
- WriteGenericCollection;
-
- /** Write handler: generic dictionary. */
- public static readonly PortableSystemWriteDelegate WriteHndGenericDictionary =
- WriteGenericDictionary;
-
- /**
- * <summary>Static initializer.</summary>
- */
- static PortableSystemHandlers()
- {
- // 1. Primitives.
-
- ReadHandlers[PortableUtils.TypeBool] = new PortableSystemReader<bool>(s => s.ReadBool());
-
- WriteHandlers[typeof(sbyte)] = WriteHndSbyte;
- ReadHandlers[PortableUtils.TypeByte] = new PortableSystemReader<byte>(s => s.ReadByte());
-
- WriteHandlers[typeof(ushort)] = WriteHndUshort;
- ReadHandlers[PortableUtils.TypeShort] = new PortableSystemReader<short>(s => s.ReadShort());
-
- ReadHandlers[PortableUtils.TypeChar] = new PortableSystemReader<char>(s => s.ReadChar());
-
- WriteHandlers[typeof(uint)] = WriteHndUint;
- ReadHandlers[PortableUtils.TypeInt] = new PortableSystemReader<int>(s => s.ReadInt());
-
- WriteHandlers[typeof(ulong)] = WriteHndUlong;
- ReadHandlers[PortableUtils.TypeLong] = new PortableSystemReader<long>(s => s.ReadLong());
-
- ReadHandlers[PortableUtils.TypeFloat] = new PortableSystemReader<float>(s => s.ReadFloat());
-
- ReadHandlers[PortableUtils.TypeDouble] = new PortableSystemReader<double>(s => s.ReadDouble());
-
- ReadHandlers[PortableUtils.TypeDecimal] = new PortableSystemReader<decimal>(PortableUtils.ReadDecimal);
-
- // 2. Date.
- ReadHandlers[PortableUtils.TypeDate] =
- new PortableSystemReader<DateTime?>(s => PortableUtils.ReadDate(s, false));
-
- // 3. String.
- ReadHandlers[PortableUtils.TypeString] = new PortableSystemReader<string>(PortableUtils.ReadString);
-
- // 4. Guid.
- ReadHandlers[PortableUtils.TypeGuid] = new PortableSystemReader<Guid?>(PortableUtils.ReadGuid);
-
- // 5. Primitive arrays.
- ReadHandlers[PortableUtils.TypeArrayBool] = new PortableSystemReader<bool[]>(PortableUtils.ReadBooleanArray);
-
- WriteHandlers[typeof(sbyte[])] = WriteHndSbyteArray;
- ReadHandlers[PortableUtils.TypeArrayByte] =
- new PortableSystemDualReader<byte[], sbyte[]>(PortableUtils.ReadByteArray, PortableUtils.ReadSbyteArray);
-
- WriteHandlers[typeof(ushort[])] = WriteHndUshortArray;
- ReadHandlers[PortableUtils.TypeArrayShort] =
- new PortableSystemDualReader<short[], ushort[]>(PortableUtils.ReadShortArray,
- PortableUtils.ReadUshortArray);
-
- ReadHandlers[PortableUtils.TypeArrayChar] =
- new PortableSystemReader<char[]>(PortableUtils.ReadCharArray);
-
- WriteHandlers[typeof(uint[])] = WriteHndUintArray;
- ReadHandlers[PortableUtils.TypeArrayInt] =
- new PortableSystemDualReader<int[], uint[]>(PortableUtils.ReadIntArray, PortableUtils.ReadUintArray);
-
-
- WriteHandlers[typeof(ulong[])] = WriteHndUlongArray;
- ReadHandlers[PortableUtils.TypeArrayLong] =
- new PortableSystemDualReader<long[], ulong[]>(PortableUtils.ReadLongArray,
- PortableUtils.ReadUlongArray);
-
- ReadHandlers[PortableUtils.TypeArrayFloat] =
- new PortableSystemReader<float[]>(PortableUtils.ReadFloatArray);
-
- ReadHandlers[PortableUtils.TypeArrayDouble] =
- new PortableSystemReader<double[]>(PortableUtils.ReadDoubleArray);
-
- ReadHandlers[PortableUtils.TypeArrayDecimal] =
- new PortableSystemReader<decimal[]>(PortableUtils.ReadDecimalArray);
-
- // 6. Date array.
- ReadHandlers[PortableUtils.TypeArrayDate] =
- new PortableSystemReader<DateTime?[]>(s => PortableUtils.ReadDateArray(s, false));
-
- // 7. String array.
- ReadHandlers[PortableUtils.TypeArrayString] = new PortableSystemGenericArrayReader<string>();
-
- // 8. Guid array.
- ReadHandlers[PortableUtils.TypeArrayGuid] = new PortableSystemGenericArrayReader<Guid?>();
-
- // 9. Array.
- ReadHandlers[PortableUtils.TypeArray] = new PortableSystemReader(ReadArray);
-
- // 10. Predefined collections.
- WriteHandlers[typeof(ArrayList)] = WriteArrayList;
-
- // 11. Predefined dictionaries.
- WriteHandlers[typeof(Hashtable)] = WriteHashtable;
-
- // 12. Arbitrary collection.
- ReadHandlers[PortableUtils.TypeCollection] = new PortableSystemReader(ReadCollection);
-
- // 13. Arbitrary dictionary.
- ReadHandlers[PortableUtils.TypeDictionary] = new PortableSystemReader(ReadDictionary);
-
- // 14. Map entry.
- WriteHandlers[typeof(DictionaryEntry)] = WriteMapEntry;
- ReadHandlers[PortableUtils.TypeMapEntry] = new PortableSystemReader(ReadMapEntry);
-
- // 15. Portable.
- WriteHandlers[typeof(PortableUserObject)] = WritePortable;
-
- // 16. Enum.
- ReadHandlers[PortableUtils.TypeEnum] = new PortableSystemReader<int>(PortableUtils.ReadEnum<int>);
- ReadHandlers[PortableUtils.TypeArrayEnum] = new PortableSystemReader(ReadEnumArray);
- }
-
- /**
- * <summary>Get write handler for type.</summary>
- * <param name="type">Type.</param>
- * <returns>Handler or null if cannot be hanled in special way.</returns>
- */
- public static PortableSystemWriteDelegate WriteHandler(Type type)
- {
- PortableSystemWriteDelegate handler;
-
- if (WriteHandlers.TryGetValue(type, out handler))
- return handler;
-
- // 1. Array?
- if (type.IsArray)
- {
- if (type.GetElementType().IsEnum)
- return WriteEnumArray;
- return WriteArray;
- }
-
- // 2. Enum?
- if (type.IsEnum)
- return WriteEnum;
-
- // 3. Collection?
- PortableCollectionInfo info = PortableCollectionInfo.Info(type);
-
- if (info.IsAny)
- return info.WriteHandler;
-
- // No special handler found.
- return null;
- }
-
- /// <summary>
- /// Reads an object of predefined type.
- /// </summary>
- public static T ReadSystemType<T>(byte typeId, PortableReaderImpl ctx)
- {
- var handler = ReadHandlers[typeId];
-
- Debug.Assert(handler != null, "Cannot find predefined read handler: " + typeId);
-
- return handler.Read<T>(ctx);
- }
-
- /**
- * <summary>Write boolean.</summary>
- */
- private static void WriteBool(PortableWriterImpl ctx, object obj)
- {
- WriteBoolTyped(ctx.Stream, (bool)obj);
- }
-
- /**
- * <summary>Write boolean.</summary>
- */
- private static void WriteBoolTyped(IPortableStream stream, bool obj)
- {
- stream.WriteByte(PortableUtils.TypeBool);
-
- stream.WriteBool(obj);
- }
-
- /**
- * <summary>Write sbyte.</summary>
- */
- private static unsafe void WriteSbyte(PortableWriterImpl ctx, object obj)
- {
- sbyte val = (sbyte)obj;
-
- ctx.Stream.WriteByte(PortableUtils.TypeByte);
- ctx.Stream.WriteByte(*(byte*)&val);
- }
-
- /**
- * <summary>Write byte.</summary>
- */
- private static void WriteByte(PortableWriterImpl ctx, object obj)
- {
- WriteByteTyped(ctx.Stream, (byte)obj);
- }
-
- /**
- * <summary>Write byte.</summary>
- */
- private static void WriteByteTyped(IPortableStream stream, byte obj)
- {
- stream.WriteByte(PortableUtils.TypeByte);
- stream.WriteByte(obj);
- }
-
- /**
- * <summary>Write short.</summary>
- */
- private static void WriteShort(PortableWriterImpl ctx, object obj)
- {
- WriteShortTyped(ctx.Stream, (short)obj);
- }
-
- /**
- * <summary>Write short.</summary>
- */
- private static void WriteShortTyped(IPortableStream stream, short obj)
- {
- stream.WriteByte(PortableUtils.TypeShort);
-
- stream.WriteShort(obj);
- }
-
- /**
- * <summary>Write ushort.</summary>
- */
- private static unsafe void WriteUshort(PortableWriterImpl ctx, object obj)
- {
- ushort val = (ushort)obj;
-
- ctx.Stream.WriteByte(PortableUtils.TypeShort);
-
- ctx.Stream.WriteShort(*(short*)&val);
- }
-
- /**
- * <summary>Write char.</summary>
- */
- private static void WriteChar(PortableWriterImpl ctx, object obj)
- {
- WriteCharTyped(ctx.Stream, (char)obj);
- }
-
- /**
- * <summary>Write char.</summary>
- */
- private static void WriteCharTyped(IPortableStream stream, char obj)
- {
- stream.WriteByte(PortableUtils.TypeChar);
-
- stream.WriteChar(obj);
- }
-
- /**
- * <summary>Write int.</summary>
- */
- private static void WriteInt(PortableWriterImpl ctx, object obj)
- {
- WriteIntTyped(ctx.Stream, (int)obj);
- }
-
- /**
- * <summary>Write int.</summary>
- */
- private static void WriteIntTyped(IPortableStream stream, int obj)
- {
- stream.WriteByte(PortableUtils.TypeInt);
- stream.WriteInt(obj);
- }
-
- /**
- * <summary>Write uint.</summary>
- */
- private static unsafe void WriteUint(PortableWriterImpl ctx, object obj)
- {
- uint val = (uint)obj;
-
- ctx.Stream.WriteByte(PortableUtils.TypeInt);
- ctx.Stream.WriteInt(*(int*)&val);
- }
-
- /**
- * <summary>Write long.</summary>
- */
- private static void WriteLong(PortableWriterImpl ctx, object obj)
- {
- WriteLongTyped(ctx.Stream, (long)obj);
- }
-
- /**
- * <summary>Write long.</summary>
- */
- private static void WriteLongTyped(IPortableStream stream, long obj)
- {
- stream.WriteByte(PortableUtils.TypeLong);
- stream.WriteLong(obj);
- }
-
- /**
- * <summary>Write ulong.</summary>
- */
- private static unsafe void WriteUlong(PortableWriterImpl ctx, object obj)
- {
- ulong val = (ulong)obj;
-
- ctx.Stream.WriteByte(PortableUtils.TypeLong);
- ctx.Stream.WriteLong(*(long*)&val);
- }
-
- /**
- * <summary>Write float.</summary>
- */
- private static void WriteFloat(PortableWriterImpl ctx, object obj)
- {
- WriteFloatTyped(ctx.Stream, (float)obj);
- }
-
- /**
- * <summary>Write float.</summary>
- */
- private static void WriteFloatTyped(IPortableStream stream, float obj)
- {
- stream.WriteByte(PortableUtils.TypeFloat);
- stream.WriteFloat(obj);
- }
-
- /**
- * <summary>Write double.</summary>
- */
- private static void WriteDouble(PortableWriterImpl ctx, object obj)
- {
- WriteDoubleTyped(ctx.Stream, (double)obj);
- }
-
- /**
- * <summary>Write double.</summary>
- */
- private static void WriteDoubleTyped(IPortableStream stream, double obj)
- {
- stream.WriteByte(PortableUtils.TypeDouble);
- stream.WriteDouble(obj);
- }
-
- /**
- * <summary>Write decimal.</summary>
- */
- private static void WriteDecimal(PortableWriterImpl ctx, object obj)
- {
- WriteDecimalTyped(ctx.Stream, (decimal)obj);
- }
-
- /**
- * <summary>Write double.</summary>
- */
- private static void WriteDecimalTyped(IPortableStream stream, decimal obj)
- {
- stream.WriteByte(PortableUtils.TypeDecimal);
-
- PortableUtils.WriteDecimal(obj, stream);
- }
-
- /**
- * <summary>Write date.</summary>
- */
- private static void WriteDate(PortableWriterImpl ctx, object obj)
- {
- WriteDateTyped(ctx.Stream, (DateTime?)obj);
- }
-
- /**
- * <summary>Write double.</summary>
- */
- private static void WriteDateTyped(IPortableStream stream, DateTime? obj)
- {
- stream.WriteByte(PortableUtils.TypeDate);
-
- PortableUtils.WriteDate(obj, stream);
- }
-
- /**
- * <summary>Write string.</summary>
- */
- private static void WriteString(PortableWriterImpl ctx, object obj)
- {
- WriteStringTyped(ctx.Stream, (string)obj);
- }
-
- /**
- * <summary>Write string.</summary>
- */
- private static void WriteStringTyped(IPortableStream stream, string obj)
- {
- stream.WriteByte(PortableUtils.TypeString);
-
- PortableUtils.WriteString(obj, stream);
- }
-
- /**
- * <summary>Write Guid.</summary>
- */
- private static void WriteGuid(PortableWriterImpl ctx, object obj)
- {
- WriteGuidTyped(ctx.Stream, (Guid?)obj);
- }
-
- /**
- * <summary>Write Guid.</summary>
- */
- private static void WriteGuidTyped(IPortableStream stream, Guid? obj)
- {
- stream.WriteByte(PortableUtils.TypeGuid);
-
- PortableUtils.WriteGuid(obj, stream);
- }
-
- /**
- * <summary>Write bool array.</summary>
- */
- private static void WriteBoolArray(PortableWriterImpl ctx, object obj)
- {
- WriteBoolArrayTyped(ctx.Stream, (bool[])obj);
- }
-
- /**
- * <summary>Write bool array.</summary>
- */
- private static void WriteBoolArrayTyped(IPortableStream stream, bool[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayBool);
-
- PortableUtils.WriteBooleanArray(obj, stream);
- }
-
- /**
- * <summary>Write byte array.</summary>
- */
- private static void WriteByteArray(PortableWriterImpl ctx, object obj)
- {
- WriteByteArrayTyped(ctx.Stream, (byte[])obj);
- }
-
- /**
- * <summary>Write byte array.</summary>
- */
- private static void WriteByteArrayTyped(IPortableStream stream, byte[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayByte);
-
- PortableUtils.WriteByteArray(obj, stream);
- }
-
- /**
- * <summary>Write sbyte array.</summary>
- */
- private static void WriteSbyteArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayByte);
-
- PortableUtils.WriteByteArray((byte[])(Array)obj, ctx.Stream);
- }
-
- /**
- * <summary>Write short array.</summary>
- */
- private static void WriteShortArray(PortableWriterImpl ctx, object obj)
- {
- WriteShortArrayTyped(ctx.Stream, (short[])obj);
- }
-
- /**
- * <summary>Write short array.</summary>
- */
- private static void WriteShortArrayTyped(IPortableStream stream, short[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayShort);
-
- PortableUtils.WriteShortArray(obj, stream);
- }
-
- /**
- * <summary>Write ushort array.</summary>
- */
- private static void WriteUshortArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayShort);
-
- PortableUtils.WriteShortArray((short[])(Array)obj, ctx.Stream);
- }
-
- /**
- * <summary>Write char array.</summary>
- */
- private static void WriteCharArray(PortableWriterImpl ctx, object obj)
- {
- WriteCharArrayTyped(ctx.Stream, (char[])obj);
- }
-
- /**
- * <summary>Write char array.</summary>
- */
- private static void WriteCharArrayTyped(IPortableStream stream, char[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayChar);
-
- PortableUtils.WriteCharArray(obj, stream);
- }
-
- /**
- * <summary>Write int array.</summary>
- */
- private static void WriteIntArray(PortableWriterImpl ctx, object obj)
- {
- WriteIntArrayTyped(ctx.Stream, (int[])obj);
- }
-
- /**
- * <summary>Write int array.</summary>
- */
- private static void WriteIntArrayTyped(IPortableStream stream, int[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayInt);
-
- PortableUtils.WriteIntArray(obj, stream);
- }
-
- /**
- * <summary>Write uint array.</summary>
- */
- private static void WriteUintArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayInt);
-
- PortableUtils.WriteIntArray((int[])(Array)obj, ctx.Stream);
- }
-
- /**
- * <summary>Write long array.</summary>
- */
- private static void WriteLongArray(PortableWriterImpl ctx, object obj)
- {
- WriteLongArrayTyped(ctx.Stream, (long[])obj);
- }
-
- /**
- * <summary>Write long array.</summary>
- */
- private static void WriteLongArrayTyped(IPortableStream stream, long[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayLong);
-
- PortableUtils.WriteLongArray(obj, stream);
- }
-
- /**
- * <summary>Write ulong array.</summary>
- */
- private static void WriteUlongArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayLong);
-
- PortableUtils.WriteLongArray((long[])(Array)obj, ctx.Stream);
- }
-
- /**
- * <summary>Write float array.</summary>
- */
- private static void WriteFloatArray(PortableWriterImpl ctx, object obj)
- {
- WriteFloatArrayTyped(ctx.Stream, (float[])obj);
- }
-
- /**
- * <summary>Write float array.</summary>
- */
- private static void WriteFloatArrayTyped(IPortableStream stream, float[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayFloat);
-
- PortableUtils.WriteFloatArray(obj, stream);
- }
-
- /**
- * <summary>Write double array.</summary>
- */
- private static void WriteDoubleArray(PortableWriterImpl ctx, object obj)
- {
- WriteDoubleArrayTyped(ctx.Stream, (double[])obj);
- }
-
- /**
- * <summary>Write double array.</summary>
- */
- private static void WriteDoubleArrayTyped(IPortableStream stream, double[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayDouble);
-
- PortableUtils.WriteDoubleArray(obj, stream);
- }
-
- /**
- * <summary>Write decimal array.</summary>
- */
- private static void WriteDecimalArray(PortableWriterImpl ctx, object obj)
- {
- WriteDecimalArrayTyped(ctx.Stream, (decimal[])obj);
- }
-
- /**
- * <summary>Write double array.</summary>
- */
- private static void WriteDecimalArrayTyped(IPortableStream stream, decimal[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayDecimal);
-
- PortableUtils.WriteDecimalArray(obj, stream);
- }
-
- /**
- * <summary>Write date array.</summary>
- */
- private static void WriteDateArray(PortableWriterImpl ctx, object obj)
- {
- WriteDateArrayTyped(ctx.Stream, (DateTime?[])obj);
- }
-
- /**
- * <summary>Write date array.</summary>
- */
- private static void WriteDateArrayTyped(IPortableStream stream, DateTime?[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayDate);
-
- PortableUtils.WriteDateArray(obj, stream);
- }
-
- /**
- * <summary>Write string array.</summary>
- */
- private static void WriteStringArray(PortableWriterImpl ctx, object obj)
- {
- WriteStringArrayTyped(ctx.Stream, (string[])obj);
- }
-
- /**
- * <summary>Write string array.</summary>
- */
- private static void WriteStringArrayTyped(IPortableStream stream, string[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayString);
-
- PortableUtils.WriteStringArray(obj, stream);
- }
-
- /**
- * <summary>Write Guid array.</summary>
- */
- private static void WriteGuidArray(PortableWriterImpl ctx, object obj)
- {
- WriteGuidArrayTyped(ctx.Stream, (Guid?[])obj);
- }
-
- /**
- * <summary>Write Guid array.</summary>
- */
- private static void WriteGuidArrayTyped(IPortableStream stream, Guid?[] obj)
- {
- stream.WriteByte(PortableUtils.TypeArrayGuid);
-
- PortableUtils.WriteGuidArray(obj, stream);
- }
-
- /**
- * <summary>Write enum array.</summary>
- */
- private static void WriteEnumArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArrayEnum);
-
- PortableUtils.WriteArray((Array)obj, ctx, true);
- }
-
- /**
- * <summary>Write array.</summary>
- */
- private static void WriteArray(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeArray);
-
- PortableUtils.WriteArray((Array)obj, ctx, true);
- }
-
- /**
- * <summary>Write collection.</summary>
- */
- private static void WriteCollection(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeCollection);
-
- PortableUtils.WriteCollection((ICollection)obj, ctx);
- }
-
- /**
- * <summary>Write generic collection.</summary>
- */
- private static void WriteGenericCollection(PortableWriterImpl ctx, object obj)
- {
- PortableCollectionInfo info = PortableCollectionInfo.Info(obj.GetType());
-
- Debug.Assert(info.IsGenericCollection, "Not generic collection: " + obj.GetType().FullName);
-
- ctx.Stream.WriteByte(PortableUtils.TypeCollection);
-
- info.WriteGeneric(ctx, obj);
- }
-
- /**
- * <summary>Write dictionary.</summary>
- */
- private static void WriteDictionary(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeDictionary);
-
- PortableUtils.WriteDictionary((IDictionary)obj, ctx);
- }
-
- /**
- * <summary>Write generic dictionary.</summary>
- */
- private static void WriteGenericDictionary(PortableWriterImpl ctx, object obj)
- {
- PortableCollectionInfo info = PortableCollectionInfo.Info(obj.GetType());
-
- Debug.Assert(info.IsGenericDictionary, "Not generic dictionary: " + obj.GetType().FullName);
-
- ctx.Stream.WriteByte(PortableUtils.TypeDictionary);
-
- info.WriteGeneric(ctx, obj);
- }
-
- /**
- * <summary>Write ArrayList.</summary>
- */
- private static void WriteArrayList(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeCollection);
-
- PortableUtils.WriteTypedCollection((ICollection)obj, ctx, PortableUtils.CollectionArrayList);
- }
-
- /**
- * <summary>Write Hashtable.</summary>
- */
- private static void WriteHashtable(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeDictionary);
-
- PortableUtils.WriteTypedDictionary((IDictionary)obj, ctx, PortableUtils.MapHashMap);
- }
-
- /**
- * <summary>Write map entry.</summary>
- */
- private static void WriteMapEntry(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeMapEntry);
-
- PortableUtils.WriteMapEntry(ctx, (DictionaryEntry)obj);
- }
-
- /**
- * <summary>Write portable object.</summary>
- */
- private static void WritePortable(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypePortable);
-
- PortableUtils.WritePortable(ctx.Stream, (PortableUserObject)obj);
- }
-
- /**
- * <summary>Write portable object.</summary>
- */
- private static void WritePortableTyped(IPortableStream stream, PortableUserObject obj)
- {
- stream.WriteByte(PortableUtils.TypePortable);
-
- PortableUtils.WritePortable(stream, obj);
- }
-
- /// <summary>
- /// Write enum.
- /// </summary>
- private static void WriteEnum(PortableWriterImpl ctx, object obj)
- {
- ctx.Stream.WriteByte(PortableUtils.TypeEnum);
-
- PortableUtils.WriteEnum(ctx.Stream, (Enum)obj);
- }
-
- /**
- * <summary>Read enum array.</summary>
- */
- private static object ReadEnumArray(PortableReaderImpl ctx, Type type)
- {
- return PortableUtils.ReadArray(ctx, true, type.GetElementType());
- }
-
- /**
- * <summary>Read array.</summary>
- */
- private static object ReadArray(PortableReaderImpl ctx, Type type)
- {
- var elemType = type.IsArray ? type.GetElementType() : typeof(object);
-
- return PortableUtils.ReadArray(ctx, true, elemType);
- }
-
- /**
- * <summary>Read collection.</summary>
- */
- private static object ReadCollection(PortableReaderImpl ctx, Type type)
- {
- PortableCollectionInfo info = PortableCollectionInfo.Info(type);
-
- return info.IsGenericCollection
- ? info.ReadGeneric(ctx)
- : PortableUtils.ReadCollection(ctx, null, null);
- }
-
- /**
- * <summary>Read dictionary.</summary>
- */
- private static object ReadDictionary(PortableReaderImpl ctx, Type type)
- {
- PortableCollectionInfo info = PortableCollectionInfo.Info(type);
-
- return info.IsGenericDictionary
- ? info.ReadGeneric(ctx)
- : PortableUtils.ReadDictionary(ctx, null);
- }
-
- /**
- * <summary>Read map entry.</summary>
- */
- private static object ReadMapEntry(PortableReaderImpl ctx, Type type)
- {
- return PortableUtils.ReadMapEntry(ctx);
- }
-
- /**
- * <summary>Create new ArrayList.</summary>
- * <param name="len">Length.</param>
- * <returns>ArrayList.</returns>
- */
- public static ICollection CreateArrayList(int len)
- {
- return new ArrayList(len);
- }
-
- /**
- * <summary>Add element to array list.</summary>
- * <param name="col">Array list.</param>
- * <param name="elem">Element.</param>
- */
- public static void AddToArrayList(ICollection col, object elem)
- {
- ((ArrayList) col).Add(elem);
- }
-
- /**
- * <summary>Create new List.</summary>
- * <param name="len">Length.</param>
- * <returns>List.</returns>
- */
- public static ICollection<T> CreateList<T>(int len)
- {
- return new List<T>(len);
- }
-
- /**
- * <summary>Create new LinkedList.</summary>
- * <param name="len">Length.</param>
- * <returns>LinkedList.</returns>
- */
- public static ICollection<T> CreateLinkedList<T>(int len)
- {
- return new LinkedList<T>();
- }
-
- /**
- * <summary>Create new HashSet.</summary>
- * <param name="len">Length.</param>
- * <returns>HashSet.</returns>
- */
- public static ICollection<T> CreateHashSet<T>(int len)
- {
- return new HashSet<T>();
- }
-
- /**
- * <summary>Create new SortedSet.</summary>
- * <param name="len">Length.</param>
- * <returns>SortedSet.</returns>
- */
- public static ICollection<T> CreateSortedSet<T>(int len)
- {
- return new SortedSet<T>();
- }
-
- /**
- * <summary>Create new Hashtable.</summary>
- * <param name="len">Length.</param>
- * <returns>Hashtable.</returns>
- */
- public static IDictionary CreateHashtable(int len)
- {
- return new Hashtable(len);
- }
-
- /**
- * <summary>Create new Dictionary.</summary>
- * <param name="len">Length.</param>
- * <returns>Dictionary.</returns>
- */
- public static IDictionary<TK, TV> CreateDictionary<TK, TV>(int len)
- {
- return new Dictionary<TK, TV>(len);
- }
-
- /**
- * <summary>Create new SortedDictionary.</summary>
- * <param name="len">Length.</param>
- * <returns>SortedDictionary.</returns>
- */
- public static IDictionary<TK, TV> CreateSortedDictionary<TK, TV>(int len)
- {
- return new SortedDictionary<TK, TV>();
- }
-
- /**
- * <summary>Create new ConcurrentDictionary.</summary>
- * <param name="len">Length.</param>
- * <returns>ConcurrentDictionary.</returns>
- */
- public static IDictionary<TK, TV> CreateConcurrentDictionary<TK, TV>(int len)
- {
- return new ConcurrentDictionary<TK, TV>(Environment.ProcessorCount, len);
- }
-
-
- /**
- * <summary>Read delegate.</summary>
- * <param name="ctx">Read context.</param>
- * <param name="type">Type.</param>
- */
- private delegate object PortableSystemReadDelegate(PortableReaderImpl ctx, Type type);
-
- /// <summary>
- /// System type reader.
- /// </summary>
- private interface IPortableSystemReader
- {
- /// <summary>
- /// Reads a value of specified type from reader.
- /// </summary>
- T Read<T>(PortableReaderImpl ctx);
- }
-
- /// <summary>
- /// System type generic reader.
- /// </summary>
- private interface IPortableSystemReader<out T>
- {
- /// <summary>
- /// Reads a value of specified type from reader.
- /// </summary>
- T Read(PortableReaderImpl ctx);
- }
-
- /// <summary>
- /// Default reader with boxing.
- /// </summary>
- private class PortableSystemReader : IPortableSystemReader
- {
- /** */
- private readonly PortableSystemReadDelegate _readDelegate;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableSystemReader"/> class.
- /// </summary>
- /// <param name="readDelegate">The read delegate.</param>
- public PortableSystemReader(PortableSystemReadDelegate readDelegate)
- {
- Debug.Assert(readDelegate != null);
-
- _readDelegate = readDelegate;
- }
-
- /** <inheritdoc /> */
- public T Read<T>(PortableReaderImpl ctx)
- {
- return (T)_readDelegate(ctx, typeof(T));
- }
- }
-
- /// <summary>
- /// Reader without boxing.
- /// </summary>
- private class PortableSystemReader<T> : IPortableSystemReader
- {
- /** */
- private readonly Func<IPortableStream, T> _readDelegate;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableSystemReader{T}"/> class.
- /// </summary>
- /// <param name="readDelegate">The read delegate.</param>
- public PortableSystemReader(Func<IPortableStream, T> readDelegate)
- {
- Debug.Assert(readDelegate != null);
-
- _readDelegate = readDelegate;
- }
-
- /** <inheritdoc /> */
- public TResult Read<TResult>(PortableReaderImpl ctx)
- {
- return TypeCaster<TResult>.Cast(_readDelegate(ctx.Stream));
- }
- }
-
- /// <summary>
- /// Reader without boxing.
- /// </summary>
- private class PortableSystemGenericArrayReader<T> : IPortableSystemReader
- {
- public TResult Read<TResult>(PortableReaderImpl ctx)
- {
- return TypeCaster<TResult>.Cast(PortableUtils.ReadGenericArray<T>(ctx, false));
- }
- }
-
- /// <summary>
- /// Reader with selection based on requested type.
- /// </summary>
- private class PortableSystemDualReader<T1, T2> : IPortableSystemReader, IPortableSystemReader<T2>
- {
- /** */
- private readonly Func<IPortableStream, T1> _readDelegate1;
-
- /** */
- private readonly Func<IPortableStream, T2> _readDelegate2;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableSystemDualReader{T1, T2}"/> class.
- /// </summary>
- /// <param name="readDelegate1">The read delegate1.</param>
- /// <param name="readDelegate2">The read delegate2.</param>
- public PortableSystemDualReader(Func<IPortableStream, T1> readDelegate1, Func<IPortableStream, T2> readDelegate2)
- {
- Debug.Assert(readDelegate1 != null);
- Debug.Assert(readDelegate2 != null);
-
- _readDelegate1 = readDelegate1;
- _readDelegate2 = readDelegate2;
- }
-
- /** <inheritdoc /> */
- T2 IPortableSystemReader<T2>.Read(PortableReaderImpl ctx)
- {
- return _readDelegate2(ctx.Stream);
- }
-
- /** <inheritdoc /> */
- public T Read<T>(PortableReaderImpl ctx)
- {
- // Can't use "as" because of variance.
- // For example, IPortableSystemReader<byte[]> can be cast to IPortableSystemReader<sbyte[]>, which
- // will cause incorrect behavior.
- if (typeof (T) == typeof (T2))
- return ((IPortableSystemReader<T>) this).Read(ctx);
-
- return TypeCaster<T>.Cast(_readDelegate1(ctx.Stream));
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemTypeSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemTypeSerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemTypeSerializer.cs
deleted file mode 100644
index 014955b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSystemTypeSerializer.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable serializer for system types.
- /// </summary>
- /// <typeparam name="T">Object type.</typeparam>
- internal class PortableSystemTypeSerializer<T> : IPortableSystemTypeSerializer where T : IPortableWriteAware
- {
- /** Ctor delegate. */
- private readonly Func<PortableReaderImpl, T> _ctor;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableSystemTypeSerializer{T}"/> class.
- /// </summary>
- /// <param name="ctor">Constructor delegate.</param>
- public PortableSystemTypeSerializer(Func<PortableReaderImpl, T> ctor)
- {
- Debug.Assert(ctor != null);
-
- _ctor = ctor;
- }
-
- /** <inheritdoc /> */
- public void WritePortable(object obj, IPortableWriter writer)
- {
- ((T) obj).WritePortable(writer);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(object obj, IPortableReader reader)
- {
- throw new NotSupportedException("System serializer does not support ReadPortable.");
- }
-
- /** <inheritdoc /> */
- public object ReadInstance(PortableReaderImpl reader)
- {
- return _ctor(reader);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUserObject.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUserObject.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUserObject.cs
deleted file mode 100644
index 66e70ee..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableUserObject.cs
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System.Collections;
- using System.Collections.Generic;
- using System.IO;
- using System.Runtime.CompilerServices;
- using System.Text;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// User portable object.
- /// </summary>
- internal class PortableUserObject : IPortableObject
- {
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Raw data of this portable object. */
- private readonly byte[] _data;
-
- /** Offset in data array. */
- private readonly int _offset;
-
- /** Type ID. */
- private readonly int _typeId;
-
- /** Hash code. */
- private readonly int _hashCode;
-
- /** Fields. */
- private volatile IDictionary<int, int> _fields;
-
- /** Deserialized value. */
- private object _deserialized;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableUserObject"/> class.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="data">Raw data of this portable object.</param>
- /// <param name="offset">Offset in data array.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="hashCode">Hash code.</param>
- public PortableUserObject(PortableMarshaller marsh, byte[] data, int offset, int typeId, int hashCode)
- {
- _marsh = marsh;
-
- _data = data;
- _offset = offset;
-
- _typeId = typeId;
- _hashCode = hashCode;
- }
-
- /** <inheritdoc /> */
- public int TypeId
- {
- get { return _typeId; }
- }
-
- /** <inheritdoc /> */
- public T GetField<T>(string fieldName)
- {
- return Field<T>(fieldName, null);
- }
-
- /** <inheritdoc /> */
- public T Deserialize<T>()
- {
- return Deserialize<T>(PortableMode.Deserialize);
- }
-
- /// <summary>
- /// Internal deserialization routine.
- /// </summary>
- /// <param name="mode">The mode.</param>
- /// <returns>
- /// Deserialized object.
- /// </returns>
- private T Deserialize<T>(PortableMode mode)
- {
- if (_deserialized == null)
- {
- IPortableStream stream = new PortableHeapStream(_data);
-
- stream.Seek(_offset, SeekOrigin.Begin);
-
- T res = _marsh.Unmarshal<T>(stream, mode);
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(true, _typeId);
-
- if (!desc.KeepDeserialized)
- return res;
-
- _deserialized = res;
- }
-
- return (T)_deserialized;
- }
-
- /** <inheritdoc /> */
- public IPortableMetadata GetMetadata()
- {
- return _marsh.Metadata(_typeId);
- }
-
- /// <summary>
- /// Raw data of this portable object.
- /// </summary>
- public byte[] Data
- {
- get { return _data; }
- }
-
- /// <summary>
- /// Offset in data array.
- /// </summary>
- public int Offset
- {
- get { return _offset; }
- }
-
- /// <summary>
- /// Get field with builder.
- /// </summary>
- /// <typeparam name="T"></typeparam>
- /// <param name="fieldName"></param>
- /// <param name="builder"></param>
- /// <returns></returns>
- public T Field<T>(string fieldName, PortableBuilderImpl builder)
- {
- IPortableTypeDescriptor desc = _marsh.Descriptor(true, _typeId);
-
- InitializeFields();
-
- int fieldId = PortableUtils.FieldId(_typeId, fieldName, desc.NameConverter, desc.Mapper);
-
- int pos;
-
- if (_fields.TryGetValue(fieldId, out pos))
- {
- if (builder != null)
- {
- // Read in scope of build process.
- T res;
-
- if (!builder.CachedField(pos, out res))
- {
- res = Field0<T>(pos, builder);
-
- builder.CacheField(pos, res);
- }
-
- return res;
- }
- return Field0<T>(pos, null);
- }
- return default(T);
- }
-
- /// <summary>
- /// Lazy fields initialization routine.
- /// </summary>
- private void InitializeFields()
- {
- if (_fields == null)
- {
- IPortableStream stream = new PortableHeapStream(_data);
-
- stream.Seek(_offset + 14, SeekOrigin.Begin);
-
- int rawDataOffset = stream.ReadInt();
-
- _fields = PortableUtils.ObjectFields(stream, _typeId, rawDataOffset);
- }
- }
-
- /// <summary>
- /// Gets field value on the given object.
- /// </summary>
- /// <param name="pos">Position.</param>
- /// <param name="builder">Builder.</param>
- /// <returns>Field value.</returns>
- private T Field0<T>(int pos, PortableBuilderImpl builder)
- {
- IPortableStream stream = new PortableHeapStream(_data);
-
- stream.Seek(pos, SeekOrigin.Begin);
-
- return _marsh.Unmarshal<T>(stream, PortableMode.ForcePortable, builder);
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return _hashCode;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- if (this == obj)
- return true;
-
- PortableUserObject that = obj as PortableUserObject;
-
- if (that != null)
- {
- if (_data == that._data && _offset == that._offset)
- return true;
-
- // 1. Check hash code and type IDs.
- if (_hashCode == that._hashCode && _typeId == that._typeId)
- {
- // 2. Check if objects have the same field sets.
- InitializeFields();
- that.InitializeFields();
-
- if (_fields.Keys.Count != that._fields.Keys.Count)
- return false;
-
- foreach (int id in _fields.Keys)
- {
- if (!that._fields.Keys.Contains(id))
- return false;
- }
-
- // 3. Check if objects have the same field values.
- foreach (KeyValuePair<int, int> field in _fields)
- {
- object fieldVal = Field0<object>(field.Value, null);
- object thatFieldVal = that.Field0<object>(that._fields[field.Key], null);
-
- if (!Equals(fieldVal, thatFieldVal))
- return false;
- }
-
- // 4. Check if objects have the same raw data.
- IPortableStream stream = new PortableHeapStream(_data);
- stream.Seek(_offset + 10, SeekOrigin.Begin);
- int len = stream.ReadInt();
- int rawOffset = stream.ReadInt();
-
- IPortableStream thatStream = new PortableHeapStream(that._data);
- thatStream.Seek(_offset + 10, SeekOrigin.Begin);
- int thatLen = thatStream.ReadInt();
- int thatRawOffset = thatStream.ReadInt();
-
- return PortableUtils.CompareArrays(_data, _offset + rawOffset, len - rawOffset, that._data,
- that._offset + thatRawOffset, thatLen - thatRawOffset);
- }
- }
-
- return false;
- }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- return ToString(new Dictionary<int, int>());
- }
-
- /// <summary>
- /// ToString implementation.
- /// </summary>
- /// <param name="handled">Already handled objects.</param>
- /// <returns>Object string.</returns>
- private string ToString(IDictionary<int, int> handled)
- {
- int idHash;
-
- bool alreadyHandled = handled.TryGetValue(_offset, out idHash);
-
- if (!alreadyHandled)
- idHash = RuntimeHelpers.GetHashCode(this);
-
- StringBuilder sb;
-
- IPortableTypeDescriptor desc = _marsh.Descriptor(true, _typeId);
-
- IPortableMetadata meta;
-
- try
- {
- meta = _marsh.Metadata(_typeId);
- }
- catch (IgniteException)
- {
- meta = null;
- }
-
- if (meta == null)
- sb = new StringBuilder("PortableObject [typeId=").Append(_typeId).Append(", idHash=" + idHash);
- else
- {
- sb = new StringBuilder(meta.TypeName).Append(" [idHash=" + idHash);
-
- if (!alreadyHandled)
- {
- handled[_offset] = idHash;
-
- InitializeFields();
-
- foreach (string fieldName in meta.Fields)
- {
- sb.Append(", ");
-
- int fieldId = PortableUtils.FieldId(_typeId, fieldName, desc.NameConverter, desc.Mapper);
-
- int fieldPos;
-
- if (_fields.TryGetValue(fieldId, out fieldPos))
- {
- sb.Append(fieldName).Append('=');
-
- ToString0(sb, Field0<object>(fieldPos, null), handled);
- }
- }
- }
- else
- sb.Append(", ...");
- }
-
- sb.Append(']');
-
- return sb.ToString();
- }
-
- /// <summary>
- /// Internal ToString routine with correct collections printout.
- /// </summary>
- /// <param name="sb">String builder.</param>
- /// <param name="obj">Object to print.</param>
- /// <param name="handled">Already handled objects.</param>
- /// <returns>The same string builder.</returns>
- private static void ToString0(StringBuilder sb, object obj, IDictionary<int, int> handled)
- {
- IEnumerable col = (obj is string) ? null : obj as IEnumerable;
-
- if (col == null)
- {
- PortableUserObject obj0 = obj as PortableUserObject;
-
- sb.Append(obj0 == null ? obj : obj0.ToString(handled));
- }
- else
- {
- sb.Append('[');
-
- bool first = true;
-
- foreach (object elem in col)
- {
- if (first)
- first = false;
- else
- sb.Append(", ");
-
- ToString0(sb, elem, handled);
- }
-
- sb.Append(']');
- }
- }
- }
-}
[22/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableAbstractStream.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableAbstractStream.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableAbstractStream.cs
deleted file mode 100644
index 648d754..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableAbstractStream.cs
+++ /dev/null
@@ -1,1298 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.IO
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Reflection;
- using System.Text;
-
- /// <summary>
- /// Base class for managed and unmanaged data streams.
- /// </summary>
- internal unsafe abstract class PortableAbstractStream : IPortableStream
- {
- /// <summary>
- /// Array copy delegate.
- /// </summary>
- delegate void MemCopy(byte* a1, byte* a2, int len);
-
- /** memcpy function handle. */
- private static readonly MemCopy Memcpy;
-
- /** Whether src and dest arguments are inverted. */
- private static readonly bool MemcpyInverted;
-
- /** Byte: zero. */
- protected const byte ByteZero = 0;
-
- /** Byte: one. */
- protected const byte ByteOne = 1;
-
- /** LITTLE_ENDIAN flag. */
- protected static readonly bool LittleEndian = BitConverter.IsLittleEndian;
-
- /** Position. */
- protected int Pos;
-
- /** Disposed flag. */
- private bool _disposed;
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")]
- static PortableAbstractStream()
- {
- Type type = typeof(Buffer);
-
- const BindingFlags flags = BindingFlags.Static | BindingFlags.NonPublic;
- Type[] paramTypes = { typeof(byte*), typeof(byte*), typeof(int) };
-
- // Assume .Net 4.5.
- MethodInfo mthd = type.GetMethod("Memcpy", flags, null, paramTypes, null);
-
- MemcpyInverted = true;
-
- if (mthd == null)
- {
- // Assume .Net 4.0.
- mthd = type.GetMethod("memcpyimpl", flags, null, paramTypes, null);
-
- MemcpyInverted = false;
-
- if (mthd == null)
- throw new InvalidOperationException("Unable to get memory copy function delegate.");
- }
-
- Memcpy = (MemCopy)Delegate.CreateDelegate(typeof(MemCopy), mthd);
- }
-
- /// <summary>
- /// Write byte.
- /// </summary>
- /// <param name="val">Byte value.</param>
- public abstract void WriteByte(byte val);
-
- /// <summary>
- /// Read byte.
- /// </summary>
- /// <returns>
- /// Byte value.
- /// </returns>
- public abstract byte ReadByte();
-
- /// <summary>
- /// Write byte array.
- /// </summary>
- /// <param name="val">Byte array.</param>
- public abstract void WriteByteArray(byte[] val);
-
- /// <summary>
- /// Internal routine to write byte array.
- /// </summary>
- /// <param name="val">Byte array.</param>
- /// <param name="data">Data pointer.</param>
- protected void WriteByteArray0(byte[] val, byte* data)
- {
- fixed (byte* val0 = val)
- {
- CopyMemory(val0, data, val.Length);
- }
- }
-
- /// <summary>
- /// Read byte array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Byte array.
- /// </returns>
- public abstract byte[] ReadByteArray(int cnt);
-
- /// <summary>
- /// Internal routine to read byte array.
- /// </summary>
- /// <param name="len">Array length.</param>
- /// <param name="data">Data pointer.</param>
- /// <returns>Byte array</returns>
- protected byte[] ReadByteArray0(int len, byte* data)
- {
- byte[] res = new byte[len];
-
- fixed (byte* res0 = res)
- {
- CopyMemory(data, res0, len);
- }
-
- return res;
- }
-
- /// <summary>
- /// Write bool.
- /// </summary>
- /// <param name="val">Bool value.</param>
- public void WriteBool(bool val)
- {
- WriteByte(val ? ByteOne : ByteZero);
- }
-
- /// <summary>
- /// Read bool.
- /// </summary>
- /// <returns>
- /// Bool value.
- /// </returns>
- public bool ReadBool()
- {
- return ReadByte() == ByteOne;
- }
-
- /// <summary>
- /// Write bool array.
- /// </summary>
- /// <param name="val">Bool array.</param>
- public abstract void WriteBoolArray(bool[] val);
-
- /// <summary>
- /// Internal routine to write bool array.
- /// </summary>
- /// <param name="val">Bool array.</param>
- /// <param name="data">Data pointer.</param>
- protected void WriteBoolArray0(bool[] val, byte* data)
- {
- fixed (bool* val0 = val)
- {
- CopyMemory((byte*)val0, data, val.Length);
- }
- }
-
- /// <summary>
- /// Read bool array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Bool array.
- /// </returns>
- public abstract bool[] ReadBoolArray(int cnt);
-
- /// <summary>
- /// Internal routine to read bool array.
- /// </summary>
- /// <param name="len">Array length.</param>
- /// <param name="data">Data pointer.</param>
- /// <returns>Bool array</returns>
- protected bool[] ReadBoolArray0(int len, byte* data)
- {
- bool[] res = new bool[len];
-
- fixed (bool* res0 = res)
- {
- CopyMemory(data, (byte*)res0, len);
- }
-
- return res;
- }
-
- /// <summary>
- /// Write short.
- /// </summary>
- /// <param name="val">Short value.</param>
- public abstract void WriteShort(short val);
-
- /// <summary>
- /// Internal routine to write short value.
- /// </summary>
- /// <param name="val">Short value.</param>
- /// <param name="data">Data pointer.</param>
- protected void WriteShort0(short val, byte* data)
- {
- if (LittleEndian)
- *((short*)data) = val;
- else
- {
- byte* valPtr = (byte*)&val;
-
- data[0] = valPtr[1];
- data[1] = valPtr[0];
- }
- }
-
- /// <summary>
- /// Read short.
- /// </summary>
- /// <returns>
- /// Short value.
- /// </returns>
- public abstract short ReadShort();
-
- /// <summary>
- /// Internal routine to read short value.
- /// </summary>
- /// <param name="data">Data pointer.</param>
- /// <returns>Short value</returns>
- protected short ReadShort0(byte* data)
- {
- short val;
-
- if (LittleEndian)
- val = *((short*)data);
- else
- {
- byte* valPtr = (byte*)&val;
-
- valPtr[0] = data[1];
- valPtr[1] = data[0];
- }
-
- return val;
- }
-
- /// <summary>
- /// Write short array.
- /// </summary>
- /// <param name="val">Short array.</param>
- public abstract void WriteShortArray(short[] val);
-
- /// <summary>
- /// Internal routine to write short array.
- /// </summary>
- /// <param name="val">Short array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteShortArray0(short[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (short* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- short val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read short array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Short array.
- /// </returns>
- public abstract short[] ReadShortArray(int cnt);
-
- /// <summary>
- /// Internal routine to read short array.
- /// </summary>
- /// <param name="len">Array length.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Short array</returns>
- protected short[] ReadShortArray0(int len, byte* data, int cnt)
- {
- short[] res = new short[len];
-
- if (LittleEndian)
- {
- fixed (short* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- short val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write char.
- /// </summary>
- /// <param name="val">Char value.</param>
- public void WriteChar(char val)
- {
- WriteShort(*(short*)(&val));
- }
-
- /// <summary>
- /// Read char.
- /// </summary>
- /// <returns>
- /// Char value.
- /// </returns>
- public char ReadChar()
- {
- short val = ReadShort();
-
- return *(char*)(&val);
- }
-
- /// <summary>
- /// Write char array.
- /// </summary>
- /// <param name="val">Char array.</param>
- public abstract void WriteCharArray(char[] val);
-
- /// <summary>
- /// Internal routine to write char array.
- /// </summary>
- /// <param name="val">Char array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteCharArray0(char[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (char* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- char val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read char array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Char array.
- /// </returns>
- public abstract char[] ReadCharArray(int cnt);
-
- /// <summary>
- /// Internal routine to read char array.
- /// </summary>
- /// <param name="len">Count.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Char array</returns>
- protected char[] ReadCharArray0(int len, byte* data, int cnt)
- {
- char[] res = new char[len];
-
- if (LittleEndian)
- {
- fixed (char* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- char val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write int.
- /// </summary>
- /// <param name="val">Int value.</param>
- public abstract void WriteInt(int val);
-
- /// <summary>
- /// Write int to specific position.
- /// </summary>
- /// <param name="writePos">Position.</param>
- /// <param name="val">Value.</param>
- public abstract void WriteInt(int writePos, int val);
-
- /// <summary>
- /// Internal routine to write int value.
- /// </summary>
- /// <param name="val">Int value.</param>
- /// <param name="data">Data pointer.</param>
- protected void WriteInt0(int val, byte* data)
- {
- if (LittleEndian)
- *((int*)data) = val;
- else
- {
- byte* valPtr = (byte*)&val;
-
- data[0] = valPtr[3];
- data[1] = valPtr[2];
- data[2] = valPtr[1];
- data[3] = valPtr[0];
- }
- }
-
- /// <summary>
- /// Read int.
- /// </summary>
- /// <returns>
- /// Int value.
- /// </returns>
- public abstract int ReadInt();
-
- /// <summary>
- /// Internal routine to read int value.
- /// </summary>
- /// <param name="data">Data pointer.</param>
- /// <returns>Int value</returns>
- protected int ReadInt0(byte* data) {
- int val;
-
- if (LittleEndian)
- val = *((int*)data);
- else
- {
- byte* valPtr = (byte*)&val;
-
- valPtr[0] = data[3];
- valPtr[1] = data[2];
- valPtr[2] = data[1];
- valPtr[3] = data[0];
- }
-
- return val;
- }
-
- /// <summary>
- /// Write int array.
- /// </summary>
- /// <param name="val">Int array.</param>
- public abstract void WriteIntArray(int[] val);
-
- /// <summary>
- /// Internal routine to write int array.
- /// </summary>
- /// <param name="val">Int array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteIntArray0(int[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (int* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- int val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read int array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Int array.
- /// </returns>
- public abstract int[] ReadIntArray(int cnt);
-
- /// <summary>
- /// Internal routine to read int array.
- /// </summary>
- /// <param name="len">Count.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Int array</returns>
- protected int[] ReadIntArray0(int len, byte* data, int cnt)
- {
- int[] res = new int[len];
-
- if (LittleEndian)
- {
- fixed (int* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- int val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *data++;
- valPtr[2] = *data++;
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write float.
- /// </summary>
- /// <param name="val">Float value.</param>
- public void WriteFloat(float val)
- {
- int val0 = *(int*)(&val);
-
- WriteInt(val0);
- }
-
- /// <summary>
- /// Read float.
- /// </summary>
- /// <returns>
- /// Float value.
- /// </returns>
- public float ReadFloat()
- {
- int val = ReadInt();
-
- return *(float*)(&val);
- }
-
- /// <summary>
- /// Write float array.
- /// </summary>
- /// <param name="val">Float array.</param>
- public abstract void WriteFloatArray(float[] val);
-
- /// <summary>
- /// Internal routine to write float array.
- /// </summary>
- /// <param name="val">Int array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteFloatArray0(float[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (float* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- float val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read float array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Float array.
- /// </returns>
- public abstract float[] ReadFloatArray(int cnt);
-
- /// <summary>
- /// Internal routine to read float array.
- /// </summary>
- /// <param name="len">Count.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Float array</returns>
- protected float[] ReadFloatArray0(int len, byte* data, int cnt)
- {
- float[] res = new float[len];
-
- if (LittleEndian)
- {
- fixed (float* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- int val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[3] = *data++;
- valPtr[2] = *data++;
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write long.
- /// </summary>
- /// <param name="val">Long value.</param>
- public abstract void WriteLong(long val);
-
- /// <summary>
- /// Internal routine to write long value.
- /// </summary>
- /// <param name="val">Long value.</param>
- /// <param name="data">Data pointer.</param>
- protected void WriteLong0(long val, byte* data)
- {
- if (LittleEndian)
- *((long*)data) = val;
- else
- {
- byte* valPtr = (byte*)&val;
-
- data[0] = valPtr[7];
- data[1] = valPtr[6];
- data[2] = valPtr[5];
- data[3] = valPtr[4];
- data[4] = valPtr[3];
- data[5] = valPtr[2];
- data[6] = valPtr[1];
- data[7] = valPtr[0];
- }
- }
-
- /// <summary>
- /// Read long.
- /// </summary>
- /// <returns>
- /// Long value.
- /// </returns>
- public abstract long ReadLong();
-
- /// <summary>
- /// Internal routine to read long value.
- /// </summary>
- /// <param name="data">Data pointer.</param>
- /// <returns>Long value</returns>
- protected long ReadLong0(byte* data)
- {
- long val;
-
- if (LittleEndian)
- val = *((long*)data);
- else
- {
- byte* valPtr = (byte*)&val;
-
- valPtr[0] = data[7];
- valPtr[1] = data[6];
- valPtr[2] = data[5];
- valPtr[3] = data[4];
- valPtr[4] = data[3];
- valPtr[5] = data[2];
- valPtr[6] = data[1];
- valPtr[7] = data[0];
- }
-
- return val;
- }
-
- /// <summary>
- /// Write long array.
- /// </summary>
- /// <param name="val">Long array.</param>
- public abstract void WriteLongArray(long[] val);
-
- /// <summary>
- /// Internal routine to write long array.
- /// </summary>
- /// <param name="val">Long array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteLongArray0(long[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (long* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- long val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[7];
- *curPos++ = valPtr[6];
- *curPos++ = valPtr[5];
- *curPos++ = valPtr[4];
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read long array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Long array.
- /// </returns>
- public abstract long[] ReadLongArray(int cnt);
-
- /// <summary>
- /// Internal routine to read long array.
- /// </summary>
- /// <param name="len">Count.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Long array</returns>
- protected long[] ReadLongArray0(int len, byte* data, int cnt)
- {
- long[] res = new long[len];
-
- if (LittleEndian)
- {
- fixed (long* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- long val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[7] = *data++;
- valPtr[6] = *data++;
- valPtr[5] = *data++;
- valPtr[4] = *data++;
- valPtr[3] = *data++;
- valPtr[2] = *data++;
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write double.
- /// </summary>
- /// <param name="val">Double value.</param>
- public void WriteDouble(double val)
- {
- long val0 = *(long*)(&val);
-
- WriteLong(val0);
- }
-
- /// <summary>
- /// Read double.
- /// </summary>
- /// <returns>
- /// Double value.
- /// </returns>
- public double ReadDouble()
- {
- long val = ReadLong();
-
- return *(double*)(&val);
- }
-
- /// <summary>
- /// Write double array.
- /// </summary>
- /// <param name="val">Double array.</param>
- public abstract void WriteDoubleArray(double[] val);
-
- /// <summary>
- /// Internal routine to write double array.
- /// </summary>
- /// <param name="val">Double array.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- protected void WriteDoubleArray0(double[] val, byte* data, int cnt)
- {
- if (LittleEndian)
- {
- fixed (double* val0 = val)
- {
- CopyMemory((byte*)val0, data, cnt);
- }
- }
- else
- {
- byte* curPos = data;
-
- for (int i = 0; i < val.Length; i++)
- {
- double val0 = val[i];
-
- byte* valPtr = (byte*)&(val0);
-
- *curPos++ = valPtr[7];
- *curPos++ = valPtr[6];
- *curPos++ = valPtr[5];
- *curPos++ = valPtr[4];
- *curPos++ = valPtr[3];
- *curPos++ = valPtr[2];
- *curPos++ = valPtr[1];
- *curPos++ = valPtr[0];
- }
- }
- }
-
- /// <summary>
- /// Read double array.
- /// </summary>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Double array.
- /// </returns>
- public abstract double[] ReadDoubleArray(int cnt);
-
- /// <summary>
- /// Internal routine to read double array.
- /// </summary>
- /// <param name="len">Count.</param>
- /// <param name="data">Data pointer.</param>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Double array</returns>
- protected double[] ReadDoubleArray0(int len, byte* data, int cnt)
- {
- double[] res = new double[len];
-
- if (LittleEndian)
- {
- fixed (double* res0 = res)
- {
- CopyMemory(data, (byte*)res0, cnt);
- }
- }
- else
- {
- for (int i = 0; i < len; i++)
- {
- double val;
-
- byte* valPtr = (byte*)&val;
-
- valPtr[7] = *data++;
- valPtr[6] = *data++;
- valPtr[5] = *data++;
- valPtr[4] = *data++;
- valPtr[3] = *data++;
- valPtr[2] = *data++;
- valPtr[1] = *data++;
- valPtr[0] = *data++;
-
- res[i] = val;
- }
- }
-
- return res;
- }
-
- /// <summary>
- /// Write string.
- /// </summary>
- /// <param name="chars">Characters.</param>
- /// <param name="charCnt">Char count.</param>
- /// <param name="byteCnt">Byte count.</param>
- /// <param name="encoding">Encoding.</param>
- /// <returns>
- /// Amounts of bytes written.
- /// </returns>
- public abstract int WriteString(char* chars, int charCnt, int byteCnt, Encoding encoding);
-
- /// <summary>
- /// Internal string write routine.
- /// </summary>
- /// <param name="chars">Chars.</param>
- /// <param name="charCnt">Chars count.</param>
- /// <param name="byteCnt">Bytes count.</param>
- /// <param name="enc">Encoding.</param>
- /// <param name="data">Data.</param>
- /// <returns>Amount of bytes written.</returns>
- protected int WriteString0(char* chars, int charCnt, int byteCnt, Encoding enc, byte* data)
- {
- return enc.GetBytes(chars, charCnt, data, byteCnt);
- }
-
- /// <summary>
- /// Write arbitrary data.
- /// </summary>
- /// <param name="src">Source array.</param>
- /// <param name="off">Offset</param>
- /// <param name="cnt">Count.</param>
- public void Write(byte[] src, int off, int cnt)
- {
- fixed (byte* src0 = src)
- {
- Write(src0 + off, cnt);
- }
- }
-
- /// <summary>
- /// Read arbitrary data.
- /// </summary>
- /// <param name="dest">Destination array.</param>
- /// <param name="off">Offset.</param>
- /// <param name="cnt">Count.</param>
- /// <returns>
- /// Amount of bytes read.
- /// </returns>
- public void Read(byte[] dest, int off, int cnt)
- {
- fixed (byte* dest0 = dest)
- {
- Read(dest0 + off, cnt);
- }
- }
-
- /// <summary>
- /// Write arbitrary data.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="cnt">Count.</param>
- public abstract void Write(byte* src, int cnt);
-
- /// <summary>
- /// Internal write routine.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="cnt">Count.</param>
- /// <param name="data">Data (dsetination).</param>
- protected void WriteInternal(byte* src, int cnt, byte* data)
- {
- CopyMemory(src, data + Pos, cnt);
- }
-
- /// <summary>
- /// Read arbitrary data.
- /// </summary>
- /// <param name="dest">Destination.</param>
- /// <param name="cnt">Count.</param>
- /// <returns></returns>
- public abstract void Read(byte* dest, int cnt);
-
- /// <summary>
- /// Internal read routine.
- /// </summary>
- /// <param name="dest">Destination.</param>
- /// <param name="cnt">Count.</param>
- /// <param name="data">Data (source).</param>
- /// <returns>Amount of bytes written.</returns>
- protected void ReadInternal(byte* dest, int cnt, byte* data)
- {
- int cnt0 = Math.Min(Remaining(), cnt);
-
- CopyMemory(data + Pos, dest, cnt0);
-
- ShiftRead(cnt0);
- }
-
- /// <summary>
- /// Position.
- /// </summary>
- public int Position
- {
- get { return Pos; }
- }
-
- /// <summary>
- /// Gets remaining bytes in the stream.
- /// </summary>
- /// <returns>
- /// Remaining bytes.
- /// </returns>
- public abstract int Remaining();
-
- /// <summary>
- /// Gets underlying array, avoiding copying if possible.
- /// </summary>
- /// <returns>
- /// Underlying array.
- /// </returns>
- public abstract byte[] Array();
-
- /// <summary>
- /// Gets underlying data in a new array.
- /// </summary>
- /// <returns>
- /// New array with data.
- /// </returns>
- public abstract byte[] ArrayCopy();
-
- /// <summary>
- /// Check whether array passed as argument is the same as the stream hosts.
- /// </summary>
- /// <param name="arr">Array.</param>
- /// <returns>
- /// <c>True</c> if they are same.
- /// </returns>
- public virtual bool IsSameArray(byte[] arr)
- {
- return false;
- }
-
- /// <summary>
- /// Seek to the given positoin.
- /// </summary>
- /// <param name="offset">Offset.</param>
- /// <param name="origin">Seek origin.</param>
- /// <returns>
- /// Position.
- /// </returns>
- /// <exception cref="System.ArgumentException">
- /// Unsupported seek origin: + origin
- /// or
- /// Seek before origin: + newPos
- /// </exception>
- public int Seek(int offset, SeekOrigin origin)
- {
- int newPos;
-
- switch (origin)
- {
- case SeekOrigin.Begin:
- {
- newPos = offset;
-
- break;
- }
-
- case SeekOrigin.Current:
- {
- newPos = Pos + offset;
-
- break;
- }
-
- default:
- throw new ArgumentException("Unsupported seek origin: " + origin);
- }
-
- if (newPos < 0)
- throw new ArgumentException("Seek before origin: " + newPos);
-
- EnsureWriteCapacity(newPos);
-
- Pos = newPos;
-
- return Pos;
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- if (_disposed)
- return;
-
- Dispose(true);
-
- GC.SuppressFinalize(this);
-
- _disposed = true;
- }
-
- /// <summary>
- /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
- /// </summary>
- protected abstract void Dispose(bool disposing);
-
- /// <summary>
- /// Ensure capacity for write.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- protected abstract void EnsureWriteCapacity(int cnt);
-
- /// <summary>
- /// Ensure capacity for write and shift position.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Position before shift.</returns>
- protected int EnsureWriteCapacityAndShift(int cnt)
- {
- int pos0 = Pos;
-
- EnsureWriteCapacity(Pos + cnt);
-
- ShiftWrite(cnt);
-
- return pos0;
- }
-
- /// <summary>
- /// Ensure capacity for read.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- protected abstract void EnsureReadCapacity(int cnt);
-
- /// <summary>
- /// Ensure capacity for read and shift position.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- /// <returns>Position before shift.</returns>
- protected int EnsureReadCapacityAndShift(int cnt)
- {
- int pos0 = Pos;
-
- EnsureReadCapacity(cnt);
-
- ShiftRead(cnt);
-
- return pos0;
- }
-
- /// <summary>
- /// Shift position due to write
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- protected void ShiftWrite(int cnt)
- {
- Pos += cnt;
- }
-
- /// <summary>
- /// Shift position due to read.
- /// </summary>
- /// <param name="cnt">Bytes count.</param>
- protected void ShiftRead(int cnt)
- {
- Pos += cnt;
- }
-
- /// <summary>
- /// Calculate new capacity.
- /// </summary>
- /// <param name="curCap">Current capacity.</param>
- /// <param name="reqCap">Required capacity.</param>
- /// <returns>New capacity.</returns>
- protected static int Capacity(int curCap, int reqCap)
- {
- int newCap;
-
- if (reqCap < 256)
- newCap = 256;
- else
- {
- newCap = curCap << 1;
-
- if (newCap < reqCap)
- newCap = reqCap;
- }
-
- return newCap;
- }
-
- /// <summary>
- /// Unsafe memory copy routine.
- /// </summary>
- /// <param name="src">Source.</param>
- /// <param name="dest">Destination.</param>
- /// <param name="len">Length.</param>
- public static void CopyMemory(byte* src, byte* dest, int len)
- {
- if (MemcpyInverted)
- Memcpy.Invoke(dest, src, len);
- else
- Memcpy.Invoke(src, dest, len);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableHeapStream.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableHeapStream.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableHeapStream.cs
deleted file mode 100644
index 690f92c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableHeapStream.cs
+++ /dev/null
@@ -1,447 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.IO
-{
- using System;
- using System.IO;
- using System.Text;
-
- /// <summary>
- /// Portable onheap stream.
- /// </summary>
- internal unsafe class PortableHeapStream : PortableAbstractStream
- {
- /** Data array. */
- protected byte[] Data;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cap">Initial capacity.</param>
- public PortableHeapStream(int cap)
- {
- Data = new byte[cap];
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="data">Data array.</param>
- public PortableHeapStream(byte[] data)
- {
- Data = data;
- }
-
- /** <inheritdoc /> */
- public override void WriteByte(byte val)
- {
- int pos0 = EnsureWriteCapacityAndShift(1);
-
- Data[pos0] = val;
- }
-
- /** <inheritdoc /> */
- public override byte ReadByte()
- {
- int pos0 = EnsureReadCapacityAndShift(1);
-
- return Data[pos0];
- }
-
- /** <inheritdoc /> */
- public override void WriteByteArray(byte[] val)
- {
- int pos0 = EnsureWriteCapacityAndShift(val.Length);
-
- fixed (byte* data0 = Data)
- {
- WriteByteArray0(val, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override byte[] ReadByteArray(int cnt)
- {
- int pos0 = EnsureReadCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- return ReadByteArray0(cnt, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteBoolArray(bool[] val)
- {
- int pos0 = EnsureWriteCapacityAndShift(val.Length);
-
- fixed (byte* data0 = Data)
- {
- WriteBoolArray0(val, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override bool[] ReadBoolArray(int cnt)
- {
- int pos0 = EnsureReadCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- return ReadBoolArray0(cnt, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteShort(short val)
- {
- int pos0 = EnsureWriteCapacityAndShift(2);
-
- fixed (byte* data0 = Data)
- {
- WriteShort0(val, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override short ReadShort()
- {
- int pos0 = EnsureReadCapacityAndShift(2);
-
- fixed (byte* data0 = Data)
- {
- return ReadShort0(data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteShortArray(short[] val)
- {
- int cnt = val.Length << 1;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteShortArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override short[] ReadShortArray(int cnt)
- {
- int cnt0 = cnt << 1;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadShortArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteCharArray(char[] val)
- {
- int cnt = val.Length << 1;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteCharArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override char[] ReadCharArray(int cnt)
- {
- int cnt0 = cnt << 1;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadCharArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteInt(int val)
- {
- int pos0 = EnsureWriteCapacityAndShift(4);
-
- fixed (byte* data0 = Data)
- {
- WriteInt0(val, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteInt(int writePos, int val)
- {
- EnsureWriteCapacity(writePos + 4);
-
- fixed (byte* data0 = Data)
- {
- WriteInt0(val, data0 + writePos);
- }
- }
-
- /** <inheritdoc /> */
- public override int ReadInt()
- {
- int pos0 = EnsureReadCapacityAndShift(4);
-
- fixed (byte* data0 = Data)
- {
- return ReadInt0(data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteIntArray(int[] val)
- {
- int cnt = val.Length << 2;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteIntArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override int[] ReadIntArray(int cnt)
- {
- int cnt0 = cnt << 2;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadIntArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteFloatArray(float[] val)
- {
- int cnt = val.Length << 2;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteFloatArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override float[] ReadFloatArray(int cnt)
- {
- int cnt0 = cnt << 2;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadFloatArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteLong(long val)
- {
- int pos0 = EnsureWriteCapacityAndShift(8);
-
- fixed (byte* data0 = Data)
- {
- WriteLong0(val, data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override long ReadLong()
- {
- int pos0 = EnsureReadCapacityAndShift(8);
-
- fixed (byte* data0 = Data)
- {
- return ReadLong0(data0 + pos0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteLongArray(long[] val)
- {
- int cnt = val.Length << 3;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteLongArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override long[] ReadLongArray(int cnt)
- {
- int cnt0 = cnt << 3;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadLongArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override void WriteDoubleArray(double[] val)
- {
- int cnt = val.Length << 3;
-
- int pos0 = EnsureWriteCapacityAndShift(cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteDoubleArray0(val, data0 + pos0, cnt);
- }
- }
-
- /** <inheritdoc /> */
- public override double[] ReadDoubleArray(int cnt)
- {
- int cnt0 = cnt << 3;
-
- int pos0 = EnsureReadCapacityAndShift(cnt0);
-
- fixed (byte* data0 = Data)
- {
- return ReadDoubleArray0(cnt, data0 + pos0, cnt0);
- }
- }
-
- /** <inheritdoc /> */
- public override int WriteString(char* chars, int charCnt, int byteCnt, Encoding encoding)
- {
- int pos0 = EnsureWriteCapacityAndShift(byteCnt);
-
- int written;
-
- fixed (byte* data0 = Data)
- {
- written = WriteString0(chars, charCnt, byteCnt, encoding, data0 + pos0);
- }
-
- return written;
- }
-
- /** <inheritdoc /> */
- public override void Write(byte* src, int cnt)
- {
- EnsureWriteCapacity(Pos + cnt);
-
- fixed (byte* data0 = Data)
- {
- WriteInternal(src, cnt, data0);
- }
-
- ShiftWrite(cnt);
- }
-
- /** <inheritdoc /> */
- public override void Read(byte* dest, int cnt)
- {
- fixed (byte* data0 = Data)
- {
- ReadInternal(dest, cnt, data0);
- }
- }
-
- /** <inheritdoc /> */
- public override int Remaining()
- {
- return Data.Length - Pos;
- }
-
- /** <inheritdoc /> */
- public override byte[] Array()
- {
- return Data;
- }
-
- /** <inheritdoc /> */
- public override byte[] ArrayCopy()
- {
- byte[] copy = new byte[Pos];
-
- Buffer.BlockCopy(Data, 0, copy, 0, Pos);
-
- return copy;
- }
-
- /** <inheritdoc /> */
- public override bool IsSameArray(byte[] arr)
- {
- return Data == arr;
- }
-
- /** <inheritdoc /> */
- protected override void Dispose(bool disposing)
- {
- // No-op.
- }
-
- /// <summary>
- /// Internal array.
- /// </summary>
- internal byte[] InternalArray
- {
- get { return Data; }
- }
-
- /** <inheritdoc /> */
- protected override void EnsureWriteCapacity(int cnt)
- {
- if (cnt > Data.Length)
- {
- int newCap = Capacity(Data.Length, cnt);
-
- byte[] data0 = new byte[newCap];
-
- // Copy the whole initial array length here because it can be changed
- // from Java without position adjusting.
- Buffer.BlockCopy(Data, 0, data0, 0, Data.Length);
-
- Data = data0;
- }
- }
-
- /** <inheritdoc /> */
- protected override void EnsureReadCapacity(int cnt)
- {
- if (Data.Length - Pos < cnt)
- throw new EndOfStreamException("Not enough data in stream [expected=" + cnt +
- ", remaining=" + (Data.Length - Pos) + ']');
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableStreamAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableStreamAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableStreamAdapter.cs
deleted file mode 100644
index 1d17f89..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Io/PortableStreamAdapter.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.IO
-{
- using System;
- using System.IO;
-
- /// <summary>
- /// Adapter providing .Net streaming functionality over the portable stream.
- /// </summary>
- internal class PortableStreamAdapter : Stream
- {
- /// <summary>
- ///
- /// </summary>
- private readonly IPortableStream _stream;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="stream">Stream.</param>
- public PortableStreamAdapter(IPortableStream stream)
- {
- _stream = stream;
- }
-
- /** <inheritDoc /> */
- public override void Write(byte[] buffer, int offset, int count)
- {
- _stream.Write(buffer, offset, count);
- }
-
- /** <inheritDoc /> */
- public override int Read(byte[] buffer, int offset, int count)
- {
- _stream.Read(buffer, offset, count);
-
- return count;
- }
-
- /** <inheritDoc /> */
- public override void Flush()
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- public override bool CanRead
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public override bool CanWrite
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public override bool CanSeek
- {
- get { return false; }
- }
-
- /** <inheritDoc /> */
- public override long Seek(long offset, SeekOrigin origin)
- {
- throw new NotSupportedException("Stream is not seekable.");
- }
-
- /** <inheritDoc /> */
- public override long Position
- {
- get
- {
- throw new NotSupportedException("Stream is not seekable.");
- }
- set
- {
- throw new NotSupportedException("Stream is not seekable.");
- }
- }
-
- /** <inheritDoc /> */
- public override long Length
- {
- get
- {
- throw new NotSupportedException("Stream is not seekable.");
- }
- }
-
- /** <inheritDoc /> */
- public override void SetLength(long value)
- {
- throw new NotSupportedException("Stream is not seekable.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/IPortableMetadataHandler.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/IPortableMetadataHandler.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/IPortableMetadataHandler.cs
deleted file mode 100644
index dc3090f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/IPortableMetadataHandler.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.Metadata
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Portable metadata handler.
- /// </summary>
- public interface IPortableMetadataHandler
- {
- /// <summary>
- /// Callback invoked when named field is written.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <param name="fieldName">Field name.</param>
- /// <param name="typeId">Field type ID.</param>
- void OnFieldWrite(int fieldId, string fieldName, int typeId);
-
- /// <summary>
- /// Callback invoked when object write is finished and it is time to collect missing metadata.
- /// </summary>
- /// <returns>Collected metadata.</returns>
- IDictionary<string, int> OnObjectWriteFinished();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableHashsetMetadataHandler.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableHashsetMetadataHandler.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableHashsetMetadataHandler.cs
deleted file mode 100644
index 8df5f36..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableHashsetMetadataHandler.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.Metadata
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Metadata handler which uses hash set to determine whether field was already written or not.
- /// </summary>
- internal class PortableHashsetMetadataHandler : IPortableMetadataHandler
- {
- /** Empty fields collection. */
- private static readonly IDictionary<string, int> EmptyFields = new Dictionary<string, int>();
-
- /** IDs known when serialization starts. */
- private readonly ICollection<int> _ids;
-
- /** New fields. */
- private IDictionary<string, int> _fieldMap;
-
- /** */
- private readonly bool _newType;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ids">IDs.</param>
- /// <param name="newType">True is metadata for type is not saved.</param>
- public PortableHashsetMetadataHandler(ICollection<int> ids, bool newType)
- {
- _ids = ids;
- _newType = newType;
- }
-
- /** <inheritdoc /> */
- public void OnFieldWrite(int fieldId, string fieldName, int typeId)
- {
- if (!_ids.Contains(fieldId))
- {
- if (_fieldMap == null)
- _fieldMap = new Dictionary<string, int>();
-
- if (!_fieldMap.ContainsKey(fieldName))
- _fieldMap[fieldName] = typeId;
- }
- }
-
- /** <inheritdoc /> */
- public IDictionary<string, int> OnObjectWriteFinished()
- {
- return _fieldMap ?? (_newType ? EmptyFields : null);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataHolder.cs
deleted file mode 100644
index a3fa90f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataHolder.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.Metadata
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Metadata for particular type.
- /// </summary>
- internal class PortableMetadataHolder
- {
- /** Type ID. */
- private readonly int _typeId;
-
- /** Type name. */
- private readonly string _typeName;
-
- /** Affinity key field name. */
- private readonly string _affKeyFieldName;
-
- /** Empty metadata when nothig is know about object fields yet. */
- private readonly IPortableMetadata _emptyMeta;
-
- /** Collection of know field IDs. */
- private volatile ICollection<int> _ids;
-
- /** Last known unmodifiable metadata which is given to the user. */
- private volatile PortableMetadataImpl _meta;
-
- /** Saved flag (set if type metadata was saved at least once). */
- private volatile bool _saved;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="affKeyFieldName">Affinity key field name.</param>
- public PortableMetadataHolder(int typeId, string typeName, string affKeyFieldName)
- {
- _typeId = typeId;
- _typeName = typeName;
- _affKeyFieldName = affKeyFieldName;
-
- _emptyMeta = new PortableMetadataImpl(typeId, typeName, null, affKeyFieldName);
- }
-
- /// <summary>
- /// Get saved flag.
- /// </summary>
- /// <returns>True if type metadata was saved at least once.</returns>
- public bool Saved()
- {
- return _saved;
- }
-
- /// <summary>
- /// Get current type metadata.
- /// </summary>
- /// <returns>Type metadata.</returns>
- public IPortableMetadata Metadata()
- {
- PortableMetadataImpl meta0 = _meta;
-
- return meta0 != null ? _meta : _emptyMeta;
- }
-
- /// <summary>
- /// Currently cached field IDs.
- /// </summary>
- /// <returns>Cached field IDs.</returns>
- public ICollection<int> FieldIds()
- {
- ICollection<int> ids0 = _ids;
-
- if (_ids == null)
- {
- lock (this)
- {
- ids0 = _ids;
-
- if (ids0 == null)
- {
- ids0 = new HashSet<int>();
-
- _ids = ids0;
- }
- }
- }
-
- return ids0;
- }
-
- /// <summary>
- /// Merge newly sent field metadatas into existing ones.
- /// </summary>
- /// <param name="newMap">New field metadatas map.</param>
- public void Merge(IDictionary<int, Tuple<string, int>> newMap)
- {
- _saved = true;
-
- if (newMap == null || newMap.Count == 0)
- return;
-
- lock (this)
- {
- // 1. Create copies of the old meta.
- ICollection<int> ids0 = _ids;
- PortableMetadataImpl meta0 = _meta;
-
- ICollection<int> newIds = ids0 != null ? new HashSet<int>(ids0) : new HashSet<int>();
-
- IDictionary<string, int> newFields = meta0 != null ?
- new Dictionary<string, int>(meta0.FieldsMap()) : new Dictionary<string, int>(newMap.Count);
-
- // 2. Add new fields.
- foreach (KeyValuePair<int, Tuple<string, int>> newEntry in newMap)
- {
- if (!newIds.Contains(newEntry.Key))
- newIds.Add(newEntry.Key);
-
- if (!newFields.ContainsKey(newEntry.Value.Item1))
- newFields[newEntry.Value.Item1] = newEntry.Value.Item2;
- }
-
- // 3. Assign new meta. Order is important here: meta must be assigned before field IDs.
- _meta = new PortableMetadataImpl(_typeId, _typeName, newFields, _affKeyFieldName);
- _ids = newIds;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
deleted file mode 100644
index 06578c0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/Metadata/PortableMetadataImpl.cs
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable.Metadata
-{
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable metadata implementation.
- /// </summary>
- internal class PortableMetadataImpl : IPortableMetadata
- {
- /** Empty metadata. */
- [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")]
- public static readonly PortableMetadataImpl EmptyMeta =
- new PortableMetadataImpl(PortableUtils.TypeObject, PortableTypeNames.TypeNameObject, null, null);
-
- /** Empty dictionary. */
- private static readonly IDictionary<string, int> EmptyDict = new Dictionary<string, int>();
-
- /** Empty list. */
- private static readonly ICollection<string> EmptyList = new List<string>().AsReadOnly();
-
- /** Fields. */
- private readonly IDictionary<string, int> _fields;
-
- /// <summary>
- /// Get type name by type ID.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <returns>Type name.</returns>
- private static string ConvertTypeName(int typeId)
- {
- switch (typeId)
- {
- case PortableUtils.TypeBool:
- return PortableTypeNames.TypeNameBool;
- case PortableUtils.TypeByte:
- return PortableTypeNames.TypeNameByte;
- case PortableUtils.TypeShort:
- return PortableTypeNames.TypeNameShort;
- case PortableUtils.TypeChar:
- return PortableTypeNames.TypeNameChar;
- case PortableUtils.TypeInt:
- return PortableTypeNames.TypeNameInt;
- case PortableUtils.TypeLong:
- return PortableTypeNames.TypeNameLong;
- case PortableUtils.TypeFloat:
- return PortableTypeNames.TypeNameFloat;
- case PortableUtils.TypeDouble:
- return PortableTypeNames.TypeNameDouble;
- case PortableUtils.TypeDecimal:
- return PortableTypeNames.TypeNameDecimal;
- case PortableUtils.TypeString:
- return PortableTypeNames.TypeNameString;
- case PortableUtils.TypeGuid:
- return PortableTypeNames.TypeNameGuid;
- case PortableUtils.TypeDate:
- return PortableTypeNames.TypeNameDate;
- case PortableUtils.TypeEnum:
- return PortableTypeNames.TypeNameEnum;
- case PortableUtils.TypePortable:
- case PortableUtils.TypeObject:
- return PortableTypeNames.TypeNameObject;
- case PortableUtils.TypeArrayBool:
- return PortableTypeNames.TypeNameArrayBool;
- case PortableUtils.TypeArrayByte:
- return PortableTypeNames.TypeNameArrayByte;
- case PortableUtils.TypeArrayShort:
- return PortableTypeNames.TypeNameArrayShort;
- case PortableUtils.TypeArrayChar:
- return PortableTypeNames.TypeNameArrayChar;
- case PortableUtils.TypeArrayInt:
- return PortableTypeNames.TypeNameArrayInt;
- case PortableUtils.TypeArrayLong:
- return PortableTypeNames.TypeNameArrayLong;
- case PortableUtils.TypeArrayFloat:
- return PortableTypeNames.TypeNameArrayFloat;
- case PortableUtils.TypeArrayDouble:
- return PortableTypeNames.TypeNameArrayDouble;
- case PortableUtils.TypeArrayDecimal:
- return PortableTypeNames.TypeNameArrayDecimal;
- case PortableUtils.TypeArrayString:
- return PortableTypeNames.TypeNameArrayString;
- case PortableUtils.TypeArrayGuid:
- return PortableTypeNames.TypeNameArrayGuid;
- case PortableUtils.TypeArrayDate:
- return PortableTypeNames.TypeNameArrayDate;
- case PortableUtils.TypeArrayEnum:
- return PortableTypeNames.TypeNameArrayEnum;
- case PortableUtils.TypeArray:
- return PortableTypeNames.TypeNameArrayObject;
- case PortableUtils.TypeCollection:
- return PortableTypeNames.TypeNameCollection;
- case PortableUtils.TypeDictionary:
- return PortableTypeNames.TypeNameMap;
- default:
- throw new PortableException("Invalid type ID: " + typeId);
- }
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableMetadataImpl" /> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public PortableMetadataImpl(IPortableRawReader reader)
- {
- TypeId = reader.ReadInt();
- TypeName = reader.ReadString();
- AffinityKeyFieldName = reader.ReadString();
- _fields = reader.ReadGenericDictionary<string, int>();
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <param name="typeName">Type name.</param>
- /// <param name="fields">Fields.</param>
- /// <param name="affKeyFieldName">Affinity key field name.</param>
- public PortableMetadataImpl(int typeId, string typeName, IDictionary<string, int> fields,
- string affKeyFieldName)
- {
- TypeId = typeId;
- TypeName = typeName;
- AffinityKeyFieldName = affKeyFieldName;
- _fields = fields;
- }
-
- /// <summary>
- /// Type ID.
- /// </summary>
- /// <returns></returns>
- public int TypeId { get; private set; }
-
- /// <summary>
- /// Gets type name.
- /// </summary>
- public string TypeName { get; private set; }
-
- /// <summary>
- /// Gets field names for that type.
- /// </summary>
- public ICollection<string> Fields
- {
- get { return _fields != null ? _fields.Keys : EmptyList; }
- }
-
- /// <summary>
- /// Gets field type for the given field name.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>
- /// Field type.
- /// </returns>
- public string GetFieldTypeName(string fieldName)
- {
- if (_fields != null)
- {
- int typeId;
-
- _fields.TryGetValue(fieldName, out typeId);
-
- return ConvertTypeName(typeId);
- }
-
- return null;
- }
-
- /// <summary>
- /// Gets optional affinity key field name.
- /// </summary>
- public string AffinityKeyFieldName { get; private set; }
-
- /// <summary>
- /// Gets fields map.
- /// </summary>
- /// <returns>Fields map.</returns>
- public IDictionary<string, int> FieldsMap()
- {
- return _fields ?? EmptyDict;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderField.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderField.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderField.cs
deleted file mode 100644
index 026d0d4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableBuilderField.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
-
- /// <summary>
- /// Portable builder field.
- /// </summary>
- internal class PortableBuilderField
- {
- /** Remove marker object. */
- public static readonly object RmvMarkerObj = new object();
-
- /** Remove marker. */
- public static readonly PortableBuilderField RmvMarker =
- new PortableBuilderField(null, RmvMarkerObj);
-
- /** Type. */
- private readonly Type _typ;
-
- /** Value. */
- private readonly object _val;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="val">Value.</param>
- public PortableBuilderField(Type typ, object val)
- {
- _typ = typ;
- _val = val;
- }
-
- /// <summary>
- /// Type.
- /// </summary>
- public Type Type
- {
- get
- {
- return _typ;
- }
- }
-
- /// <summary>
- /// Value.
- /// </summary>
- public object Value
- {
- get
- {
- return _val;
- }
- }
- }
-}
[30/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
deleted file mode 100644
index b42e03c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ /dev/null
@@ -1,941 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Expiry;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Cache.Query;
- using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Native cache wrapper.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class CacheImpl<TK, TV> : PlatformTarget, ICache<TK, TV>
- {
- /** Duration: unchanged. */
- private const long DurUnchanged = -2;
-
- /** Duration: eternal. */
- private const long DurEternal = -1;
-
- /** Duration: zero. */
- private const long DurZero = 0;
-
- /** Ignite instance. */
- private readonly Ignite _ignite;
-
- /** Flag: skip store. */
- private readonly bool _flagSkipStore;
-
- /** Flag: keep portable. */
- private readonly bool _flagKeepPortable;
-
- /** Flag: async mode.*/
- private readonly bool _flagAsync;
-
- /** Flag: no-retries.*/
- private readonly bool _flagNoRetries;
-
- /**
- * Result converter for async InvokeAll operation.
- * In future result processing there is only one TResult generic argument,
- * and we can't get the type of ICacheEntryProcessorResult at compile time from it.
- * This field caches converter for the last InvokeAll operation to avoid using reflection.
- */
- private readonly ThreadLocal<object> _invokeAllConverter = new ThreadLocal<object>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="flagSkipStore">Skip store flag.</param>
- /// <param name="flagKeepPortable">Keep portable flag.</param>
- /// <param name="flagAsync">Async mode flag.</param>
- /// <param name="flagNoRetries">No-retries mode flag.</param>
- public CacheImpl(Ignite grid, IUnmanagedTarget target, PortableMarshaller marsh,
- bool flagSkipStore, bool flagKeepPortable, bool flagAsync, bool flagNoRetries) : base(target, marsh)
- {
- _ignite = grid;
- _flagSkipStore = flagSkipStore;
- _flagKeepPortable = flagKeepPortable;
- _flagAsync = flagAsync;
- _flagNoRetries = flagNoRetries;
- }
-
- /** <inheritDoc /> */
- public IIgnite Ignite
- {
- get
- {
- return _ignite;
- }
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return _flagAsync; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- throw new NotSupportedException("GetFuture() should be called through CacheProxyImpl");
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- throw new NotSupportedException("GetFuture() should be called through CacheProxyImpl");
- }
-
- /// <summary>
- /// Gets and resets future for previous asynchronous operation.
- /// </summary>
- /// <param name="lastAsyncOpId">The last async op id.</param>
- /// <returns>
- /// Future for previous asynchronous operation.
- /// </returns>
- /// <exception cref="System.InvalidOperationException">Asynchronous mode is disabled</exception>
- internal IFuture<TResult> GetFuture<TResult>(int lastAsyncOpId)
- {
- if (!_flagAsync)
- throw IgniteUtils.GetAsyncModeDisabledException();
-
- var converter = GetFutureResultConverter<TResult>(lastAsyncOpId);
-
- _invokeAllConverter.Value = null;
-
- return GetFuture((futId, futTypeId) => UU.TargetListenFutureForOperation(Target, futId, futTypeId, lastAsyncOpId),
- _flagKeepPortable, converter);
- }
-
- /** <inheritDoc /> */
- public string Name
- {
- get { return DoInOp<string>((int)CacheOp.GetName); }
- }
-
- /** <inheritDoc /> */
-
- public bool IsEmpty()
- {
- return GetSize() == 0;
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithSkipStore()
- {
- if (_flagSkipStore)
- return this;
-
- return new CacheImpl<TK, TV>(_ignite, UU.CacheWithSkipStore(Target), Marshaller,
- true, _flagKeepPortable, _flagAsync, true);
- }
-
- /// <summary>
- /// Skip store flag getter.
- /// </summary>
- internal bool IsSkipStore { get { return _flagSkipStore; } }
-
- /** <inheritDoc /> */
- public ICache<TK1, TV1> WithKeepPortable<TK1, TV1>()
- {
- if (_flagKeepPortable)
- {
- var result = this as ICache<TK1, TV1>;
-
- if (result == null)
- throw new InvalidOperationException(
- "Can't change type of portable cache. WithKeepPortable has been called on an instance of " +
- "portable cache with incompatible generic arguments.");
-
- return result;
- }
-
- return new CacheImpl<TK1, TV1>(_ignite, UU.CacheWithKeepPortable(Target), Marshaller,
- _flagSkipStore, true, _flagAsync, _flagNoRetries);
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithExpiryPolicy(IExpiryPolicy plc)
- {
- IgniteArgumentCheck.NotNull(plc, "plc");
-
- long create = ConvertDuration(plc.GetExpiryForCreate());
- long update = ConvertDuration(plc.GetExpiryForUpdate());
- long access = ConvertDuration(plc.GetExpiryForAccess());
-
- IUnmanagedTarget cache0 = UU.CacheWithExpiryPolicy(Target, create, update, access);
-
- return new CacheImpl<TK, TV>(_ignite, cache0, Marshaller, _flagSkipStore, _flagKeepPortable, _flagAsync, _flagNoRetries);
- }
-
- /// <summary>
- /// Convert TimeSpan to duration recognizable by Java.
- /// </summary>
- /// <param name="dur">.Net duration.</param>
- /// <returns>Java duration in milliseconds.</returns>
- private static long ConvertDuration(TimeSpan? dur)
- {
- if (dur.HasValue)
- {
- if (dur.Value == TimeSpan.MaxValue)
- return DurEternal;
-
- long dur0 = (long)dur.Value.TotalMilliseconds;
-
- return dur0 > 0 ? dur0 : DurZero;
- }
-
- return DurUnchanged;
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithAsync()
- {
- return _flagAsync ? this : new CacheImpl<TK, TV>(_ignite, UU.CacheWithAsync(Target), Marshaller,
- _flagSkipStore, _flagKeepPortable, true, _flagNoRetries);
- }
-
- /** <inheritDoc /> */
- public bool IsKeepPortable
- {
- get { return _flagKeepPortable; }
- }
-
- /** <inheritDoc /> */
- public void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- LoadCache0(p, args, (int)CacheOp.LoadCache);
- }
-
- /** <inheritDoc /> */
- public void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- LoadCache0(p, args, (int)CacheOp.LocLoadCache);
- }
-
- /// <summary>
- /// Loads the cache.
- /// </summary>
- private void LoadCache0(ICacheEntryFilter<TK, TV> p, object[] args, int opId)
- {
- DoOutOp(opId, writer =>
- {
- if (p != null)
- {
- var p0 = new CacheEntryFilterHolder(p, (k, v) => p.Invoke(new CacheEntry<TK, TV>((TK)k, (TV)v)),
- Marshaller, IsKeepPortable);
- writer.WriteObject(p0);
- writer.WriteLong(p0.Handle);
- }
- else
- writer.WriteObject<CacheEntryFilterHolder>(null);
-
- writer.WriteObjectArray(args);
- });
- }
-
- /** <inheritDoc /> */
- public bool ContainsKey(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp((int)CacheOp.ContainsKey, key) == True;
- }
-
- /** <inheritDoc /> */
- public bool ContainsKeys(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- return DoOutOp((int)CacheOp.ContainsKeys, writer => WriteEnumerable(writer, keys)) == True;
- }
-
- /** <inheritDoc /> */
- public TV LocalPeek(TK key, params CachePeekMode[] modes)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp<TV>((int)CacheOp.Peek, writer =>
- {
- writer.Write(key);
- writer.WriteInt(EncodePeekModes(modes));
- });
- }
-
- /** <inheritDoc /> */
- public TV Get(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp<TK, TV>((int)CacheOp.Get, key);
- }
-
- /** <inheritDoc /> */
- public IDictionary<TK, TV> GetAll(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- return DoOutInOp((int)CacheOp.GetAll,
- writer => WriteEnumerable(writer, keys),
- input =>
- {
- var reader = Marshaller.StartUnmarshal(input, _flagKeepPortable);
-
- return ReadGetAllDictionary(reader);
- });
- }
-
- /** <inheritdoc /> */
- public void Put(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- DoOutOp((int)CacheOp.Put, key, val);
- }
-
- /** <inheritDoc /> */
- public TV GetAndPut(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutInOp<TK, TV, TV>((int)CacheOp.GetAndPut, key, val);
- }
-
- /** <inheritDoc /> */
- public TV GetAndReplace(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutInOp<TK, TV, TV>((int)CacheOp.GetAndReplace, key, val);
- }
-
- /** <inheritDoc /> */
- public TV GetAndRemove(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp<TK, TV>((int)CacheOp.GetAndRemove, key);
- }
-
- /** <inheritdoc /> */
- public bool PutIfAbsent(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutOp((int) CacheOp.PutIfAbsent, key, val) == True;
- }
-
- /** <inheritdoc /> */
- public TV GetAndPutIfAbsent(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutInOp<TK, TV, TV>((int)CacheOp.GetAndPutIfAbsent, key, val);
- }
-
- /** <inheritdoc /> */
- public bool Replace(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutOp((int)CacheOp.Replace2, key, val) == True;
- }
-
- /** <inheritdoc /> */
- public bool Replace(TK key, TV oldVal, TV newVal)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(oldVal, "oldVal");
-
- IgniteArgumentCheck.NotNull(newVal, "newVal");
-
- return DoOutOp((int)CacheOp.Replace3, key, oldVal, newVal) == True;
- }
-
- /** <inheritdoc /> */
- public void PutAll(IDictionary<TK, TV> vals)
- {
- IgniteArgumentCheck.NotNull(vals, "vals");
-
- DoOutOp((int) CacheOp.PutAll, writer => WriteDictionary(writer, vals));
- }
-
- /** <inheritdoc /> */
- public void LocalEvict(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- DoOutOp((int) CacheOp.LocEvict, writer => WriteEnumerable(writer, keys));
- }
-
- /** <inheritdoc /> */
- public void Clear()
- {
- UU.CacheClear(Target);
- }
-
- /** <inheritdoc /> */
- public void Clear(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- DoOutOp((int)CacheOp.Clear, key);
- }
-
- /** <inheritdoc /> */
- public void ClearAll(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- DoOutOp((int)CacheOp.ClearAll, writer => WriteEnumerable(writer, keys));
- }
-
- /** <inheritdoc /> */
- public void LocalClear(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- DoOutOp((int) CacheOp.LocalClear, key);
- }
-
- /** <inheritdoc /> */
- public void LocalClearAll(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- DoOutOp((int)CacheOp.LocalClearAll, writer => WriteEnumerable(writer, keys));
- }
-
- /** <inheritdoc /> */
- public bool Remove(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp((int)CacheOp.RemoveObj, key) == True;
- }
-
- /** <inheritDoc /> */
- public bool Remove(TK key, TV val)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(val, "val");
-
- return DoOutOp((int)CacheOp.RemoveBool, key, val) == True;
- }
-
- /** <inheritDoc /> */
- public void RemoveAll(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- DoOutOp((int)CacheOp.RemoveAll, writer => WriteEnumerable(writer, keys));
- }
-
- /** <inheritDoc /> */
- public void RemoveAll()
- {
- UU.CacheRemoveAll(Target);
- }
-
- /** <inheritDoc /> */
- public int GetLocalSize(params CachePeekMode[] modes)
- {
- return Size0(true, modes);
- }
-
- /** <inheritDoc /> */
- public int GetSize(params CachePeekMode[] modes)
- {
- return Size0(false, modes);
- }
-
- /// <summary>
- /// Internal size routine.
- /// </summary>
- /// <param name="loc">Local flag.</param>
- /// <param name="modes">peek modes</param>
- /// <returns>Size.</returns>
- private int Size0(bool loc, params CachePeekMode[] modes)
- {
- int modes0 = EncodePeekModes(modes);
-
- return UU.CacheSize(Target, modes0, loc);
- }
-
- /** <inheritDoc /> */
- public void LocalPromote(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- DoOutOp((int)CacheOp.LocPromote, writer => WriteEnumerable(writer, keys));
- }
-
- /** <inheritdoc /> */
- public TR Invoke<TR, TA>(TK key, ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- IgniteArgumentCheck.NotNull(processor, "processor");
-
- var holder = new CacheEntryProcessorHolder(processor, arg,
- (e, a) => processor.Process((IMutableCacheEntry<TK, TV>)e, (TA)a), typeof(TK), typeof(TV));
-
- return DoOutInOp((int)CacheOp.Invoke, writer =>
- {
- writer.Write(key);
- writer.Write(holder);
- },
- input => GetResultOrThrow<TR>(Unmarshal<object>(input)));
- }
-
- /** <inheritdoc /> */
- public IDictionary<TK, ICacheEntryProcessorResult<TR>> InvokeAll<TR, TA>(IEnumerable<TK> keys,
- ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- IgniteArgumentCheck.NotNull(processor, "processor");
-
- var holder = new CacheEntryProcessorHolder(processor, arg,
- (e, a) => processor.Process((IMutableCacheEntry<TK, TV>)e, (TA)a), typeof(TK), typeof(TV));
-
- return DoOutInOp((int)CacheOp.InvokeAll, writer =>
- {
- WriteEnumerable(writer, keys);
- writer.Write(holder);
- },
- input =>
- {
- if (IsAsync)
- _invokeAllConverter.Value = (Func<PortableReaderImpl, IDictionary<TK, ICacheEntryProcessorResult<TR>>>)
- (reader => ReadInvokeAllResults<TR>(reader.Stream));
-
- return ReadInvokeAllResults<TR>(input);
- });
- }
-
- /** <inheritdoc /> */
- public ICacheLock Lock(TK key)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutInOp((int)CacheOp.Lock, writer =>
- {
- writer.Write(key);
- }, input => new CacheLock(input.ReadInt(), Target));
- }
-
- /** <inheritdoc /> */
- public ICacheLock LockAll(IEnumerable<TK> keys)
- {
- IgniteArgumentCheck.NotNull(keys, "keys");
-
- return DoOutInOp((int)CacheOp.LockAll, writer =>
- {
- WriteEnumerable(writer, keys);
- }, input => new CacheLock(input.ReadInt(), Target));
- }
-
- /** <inheritdoc /> */
- public bool IsLocalLocked(TK key, bool byCurrentThread)
- {
- IgniteArgumentCheck.NotNull(key, "key");
-
- return DoOutOp((int)CacheOp.IsLocalLocked, writer =>
- {
- writer.Write(key);
- writer.WriteBoolean(byCurrentThread);
- }) == True;
- }
-
- /** <inheritDoc /> */
- public ICacheMetrics GetMetrics()
- {
- return DoInOp((int)CacheOp.Metrics, stream =>
- {
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- return new CacheMetricsImpl(reader);
- });
- }
-
- /** <inheritDoc /> */
- public IFuture Rebalance()
- {
- return GetFuture<object>((futId, futTyp) => UU.CacheRebalance(Target, futId));
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithNoRetries()
- {
- if (_flagNoRetries)
- return this;
-
- return new CacheImpl<TK, TV>(_ignite, UU.CacheWithNoRetries(Target), Marshaller,
- _flagSkipStore, _flagKeepPortable, _flagAsync, true);
- }
-
- /// <summary>
- /// Gets a value indicating whether this instance is in no-retries mode.
- /// </summary>
- internal bool IsNoRetries
- {
- get { return _flagNoRetries; }
- }
-
- #region Queries
-
- /** <inheritDoc /> */
- public IQueryCursor<IList> QueryFields(SqlFieldsQuery qry)
- {
- IgniteArgumentCheck.NotNull(qry, "qry");
-
- if (string.IsNullOrEmpty(qry.Sql))
- throw new ArgumentException("Sql cannot be null or empty");
-
- IUnmanagedTarget cursor;
-
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- var writer = Marshaller.StartMarshal(stream);
-
- writer.WriteBoolean(qry.Local);
- writer.WriteString(qry.Sql);
- writer.WriteInt(qry.PageSize);
-
- WriteQueryArgs(writer, qry.Arguments);
-
- FinishMarshal(writer);
-
- cursor = UU.CacheOutOpQueryCursor(Target, (int) CacheOp.QrySqlFields, stream.SynchronizeOutput());
- }
-
- return new FieldsQueryCursor(cursor, Marshaller, _flagKeepPortable);
- }
-
- /** <inheritDoc /> */
- public IQueryCursor<ICacheEntry<TK, TV>> Query(QueryBase qry)
- {
- IgniteArgumentCheck.NotNull(qry, "qry");
-
- IUnmanagedTarget cursor;
-
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- var writer = Marshaller.StartMarshal(stream);
-
- qry.Write(writer, IsKeepPortable);
-
- FinishMarshal(writer);
-
- cursor = UU.CacheOutOpQueryCursor(Target, (int)qry.OpId, stream.SynchronizeOutput());
- }
-
- return new QueryCursor<TK, TV>(cursor, Marshaller, _flagKeepPortable);
- }
-
- /// <summary>
- /// Write query arguments.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="args">Arguments.</param>
- private static void WriteQueryArgs(PortableWriterImpl writer, object[] args)
- {
- if (args == null)
- writer.WriteInt(0);
- else
- {
- writer.WriteInt(args.Length);
-
- foreach (var arg in args)
- writer.WriteObject(arg);
- }
- }
-
- /** <inheritdoc /> */
- public IContinuousQueryHandle QueryContinuous(ContinuousQuery<TK, TV> qry)
- {
- IgniteArgumentCheck.NotNull(qry, "qry");
-
- return QueryContinuousImpl(qry, null);
- }
-
- /** <inheritdoc /> */
- public IContinuousQueryHandle<ICacheEntry<TK, TV>> QueryContinuous(ContinuousQuery<TK, TV> qry, QueryBase initialQry)
- {
- IgniteArgumentCheck.NotNull(qry, "qry");
- IgniteArgumentCheck.NotNull(initialQry, "initialQry");
-
- return QueryContinuousImpl(qry, initialQry);
- }
-
- /// <summary>
- /// QueryContinuous implementation.
- /// </summary>
- private IContinuousQueryHandle<ICacheEntry<TK, TV>> QueryContinuousImpl(ContinuousQuery<TK, TV> qry,
- QueryBase initialQry)
- {
- qry.Validate();
-
- var hnd = new ContinuousQueryHandleImpl<TK, TV>(qry, Marshaller, _flagKeepPortable);
-
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- var writer = Marshaller.StartMarshal(stream);
-
- hnd.Start(_ignite, writer, () =>
- {
- if (initialQry != null)
- {
- writer.WriteInt((int) initialQry.OpId);
-
- initialQry.Write(writer, IsKeepPortable);
- }
- else
- writer.WriteInt(-1); // no initial query
-
- FinishMarshal(writer);
-
- // ReSharper disable once AccessToDisposedClosure
- return UU.CacheOutOpContinuousQuery(Target, (int)CacheOp.QryContinuous, stream.SynchronizeOutput());
- }, qry);
- }
-
- return hnd;
- }
-
- #endregion
-
- #region Enumerable support
-
- /** <inheritdoc /> */
- public IEnumerable<ICacheEntry<TK, TV>> GetLocalEntries(CachePeekMode[] peekModes)
- {
- return new CacheEnumerable<TK, TV>(this, EncodePeekModes(peekModes));
- }
-
- /** <inheritdoc /> */
- public IEnumerator<ICacheEntry<TK, TV>> GetEnumerator()
- {
- return new CacheEnumeratorProxy<TK, TV>(this, false, 0);
- }
-
- /** <inheritdoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- /// <summary>
- /// Create real cache enumerator.
- /// </summary>
- /// <param name="loc">Local flag.</param>
- /// <param name="peekModes">Peek modes for local enumerator.</param>
- /// <returns>Cache enumerator.</returns>
- internal CacheEnumerator<TK, TV> CreateEnumerator(bool loc, int peekModes)
- {
- if (loc)
- return new CacheEnumerator<TK, TV>(UU.CacheLocalIterator(Target, peekModes), Marshaller, _flagKeepPortable);
-
- return new CacheEnumerator<TK, TV>(UU.CacheIterator(Target), Marshaller, _flagKeepPortable);
- }
-
- #endregion
-
- /** <inheritDoc /> */
- protected override T Unmarshal<T>(IPortableStream stream)
- {
- return Marshaller.Unmarshal<T>(stream, _flagKeepPortable);
- }
-
- /// <summary>
- /// Encodes the peek modes into a single int value.
- /// </summary>
- private static int EncodePeekModes(CachePeekMode[] modes)
- {
- int modesEncoded = 0;
-
- if (modes != null)
- {
- foreach (var mode in modes)
- modesEncoded |= (int) mode;
- }
-
- return modesEncoded;
- }
-
- /// <summary>
- /// Unwraps an exception from PortableResultHolder, if any. Otherwise does the cast.
- /// </summary>
- /// <typeparam name="T">Result type.</typeparam>
- /// <param name="obj">Object.</param>
- /// <returns>Result.</returns>
- private static T GetResultOrThrow<T>(object obj)
- {
- var holder = obj as PortableResultWrapper;
-
- if (holder != null)
- {
- var err = holder.Result as Exception;
-
- if (err != null)
- throw err as CacheEntryProcessorException ?? new CacheEntryProcessorException(err);
- }
-
- return obj == null ? default(T) : (T) obj;
- }
-
- /// <summary>
- /// Reads results of InvokeAll operation.
- /// </summary>
- /// <typeparam name="T">The type of the result.</typeparam>
- /// <param name="inStream">Stream.</param>
- /// <returns>Results of InvokeAll operation.</returns>
- private IDictionary<TK, ICacheEntryProcessorResult<T>> ReadInvokeAllResults<T>(IPortableStream inStream)
- {
- var count = inStream.ReadInt();
-
- if (count == -1)
- return null;
-
- var results = new Dictionary<TK, ICacheEntryProcessorResult<T>>(count);
-
- for (var i = 0; i < count; i++)
- {
- var key = Unmarshal<TK>(inStream);
-
- var hasError = inStream.ReadBool();
-
- results[key] = hasError
- ? new CacheEntryProcessorResult<T>(ReadException(inStream))
- : new CacheEntryProcessorResult<T>(Unmarshal<T>(inStream));
- }
-
- return results;
- }
-
- /// <summary>
- /// Reads the exception, either in portable wrapper form, or as a pair of strings.
- /// </summary>
- /// <param name="inStream">The stream.</param>
- /// <returns>Exception.</returns>
- private CacheEntryProcessorException ReadException(IPortableStream inStream)
- {
- var item = Unmarshal<object>(inStream);
-
- var clsName = item as string;
-
- if (clsName == null)
- return new CacheEntryProcessorException((Exception) ((PortableResultWrapper) item).Result);
-
- var msg = Unmarshal<string>(inStream);
-
- return new CacheEntryProcessorException(ExceptionUtils.GetException(clsName, msg));
- }
-
- /// <summary>
- /// Read dictionary returned by GET_ALL operation.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Dictionary.</returns>
- private static IDictionary<TK, TV> ReadGetAllDictionary(PortableReaderImpl reader)
- {
- IPortableStream stream = reader.Stream;
-
- if (stream.ReadBool())
- {
- int size = stream.ReadInt();
-
- IDictionary<TK, TV> res = new Dictionary<TK, TV>(size);
-
- for (int i = 0; i < size; i++)
- {
- TK key = reader.ReadObject<TK>();
- TV val = reader.ReadObject<TV>();
-
- res[key] = val;
- }
-
- return res;
- }
- return null;
- }
-
- /// <summary>
- /// Gets the future result converter based on the last operation id.
- /// </summary>
- /// <typeparam name="TResult">The type of the future result.</typeparam>
- /// <param name="lastAsyncOpId">The last op id.</param>
- /// <returns>Future result converter.</returns>
- private Func<PortableReaderImpl, TResult> GetFutureResultConverter<TResult>(int lastAsyncOpId)
- {
- if (lastAsyncOpId == (int) CacheOp.GetAll)
- return reader => (TResult)ReadGetAllDictionary(reader);
-
- if (lastAsyncOpId == (int)CacheOp.Invoke)
- return reader =>
- {
- var hasError = reader.ReadBoolean();
-
- if (hasError)
- throw ReadException(reader.Stream);
-
- return reader.ReadObject<TResult>();
- };
-
- if (lastAsyncOpId == (int) CacheOp.InvokeAll)
- return _invokeAllConverter.Value as Func<PortableReaderImpl, TResult>;
-
- return null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs
deleted file mode 100644
index ceb3b05..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheLock.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using System.Diagnostics;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Cache lock implementation.
- /// </summary>
- internal class CacheLock : ICacheLock
- {
- /** Unique lock ID.*/
- private readonly long _id;
-
- /** Cache. */
- private readonly IUnmanagedTarget _cache;
-
- /** State (-1 for disposed, >=0 for number of currently executing methods). */
- private int _state;
-
- /** Current number of lock contenders. */
- private int _counter;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheLock"/> class.
- /// </summary>
- /// <param name="id">Lock id.</param>
- /// <param name="cache">Cache.</param>
- public CacheLock(long id, IUnmanagedTarget cache)
- {
- Debug.Assert(cache != null);
-
- _id = id;
- _cache = cache;
- }
-
- /** <inheritDoc /> */
- public void Enter()
- {
- lock (this)
- {
- ThrowIfDisposed();
-
- _state++;
- }
-
- var res = false;
-
- try
- {
- UU.CacheEnterLock(_cache, _id);
-
- res = true;
- }
- finally
- {
- lock (this)
- {
- if (res)
- _counter++;
-
- _state--;
- }
- }
- }
-
- /** <inheritDoc /> */
- public bool TryEnter()
- {
- return TryEnter(TimeSpan.FromMilliseconds(-1));
- }
-
- /** <inheritDoc /> */
- public bool TryEnter(TimeSpan timeout)
- {
- lock (this)
- {
- ThrowIfDisposed();
-
- _state++;
- }
-
- var res = false;
-
- try
- {
- return res = UU.CacheTryEnterLock(_cache, _id, (long)timeout.TotalMilliseconds);
- }
- finally
- {
- lock (this)
- {
- if (res)
- _counter++;
-
- _state--;
- }
- }
- }
-
- /** <inheritDoc /> */
- public void Exit()
- {
- lock (this)
- {
- ThrowIfDisposed();
-
- UU.CacheExitLock(_cache, _id);
-
- _counter--;
- }
- }
-
- /** <inheritDoc /> */
- public void Dispose()
- {
- lock (this)
- {
- ThrowIfDisposed();
-
- if (_state > 0 || _counter > 0)
- throw new SynchronizationLockException(
- "The lock is being disposed while still being used. " +
- "It either is being held by a thread and/or has active waiters waiting to acquire the lock.");
-
- UU.CacheCloseLock(_cache, _id);
-
- _state = -1;
-
- GC.SuppressFinalize(this);
- }
- }
-
- /// <summary>
- /// Finalizes an instance of the <see cref="CacheLock"/> class.
- /// </summary>
- ~CacheLock()
- {
- UU.CacheCloseLock(_cache, _id);
- }
-
- /// <summary>
- /// Throws <see cref="ObjectDisposedException"/> if this instance has been disposed.
- /// </summary>
- private void ThrowIfDisposed()
- {
- if (_state < 0)
- throw new ObjectDisposedException("CacheLock", "CacheLock has been disposed.");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
deleted file mode 100644
index b5982f6..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheMetricsImpl.cs
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Cache metrics used to obtain statistics on cache.
- /// </summary>
- internal class CacheMetricsImpl : ICacheMetrics
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheMetricsImpl"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public CacheMetricsImpl(IPortableRawReader reader)
- {
- CacheGets = reader.ReadLong();
- CachePuts = reader.ReadLong();
- CacheHits = reader.ReadLong();
- CacheMisses = reader.ReadLong();
- CacheTxCommits = reader.ReadLong();
- CacheTxRollbacks = reader.ReadLong();
- CacheEvictions = reader.ReadLong();
- CacheRemovals = reader.ReadLong();
- AveragePutTime = reader.ReadFloat();
- AverageGetTime = reader.ReadFloat();
- AverageRemoveTime = reader.ReadFloat();
- AverageTxCommitTime = reader.ReadFloat();
- AverageTxRollbackTime = reader.ReadFloat();
- CacheName = reader.ReadString();
- OverflowSize = reader.ReadLong();
- OffHeapEntriesCount = reader.ReadLong();
- OffHeapAllocatedSize = reader.ReadLong();
- Size = reader.ReadInt();
- KeySize = reader.ReadInt();
- IsEmpty = reader.ReadBoolean();
- DhtEvictQueueCurrentSize = reader.ReadInt();
- TxThreadMapSize = reader.ReadInt();
- TxXidMapSize = reader.ReadInt();
- TxCommitQueueSize = reader.ReadInt();
- TxPrepareQueueSize = reader.ReadInt();
- TxStartVersionCountsSize = reader.ReadInt();
- TxCommittedVersionsSize = reader.ReadInt();
- TxRolledbackVersionsSize = reader.ReadInt();
- TxDhtThreadMapSize = reader.ReadInt();
- TxDhtXidMapSize = reader.ReadInt();
- TxDhtCommitQueueSize = reader.ReadInt();
- TxDhtPrepareQueueSize = reader.ReadInt();
- TxDhtStartVersionCountsSize = reader.ReadInt();
- TxDhtCommittedVersionsSize = reader.ReadInt();
- TxDhtRolledbackVersionsSize = reader.ReadInt();
- IsWriteBehindEnabled = reader.ReadBoolean();
- WriteBehindFlushSize = reader.ReadInt();
- WriteBehindFlushThreadCount = reader.ReadInt();
- WriteBehindFlushFrequency = reader.ReadLong();
- WriteBehindStoreBatchSize = reader.ReadInt();
- WriteBehindTotalCriticalOverflowCount = reader.ReadInt();
- WriteBehindCriticalOverflowCount = reader.ReadInt();
- WriteBehindErrorRetryCount = reader.ReadInt();
- WriteBehindBufferSize = reader.ReadInt();
- KeyType = reader.ReadString();
- ValueType = reader.ReadString();
- IsStoreByValue = reader.ReadBoolean();
- IsStatisticsEnabled = reader.ReadBoolean();
- IsManagementEnabled = reader.ReadBoolean();
- IsReadThrough = reader.ReadBoolean();
- IsWriteThrough = reader.ReadBoolean();
- CacheHitPercentage = reader.ReadFloat();
- CacheMissPercentage = reader.ReadFloat();
- }
-
- /** <inheritdoc /> */
- public long CacheHits { get; private set; }
-
- /** <inheritdoc /> */
- public float CacheHitPercentage { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheMisses { get; private set; }
-
- /** <inheritdoc /> */
- public float CacheMissPercentage { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheGets { get; private set; }
-
- /** <inheritdoc /> */
- public long CachePuts { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheRemovals { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheEvictions { get; private set; }
-
- /** <inheritdoc /> */
- public float AverageGetTime { get; private set; }
-
- /** <inheritdoc /> */
- public float AveragePutTime { get; private set; }
-
- /** <inheritdoc /> */
- public float AverageRemoveTime { get; private set; }
-
- /** <inheritdoc /> */
- public float AverageTxCommitTime { get; private set; }
-
- /** <inheritdoc /> */
- public float AverageTxRollbackTime { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheTxCommits { get; private set; }
-
- /** <inheritdoc /> */
- public long CacheTxRollbacks { get; private set; }
-
- /** <inheritdoc /> */
- public string CacheName { get; private set; }
-
- /** <inheritdoc /> */
- public long OverflowSize { get; private set; }
-
- /** <inheritdoc /> */
- public long OffHeapEntriesCount { get; private set; }
-
- /** <inheritdoc /> */
- public long OffHeapAllocatedSize { get; private set; }
-
- /** <inheritdoc /> */
- public int Size { get; private set; }
-
- /** <inheritdoc /> */
- public int KeySize { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsEmpty { get; private set; }
-
- /** <inheritdoc /> */
- public int DhtEvictQueueCurrentSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxThreadMapSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxXidMapSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxCommitQueueSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxPrepareQueueSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxStartVersionCountsSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxCommittedVersionsSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxRolledbackVersionsSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtThreadMapSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtXidMapSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtCommitQueueSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtPrepareQueueSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtStartVersionCountsSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtCommittedVersionsSize { get; private set; }
-
- /** <inheritdoc /> */
- public int TxDhtRolledbackVersionsSize { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsWriteBehindEnabled { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindFlushSize { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindFlushThreadCount { get; private set; }
-
- /** <inheritdoc /> */
- public long WriteBehindFlushFrequency { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindStoreBatchSize { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindTotalCriticalOverflowCount { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindCriticalOverflowCount { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindErrorRetryCount { get; private set; }
-
- /** <inheritdoc /> */
- public int WriteBehindBufferSize { get; private set; }
-
- /** <inheritdoc /> */
- public string KeyType { get; private set; }
-
- /** <inheritdoc /> */
- public string ValueType { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsStoreByValue { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsStatisticsEnabled { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsManagementEnabled { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsReadThrough { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsWriteThrough { get; private set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
deleted file mode 100644
index 3eb63ca..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheOp.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- /// <summary>
- /// Cache opcodes.
- /// </summary>
- internal enum CacheOp
- {
- Clear = 1,
- ClearAll = 2,
- ContainsKey = 3,
- ContainsKeys = 4,
- Get = 5,
- GetAll = 6,
- GetAndPut = 7,
- GetAndPutIfAbsent = 8,
- GetAndRemove = 9,
- GetAndReplace = 10,
- GetName = 11,
- Invoke = 12,
- InvokeAll = 13,
- IsLocalLocked = 14,
- LoadCache = 15,
- LocEvict = 16,
- LocLoadCache = 17,
- LocPromote = 18,
- LocalClear = 20,
- LocalClearAll = 21,
- Lock = 22,
- LockAll = 23,
- Metrics = 24,
- Peek = 25,
- Put = 26,
- PutAll = 27,
- PutIfAbsent = 28,
- QryContinuous = 29,
- QryScan = 30,
- QrySql = 31,
- QrySqlFields = 32,
- QryTxt = 33,
- RemoveAll = 34,
- RemoveBool = 35,
- RemoveObj = 36,
- Replace2 = 37,
- Replace3 = 38
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheProxyImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheProxyImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheProxyImpl.cs
deleted file mode 100644
index bfd7866..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/CacheProxyImpl.cs
+++ /dev/null
@@ -1,500 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Expiry;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Cache proxy.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class CacheProxyImpl<TK, TV> : ICache<TK, TV>
- {
- /** wrapped cache instance */
- private readonly CacheImpl<TK, TV> _cache;
-
- /** */
- private readonly ThreadLocal<int> _lastAsyncOp = new ThreadLocal<int>(() => PlatformTarget.OpNone);
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheProxyImpl{K, V}"/> class.
- /// </summary>
- /// <param name="cache">The cache to wrap.</param>
- public CacheProxyImpl(CacheImpl<TK, TV> cache)
- {
- Debug.Assert(cache != null);
-
- _cache = cache;
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithSkipStore()
- {
- return _cache.IsSkipStore ? this : new CacheProxyImpl<TK, TV>((CacheImpl<TK, TV>)_cache.WithSkipStore());
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithExpiryPolicy(IExpiryPolicy plc)
- {
- return new CacheProxyImpl<TK, TV>((CacheImpl<TK, TV>)_cache.WithExpiryPolicy(plc));
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithAsync()
- {
- return IsAsync ? this : new CacheProxyImpl<TK, TV>((CacheImpl<TK, TV>) _cache.WithAsync());
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return _cache.IsAsync; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- return GetFuture<object>();
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- var fut = _cache.GetFuture<TResult>(_lastAsyncOp.Value);
-
- ClearLastAsyncOp();
-
- return fut;
- }
-
- /** <inheritDoc /> */
- public IEnumerator<ICacheEntry<TK, TV>> GetEnumerator()
- {
- return _cache.GetEnumerator();
- }
-
- /** <inheritDoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable) _cache).GetEnumerator();
- }
-
- /** <inheritDoc /> */
- public string Name
- {
- get { return _cache.Name; }
- }
-
- /** <inheritDoc /> */
- public IIgnite Ignite
- {
- get { return _cache.Ignite; }
- }
-
- /** <inheritDoc /> */
-
- public bool IsEmpty()
- {
- return _cache.IsEmpty();
- }
-
- /** <inheritDoc /> */
- public bool IsKeepPortable
- {
- get { return _cache.IsKeepPortable; }
- }
-
- /// <summary>
- /// Skip store flag.
- /// </summary>
- internal bool SkipStore
- {
- get { return _cache.IsSkipStore; }
- }
-
- /** <inheritDoc /> */
- public ICache<TK1, TV1> WithKeepPortable<TK1, TV1>()
- {
- return new CacheProxyImpl<TK1, TV1>((CacheImpl<TK1, TV1>) _cache.WithKeepPortable<TK1, TV1>());
- }
-
- /** <inheritDoc /> */
- public void LoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- _cache.LoadCache(p, args);
-
- SetLastAsyncOp(CacheOp.LoadCache);
- }
-
- /** <inheritDoc /> */
- public void LocalLoadCache(ICacheEntryFilter<TK, TV> p, params object[] args)
- {
- _cache.LocalLoadCache(p, args);
-
- SetLastAsyncOp(CacheOp.LocLoadCache);
- }
-
- /** <inheritDoc /> */
- public bool ContainsKey(TK key)
- {
- var result = _cache.ContainsKey(key);
-
- SetLastAsyncOp(CacheOp.ContainsKey);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public bool ContainsKeys(IEnumerable<TK> keys)
- {
- var result = _cache.ContainsKeys(keys);
-
- SetLastAsyncOp(CacheOp.ContainsKeys);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public TV LocalPeek(TK key, params CachePeekMode[] modes)
- {
- return _cache.LocalPeek(key, modes);
- }
-
- /** <inheritDoc /> */
- public TV Get(TK key)
- {
- var result = _cache.Get(key);
-
- SetLastAsyncOp(CacheOp.Get);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public IDictionary<TK, TV> GetAll(IEnumerable<TK> keys)
- {
- var result = _cache.GetAll(keys);
-
- SetLastAsyncOp(CacheOp.GetAll);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public void Put(TK key, TV val)
- {
- _cache.Put(key, val);
-
- SetLastAsyncOp(CacheOp.Put);
- }
-
- /** <inheritDoc /> */
- public TV GetAndPut(TK key, TV val)
- {
- var result = _cache.GetAndPut(key, val);
-
- SetLastAsyncOp(CacheOp.GetAndPut);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public TV GetAndReplace(TK key, TV val)
- {
- var result = _cache.GetAndReplace(key, val);
-
- SetLastAsyncOp(CacheOp.GetAndReplace);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public TV GetAndRemove(TK key)
- {
- var result = _cache.GetAndRemove(key);
-
- SetLastAsyncOp(CacheOp.GetAndRemove);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public bool PutIfAbsent(TK key, TV val)
- {
- var result = _cache.PutIfAbsent(key, val);
-
- SetLastAsyncOp(CacheOp.PutIfAbsent);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public TV GetAndPutIfAbsent(TK key, TV val)
- {
- var result = _cache.GetAndPutIfAbsent(key, val);
-
- SetLastAsyncOp(CacheOp.GetAndPutIfAbsent);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public bool Replace(TK key, TV val)
- {
- var result = _cache.Replace(key, val);
-
- SetLastAsyncOp(CacheOp.Replace2);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public bool Replace(TK key, TV oldVal, TV newVal)
- {
- var result = _cache.Replace(key, oldVal, newVal);
-
- SetLastAsyncOp(CacheOp.Replace3);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public void PutAll(IDictionary<TK, TV> vals)
- {
- _cache.PutAll(vals);
-
- SetLastAsyncOp(CacheOp.PutAll);
- }
-
- /** <inheritDoc /> */
- public void LocalEvict(IEnumerable<TK> keys)
- {
- _cache.LocalEvict(keys);
- }
-
- /** <inheritDoc /> */
- public void Clear()
- {
- _cache.Clear();
-
- ClearLastAsyncOp();
- }
-
- /** <inheritDoc /> */
- public void Clear(TK key)
- {
- _cache.Clear(key);
-
- SetLastAsyncOp(CacheOp.Clear);
- }
-
- /** <inheritDoc /> */
- public void ClearAll(IEnumerable<TK> keys)
- {
- _cache.ClearAll(keys);
-
- SetLastAsyncOp(CacheOp.ClearAll);
- }
-
- /** <inheritDoc /> */
- public void LocalClear(TK key)
- {
- _cache.LocalClear(key);
- }
-
- /** <inheritDoc /> */
- public void LocalClearAll(IEnumerable<TK> keys)
- {
- _cache.LocalClearAll(keys);
- }
-
- /** <inheritDoc /> */
- public bool Remove(TK key)
- {
- var result = _cache.Remove(key);
-
- SetLastAsyncOp(CacheOp.RemoveObj);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public bool Remove(TK key, TV val)
- {
- var result = _cache.Remove(key, val);
-
- SetLastAsyncOp(CacheOp.RemoveBool);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public void RemoveAll(IEnumerable<TK> keys)
- {
- _cache.RemoveAll(keys);
-
- SetLastAsyncOp(CacheOp.RemoveAll);
- }
-
- /** <inheritDoc /> */
- public void RemoveAll()
- {
- _cache.RemoveAll();
-
- ClearLastAsyncOp();
- }
-
- /** <inheritDoc /> */
- public int GetLocalSize(params CachePeekMode[] modes)
- {
- return _cache.GetLocalSize(modes);
- }
-
- /** <inheritDoc /> */
- public int GetSize(params CachePeekMode[] modes)
- {
- var result = _cache.GetSize(modes);
-
- ClearLastAsyncOp();
-
- return result;
- }
-
- /** <inheritDoc /> */
- public void LocalPromote(IEnumerable<TK> keys)
- {
- _cache.LocalPromote(keys);
- }
-
- /** <inheritDoc /> */
- public IQueryCursor<ICacheEntry<TK, TV>> Query(QueryBase qry)
- {
- return _cache.Query(qry);
- }
-
- /** <inheritDoc /> */
- public IQueryCursor<IList> QueryFields(SqlFieldsQuery qry)
- {
- return _cache.QueryFields(qry);
- }
-
- /** <inheritDoc /> */
- public IContinuousQueryHandle QueryContinuous(ContinuousQuery<TK, TV> qry)
- {
- return _cache.QueryContinuous(qry);
- }
-
- /** <inheritDoc /> */
- public IContinuousQueryHandle<ICacheEntry<TK, TV>> QueryContinuous(ContinuousQuery<TK, TV> qry, QueryBase initialQry)
- {
- return _cache.QueryContinuous(qry, initialQry);
- }
-
- /** <inheritDoc /> */
- public IEnumerable<ICacheEntry<TK, TV>> GetLocalEntries(params CachePeekMode[] peekModes)
- {
- return _cache.GetLocalEntries(peekModes);
- }
-
- /** <inheritDoc /> */
- public TR Invoke<TR, TA>(TK key, ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- var result = _cache.Invoke(key, processor, arg);
-
- SetLastAsyncOp(CacheOp.Invoke);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public IDictionary<TK, ICacheEntryProcessorResult<TR>> InvokeAll<TR, TA>(IEnumerable<TK> keys,
- ICacheEntryProcessor<TK, TV, TA, TR> processor, TA arg)
- {
- var result = _cache.InvokeAll(keys, processor, arg);
-
- SetLastAsyncOp(CacheOp.InvokeAll);
-
- return result;
- }
-
- /** <inheritDoc /> */
- public ICacheLock Lock(TK key)
- {
- return _cache.Lock(key);
- }
-
- /** <inheritDoc /> */
- public ICacheLock LockAll(IEnumerable<TK> keys)
- {
- return _cache.LockAll(keys);
- }
-
- /** <inheritDoc /> */
- public bool IsLocalLocked(TK key, bool byCurrentThread)
- {
- return _cache.IsLocalLocked(key, byCurrentThread);
- }
-
- /** <inheritDoc /> */
- public ICacheMetrics GetMetrics()
- {
- return _cache.GetMetrics();
- }
-
- /** <inheritDoc /> */
- public IFuture Rebalance()
- {
- return _cache.Rebalance();
- }
-
- /** <inheritDoc /> */
- public ICache<TK, TV> WithNoRetries()
- {
- return _cache.IsNoRetries ? this : new CacheProxyImpl<TK, TV>((CacheImpl<TK, TV>) _cache.WithNoRetries());
- }
-
- /// <summary>
- /// Sets the last asynchronous op id.
- /// </summary>
- /// <param name="opId">The op identifier.</param>
- private void SetLastAsyncOp(CacheOp opId)
- {
- if (IsAsync)
- _lastAsyncOp.Value = (int) opId;
- }
-
- /// <summary>
- /// Clears the last asynchronous op id.
- /// This should be called in the end of each method that supports async and does not call SetLastAsyncOp.
- /// </summary>
- private void ClearLastAsyncOp()
- {
- if (IsAsync)
- _lastAsyncOp.Value = PlatformTarget.OpNone;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
deleted file mode 100644
index 8d9dfef..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryCreateEvent.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Event
-{
- using Apache.Ignite.Core.Cache.Event;
-
- /// <summary>
- /// Cache entry create event.
- /// </summary>
- internal class CacheEntryCreateEvent<TK, TV> : ICacheEntryEvent<TK, TV>
- {
- /** Key.*/
- private readonly TK _key;
-
- /** Value.*/
- private readonly TV _val;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- public CacheEntryCreateEvent(TK key, TV val)
- {
- _key = key;
- _val = val;
- }
-
- /** <inheritdoc /> */
- public TK Key
- {
- get { return _key; }
- }
-
- /** <inheritdoc /> */
- public TV Value
- {
- get { return _val; }
- }
-
- /** <inheritdoc /> */
- public TV OldValue
- {
- get { return default(TV); }
- }
-
- /** <inheritdoc /> */
- public bool HasOldValue
- {
- get { return false; }
- }
-
- /** <inheritdoc /> */
- public CacheEntryEventType EventType
- {
- get { return CacheEntryEventType.Created; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
deleted file mode 100644
index a44a800..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryRemoveEvent.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Event
-{
- using Apache.Ignite.Core.Cache.Event;
-
- /// <summary>
- /// Cache entry remove event.
- /// </summary>
- internal class CacheEntryRemoveEvent<TK, TV> : ICacheEntryEvent<TK, TV>
- {
- /** Key.*/
- private readonly TK _key;
-
- /** Old value.*/
- private readonly TV _oldVal;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="oldVal">Old value.</param>
- public CacheEntryRemoveEvent(TK key, TV oldVal)
- {
- _key = key;
- _oldVal = oldVal;
- }
-
- /** <inheritdoc /> */
- public TK Key
- {
- get { return _key; }
- }
-
- /** <inheritdoc /> */
- public TV Value
- {
- get { return default(TV); }
- }
-
- /** <inheritdoc /> */
- public TV OldValue
- {
- get { return _oldVal; }
- }
-
- /** <inheritdoc /> */
- public bool HasOldValue
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public CacheEntryEventType EventType
- {
- get { return CacheEntryEventType.Removed; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
deleted file mode 100644
index e6fb927..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Event/CacheEntryUpdateEvent.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Event
-{
- using Apache.Ignite.Core.Cache.Event;
-
- /// <summary>
- /// Cache entry update event.
- /// </summary>
- internal class CacheEntryUpdateEvent<TK, TV> : ICacheEntryEvent<TK, TV>
- {
- /** Key.*/
- private readonly TK _key;
-
- /** Value.*/
- private readonly TV _val;
-
- /** Old value.*/
- private readonly TV _oldVal;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="oldVal">Old value.</param>
- /// <param name="val">Value.</param>
- public CacheEntryUpdateEvent(TK key, TV oldVal, TV val)
- {
- _key = key;
- _oldVal = oldVal;
- _val = val;
- }
-
- /** <inheritdoc /> */
- public TK Key
- {
- get { return _key; }
- }
-
- /** <inheritdoc /> */
- public TV Value
- {
- get { return _val; }
- }
-
- /** <inheritdoc /> */
- public TV OldValue
- {
- get { return _oldVal; }
- }
-
- /** <inheritdoc /> */
- public bool HasOldValue
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public CacheEntryEventType EventType
- {
- get { return CacheEntryEventType.Updated; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
deleted file mode 100644
index 2c69043..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/MutableCacheEntry.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache
-{
- using System;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Represents a cache entry.
- /// </summary>
- internal class MutableCacheEntry<TK, TV> : IMutableCacheEntry<TK, TV>, IMutableCacheEntryInternal
- {
- // Entry value
- private TV _value;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MutableCacheEntry{K, V}"/> class.
- /// </summary>
- /// <param name="key">The key.</param>
- public MutableCacheEntry(TK key)
- {
- Key = key;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="MutableCacheEntry{K, V}"/> class.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="value">The value.</param>
- public MutableCacheEntry(TK key, TV value)
- {
- Key = key;
- _value = value;
- Exists = true;
- }
-
- /** <inheritdoc /> */
- public TK Key { get; private set; }
-
- /** <inheritdoc /> */
- object IMutableCacheEntryInternal.Key
- {
- get { return Key; }
- }
-
- /** <inheritdoc /> */
- public TV Value
- {
- get { return _value; }
- set
- {
- _value = value;
- Exists = true;
- State = MutableCacheEntryState.ValueSet;
- }
- }
-
- /** <inheritdoc /> */
- object IMutableCacheEntryInternal.Value
- {
- get { return Value; }
- }
-
- /** <inheritdoc /> */
- public bool Exists { get; private set; }
-
- /** <inheritdoc /> */
- public void Remove()
- {
- Value = default(TV);
- Exists = false;
- State = MutableCacheEntryState.Removed;
- }
-
- /** <inheritdoc /> */
- public MutableCacheEntryState State { get; private set; }
- }
-
- /// <summary>
- /// Internal non-generic representation of a mutable cache entry.
- /// </summary>
- internal interface IMutableCacheEntryInternal
- {
- /// <summary>
- /// Gets the key.
- /// </summary>
- object Key { get; }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- object Value { get; }
-
- /// <summary>
- /// Gets a value indicating whether cache entry exists.
- /// </summary>
- bool Exists { get; }
-
- /// <summary>
- /// Gets the state indicating user operation on this instance.
- /// </summary>
- MutableCacheEntryState State { get; }
- }
-
- /// <summary>
- /// Mutable cache entry factory.
- /// </summary>
- internal static class MutableCacheEntry
- {
- private static readonly CopyOnWriteConcurrentDictionary<Tuple<Type, Type>, Func<object, object, bool, IMutableCacheEntryInternal>>
- Ctors = new CopyOnWriteConcurrentDictionary<Tuple<Type, Type>, Func<object, object, bool, IMutableCacheEntryInternal>>();
-
- public static Func<object, object, bool, IMutableCacheEntryInternal> GetCtor(Type keyType, Type valType)
- {
- Func<object, object, bool, IMutableCacheEntryInternal> result;
- var funcKey = new Tuple<Type, Type>(keyType, valType);
-
- return Ctors.TryGetValue(funcKey, out result)
- ? result
- : Ctors.GetOrAdd(funcKey, x =>
- {
- var entryType = typeof (MutableCacheEntry<,>).MakeGenericType(keyType, valType);
-
- var oneArg = DelegateConverter.CompileCtor<Func<object, IMutableCacheEntryInternal>>(entryType,
- new[] {keyType}, false);
-
- var twoArg =
- DelegateConverter.CompileCtor<Func<object, object, IMutableCacheEntryInternal>>(entryType,
- new[] {keyType, valType}, false);
-
- return (k, v, exists) => exists ? twoArg(k, v) : oneArg(k);
- });
- }
- }
-
- /// <summary>
- /// Represents result of user operation on a mutable cache entry.
- /// </summary>
- internal enum MutableCacheEntryState : byte
- {
- Intact = 0,
- ValueSet = 1,
- Removed = 2,
- ErrPortable = 3,
- ErrString = 4
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
deleted file mode 100644
index 0f4b5a3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/AbstractQueryCursor.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Abstract query cursor implementation.
- /// </summary>
- internal abstract class AbstractQueryCursor<T> : PlatformDisposableTarget, IQueryCursor<T>, IEnumerator<T>
- {
- /** */
- private const int OpGetAll = 1;
-
- /** */
- private const int OpGetBatch = 2;
-
- /** Position before head. */
- private const int BatchPosBeforeHead = -1;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Wherther "GetAll" was called. */
- private bool _getAllCalled;
-
- /** Whether "GetEnumerator" was called. */
- private bool _iterCalled;
-
- /** Batch with entries. */
- private T[] _batch;
-
- /** Current position in batch. */
- private int _batchPos = BatchPosBeforeHead;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- protected AbstractQueryCursor(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable) :
- base(target, marsh)
- {
- _keepPortable = keepPortable;
- }
-
- #region Public methods
-
- /** <inheritdoc /> */
- public IList<T> GetAll()
- {
- ThrowIfDisposed();
-
- if (_iterCalled)
- throw new InvalidOperationException("Failed to get all entries because GetEnumerator() " +
- "method has already been called.");
-
- if (_getAllCalled)
- throw new InvalidOperationException("Failed to get all entries because GetAll() " +
- "method has already been called.");
-
- var res = DoInOp<IList<T>>(OpGetAll, ConvertGetAll);
-
- _getAllCalled = true;
-
- return res;
- }
-
- /** <inheritdoc /> */
- protected override void Dispose(bool disposing)
- {
- try
- {
- UU.QueryCursorClose(Target);
- }
- finally
- {
- base.Dispose(disposing);
- }
- }
-
- #endregion
-
- #region Public IEnumerable methods
-
- /** <inheritdoc /> */
- [SuppressMessage("ReSharper", "PossibleNullReferenceException")]
- public IEnumerator<T> GetEnumerator()
- {
- ThrowIfDisposed();
-
- if (_iterCalled)
- throw new InvalidOperationException("Failed to get enumerator entries because " +
- "GetEnumeartor() method has already been called.");
-
- if (_getAllCalled)
- throw new InvalidOperationException("Failed to get enumerator entries because " +
- "GetAll() method has already been called.");
-
- UU.QueryCursorIterator(Target);
-
- _iterCalled = true;
-
- return this;
- }
-
- /** <inheritdoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return GetEnumerator();
- }
-
- #endregion
-
- #region Public IEnumerator methods
-
- /** <inheritdoc /> */
- public T Current
- {
- get
- {
- ThrowIfDisposed();
-
- if (_batchPos == BatchPosBeforeHead)
- throw new InvalidOperationException("MoveNext has not been called.");
-
- if (_batch == null)
- throw new InvalidOperationException("Previous call to MoveNext returned false.");
-
- return _batch[_batchPos];
- }
- }
-
- /** <inheritdoc /> */
- object IEnumerator.Current
- {
- get { return Current; }
- }
-
- /** <inheritdoc /> */
- public bool MoveNext()
- {
- ThrowIfDisposed();
-
- if (_batch == null)
- {
- if (_batchPos == BatchPosBeforeHead)
- // Standing before head, let's get batch and advance position.
- RequestBatch();
- }
- else
- {
- _batchPos++;
-
- if (_batch.Length == _batchPos)
- // Reached batch end => request another.
- RequestBatch();
- }
-
- return _batch != null;
- }
-
- /** <inheritdoc /> */
- public void Reset()
- {
- throw new NotSupportedException("Reset is not supported.");
- }
-
- #endregion
-
- #region Non-public methods
-
- /// <summary>
- /// Read entry from the reader.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Entry.</returns>
- protected abstract T Read(PortableReaderImpl reader);
-
- /** <inheritdoc /> */
- protected override T1 Unmarshal<T1>(IPortableStream stream)
- {
- return Marshaller.Unmarshal<T1>(stream, _keepPortable);
- }
-
- /// <summary>
- /// Request next batch.
- /// </summary>
- private void RequestBatch()
- {
- _batch = DoInOp<T[]>(OpGetBatch, ConvertGetBatch);
-
- _batchPos = 0;
- }
-
- /// <summary>
- /// Converter for GET_ALL operation.
- /// </summary>
- /// <param name="stream">Portable stream.</param>
- /// <returns>Result.</returns>
- private IList<T> ConvertGetAll(IPortableStream stream)
- {
- var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
-
- var size = reader.ReadInt();
-
- var res = new List<T>(size);
-
- for (var i = 0; i < size; i++)
- res.Add(Read(reader));
-
- return res;
- }
-
- /// <summary>
- /// Converter for GET_BATCH operation.
- /// </summary>
- /// <param name="stream">Portable stream.</param>
- /// <returns>Result.</returns>
- private T[] ConvertGetBatch(IPortableStream stream)
- {
- var reader = Marshaller.StartUnmarshal(stream, _keepPortable);
-
- var size = reader.ReadInt();
-
- if (size == 0)
- return null;
-
- var res = new T[size];
-
- for (var i = 0; i < size; i++)
- res[i] = Read(reader);
-
- return res;
- }
-
- #endregion
-
- }
-}
[10/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs
deleted file mode 100644
index 523b83f..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/QueryExample.cs
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Cache;
-using Apache.Ignite.Core.Cache.Query;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// This example populates cache with sample data and runs several SQL and
- /// full text queries over this data.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache-query.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class QueryExample
- {
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache-query.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cache query example started.");
-
- var cache = ignite.GetCache<object, object>(null);
-
- // Clean up caches on all nodes before run.
- cache.Clear();
-
- // Populate cache with sample data entries.
- PopulateCache(cache);
-
- // Create cache that will work with specific types.
- var employeeCache = ignite.GetCache<EmployeeKey, Employee>(null);
-
- // Run SQL query example.
- SqlQueryExample(employeeCache);
-
- // Run SQL query with join example.
- SqlJoinQueryExample(employeeCache);
-
- // Run SQL fields query example.
- SqlFieldsQueryExample(employeeCache);
-
- // Run full text query example.
- FullTextQueryExample(employeeCache);
-
- Console.WriteLine();
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Queries employees that have provided ZIP code in address.
- /// </summary>
- /// <param name="cache">Cache.</param>
- private static void SqlQueryExample(ICache<EmployeeKey, Employee> cache)
- {
- const int zip = 94109;
-
- var qry = cache.Query(new SqlQuery(typeof(Employee), "zip = ?", zip));
-
- Console.WriteLine();
- Console.WriteLine(">>> Employees with zipcode " + zip + ":");
-
- foreach (var entry in qry)
- Console.WriteLine(">>> " + entry.Value);
- }
-
- /// <summary>
- /// Queries employees that work for organization with provided name.
- /// </summary>
- /// <param name="cache">Cache.</param>
- private static void SqlJoinQueryExample(ICache<EmployeeKey, Employee> cache)
- {
- const string orgName = "Apache";
-
- var qry = cache.Query(new SqlQuery("Employee",
- "from Employee, Organization " +
- "where Employee.organizationId = Organization._key and Organization.name = ?", orgName));
-
- Console.WriteLine();
- Console.WriteLine(">>> Employees working for " + orgName + ":");
-
- foreach (var entry in qry)
- Console.WriteLine(">>> " + entry.Value);
- }
-
- /// <summary>
- /// Queries names and salaries for all employees.
- /// </summary>
- /// <param name="cache">Cache.</param>
- private static void SqlFieldsQueryExample(ICache<EmployeeKey, Employee> cache)
- {
- var qry = cache.QueryFields(new SqlFieldsQuery("select name, salary from Employee"));
-
- Console.WriteLine();
- Console.WriteLine(">>> Employee names and their salaries:");
-
- foreach (IList row in qry)
- Console.WriteLine(">>> [Name=" + row[0] + ", salary=" + row[1] + ']');
- }
-
- /// <summary>
- /// Queries employees that live in Texas using full-text query API.
- /// </summary>
- /// <param name="cache">Cache.</param>
- private static void FullTextQueryExample(ICache<EmployeeKey, Employee> cache)
- {
- var qry = cache.Query(new TextQuery("Employee", "TX"));
-
- Console.WriteLine();
- Console.WriteLine(">>> Employees living in Texas:");
-
- foreach (var entry in qry)
- Console.WriteLine(">>> " + entry.Value);
- }
-
- /// <summary>
- /// Populate cache with data for this example.
- /// </summary>
- /// <param name="cache">Cache.</param>
- private static void PopulateCache(ICache<object, object> cache)
- {
- cache.Put(1, new Organization(
- "Apache",
- new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
- OrganizationType.Private,
- DateTime.Now
- ));
-
- cache.Put(2, new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.Private,
- DateTime.Now
- ));
-
- cache.Put(new EmployeeKey(1, 1), new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- new List<string> { "Human Resources", "Customer Service" }
- ));
-
- cache.Put(new EmployeeKey(2, 1), new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78130),
- new List<string> { "Development", "QA" }
- ));
-
- cache.Put(new EmployeeKey(3, 1), new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- new List<string> { "Logistics" }
- ));
-
- cache.Put(new EmployeeKey(4, 2), new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, San Francisco, CA", 94109),
- new List<string> { "Development" }
- ));
-
- cache.Put(new EmployeeKey(5, 2), new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78130),
- new List<string> { "Sales" }
- ));
-
- cache.Put(new EmployeeKey(6, 2), new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- new List<string> { "Sales" }
- ));
-
- cache.Put(new EmployeeKey(7, 2), new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 12110),
- new List<string> { "Development", "QA" }
- ));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
deleted file mode 100644
index 6c2b40d..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/StoreExample.cs
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.ExamplesDll.Datagrid;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// Example demonstrating cache store.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache-store.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- class StoreExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache-store.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cache store example started.");
-
- var cache = ignite.GetCache<int, Employee>(null);
-
- // Clean up caches on all nodes before run.
- cache.Clear();
-
- Console.WriteLine();
- Console.WriteLine(">>> Cleared values from cache.");
- Console.WriteLine(">>> Current cache size: " + cache.GetSize());
-
- // Load entries from store which pass provided filter.
- cache.LoadCache(new EmployeeStorePredicate());
-
- Console.WriteLine();
- Console.WriteLine(">>> Loaded entry from store through ICache.LoadCache().");
- Console.WriteLine(">>> Current cache size: " + cache.GetSize());
-
- // Load entry from store calling ICache.Get() method.
- Employee emp = cache.Get(2);
-
- Console.WriteLine();
- Console.WriteLine(">>> Loaded entry from store through ICache.Get(): " + emp);
- Console.WriteLine(">>> Current cache size: " + cache.GetSize());
-
- // Put an entry to the cache
- cache.Put(3, new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- new List<string> { "Human Resources", "Customer Service" }
- ));
-
- Console.WriteLine();
- Console.WriteLine(">>> Put entry to cache. ");
- Console.WriteLine(">>> Current cache size: " + cache.GetSize());
-
- // Clear values again.
- cache.Clear();
-
- Console.WriteLine();
- Console.WriteLine(">>> Cleared values from cache again.");
- Console.WriteLine(">>> Current cache size: " + cache.GetSize());
-
- // Read values from cache after clear.
- Console.WriteLine();
- Console.WriteLine(">>> Read values after clear:");
-
- for (int i = 1; i <= 3; i++)
- Console.WriteLine(">>> Key=" + i + ", value=" + cache.Get(i));
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
deleted file mode 100644
index 6be3523..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/TransactionExample.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Transactions;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// This example demonstrates how to use transactions on Apache cache.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- class TransactionExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Transaction example started.");
-
- var cache = ignite.GetCache<int, Account>("tx");
-
- // Clean up caches on all nodes before run.
- cache.Clear();
-
- // Initialize.
- cache.Put(1, new Account(1, 100));
- cache.Put(2, new Account(2, 200));
-
- Console.WriteLine();
- Console.WriteLine(">>> Accounts before transfer: ");
- Console.WriteLine(">>> " + cache.Get(1));
- Console.WriteLine(">>> " + cache.Get(2));
- Console.WriteLine();
-
- // Transfer money between accounts in a single transaction.
- using (var tx = cache.Ignite.GetTransactions().TxStart(TransactionConcurrency.Pessimistic,
- TransactionIsolation.RepeatableRead))
- {
- Account acc1 = cache.Get(1);
- Account acc2 = cache.Get(2);
-
- acc1.Balance += 100;
- acc2.Balance -= 100;
-
- cache.Put(1, acc1);
- cache.Put(2, acc2);
-
- tx.Commit();
- }
-
- Console.WriteLine(">>> Transfer finished.");
-
- Console.WriteLine();
- Console.WriteLine(">>> Accounts after transfer: ");
- Console.WriteLine(">>> " + cache.Get(1));
- Console.WriteLine(">>> " + cache.Get(2));
- Console.WriteLine();
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs
deleted file mode 100644
index 83802cc..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Events/EventsExample.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Events;
-using Apache.Ignite.ExamplesDll.Compute;
-using Apache.Ignite.ExamplesDll.Events;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Events
-{
- /// <summary>
- /// Example demonstrating Ignite events.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class EventsExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"}
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine(">>> Events example started.");
- Console.WriteLine();
-
- // Local listen example
- Console.WriteLine(">>> Listening for a local event...");
-
- var listener = new LocalListener();
- ignite.GetEvents().LocalListen(listener, EventType.EvtsTaskExecution);
-
- ExecuteTask(ignite);
-
- ignite.GetEvents().StopLocalListen(listener);
-
- Console.WriteLine(">>> Received events count: " + listener.EventsReceived);
- Console.WriteLine();
-
- // Remote listen example (start standalone nodes for better demonstration)
- Console.WriteLine(">>> Listening for remote events...");
-
- var localListener = new LocalListener();
- var remoteFilter = new RemoteFilter();
-
- var listenId = ignite.GetEvents().RemoteListen(localListener: localListener,
- remoteFilter: remoteFilter, types: EventType.EvtsJobExecution);
-
- ExecuteTask(ignite);
-
- ignite.GetEvents().StopRemoteListen(listenId);
-
- Console.WriteLine(">>> Received events count: " + localListener.EventsReceived);
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Executes a task to generate events.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void ExecuteTask(IIgnite ignite)
- {
- var employees = Enumerable.Range(1, 10).SelectMany(x => new[]
- {
- new Employee("Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, San Francisco, CA", 94109),
- new[] {"Development"}),
-
- new Employee("Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78130),
- new[] {"Sales"})
- }).ToArray();
-
- ignite.GetCompute().Execute(new AverageSalaryTask(), employees);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs
deleted file mode 100644
index a24c47c..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Messaging/MessagingExample.cs
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using Apache.Ignite.Core;
-using Apache.Ignite.ExamplesDll.Messaging;
-
-namespace Apache.Ignite.Examples.Messaging
-{
- /// <summary>
- /// Example demonstrating Ignite messaging. Should be run with standalone Apache Ignite .Net node.
- /// <para />
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 3) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 4) Start example (F5 or Ctrl+F5).
- /// </summary>
- public class MessagingExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- var remotes = ignite.GetCluster().ForRemotes();
-
- if (remotes.GetNodes().Count == 0)
- {
- Console.WriteLine(">>> This example requires remote nodes to be started.");
- Console.WriteLine(">>> Please start at least 1 remote node.");
- Console.WriteLine(">>> Refer to example's documentation for details on configuration.");
- }
- else
- {
- Console.WriteLine(">>> Messaging example started.");
- Console.WriteLine();
-
- // Set up local listeners
- var localMessaging = ignite.GetCluster().ForLocal().GetMessaging();
-
- var msgCount = remotes.GetNodes().Count * 10;
-
- var orderedCounter = new CountdownEvent(msgCount);
- var unorderedCounter = new CountdownEvent(msgCount);
-
- localMessaging.LocalListen(new LocalListener(unorderedCounter), Topic.Unordered);
- localMessaging.LocalListen(new LocalListener(orderedCounter), Topic.Ordered);
-
- // Set up remote listeners
- var remoteMessaging = remotes.GetMessaging();
-
- remoteMessaging.RemoteListen(new RemoteUnorderedListener(), Topic.Unordered);
- remoteMessaging.RemoteListen(new RemoteOrderedListener(), Topic.Ordered);
-
- // Send unordered
- Console.WriteLine(">>> Sending unordered messages...");
-
- for (var i = 0; i < 10; i++)
- remoteMessaging.Send(i, Topic.Unordered);
-
- Console.WriteLine(">>> Finished sending unordered messages.");
-
- // Send ordered
- Console.WriteLine(">>> Sending ordered messages...");
-
- for (var i = 0; i < 10; i++)
- remoteMessaging.SendOrdered(i, Topic.Ordered);
-
- Console.WriteLine(">>> Finished sending ordered messages.");
-
- Console.WriteLine(">>> Check output on all nodes for message printouts.");
- Console.WriteLine(">>> Waiting for messages acknowledgements from all remote nodes...");
-
- unorderedCounter.Wait();
- orderedCounter.Wait();
- }
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs
deleted file mode 100644
index 2d319e8..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Misc/LifecycleExample.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Lifecycle;
-using Apache.Ignite.Core.Resource;
-
-namespace Apache.Ignite.Examples.Misc
-{
- /// <summary>
- /// This example shows how to provide your own <see cref="ILifecycleBean"/> implementation
- /// to be able to hook into Apache lifecycle. Example bean will output occurred lifecycle
- /// events to the console.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// </summary>
- public class LifecycleExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- Console.WriteLine();
- Console.WriteLine(">>> Lifecycle example started.");
-
- // Create new configuration.
- var lifecycleExampleBean = new LifecycleExampleBean();
-
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" },
- LifecycleBeans = new List<ILifecycleBean> { lifecycleExampleBean }
- };
-
- // Provide lifecycle bean to configuration.
- using (Ignition.Start(cfg))
- {
- // Make sure that lifecycle bean was notified about Ignite startup.
- Console.WriteLine();
- Console.WriteLine(">>> Started (should be true): " + lifecycleExampleBean.Started);
- }
-
- // Make sure that lifecycle bean was notified about Ignite stop.
- Console.WriteLine();
- Console.WriteLine(">>> Started (should be false): " + lifecycleExampleBean.Started);
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Sample lifecycle bean implementation.
- /// </summary>
- private class LifecycleExampleBean : ILifecycleBean
- {
- /** Auto-injected Ignite instance. */
- [InstanceResource]
-#pragma warning disable 649
- private IIgnite _ignite;
-#pragma warning restore 649
-
- /** <inheritDoc /> */
- public void OnLifecycleEvent(LifecycleEventType evt)
- {
- Console.WriteLine();
- Console.WriteLine(">>> Ignite lifecycle event occurred: " + evt);
- Console.WriteLine(">>> Ignite name: " + (_ignite != null ? _ignite.Name : "not available"));
-
- if (evt == LifecycleEventType.AfterNodeStart)
- Started = true;
- else if (evt == LifecycleEventType.AfterNodeStop)
- Started = false;
- }
-
- /// <summary>
- /// Started flag.
- /// </summary>
- public bool Started
- {
- get;
- private set;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
deleted file mode 100644
index 555a35f..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Apache Ignite Examples")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Apache Software Foundation")]
-[assembly: AssemblyProduct("Apache Ignite")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("41a0cb95-3435-4c78-b867-900b28e2c9ee")]
-
-[assembly: AssemblyVersion("1.5.0")]
-[assembly: AssemblyFileVersion("1.5.0")]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs
deleted file mode 100644
index 7253a0b..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/IMapService.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-using Apache.Ignite.ExamplesDll.Services;
-
-namespace Apache.Ignite.Examples.Services
-{
- /// <summary>
- /// Interface for service proxy interaction.
- /// Actual service class (<see cref="MapService{TK,TV}"/>) does not have to implement this interface.
- /// Target method/property will be searched by signature (name, arguments).
- /// </summary>
- public interface IMapService<TK, TV>
- {
- /// <summary>
- /// Puts an entry to the map.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="value">The value.</param>
- void Put(TK key, TV value);
-
- /// <summary>
- /// Gets an entry from the map.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <returns>Entry value.</returns>
- TV Get(TK key);
-
- /// <summary>
- /// Clears the map.
- /// </summary>
- void Clear();
-
- /// <summary>
- /// Gets the size of the map.
- /// </summary>
- /// <value>
- /// The size.
- /// </value>
- int Size { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs
deleted file mode 100644
index 6d0ddd0..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Services/ServicesExample.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.ExamplesDll.Services;
-
-namespace Apache.Ignite.Examples.Services
-{
- /// <summary>
- /// Example demonstrating Ignite services.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class ServicesExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"}
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine(">>> Services example started.");
- Console.WriteLine();
-
- // Deploy a service
- var svc = new MapService<int, string>();
- Console.WriteLine(">>> Deploying service to all nodes...");
- ignite.GetServices().DeployNodeSingleton("service", svc);
-
- // Get a sticky service proxy so that we will always be contacting the same remote node.
- var prx = ignite.GetServices().GetServiceProxy<IMapService<int, string>>("service", true);
-
- for (var i = 0; i < 10; i++)
- prx.Put(i, i.ToString());
-
- var mapSize = prx.Size;
-
- Console.WriteLine(">>> Map service size: " + mapSize);
-
- ignite.GetServices().CancelAll();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj
deleted file mode 100644
index cb2ff6f..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csproj
+++ /dev/null
@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{DFB08363-202E-412D-8812-349EF10A8702}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.ExamplesDll</RootNamespace>
- <AssemblyName>Apache.Ignite.ExamplesDll</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\x86\Release\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Compute\AverageSalaryJob.cs" />
- <Compile Include="Compute\AverageSalaryTask.cs" />
- <Compile Include="Compute\CharacterCountClosure.cs" />
- <Compile Include="Compute\CharacterCountReducer.cs" />
- <Compile Include="Datagrid\EmployeeStorePredicate.cs" />
- <Compile Include="Datagrid\ContinuousQueryFilter.cs" />
- <Compile Include="Datagrid\EmployeeStore.cs" />
- <Compile Include="Events\LocalListener.cs" />
- <Compile Include="Events\RemoteFilter.cs" />
- <Compile Include="Messaging\LocalListener.cs" />
- <Compile Include="Messaging\RemoteOrderedListener.cs" />
- <Compile Include="Messaging\RemoteUnorderedListener.cs" />
- <Compile Include="Messaging\Topic.cs" />
- <Compile Include="Portable\Account.cs" />
- <Compile Include="Portable\Address.cs" />
- <Compile Include="Portable\Employee.cs" />
- <Compile Include="Portable\EmployeeKey.cs" />
- <Compile Include="Portable\Organization.cs" />
- <Compile Include="Portable\OrganizationType.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Services\MapService.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
- <Project>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</Project>
- <Name>Apache.Ignite.Core</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel
deleted file mode 100644
index fa6b71c..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Apache.Ignite.ExamplesDll.csprojrel
+++ /dev/null
@@ -1,72 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{DFB08363-202E-412D-8812-349EF10A8702}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.ExamplesDll</RootNamespace>
- <AssemblyName>Apache.Ignite.ExamplesDll</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\x86\Release\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Apache.Ignite.Core">
- <HintPath>..\..\Apache.Ignite\bin\$(Platform)\$(Configuration)\Apache.Ignite.Core.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Compute\AverageSalaryJob.cs" />
- <Compile Include="Compute\AverageSalaryTask.cs" />
- <Compile Include="Compute\CharacterCountClosure.cs" />
- <Compile Include="Compute\CharacterCountReducer.cs" />
- <Compile Include="Datagrid\EmployeeStorePredicate.cs" />
- <Compile Include="Datagrid\ContinuousQueryFilter.cs" />
- <Compile Include="Datagrid\EmployeeStore.cs" />
- <Compile Include="Events\LocalListener.cs" />
- <Compile Include="Events\RemoteFilter.cs" />
- <Compile Include="Messaging\LocalListener.cs" />
- <Compile Include="Messaging\RemoteOrderedListener.cs" />
- <Compile Include="Messaging\RemoteUnorderedListener.cs" />
- <Compile Include="Messaging\Topic.cs" />
- <Compile Include="Portable\Account.cs" />
- <Compile Include="Portable\Address.cs" />
- <Compile Include="Portable\Employee.cs" />
- <Compile Include="Portable\EmployeeKey.cs" />
- <Compile Include="Portable\Organization.cs" />
- <Compile Include="Portable\OrganizationType.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Services\MapService.cs" />
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs
deleted file mode 100644
index e4713d4..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryJob.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core.Compute;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.ExamplesDll.Compute
-{
- /// <summary>
- /// Average salary job.
- /// </summary>
- [Serializable]
- public class AverageSalaryJob : ComputeJobAdapter<Tuple<long, int>>
- {
- /// <summary> Employees. </summary>
- private readonly ICollection<Employee> _employees = new List<Employee>();
-
- /// <summary>
- /// Adds employee.
- /// </summary>
- /// <param name="employee">Employee.</param>
- public void Add(Employee employee)
- {
- _employees.Add(employee);
- }
-
- /// <summary>
- /// Execute the job.
- /// </summary>
- /// <returns>Job result: tuple with total salary in the first item and employees count in the second.</returns>
- override public Tuple<long, int> Execute()
- {
- long sum = 0;
- int count = 0;
-
- Console.WriteLine();
- Console.WriteLine(">>> Executing salary job for " + _employees.Count + " employee(s) ...");
- Console.WriteLine();
-
- foreach (Employee emp in _employees)
- {
- sum += emp.Salary;
- count++;
- }
-
- return new Tuple<long, int>(sum, count);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs
deleted file mode 100644
index f8acb01..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/AverageSalaryTask.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Apache.Ignite.Core.Compute;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.ExamplesDll.Compute
-{
- /// <summary>
- /// Average salary task.
- /// </summary>
- public class AverageSalaryTask : ComputeTaskSplitAdapter<ICollection<Employee>, Tuple<long, int>, long>
- {
- /// <summary>
- /// Split the task distributing employees between several jobs.
- /// </summary>
- /// <param name="gridSize">Number of available grid nodes.</param>
- /// <param name="arg">Task execution argument.</param>
- protected override ICollection<IComputeJob<Tuple<long, int>>> Split(int gridSize, ICollection<Employee> arg)
- {
- ICollection<Employee> employees = arg;
-
- var jobs = new List<IComputeJob<Tuple<long, int>>>(gridSize);
-
- int count = 0;
-
- foreach (Employee employee in employees)
- {
- int idx = count++ % gridSize;
-
- AverageSalaryJob job;
-
- if (idx >= jobs.Count)
- {
- job = new AverageSalaryJob();
-
- jobs.Add(job);
- }
- else
- job = (AverageSalaryJob) jobs[idx];
-
- job.Add(employee);
- }
-
- return jobs;
- }
-
- /// <summary>
- /// Calculate average salary after all jobs are finished.
- /// </summary>
- /// <param name="results">Job results.</param>
- /// <returns>Average salary.</returns>
- public override long Reduce(IList<IComputeJobResult<Tuple<long, int>>> results)
- {
- long sum = 0;
- int count = 0;
-
- foreach (var t in results.Select(result => result.Data()))
- {
- sum += t.Item1;
- count += t.Item2;
- }
-
- return sum / count;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
deleted file mode 100644
index 2823221..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountClosure.cs
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core.Compute;
-
-namespace Apache.Ignite.ExamplesDll.Compute
-{
- /// <summary>
- /// Closure counting characters in a string.
- /// </summary>
- [Serializable]
- public class CharacterCountClosure : IComputeFunc<string, int>
- {
- /// <summary>
- /// Calculate character count of the given word.
- /// </summary>
- /// <param name="arg">Word.</param>
- /// <returns>Character count.</returns>
- public int Invoke(string arg)
- {
- int len = arg.Length;
-
- Console.WriteLine("Character count in word \"" + arg + "\": " + len);
-
- return len;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs
deleted file mode 100644
index 6825046..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Compute/CharacterCountReducer.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-using Apache.Ignite.Core.Compute;
-
-namespace Apache.Ignite.ExamplesDll.Compute
-{
- /// <summary>
- /// Character count reducer which collects individual string lengths and aggregate them.
- /// </summary>
- public class CharacterCountReducer : IComputeReducer<int, int>
- {
- /// <summary> Total length. </summary>
- private int _length;
-
- /// <summary>
- /// Collect character counts of distinct words.
- /// </summary>
- /// <param name="res">Character count of a distinct word.</param>
- /// <returns><c>True</c> to continue collecting results until all closures are finished.</returns>
- public bool Collect(int res)
- {
- _length += res;
-
- return true;
- }
-
- /// <summary>
- /// Reduce all collected results.
- /// </summary>
- /// <returns>Total character count.</returns>
- public int Reduce()
- {
- return _length;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
deleted file mode 100644
index 8c05f42..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/ContinuousQueryFilter.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core.Cache.Event;
-
-namespace Apache.Ignite.ExamplesDll.Datagrid
-{
- /// <summary>
- /// Filter for continuous query example.
- /// </summary>
- [Serializable]
- public class ContinuousQueryFilter : ICacheEntryEventFilter<int, string>
- {
- /// <summary> Threshold. </summary>
- private readonly int _threshold;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="threshold">Threshold.</param>
- public ContinuousQueryFilter(int threshold)
- {
- _threshold = threshold;
- }
-
- /// <summary>
- /// Evaluates cache entry event.
- /// </summary>
- /// <param name="evt">Event.</param>
- public bool Evaluate(ICacheEntryEvent<int, string> evt)
- {
- return evt.Key >= _threshold;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
deleted file mode 100644
index 742b048..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStore.cs
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using Apache.Ignite.Core.Cache;
-using Apache.Ignite.Core.Cache.Store;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.ExamplesDll.Datagrid
-{
- /// <summary>
- /// Example cache store implementation.
- /// </summary>
- public class EmployeeStore : CacheStoreAdapter
- {
- /// <summary>
- /// Dictionary representing the store.
- /// </summary>
- private readonly ConcurrentDictionary<object, object> _db = new ConcurrentDictionary<object, object>(
- new List<KeyValuePair<object, object>>
- {
- new KeyValuePair<object, object>(1, new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, San Francisco, CA", 94109),
- new List<string> {"Development"}
- )),
-
- new KeyValuePair<object, object>(2, new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78130),
- new List<string> {"Sales"}
- ))
- });
-
- /// <summary>
- /// Loads all values from underlying persistent storage.
- /// This method gets called as a result of <see cref="ICache{TK,TV}.LoadCache"/> call.
- /// </summary>
- /// <param name="act">Action that loads a cache entry.</param>
- /// <param name="args">Optional arguments.</param>
- public override void LoadCache(Action<object, object> act, params object[] args)
- {
- // Iterate over whole underlying store and call act on each entry to load it into the cache.
- foreach (var entry in _db)
- act(entry.Key, entry.Value);
- }
-
- /// <summary>
- /// Loads multiple objects from the cache store.
- /// This method gets called as a result of <see cref="ICache{K,V}.GetAll"/> call.
- /// </summary>
- /// <param name="keys">Keys to load.</param>
- /// <returns>
- /// A map of key, values to be stored in the cache.
- /// </returns>
- public override IDictionary LoadAll(ICollection keys)
- {
- var result = new Dictionary<object, object>();
-
- foreach (var key in keys)
- result[key] = Load(key);
-
- return result;
- }
-
- /// <summary>
- /// Loads an object from the cache store.
- /// This method gets called as a result of <see cref="ICache{K,V}.Get"/> call.
- /// </summary>
- /// <param name="key">Key to load.</param>
- /// <returns>Loaded value</returns>
- public override object Load(object key)
- {
- object val;
-
- _db.TryGetValue(key, out val);
-
- return val;
- }
-
- /// <summary>
- /// Write key-value pair to store.
- /// </summary>
- /// <param name="key">Key to write.</param>
- /// <param name="val">Value to write.</param>
- public override void Write(object key, object val)
- {
- _db[key] = val;
- }
-
- /// <summary>
- /// Delete cache entry form store.
- /// </summary>
- /// <param name="key">Key to delete.</param>
- public override void Delete(object key)
- {
- object val;
-
- _db.TryRemove(key, out val);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
deleted file mode 100644
index a585e5e..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Datagrid/EmployeeStorePredicate.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core.Cache;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.ExamplesDll.Datagrid
-{
- /// <summary>
- /// Example cache entry predicate.
- /// </summary>
- [Serializable]
- public class EmployeeStorePredicate : ICacheEntryFilter<int, Employee>
- {
- /// <summary>
- /// Returns a value indicating whether provided cache entry satisfies this predicate.
- /// </summary>
- /// <param name="entry">Cache entry.</param>
- /// <returns>Value indicating whether provided cache entry satisfies this predicate.</returns>
- public bool Invoke(ICacheEntry<int, Employee> entry)
- {
- return entry.Key == 1;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs
deleted file mode 100644
index 8a28355..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/LocalListener.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Threading;
-using Apache.Ignite.Core.Events;
-
-namespace Apache.Ignite.ExamplesDll.Events
-{
- /// <summary>
- /// Local event listener.
- /// </summary>
- public class LocalListener : IEventFilter<IEvent>
- {
- /** Сount of received events. */
- private int _eventsReceived;
-
- /// <summary>
- /// Gets the count of received events.
- /// </summary>
- public int EventsReceived
- {
- get { return _eventsReceived; }
- }
-
- /// <summary>
- /// Determines whether specified event passes this filter.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="evt">Event.</param>
- /// <returns>Value indicating whether specified event passes this filter.</returns>
- public bool Invoke(Guid nodeId, IEvent evt)
- {
- Interlocked.Increment(ref _eventsReceived);
-
- Console.WriteLine("Local listener received an event [evt={0}]", evt.Name);
-
- return true;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs
deleted file mode 100644
index db3204a..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Events/RemoteFilter.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core.Events;
-
-namespace Apache.Ignite.ExamplesDll.Events
-{
- /// <summary>
- /// Remote event filter.
- /// </summary>
- [Serializable]
- public class RemoteFilter : IEventFilter<IEvent>
- {
- /// <summary>
- /// Determines whether specified event passes this filter.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="evt">Event.</param>
- /// <returns>Value indicating whether specified event passes this filter.</returns>
- public bool Invoke(Guid nodeId, IEvent evt)
- {
- Console.WriteLine("Remote filter received event [evt={0}]", evt.Name);
-
- return evt is JobEvent;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs
deleted file mode 100644
index 7659bb4..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/LocalListener.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Threading;
-using Apache.Ignite.Core.Messaging;
-
-namespace Apache.Ignite.ExamplesDll.Messaging
-{
- /// <summary>
- /// Local message listener which signals countdown event on each received message.
- /// </summary>
- public class LocalListener : IMessageFilter<int>
- {
- /** Countdown event. */
- private readonly CountdownEvent _countdown;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LocalListener"/> class.
- /// </summary>
- /// <param name="countdown">The countdown event.</param>
- public LocalListener(CountdownEvent countdown)
- {
- if (countdown == null)
- throw new ArgumentNullException("countdown");
-
- _countdown = countdown;
- }
-
- /// <summary>
- /// Receives a message and returns a value
- /// indicating whether provided message and node id satisfy this predicate.
- /// Returning false will unsubscribe this listener from future notifications.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="message">Message.</param>
- /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns>
- public bool Invoke(Guid nodeId, int message)
- {
- _countdown.Signal();
-
- return !_countdown.IsSet;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
deleted file mode 100644
index 8ae5ac1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteOrderedListener.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Messaging;
-using Apache.Ignite.Core.Resource;
-
-namespace Apache.Ignite.ExamplesDll.Messaging
-{
- /// <summary>
- /// Listener for Ordered topic.
- /// </summary>
- [Serializable]
- public class RemoteOrderedListener : IMessageFilter<int>
- {
- /** Injected Ignite instance. */
- [InstanceResource]
-#pragma warning disable 649
- private readonly IIgnite _ignite;
-#pragma warning restore 649
-
- /// <summary>
- /// Receives a message and returns a value
- /// indicating whether provided message and node id satisfy this predicate.
- /// Returning false will unsubscribe this listener from future notifications.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="message">Message.</param>
- /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns>
- public bool Invoke(Guid nodeId, int message)
- {
- Console.WriteLine("Received ordered message [msg={0}, fromNodeId={1}]", message, nodeId);
-
- _ignite.GetCluster().ForNodeIds(nodeId).GetMessaging().Send(message, Topic.Ordered);
-
- return true;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
deleted file mode 100644
index 166dbd6..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/RemoteUnorderedListener.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Messaging;
-using Apache.Ignite.Core.Resource;
-
-namespace Apache.Ignite.ExamplesDll.Messaging
-{
- /// <summary>
- /// Listener for Unordered topic.
- /// </summary>
- [Serializable]
- public class RemoteUnorderedListener : IMessageFilter<int>
- {
- /** Injected Ignite instance. */
- [InstanceResource]
-#pragma warning disable 649
- private readonly IIgnite _ignite;
-#pragma warning restore 649
-
- /// <summary>
- /// Receives a message and returns a value
- /// indicating whether provided message and node id satisfy this predicate.
- /// Returning false will unsubscribe this listener from future notifications.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="message">Message.</param>
- /// <returns>Value indicating whether provided message and node id satisfy this predicate.</returns>
- public bool Invoke(Guid nodeId, int message)
- {
- Console.WriteLine("Received unordered message [msg={0}, fromNodeId={1}]", message, nodeId);
-
- _ignite.GetCluster().ForNodeIds(nodeId).GetMessaging().Send(message, Topic.Unordered);
-
- return true;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs
deleted file mode 100644
index bda0bfe..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.ExamplesDll/Messaging/Topic.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.ExamplesDll.Messaging
-{
- /// <summary>
- /// Message topics.
- /// </summary>
- public static class Topic
- {
- public const int Ordered = 1;
- public const int Unordered = 2;
- }
-}
\ No newline at end of file
[28/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyCollection.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyCollection.cs
deleted file mode 100644
index 23cae6b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyCollection.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Collections
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- /// <summary>
- /// Read-only wrapper over ICollection{T}.
- /// </summary>
- internal struct ReadOnlyCollection<T> : ICollection<T>
- {
- /** Wrapped collection. */
- private readonly ICollection<T> _col;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ReadOnlyCollection{T}"/> class.
- /// </summary>
- public ReadOnlyCollection(ICollection<T> col)
- {
- _col = col;
- }
-
- /** <inheritdoc /> */
- public IEnumerator<T> GetEnumerator()
- {
- return _col.GetEnumerator();
- }
-
- /** <inheritdoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable) _col).GetEnumerator();
- }
-
- /** <inheritdoc /> */
- public void Add(T item)
- {
- throw GetReadOnlyException();
- }
-
- /** <inheritdoc /> */
- public void Clear()
- {
- throw GetReadOnlyException();
- }
-
- /** <inheritdoc /> */
- public bool Contains(T item)
- {
- return _col.Contains(item);
- }
-
- /** <inheritdoc /> */
- public void CopyTo(T[] array, int arrayIndex)
- {
- _col.CopyTo(array, arrayIndex);
- }
-
- /** <inheritdoc /> */
- public bool Remove(T item)
- {
- throw GetReadOnlyException();
- }
-
- /** <inheritdoc /> */
- public int Count
- {
- get { return _col.Count; }
- }
-
- /** <inheritdoc /> */
- public bool IsReadOnly
- {
- get { return true; }
- }
-
- /// <summary>
- /// Gets the readonly exception.
- /// </summary>
- private static Exception GetReadOnlyException()
- {
- return new NotSupportedException("Collection is read-only.");
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
deleted file mode 100644
index 60ec9d0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/ReadOnlyDictionary.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Collections
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
-
- /// <summary>
- /// Read-only wrapper over IDictionary{K, V}.
- /// </summary>
- internal struct ReadOnlyDictionary<TKey, TValue> : IDictionary<TKey, TValue>
- {
- /** Inner dict. */
- private readonly IDictionary<TKey, TValue> _dict;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ReadOnlyDictionary{K, V}"/> class.
- /// </summary>
- /// <param name="dict">The dictionary to wrap.</param>
- public ReadOnlyDictionary(IDictionary<TKey, TValue> dict)
- {
- Debug.Assert(dict != null);
-
- _dict = dict;
- }
-
- /** <inheritdoc /> */
- public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
- {
- return _dict.GetEnumerator();
- }
-
- /** <inheritdoc /> */
- IEnumerator IEnumerable.GetEnumerator()
- {
- return ((IEnumerable) _dict).GetEnumerator();
- }
-
- /** <inheritdoc /> */
- public void Add(KeyValuePair<TKey, TValue> item)
- {
- throw GetReadonlyException();
- }
-
- /** <inheritdoc /> */
- public void Clear()
- {
- throw GetReadonlyException();
- }
-
- /** <inheritdoc /> */
- public bool Contains(KeyValuePair<TKey, TValue> item)
- {
- return _dict.Contains(item);
- }
-
- /** <inheritdoc /> */
- public void CopyTo(KeyValuePair<TKey, TValue>[] array, int arrayIndex)
- {
- _dict.CopyTo(array, arrayIndex);
- }
-
- /** <inheritdoc /> */
- public bool Remove(KeyValuePair<TKey, TValue> item)
- {
- throw GetReadonlyException();
- }
-
- /** <inheritdoc /> */
- public int Count
- {
- get { return _dict.Count; }
- }
-
- /** <inheritdoc /> */
- public bool IsReadOnly
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public bool ContainsKey(TKey key)
- {
- return _dict.ContainsKey(key);
- }
-
- /** <inheritdoc /> */
- public void Add(TKey key, TValue value)
- {
- throw GetReadonlyException();
- }
-
- /** <inheritdoc /> */
- public bool Remove(TKey key)
- {
- return _dict.Remove(key);
- }
-
- /** <inheritdoc /> */
- public bool TryGetValue(TKey key, out TValue value)
- {
- return _dict.TryGetValue(key, out value);
- }
-
- /** <inheritdoc /> */
- public TValue this[TKey key]
- {
- get { return _dict[key]; }
- set { throw GetReadonlyException(); }
- }
-
- /** <inheritdoc /> */
- public ICollection<TKey> Keys
- {
- get { return _dict.Keys; }
- }
-
- /** <inheritdoc /> */
- public ICollection<TValue> Values
- {
- get { return _dict.Values; }
- }
-
- /// <summary>
- /// Gets the readonly exception.
- /// </summary>
- private static Exception GetReadonlyException()
- {
- return new NotSupportedException("Dictionary is read-only.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/AsyncResult.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/AsyncResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/AsyncResult.cs
deleted file mode 100644
index 4e5c396..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/AsyncResult.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Adapts IGridFuture to the IAsyncResult.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
- Justification = "Implementing IDisposable has no point since we return this class as IAsyncResult " +
- "to the client, and IAsyncResult is not IDisposable.")]
- public class AsyncResult : IAsyncResult
- {
- /** */
- private readonly ManualResetEvent _waitHandle;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AsyncResult"/> class.
- /// </summary>
- /// <param name="fut">The future to wrap.</param>
- public AsyncResult(IFuture fut)
- {
- _waitHandle = new ManualResetEvent(false);
-
- fut.Listen(() => _waitHandle.Set());
- }
-
- /** <inheritdoc /> */
- public bool IsCompleted
- {
- get { return _waitHandle.WaitOne(0); }
- }
-
- /** <inheritdoc /> */
- public WaitHandle AsyncWaitHandle
- {
- get { return _waitHandle; }
- }
-
- /** <inheritdoc /> */
- public object AsyncState
- {
- get { return null; }
- }
-
- /** <inheritdoc /> */
- public bool CompletedSynchronously
- {
- get { return false; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CompletedAsyncResult.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CompletedAsyncResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CompletedAsyncResult.cs
deleted file mode 100644
index 14195fd..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CompletedAsyncResult.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
-
- /// <summary>
- /// Represents an IAsyncResult that is completed.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
- Justification = "Implementing IDisposable has no point since we return this class as IAsyncResult " +
- "to the client, and IAsyncResult is not IDisposable.")]
- public class CompletedAsyncResult : IAsyncResult
- {
- /** Singleton instance. */
- public static readonly IAsyncResult Instance = new CompletedAsyncResult();
-
- /** */
- private readonly WaitHandle _asyncWaitHandle = new ManualResetEvent(true);
-
- /// <summary>
- /// Prevents a default instance of the <see cref="CompletedAsyncResult"/> class from being created.
- /// </summary>
- private CompletedAsyncResult()
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public bool IsCompleted
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public WaitHandle AsyncWaitHandle
- {
- get { return _asyncWaitHandle; }
- }
-
- /** <inheritdoc /> */
- public object AsyncState
- {
- get { return null; }
- }
-
- /** <inheritdoc /> */
- public bool CompletedSynchronously
- {
- get { return false; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
deleted file mode 100644
index fa785b2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/CopyOnWriteConcurrentDictionary.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Concurrent dictionary with CopyOnWrite mechanism inside.
- /// Good for frequent reads / infrequent writes scenarios.
- /// </summary>
- public class CopyOnWriteConcurrentDictionary<TKey, TValue>
- {
- /** */
- private volatile Dictionary<TKey, TValue> _dict = new Dictionary<TKey, TValue>();
-
- /// <summary>
- /// Gets the value associated with the specified key.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- /// <returns>true if the dictionary contains an element with the specified key; otherwise, false.</returns>
- public bool TryGetValue(TKey key, out TValue val)
- {
- return _dict.TryGetValue(key, out val);
- }
-
- /// <summary>
- /// Adds a key/value pair if the key does not already exist.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="valueFactory">The function used to generate a value for the key.</param>
- /// <returns>The value for the key.</returns>
- public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
- {
- lock (this)
- {
- TValue res;
-
- if (_dict.TryGetValue(key, out res))
- return res;
-
- var dict0 = new Dictionary<TKey, TValue>(_dict);
-
- res = valueFactory(key);
-
- dict0[key] = res;
-
- _dict = dict0;
-
- return res;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
deleted file mode 100644
index 7f83588..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateConverter.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Diagnostics;
- using System.Linq.Expressions;
- using System.Reflection;
- using System.Reflection.Emit;
-
- /// <summary>
- /// Converts generic and non-generic delegates.
- /// </summary>
- public static class DelegateConverter
- {
- /** */
- private const string DefaultMethodName = "Invoke";
-
- /// <summary>
- /// Compiles a function without arguments.
- /// </summary>
- /// <param name="targetType">Type of the target.</param>
- /// <returns>Compiled function that calls specified method on specified target.</returns>
- public static Func<object, object> CompileFunc(Type targetType)
- {
- var method = targetType.GetMethod(DefaultMethodName);
-
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, targetType);
-
- var callExpr = Expression.Call(targetParamConverted, method);
- var convertResultExpr = Expression.Convert(callExpr, typeof(object));
-
- return Expression.Lambda<Func<object, object>>(convertResultExpr, targetParam).Compile();
- }
-
- /// <summary>
- /// Compiles a function with arbitrary number of arguments.
- /// </summary>
- /// <typeparam name="T">Resulting delegate type.</typeparam>
- /// <param name="targetType">Type of the target.</param>
- /// <param name="argTypes">Argument types.</param>
- /// <param name="convertToObject">
- /// Flags that indicate whether func params and/or return value should be converted from/to object.
- /// </param>
- /// <param name="methodName">Name of the method.</param>
- /// <returns>
- /// Compiled function that calls specified method on specified target.
- /// </returns>
- public static T CompileFunc<T>(Type targetType, Type[] argTypes, bool[] convertToObject = null,
- string methodName = null)
- where T : class
- {
- var method = targetType.GetMethod(methodName ?? DefaultMethodName, argTypes);
-
- return CompileFunc<T>(targetType, method, argTypes, convertToObject);
- }
-
- /// <summary>
- /// Compiles a function with arbitrary number of arguments.
- /// </summary>
- /// <typeparam name="T">Resulting delegate type.</typeparam>
- /// <param name="method">Method.</param>
- /// <param name="targetType">Type of the target.</param>
- /// <param name="argTypes">Argument types.</param>
- /// <param name="convertToObject">
- /// Flags that indicate whether func params and/or return value should be converted from/to object.
- /// </param>
- /// <returns>
- /// Compiled function that calls specified method on specified target.
- /// </returns>
- public static T CompileFunc<T>(Type targetType, MethodInfo method, Type[] argTypes,
- bool[] convertToObject = null)
- where T : class
- {
- if (argTypes == null)
- {
- var args = method.GetParameters();
- argTypes = new Type[args.Length];
-
- for (int i = 0; i < args.Length; i++)
- argTypes[i] = args[i].ParameterType;
- }
-
- Debug.Assert(convertToObject == null || (convertToObject.Length == argTypes.Length + 1));
- Debug.Assert(method != null);
-
- targetType = method.IsStatic ? null : (targetType ?? method.DeclaringType);
-
- var targetParam = Expression.Parameter(typeof(object));
-
- Expression targetParamConverted = null;
- ParameterExpression[] argParams;
- int argParamsOffset = 0;
-
- if (targetType != null)
- {
- targetParamConverted = Expression.Convert(targetParam, targetType);
- argParams = new ParameterExpression[argTypes.Length + 1];
- argParams[0] = targetParam;
- argParamsOffset = 1;
- }
- else
- argParams = new ParameterExpression[argTypes.Length]; // static method
-
- var argParamsConverted = new Expression[argTypes.Length];
-
- for (var i = 0; i < argTypes.Length; i++)
- {
- if (convertToObject == null || convertToObject[i])
- {
- var argParam = Expression.Parameter(typeof (object));
- argParams[i + argParamsOffset] = argParam;
- argParamsConverted[i] = Expression.Convert(argParam, argTypes[i]);
- }
- else
- {
- var argParam = Expression.Parameter(argTypes[i]);
- argParams[i + argParamsOffset] = argParam;
- argParamsConverted[i] = argParam;
- }
- }
-
- Expression callExpr = Expression.Call(targetParamConverted, method, argParamsConverted);
-
- if (convertToObject == null || convertToObject[argTypes.Length])
- callExpr = Expression.Convert(callExpr, typeof(object));
-
- return Expression.Lambda<T>(callExpr, argParams).Compile();
- }
-
- /// <summary>
- /// Compiles a generic ctor with arbitrary number of arguments.
- /// </summary>
- /// <typeparam name="T">Result func type.</typeparam>
- /// <param name="type">Type to be created by ctor.</param>
- /// <param name="argTypes">Argument types.</param>
- /// <param name="convertResultToObject">if set to <c>true</c> [convert result to object].
- /// Flag that indicates whether ctor return value should be converted to object.
- /// </param>
- /// <returns>
- /// Compiled generic constructor.
- /// </returns>
- public static T CompileCtor<T>(Type type, Type[] argTypes, bool convertResultToObject = true)
- {
- var ctor = type.GetConstructor(argTypes);
-
- Debug.Assert(ctor != null);
-
- var args = new ParameterExpression[argTypes.Length];
- var argsConverted = new Expression[argTypes.Length];
-
- for (var i = 0; i < argTypes.Length; i++)
- {
- var arg = Expression.Parameter(typeof(object));
- args[i] = arg;
- argsConverted[i] = Expression.Convert(arg, argTypes[i]);
- }
-
- Expression ctorExpr = Expression.New(ctor, argsConverted); // ctor takes args of specific types
-
- if (convertResultToObject)
- ctorExpr = Expression.Convert(ctorExpr, typeof (object)); // convert ctor result to object
-
- return Expression.Lambda<T>(ctorExpr, args).Compile(); // lambda takes args as objects
- }
-
- /// <summary>
- /// Compiles the field setter.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <returns>Compiled field setter.</returns>
- public static Action<object, object> CompileFieldSetter(FieldInfo field)
- {
- Debug.Assert(field != null);
- Debug.Assert(field.DeclaringType != null); // non-static
-
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
-
- var valParam = Expression.Parameter(typeof(object));
- var valParamConverted = Expression.Convert(valParam, field.FieldType);
-
- var assignExpr = Expression.Call(GetWriteFieldMethod(field), targetParamConverted, valParamConverted);
-
- return Expression.Lambda<Action<object, object>>(assignExpr, targetParam, valParam).Compile();
- }
-
- /// <summary>
- /// Compiles the property setter.
- /// </summary>
- /// <param name="prop">The property.</param>
- /// <returns>Compiled property setter.</returns>
- public static Action<object, object> CompilePropertySetter(PropertyInfo prop)
- {
- Debug.Assert(prop != null);
- Debug.Assert(prop.DeclaringType != null); // non-static
-
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, prop.DeclaringType);
-
- var valParam = Expression.Parameter(typeof(object));
- var valParamConverted = Expression.Convert(valParam, prop.PropertyType);
-
- var fld = Expression.Property(targetParamConverted, prop);
-
- var assignExpr = Expression.Assign(fld, valParamConverted);
-
- return Expression.Lambda<Action<object, object>>(assignExpr, targetParam, valParam).Compile();
- }
-
- /// <summary>
- /// Gets a method to write a field (including private and readonly).
- /// NOTE: Expression Trees can't write readonly fields.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <returns>Resulting MethodInfo.</returns>
- public static DynamicMethod GetWriteFieldMethod(FieldInfo field)
- {
- Debug.Assert(field != null);
-
- var module = Assembly.GetExecutingAssembly().GetModules()[0];
-
- var method = new DynamicMethod(string.Empty, null, new[] { field.DeclaringType, field.FieldType }, module,
- true);
-
- var il = method.GetILGenerator();
-
- il.Emit(OpCodes.Ldarg_0);
- il.Emit(OpCodes.Ldarg_1);
- il.Emit(OpCodes.Stfld, field);
- il.Emit(OpCodes.Ret);
-
- return method;
- }
-
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
deleted file mode 100644
index 8d7cb3a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/DelegateTypeDescriptor.cs
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Datastream;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Messaging;
-
- /// <summary>
- /// Type descriptor with precompiled delegates for known methods.
- /// </summary>
- internal class DelegateTypeDescriptor
- {
- /** Cached decriptors. */
- private static readonly CopyOnWriteConcurrentDictionary<Type, DelegateTypeDescriptor> Descriptors
- = new CopyOnWriteConcurrentDictionary<Type, DelegateTypeDescriptor>();
-
- /** */
- private readonly Func<object, object> _computeOutFunc;
-
- /** */
- private readonly Func<object, object, object> _computeFunc;
-
- /** */
- private readonly Func<object, Guid, object, bool> _eventFilter;
-
- /** */
- private readonly Func<object, object, object, bool> _cacheEntryFilter;
-
- /** */
- private readonly Tuple<Func<object, IMutableCacheEntryInternal, object, object>, Tuple<Type, Type>>
- _cacheEntryProcessor;
-
- /** */
- private readonly Func<object, Guid, object, bool> _messageFilter;
-
- /** */
- private readonly Func<object, object> _computeJobExecute;
-
- /** */
- private readonly Action<object> _computeJobCancel;
-
- /** */
- private readonly Action<object, Ignite, IUnmanagedTarget, IPortableStream, bool> _streamReceiver;
-
- /** */
- private readonly Func<object, object> _streamTransformerCtor;
-
- /// <summary>
- /// Gets the <see cref="IComputeFunc{T}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, object> GetComputeOutFunc(Type type)
- {
- return Get(type)._computeOutFunc;
- }
-
- /// <summary>
- /// Gets the <see cref="IComputeFunc{T, R}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, object, object> GetComputeFunc(Type type)
- {
- return Get(type)._computeFunc;
- }
-
- /// <summary>
- /// Gets the <see cref="IEventFilter{T}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, Guid, object, bool> GetEventFilter(Type type)
- {
- return Get(type)._eventFilter;
- }
-
- /// <summary>
- /// Gets the <see cref="ICacheEntryFilter{TK,TV}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, object, object, bool> GetCacheEntryFilter(Type type)
- {
- return Get(type)._cacheEntryFilter;
- }
-
- /// <summary>
- /// Gets the <see cref="ICacheEntryProcessor{K, V, A, R}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, IMutableCacheEntryInternal, object, object> GetCacheEntryProcessor(Type type)
- {
- return Get(type)._cacheEntryProcessor.Item1;
- }
-
- /// <summary>
- /// Gets key and value types for the <see cref="ICacheEntryProcessor{K, V, A, R}" />.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Key and value types.</returns>
- public static Tuple<Type, Type> GetCacheEntryProcessorTypes(Type type)
- {
- return Get(type)._cacheEntryProcessor.Item2;
- }
-
- /// <summary>
- /// Gets the <see cref="IMessageFilter{T}" /> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, Guid, object, bool> GetMessageFilter(Type type)
- {
- return Get(type)._messageFilter;
- }
-
- /// <summary>
- /// Gets the <see cref="IComputeJob{T}.Execute" /> and <see cref="IComputeJob{T}.Cancel" /> invocators.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="execute">Execute invocator.</param>
- /// <param name="cancel">Cancel invocator.</param>
- public static void GetComputeJob(Type type, out Func<object, object> execute, out Action<object> cancel)
- {
- var desc = Get(type);
-
- execute = desc._computeJobExecute;
- cancel = desc._computeJobCancel;
- }
-
- /// <summary>
- /// Gets the <see cref="IStreamReceiver{TK,TV}"/> invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Action<object, Ignite, IUnmanagedTarget, IPortableStream, bool> GetStreamReceiver(Type type)
- {
- return Get(type)._streamReceiver;
- }
-
- /// <summary>
- /// Gets the <see cref="StreamTransformer{K, V, A, R}"/>> ctor invocator.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <returns>Precompiled invocator delegate.</returns>
- public static Func<object, object> GetStreamTransformerCtor(Type type)
- {
- return Get(type)._streamTransformerCtor;
- }
-
- /// <summary>
- /// Gets the <see cref="DelegateTypeDescriptor" /> by type.
- /// </summary>
- private static DelegateTypeDescriptor Get(Type type)
- {
- DelegateTypeDescriptor result;
-
- return Descriptors.TryGetValue(type, out result)
- ? result
- : Descriptors.GetOrAdd(type, t => new DelegateTypeDescriptor(t));
- }
-
- /// <summary>
- /// Throws an exception if first argument is not null.
- /// </summary>
- // ReSharper disable once UnusedParameter.Local
- private static void ThrowIfMultipleInterfaces(object check, Type userType, Type interfaceType)
- {
- if (check != null)
- throw new InvalidOperationException(
- string.Format("Not Supported: Type {0} implements interface {1} multiple times.", userType,
- interfaceType));
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="DelegateTypeDescriptor"/> class.
- /// </summary>
- /// <param name="type">The type.</param>
- private DelegateTypeDescriptor(Type type)
- {
- foreach (var iface in type.GetInterfaces())
- {
- if (!iface.IsGenericType)
- continue;
-
- var genericTypeDefinition = iface.GetGenericTypeDefinition();
-
- if (genericTypeDefinition == typeof (IComputeFunc<>))
- {
- ThrowIfMultipleInterfaces(_computeOutFunc, type, typeof(IComputeFunc<>));
-
- _computeOutFunc = DelegateConverter.CompileFunc(iface);
- }
- else if (genericTypeDefinition == typeof (IComputeFunc<,>))
- {
- ThrowIfMultipleInterfaces(_computeFunc, type, typeof(IComputeFunc<,>));
-
- var args = iface.GetGenericArguments();
-
- _computeFunc = DelegateConverter.CompileFunc<Func<object, object, object>>(iface, new[] {args[0]});
- }
- else if (genericTypeDefinition == typeof (IEventFilter<>))
- {
- ThrowIfMultipleInterfaces(_eventFilter, type, typeof(IEventFilter<>));
-
- var args = iface.GetGenericArguments();
-
- _eventFilter = DelegateConverter.CompileFunc<Func<object, Guid, object, bool>>(iface,
- new[] {typeof (Guid), args[0]}, new[] {false, true, false});
- }
- else if (genericTypeDefinition == typeof (ICacheEntryFilter<,>))
- {
- ThrowIfMultipleInterfaces(_cacheEntryFilter, type, typeof(ICacheEntryFilter<,>));
-
- var args = iface.GetGenericArguments();
-
- var entryType = typeof (ICacheEntry<,>).MakeGenericType(args);
-
- var invokeFunc = DelegateConverter.CompileFunc<Func<object, object, bool>>(iface,
- new[] { entryType }, new[] { true, false });
-
- var ctor = DelegateConverter.CompileCtor<Func<object, object, object>>(
- typeof (CacheEntry<,>).MakeGenericType(args), args);
-
- // Resulting func constructs CacheEntry and passes it to user implementation
- _cacheEntryFilter = (obj, k, v) => invokeFunc(obj, ctor(k, v));
- }
- else if (genericTypeDefinition == typeof (ICacheEntryProcessor<,,,>))
- {
- ThrowIfMultipleInterfaces(_cacheEntryProcessor, type, typeof(ICacheEntryProcessor<,,,>));
-
- var args = iface.GetGenericArguments();
-
- var entryType = typeof (IMutableCacheEntry<,>).MakeGenericType(args[0], args[1]);
-
- var func = DelegateConverter.CompileFunc<Func<object, object, object, object>>(iface,
- new[] { entryType, args[2] }, null, "Process");
-
- var types = new Tuple<Type, Type>(args[0], args[1]);
-
- _cacheEntryProcessor = new Tuple<Func<object, IMutableCacheEntryInternal, object, object>, Tuple<Type, Type>>
- (func, types);
-
- var transformerType = typeof (StreamTransformer<,,,>).MakeGenericType(args);
-
- _streamTransformerCtor = DelegateConverter.CompileCtor<Func<object, object>>(transformerType,
- new[] {iface});
- }
- else if (genericTypeDefinition == typeof (IMessageFilter<>))
- {
- ThrowIfMultipleInterfaces(_messageFilter, type, typeof(IMessageFilter<>));
-
- var arg = iface.GetGenericArguments()[0];
-
- _messageFilter = DelegateConverter.CompileFunc<Func<object, Guid, object, bool>>(iface,
- new[] { typeof(Guid), arg }, new[] { false, true, false });
- }
- else if (genericTypeDefinition == typeof (IComputeJob<>))
- {
- ThrowIfMultipleInterfaces(_messageFilter, type, typeof(IComputeJob<>));
-
- _computeJobExecute = DelegateConverter.CompileFunc<Func<object, object>>(iface, new Type[0],
- methodName: "Execute");
-
- _computeJobCancel = DelegateConverter.CompileFunc<Action<object>>(iface, new Type[0],
- new[] {false}, "Cancel");
- }
- else if (genericTypeDefinition == typeof (IStreamReceiver<,>))
- {
- ThrowIfMultipleInterfaces(_streamReceiver, type, typeof (IStreamReceiver<,>));
-
- var method =
- typeof (StreamReceiverHolder).GetMethod("InvokeReceiver")
- .MakeGenericMethod(iface.GetGenericArguments());
-
- _streamReceiver = DelegateConverter
- .CompileFunc<Action<object, Ignite, IUnmanagedTarget, IPortableStream, bool>>(
- typeof (StreamReceiverHolder),
- method,
- new[]
- {
- iface, typeof (Ignite), typeof (IUnmanagedTarget), typeof (IPortableStream),
- typeof (bool)
- },
- new[] {true, false, false, false, false, false});
- }
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
deleted file mode 100644
index 92b4fce..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/Future.cs
+++ /dev/null
@@ -1,286 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using System.Threading.Tasks;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Grid future implementation.
- /// </summary>
- [SuppressMessage("ReSharper", "ParameterHidesMember")]
- [CLSCompliant(false)]
- public sealed class Future<T> : IFutureInternal, IFuture<T>
- {
- /** Converter. */
- private readonly IFutureConverter<T> _converter;
-
- /** Result. */
- private T _res;
-
- /** Caught cxception. */
- private Exception _err;
-
- /** Done flag. */
- private volatile bool _done;
-
- /** Listener(s). Either Action or List{Action}. */
- private object _callbacks;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="converter">Future result marshaller and converter.</param>
- public Future(IFutureConverter<T> converter = null)
- {
- _converter = converter;
- }
-
- /** <inheritdoc/> */
- public bool IsDone
- {
- get { return _done; }
- }
-
- /** <inheritdoc/> */
- public T Get()
- {
- if (!_done)
- {
- lock (this)
- {
- while (!_done)
- Monitor.Wait(this);
- }
- }
-
- return Get0();
- }
-
- /** <inheritdoc/> */
- public T Get(TimeSpan timeout)
- {
- long ticks = timeout.Ticks;
-
- if (ticks < 0)
- throw new ArgumentException("Timeout cannot be negative.");
-
- if (ticks == 0)
- return Get();
-
- if (!_done)
- {
- // Fallback to locked mode.
- lock (this)
- {
- long endTime = DateTime.Now.Ticks + ticks;
-
- if (!_done)
- {
- while (true)
- {
- Monitor.Wait(this, timeout);
-
- if (_done)
- break;
-
- ticks = endTime - DateTime.Now.Ticks;
-
- if (ticks <= 0)
- throw new TimeoutException("Timeout waiting for future completion.");
-
- timeout = TimeSpan.FromTicks(ticks);
- }
- }
- }
- }
-
- return Get0();
- }
-
- /** <inheritdoc/> */
- public void Listen(Action callback)
- {
- Listen((Action<IFuture<T>>) (fut => callback()));
- }
-
- /** <inheritdoc/> */
- public void Listen(Action<IFuture> callback)
- {
- Listen((Action<IFuture<T>>)callback);
- }
-
- /** <inheritdoc/> */
- public void Listen(Action<IFuture<T>> callback)
- {
- IgniteArgumentCheck.NotNull(callback, "callback");
-
- if (!_done)
- {
- lock (this)
- {
- if (!_done)
- {
- AddCallback(callback);
-
- return;
- }
- }
- }
-
- callback(this);
- }
-
- /// <summary>
- /// Get result or throw an error.
- /// </summary>
- private T Get0()
- {
- if (_err != null)
- throw _err;
-
- return _res;
- }
-
- /** <inheritdoc/> */
- public IAsyncResult ToAsyncResult()
- {
- return _done ? CompletedAsyncResult.Instance : new AsyncResult(this);
- }
-
- /** <inheritdoc/> */
- Task<object> IFuture.ToTask()
- {
- return Task.Factory.FromAsync(ToAsyncResult(), x => (object) Get());
- }
-
- /** <inheritdoc/> */
- public Task<T> ToTask()
- {
- return Task.Factory.FromAsync(ToAsyncResult(), x => Get());
- }
-
- /** <inheritdoc/> */
- object IFuture.Get(TimeSpan timeout)
- {
- return Get(timeout);
- }
-
- /** <inheritdoc/> */
- object IFuture.Get()
- {
- return Get();
- }
-
- /** <inheritdoc /> */
- public void OnResult(IPortableStream stream)
- {
- try
- {
- OnResult(_converter.Convert(stream));
- }
- catch (Exception ex)
- {
- OnError(ex);
- }
- }
-
- /** <inheritdoc /> */
- public void OnError(Exception err)
- {
- OnDone(default(T), err);
- }
-
- /** <inheritdoc /> */
- public void OnNullResult()
- {
- OnResult(default(T));
- }
-
- /// <summary>
- /// Set result.
- /// </summary>
- /// <param name="res">Result.</param>
- internal void OnResult(T res)
- {
- OnDone(res, null);
- }
-
- /// <summary>
- /// Set future to Done state.
- /// </summary>
- /// <param name="res">Result.</param>
- /// <param name="err">Error.</param>
- public void OnDone(T res, Exception err)
- {
- object callbacks0 = null;
-
- lock (this)
- {
- if (!_done)
- {
- _res = res;
- _err = err;
-
- _done = true;
-
- Monitor.PulseAll(this);
-
- // Notify listeners outside the lock
- callbacks0 = _callbacks;
- _callbacks = null;
- }
- }
-
- if (callbacks0 != null)
- {
- var list = callbacks0 as List<Action<IFuture<T>>>;
-
- if (list != null)
- list.ForEach(x => x(this));
- else
- ((Action<IFuture<T>>) callbacks0)(this);
- }
- }
-
- /// <summary>
- /// Adds a callback.
- /// </summary>
- private void AddCallback(Action<IFuture<T>> callback)
- {
- if (_callbacks == null)
- {
- _callbacks = callback;
-
- return;
- }
-
- var list = _callbacks as List<Action<IFuture<T>>> ??
- new List<Action<IFuture<T>>> {(Action<IFuture<T>>) _callbacks};
-
- list.Add(callback);
-
- _callbacks = list;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureConverter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureConverter.cs
deleted file mode 100644
index a07d954..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureConverter.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Marshals and converts future value.
- /// </summary>
- internal class FutureConverter<T> : IFutureConverter<T>
- {
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Converting function. */
- private readonly Func<PortableReaderImpl, T> _func;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable.</param>
- /// <param name="func">Converting function.</param>
- public FutureConverter(PortableMarshaller marsh, bool keepPortable,
- Func<PortableReaderImpl, T> func = null)
- {
- _marsh = marsh;
- _keepPortable = keepPortable;
- _func = func ?? (reader => reader.ReadObject<T>());
- }
-
- /// <summary>
- /// Read and convert a value.
- /// </summary>
- public T Convert(IPortableStream stream)
- {
- var reader = _marsh.StartUnmarshal(stream, _keepPortable);
-
- return _func(reader);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureType.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureType.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureType.cs
deleted file mode 100644
index 0beff04..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/FutureType.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- /// <summary>
- /// Future types.
- /// </summary>
- public enum FutureType
- {
- /** Future type: byte. */
- Byte = 1,
-
- /** Future type: boolean. */
- Bool = 2,
-
- /** Future type: short. */
- Short = 3,
-
- /** Future type: char. */
- Char = 4,
-
- /** Future type: int. */
- Int = 5,
-
- /** Future type: float. */
- Float = 6,
-
- /** Future type: long. */
- Long = 7,
-
- /** Future type: double. */
- Double = 8,
-
- /** Future type: object. */
- Object = 9
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
deleted file mode 100644
index e07597d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureConverter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Marshals and converts future value.
- /// </summary>
- [CLSCompliant(false)]
- public interface IFutureConverter<out T>
- {
- /// <summary>
- /// Reads and converts a value.
- /// </summary>
- T Convert(IPortableStream stream);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
deleted file mode 100644
index 90f06be..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IFutureInternal.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Internal future interface.
- /// </summary>
- [CLSCompliant(false)]
- public interface IFutureInternal
- {
- /// <summary>
- /// Set result from stream.
- /// </summary>
- /// <param name="stream">Stream.</param>
- void OnResult(IPortableStream stream);
-
- /// <summary>
- /// Set null result.
- /// </summary>
- void OnNullResult();
-
- /// <summary>
- /// Set error result.
- /// </summary>
- /// <param name="err">Exception.</param>
- void OnError(Exception err);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs
deleted file mode 100644
index e94c577..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/IgniteArgumentCheck.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Arguments check helpers.
- /// </summary>
- public static class IgniteArgumentCheck
- {
- /// <summary>
- /// Throws an ArgumentNullException if specified arg is null.
- /// </summary>
- /// <param name="arg">The argument.</param>
- /// <param name="argName">Name of the argument.</param>
- public static void NotNull(object arg, string argName)
- {
- if (arg == null)
- throw new ArgumentNullException(argName);
- }
-
- /// <summary>
- /// Throws an ArgumentException if specified arg is null or empty string.
- /// </summary>
- /// <param name="arg">The argument.</param>
- /// <param name="argName">Name of the argument.</param>
- public static void NotNullOrEmpty(string arg, string argName)
- {
- if (string.IsNullOrEmpty(arg))
- throw new ArgumentException(string.Format("'{0}' argument should not be null or empty.", argName),
- argName);
- }
-
- /// <summary>
- /// Throws an ArgumentException if specified arg is null or empty string.
- /// </summary>
- /// <param name="collection">The collection.</param>
- /// <param name="argName">Name of the argument.</param>
- public static void NotNullOrEmpty<T>(ICollection<T> collection, string argName)
- {
- if (collection == null || collection.Count == 0)
- throw new ArgumentException(string.Format("'{0}' argument should not be null or empty.", argName),
- argName);
- }
-
- /// <summary>
- /// Throws an ArgumentException if specified condition is false.
- /// </summary>
- /// <param name="condition">Condition.</param>
- /// <param name="argName">Name of the argument.</param>
- /// <param name="message">Message.</param>
- public static void Ensure(bool condition, string argName, string message)
- {
- if (!condition)
- throw new ArgumentException(string.Format("'{0}' argument is invalid: {1}", argName, message),
- argName);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
deleted file mode 100644
index c158d5c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/LoadedAssembliesResolver.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Reflection;
-
- /// <summary>
- /// Resolves loaded assemblies by name.
- /// </summary>
- public class LoadedAssembliesResolver
- {
- // The lazy singleton instance.
- private static readonly Lazy<LoadedAssembliesResolver> LazyInstance = new Lazy<LoadedAssembliesResolver>();
-
- // Assemblies map.
- private volatile Dictionary<string, Assembly> _map;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LoadedAssembliesResolver"/> class.
- /// </summary>
- public LoadedAssembliesResolver()
- {
- lock (this)
- {
- AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad;
-
- UpdateMap();
- }
- }
-
- /// <summary>
- /// Handles the AssemblyLoad event of the AppDomain.
- /// </summary>
- /// <param name="sender">The source of the event.</param>
- /// <param name="args">The <see cref="AssemblyLoadEventArgs"/> instance containing the event data.</param>
- private void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
- {
- lock (this)
- {
- UpdateMap();
- }
- }
-
- /// <summary>
- /// Updates the assembly map according to the current list of loaded assemblies.
- /// </summary>
- private void UpdateMap()
- {
- var assemblies = AppDomain.CurrentDomain.GetAssemblies();
-
- _map = new Dictionary<string, Assembly>(assemblies.Length);
-
- foreach (var assembly in assemblies)
- _map[assembly.FullName] = assembly;
- }
-
- /// <summary>
- /// Gets the singleton instance.
- /// </summary>
- public static LoadedAssembliesResolver Instance
- {
- get { return LazyInstance.Value; }
- }
-
- /// <summary>
- /// Gets the assembly by name.
- /// </summary>
- /// <param name="assemblyName">Name of the assembly.</param>
- /// <returns>Assembly with specified name, or null.</returns>
- [SuppressMessage("ReSharper", "InconsistentlySynchronizedField")]
- public Assembly GetAssembly(string assemblyName)
- {
- Assembly asm;
-
- return _map.TryGetValue(assemblyName, out asm) ? asm : null;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs
deleted file mode 100644
index 733bed0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/PortableResultWrapper.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Simple wrapper over result to handle marshalling properly.
- /// </summary>
- internal class PortableResultWrapper : IPortableWriteAware
- {
- /** */
- private readonly object _result;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableResultWrapper"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public PortableResultWrapper(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _result = PortableUtils.ReadPortableOrSerializable<object>(reader0);
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="res">Result.</param>
- public PortableResultWrapper(object res)
- {
- _result = res;
- }
-
- /// <summary>
- /// Result.
- /// </summary>
- public object Result
- {
- get { return _result; }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl) writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, Result);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/TypeCaster.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/TypeCaster.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/TypeCaster.cs
deleted file mode 100644
index d0dd2a9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Common/TypeCaster.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Common
-{
- using System;
- using System.Linq.Expressions;
-
- /// <summary>
- /// Does type casts without extra boxing.
- /// Should be used when casting compile-time incompatible value types instead of "(T)(object)x".
- /// </summary>
- /// <typeparam name="T">Target type</typeparam>
- public static class TypeCaster<T>
- {
- /// <summary>
- /// Efficiently casts an object from TFrom to T.
- /// Does not cause boxing for value types.
- /// </summary>
- /// <typeparam name="TFrom">Source type to cast from.</typeparam>
- /// <param name="obj">The object to cast.</param>
- /// <returns>Casted object.</returns>
- public static T Cast<TFrom>(TFrom obj)
- {
- return Casters<TFrom>.Caster(obj);
- }
-
- /// <summary>
- /// Inner class serving as a cache.
- /// </summary>
- private static class Casters<TFrom>
- {
- /// <summary>
- /// Compiled caster delegate.
- /// </summary>
- internal static readonly Func<TFrom, T> Caster = Compile();
-
- /// <summary>
- /// Compiles caster delegate.
- /// </summary>
- private static Func<TFrom, T> Compile()
- {
- if (typeof (T) == typeof (TFrom))
- {
- // Just return what we have
- var pExpr = Expression.Parameter(typeof(TFrom));
-
- return Expression.Lambda<Func<TFrom, T>>(pExpr, pExpr).Compile();
- }
-
- var paramExpr = Expression.Parameter(typeof(TFrom));
- var convertExpr = Expression.Convert(paramExpr, typeof(T));
-
- return Expression.Lambda<Func<TFrom, T>>(convertExpr, paramExpr).Compile();
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
deleted file mode 100644
index 1a772c2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeAbstractClosureTask.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Base class for all tasks working with closures.
- /// </summary>
- internal abstract class ComputeAbstractClosureTask<TA, T, TR> : IComputeTask<TA, T, TR>
- {
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>
- /// Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.
- /// </returns>
- /// <exception cref="System.NotSupportedException">Map step should not be called on this task.</exception>
- public IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg)
- {
- throw new NotSupportedException("Map step should not be called on this task.");
- }
-
- /// <summary>
- /// Asynchronous callback invoked every time a result from remote execution is
- /// received. It is ultimately upto this method to return a policy based
- /// on which the system will either wait for more results, reduce results
- /// received so far, or failover this job to another node. See
- /// <see cref="ComputeJobResultPolicy" /> for more information.
- /// </summary>
- /// <param name="res">Received remote Ignite executable result.</param>
- /// <param name="rcvd">All previously received results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute" /> attribute, then this list will be empty.</param>
- /// <returns>
- /// Result policy that dictates how to process further upcoming job results.
- /// </returns>
- public ComputeJobResultPolicy Result(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd)
- {
- Exception err = res.Exception();
-
- if (err != null)
- {
- if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
- err is ComputeJobFailoverException)
- return ComputeJobResultPolicy.Failover;
-
- throw err;
- }
-
- return Result0(res);
- }
-
- /// <summary>
- /// Reduces (or aggregates) results received so far into one compound result to be returned to
- /// caller via future.
- /// <para />
- /// Note, that if some jobs did not succeed and could not be failed over then the list of
- /// results passed into this method will include the failed results. Otherwise, failed
- /// results will not be in the list.
- /// </summary>
- /// <param name="results">Received job results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute" /> attribute, then this list will be empty.</param>
- /// <returns>
- /// Task result constructed from results of remote executions.
- /// </returns>
- public abstract TR Reduce(IList<IComputeJobResult<T>> results);
-
- /// <summary>
- /// Internal result processing routine.
- /// </summary>
- /// <param name="res">Result.</param>
- /// <returns>Policy.</returns>
- protected abstract ComputeJobResultPolicy Result0(IComputeJobResult<T> res);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs
deleted file mode 100644
index c91a167..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeActionJob.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// System job which wraps over <c>Action</c>.
- /// </summary>
- internal class ComputeActionJob : IComputeJob, IComputeResourceInjector, IPortableWriteAware
- {
- /** Closure. */
- private readonly IComputeAction _action;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="action">Action.</param>
- public ComputeActionJob(IComputeAction action)
- {
- _action = action;
- }
-
- /** <inheritDoc /> */
- public object Execute()
- {
- _action.Invoke();
-
- return null;
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- throw new NotSupportedException("Func job cannot be cancelled.");
- }
-
- /** <inheritDoc /> */
- public void Inject(Ignite grid)
- {
- ResourceProcessor.Inject(_action, grid);
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _action);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeActionJob"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ComputeActionJob(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _action = PortableUtils.ReadPortableOrSerializable<IComputeAction>(reader0);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs
deleted file mode 100644
index 381c701..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeFuncJob.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// System job which wraps over <c>Func</c>.
- /// </summary>
- internal class ComputeFuncJob : IComputeJob, IComputeResourceInjector, IPortableWriteAware
- {
- /** Closure. */
- private readonly IComputeFunc _clo;
-
- /** Argument. */
- private readonly object _arg;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="clo">Closure.</param>
- /// <param name="arg">Argument.</param>
- public ComputeFuncJob(IComputeFunc clo, object arg)
- {
- _clo = clo;
- _arg = arg;
- }
-
- /** <inheritDoc /> */
- public object Execute()
- {
- return _clo.Invoke(_arg);
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- throw new NotSupportedException("Func job cannot be cancelled.");
- }
-
- /** <inheritDoc /> */
- public void Inject(Ignite grid)
- {
- ResourceProcessor.Inject(_clo, grid);
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- PortableWriterImpl writer0 = (PortableWriterImpl) writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _clo);
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _arg);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeFuncJob"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ComputeFuncJob(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl) reader.RawReader();
-
- _clo = PortableUtils.ReadPortableOrSerializable<IComputeFunc>(reader0);
- _arg = PortableUtils.ReadPortableOrSerializable<object>(reader0);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs
deleted file mode 100644
index dd57f6c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeMultiClosureTask.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Closure-based task producing multiple jobs and returning a collection of job results.
- /// </summary>
- [ComputeTaskNoResultCache]
- internal class ComputeMultiClosureTask<TA, T, TR> : ComputeAbstractClosureTask<TA, T, TR>
- where TR : ICollection<T>
- {
- /** Result. */
- private readonly ICollection<T> _res;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="size">Expected results count.</param>
- public ComputeMultiClosureTask(int size)
- {
- _res = new List<T>(size);
- }
-
- /** <inheritDoc /> */
- protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res)
- {
- _res.Add(res.Data());
-
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public override TR Reduce(IList<IComputeJobResult<T>> results)
- {
- return (TR) _res;
- }
- }
-}
[06/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
deleted file mode 100644
index e0dcdaa..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAbstractTest.cs
+++ /dev/null
@@ -1,1181 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Event;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
- using CQU = Apache.Ignite.Core.Impl.Cache.Query.Continuous.ContinuousQueryUtils;
-
- /// <summary>
- /// Tests for continuous query.
- /// </summary>
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- [SuppressMessage("ReSharper", "PossibleNullReferenceException")]
- [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
- public abstract class ContinuousQueryAbstractTest
- {
- /** Cache name: ATOMIC, backup. */
- protected const string CACHE_ATOMIC_BACKUP = "atomic_backup";
-
- /** Cache name: ATOMIC, no backup. */
- protected const string CACHE_ATOMIC_NO_BACKUP = "atomic_no_backup";
-
- /** Cache name: TRANSACTIONAL, backup. */
- protected const string CACHE_TX_BACKUP = "transactional_backup";
-
- /** Cache name: TRANSACTIONAL, no backup. */
- protected const string CACHE_TX_NO_BACKUP = "transactional_no_backup";
-
- /** Listener events. */
- public static BlockingCollection<CallbackEvent> CB_EVTS = new BlockingCollection<CallbackEvent>();
-
- /** Listener events. */
- public static BlockingCollection<FilterEvent> FILTER_EVTS = new BlockingCollection<FilterEvent>();
-
- /** First node. */
- private IIgnite grid1;
-
- /** Second node. */
- private IIgnite grid2;
-
- /** Cache on the first node. */
- private ICache<int, PortableEntry> cache1;
-
- /** Cache on the second node. */
- private ICache<int, PortableEntry> cache2;
-
- /** Cache name. */
- private readonly string cacheName;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cacheName">Cache name.</param>
- protected ContinuousQueryAbstractTest(string cacheName)
- {
- this.cacheName = cacheName;
- }
-
- /// <summary>
- /// Set-up routine.
- /// </summary>
- [TestFixtureSetUp]
- public void SetUp()
- {
- GC.Collect();
- TestUtils.JvmDebug = true;
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- PortableConfiguration portCfg = new PortableConfiguration();
-
- ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>();
-
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableEntry)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableFilter)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(KeepPortableFilter)));
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.PortableConfiguration = portCfg;
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = "config\\cache-query-continuous.xml";
-
- cfg.GridName = "grid-1";
- grid1 = Ignition.Start(cfg);
- cache1 = grid1.GetCache<int, PortableEntry>(cacheName);
-
- cfg.GridName = "grid-2";
- grid2 = Ignition.Start(cfg);
- cache2 = grid2.GetCache<int, PortableEntry>(cacheName);
- }
-
- /// <summary>
- /// Tear-down routine.
- /// </summary>
- [TestFixtureTearDown]
- public void TearDown()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Before-test routine.
- /// </summary>
- [SetUp]
- public void BeforeTest()
- {
- CB_EVTS = new BlockingCollection<CallbackEvent>();
- FILTER_EVTS = new BlockingCollection<FilterEvent>();
-
- AbstractFilter<PortableEntry>.res = true;
- AbstractFilter<PortableEntry>.err = false;
- AbstractFilter<PortableEntry>.marshErr = false;
- AbstractFilter<PortableEntry>.unmarshErr = false;
-
- cache1.Remove(PrimaryKey(cache1));
- cache1.Remove(PrimaryKey(cache2));
-
- Assert.AreEqual(0, cache1.GetSize());
- Assert.AreEqual(0, cache2.GetSize());
-
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- /// Test arguments validation.
- /// </summary>
- [Test]
- public void TestValidation()
- {
- Assert.Throws<ArgumentException>(() => { cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(null)); });
- }
-
- /// <summary>
- /// Test multiple closes.
- /// </summary>
- [Test]
- public void TestMultipleClose()
- {
- int key1 = PrimaryKey(cache1);
- int key2 = PrimaryKey(cache2);
-
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
-
- IDisposable qryHnd;
-
- using (qryHnd = cache1.QueryContinuous(qry))
- {
- // Put from local node.
- cache1.GetAndPut(key1, Entry(key1));
- CheckCallbackSingle(key1, null, Entry(key1));
-
- // Put from remote node.
- cache2.GetAndPut(key2, Entry(key2));
- CheckCallbackSingle(key2, null, Entry(key2));
- }
-
- qryHnd.Dispose();
- }
-
- /// <summary>
- /// Test regular callback operations.
- /// </summary>
- [Test]
- public void TestCallback()
- {
- CheckCallback(false);
- }
-
- /// <summary>
- /// Check regular callback execution.
- /// </summary>
- /// <param name="loc"></param>
- protected void CheckCallback(bool loc)
- {
- int key1 = PrimaryKey(cache1);
- int key2 = PrimaryKey(cache2);
-
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>(), true) :
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
-
- using (cache1.QueryContinuous(qry))
- {
- // Put from local node.
- cache1.GetAndPut(key1, Entry(key1));
- CheckCallbackSingle(key1, null, Entry(key1));
-
- cache1.GetAndPut(key1, Entry(key1 + 1));
- CheckCallbackSingle(key1, Entry(key1), Entry(key1 + 1));
-
- cache1.Remove(key1);
- CheckCallbackSingle(key1, Entry(key1 + 1), null);
-
- // Put from remote node.
- cache2.GetAndPut(key2, Entry(key2));
-
- if (loc)
- CheckNoCallback(100);
- else
- CheckCallbackSingle(key2, null, Entry(key2));
-
- cache1.GetAndPut(key2, Entry(key2 + 1));
-
- if (loc)
- CheckNoCallback(100);
- else
- CheckCallbackSingle(key2, Entry(key2), Entry(key2 + 1));
-
- cache1.Remove(key2);
-
- if (loc)
- CheckNoCallback(100);
- else
- CheckCallbackSingle(key2, Entry(key2 + 1), null);
- }
-
- cache1.Put(key1, Entry(key1));
- CheckNoCallback(100);
-
- cache1.Put(key2, Entry(key2));
- CheckNoCallback(100);
- }
-
- /// <summary>
- /// Test Ignite injection into callback.
- /// </summary>
- [Test]
- public void TestCallbackInjection()
- {
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
-
- Assert.IsNull(cb.ignite);
-
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb)))
- {
- Assert.IsNotNull(cb.ignite);
- }
- }
-
- /// <summary>
- /// Test portable filter logic.
- /// </summary>
- [Test]
- public void TestFilterPortable()
- {
- CheckFilter(true, false);
- }
-
- /// <summary>
- /// Test serializable filter logic.
- /// </summary>
- [Test]
- public void TestFilterSerializable()
- {
- CheckFilter(false, false);
- }
-
- /// <summary>
- /// Check filter.
- /// </summary>
- /// <param name="portable">Portable.</param>
- /// <param name="loc">Local cache flag.</param>
- protected void CheckFilter(bool portable, bool loc)
- {
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
-
- ContinuousQuery<int, PortableEntry> qry = loc ?
- new ContinuousQuery<int, PortableEntry>(lsnr, filter, true) :
- new ContinuousQuery<int, PortableEntry>(lsnr, filter);
-
- using (cache1.QueryContinuous(qry))
- {
- // Put from local node.
- int key1 = PrimaryKey(cache1);
- cache1.GetAndPut(key1, Entry(key1));
- CheckFilterSingle(key1, null, Entry(key1));
- CheckCallbackSingle(key1, null, Entry(key1));
-
- // Put from remote node.
- int key2 = PrimaryKey(cache2);
- cache1.GetAndPut(key2, Entry(key2));
-
- if (loc)
- {
- CheckNoFilter(key2);
- CheckNoCallback(key2);
- }
- else
- {
- CheckFilterSingle(key2, null, Entry(key2));
- CheckCallbackSingle(key2, null, Entry(key2));
- }
-
- AbstractFilter<PortableEntry>.res = false;
-
- // Ignored put from local node.
- cache1.GetAndPut(key1, Entry(key1 + 1));
- CheckFilterSingle(key1, Entry(key1), Entry(key1 + 1));
- CheckNoCallback(100);
-
- // Ignored put from remote node.
- cache1.GetAndPut(key2, Entry(key2 + 1));
-
- if (loc)
- CheckNoFilter(100);
- else
- CheckFilterSingle(key2, Entry(key2), Entry(key2 + 1));
-
- CheckNoCallback(100);
- }
- }
-
- /// <summary>
- /// Test portable filter error during invoke.
- /// </summary>
- [Ignore("IGNITE-521")]
- [Test]
- public void TestFilterInvokeErrorPortable()
- {
- CheckFilterInvokeError(true);
- }
-
- /// <summary>
- /// Test serializable filter error during invoke.
- /// </summary>
- [Ignore("IGNITE-521")]
- [Test]
- public void TestFilterInvokeErrorSerializable()
- {
- CheckFilterInvokeError(false);
- }
-
- /// <summary>
- /// Check filter error handling logic during invoke.
- /// </summary>
- private void CheckFilterInvokeError(bool portable)
- {
- AbstractFilter<PortableEntry>.err = true;
-
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>) new PortableFilter() : new SerializableFilter();
-
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
-
- using (cache1.QueryContinuous(qry))
- {
- // Put from local node.
- try
- {
- cache1.GetAndPut(PrimaryKey(cache1), Entry(1));
-
- Assert.Fail("Should not reach this place.");
- }
- catch (IgniteException)
- {
- // No-op.
- }
- catch (Exception)
- {
- Assert.Fail("Unexpected error.");
- }
-
- // Put from remote node.
- try
- {
- cache1.GetAndPut(PrimaryKey(cache2), Entry(1));
-
- Assert.Fail("Should not reach this place.");
- }
- catch (IgniteException)
- {
- // No-op.
- }
- catch (Exception)
- {
- Assert.Fail("Unexpected error.");
- }
- }
- }
-
- /// <summary>
- /// Test portable filter marshalling error.
- /// </summary>
- [Test]
- public void TestFilterMarshalErrorPortable()
- {
- CheckFilterMarshalError(true);
- }
-
- /// <summary>
- /// Test serializable filter marshalling error.
- /// </summary>
- [Test]
- public void TestFilterMarshalErrorSerializable()
- {
- CheckFilterMarshalError(false);
- }
-
- /// <summary>
- /// Check filter marshal error handling.
- /// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterMarshalError(bool portable)
- {
- AbstractFilter<PortableEntry>.marshErr = true;
-
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
-
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
-
- Assert.Throws<Exception>(() =>
- {
- using (cache1.QueryContinuous(qry))
- {
- // No-op.
- }
- });
- }
-
- /// <summary>
- /// Test non-serializable filter error.
- /// </summary>
- [Test]
- public void TestFilterNonSerializable()
- {
- CheckFilterNonSerializable(false);
- }
-
- /// <summary>
- /// Test non-serializable filter behavior.
- /// </summary>
- /// <param name="loc"></param>
- protected void CheckFilterNonSerializable(bool loc)
- {
- AbstractFilter<PortableEntry>.unmarshErr = true;
-
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter = new LocalFilter();
-
- ContinuousQuery<int, PortableEntry> qry = loc
- ? new ContinuousQuery<int, PortableEntry>(lsnr, filter, true)
- : new ContinuousQuery<int, PortableEntry>(lsnr, filter);
-
- if (loc)
- {
- using (cache1.QueryContinuous(qry))
- {
- // Local put must be fine.
- int key1 = PrimaryKey(cache1);
- cache1.GetAndPut(key1, Entry(key1));
- CheckFilterSingle(key1, null, Entry(key1));
- }
- }
- else
- {
- Assert.Throws<SerializationException>(() =>
- {
- using (cache1.QueryContinuous(qry))
- {
- // No-op.
- }
- });
- }
- }
-
- /// <summary>
- /// Test portable filter unmarshalling error.
- /// </summary>
- [Ignore("IGNITE-521")]
- [Test]
- public void TestFilterUnmarshalErrorPortable()
- {
- CheckFilterUnmarshalError(true);
- }
-
- /// <summary>
- /// Test serializable filter unmarshalling error.
- /// </summary>
- [Ignore("IGNITE-521")]
- [Test]
- public void TestFilterUnmarshalErrorSerializable()
- {
- CheckFilterUnmarshalError(false);
- }
-
- /// <summary>
- /// Check filter unmarshal error handling.
- /// </summary>
- /// <param name="portable">Portable flag.</param>
- private void CheckFilterUnmarshalError(bool portable)
- {
- AbstractFilter<PortableEntry>.unmarshErr = true;
-
- ICacheEntryEventListener<int, PortableEntry> lsnr = new Listener<PortableEntry>();
- ICacheEntryEventFilter<int, PortableEntry> filter =
- portable ? (AbstractFilter<PortableEntry>)new PortableFilter() : new SerializableFilter();
-
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(lsnr, filter);
-
- using (cache1.QueryContinuous(qry))
- {
- // Local put must be fine.
- int key1 = PrimaryKey(cache1);
- cache1.GetAndPut(key1, Entry(key1));
- CheckFilterSingle(key1, null, Entry(key1));
-
- // Remote put must fail.
- try
- {
- cache1.GetAndPut(PrimaryKey(cache2), Entry(1));
-
- Assert.Fail("Should not reach this place.");
- }
- catch (IgniteException)
- {
- // No-op.
- }
- catch (Exception)
- {
- Assert.Fail("Unexpected error.");
- }
- }
- }
-
- /// <summary>
- /// Test Ignite injection into filters.
- /// </summary>
- [Test]
- public void TestFilterInjection()
- {
- Listener<PortableEntry> cb = new Listener<PortableEntry>();
- PortableFilter filter = new PortableFilter();
-
- Assert.IsNull(filter.ignite);
-
- using (cache1.QueryContinuous(new ContinuousQuery<int, PortableEntry>(cb, filter)))
- {
- // Local injection.
- Assert.IsNotNull(filter.ignite);
-
- // Remote injection.
- cache1.GetAndPut(PrimaryKey(cache2), Entry(1));
-
- FilterEvent evt;
-
- Assert.IsTrue(FILTER_EVTS.TryTake(out evt, 500));
-
- Assert.IsNotNull(evt.ignite);
- }
- }
-
-
- /// <summary>
- /// Test "keep-portable" scenario.
- /// </summary>
- [Test]
- public void TestKeepPortable()
- {
- var cache = cache1.WithKeepPortable<int, IPortableObject>();
-
- ContinuousQuery<int, IPortableObject> qry = new ContinuousQuery<int, IPortableObject>(
- new Listener<IPortableObject>(), new KeepPortableFilter());
-
- using (cache.QueryContinuous(qry))
- {
- // 1. Local put.
- cache1.GetAndPut(PrimaryKey(cache1), Entry(1));
-
- CallbackEvent cbEvt;
- FilterEvent filterEvt;
-
- Assert.IsTrue(FILTER_EVTS.TryTake(out filterEvt, 500));
- Assert.AreEqual(PrimaryKey(cache1), filterEvt.entry.Key);
- Assert.AreEqual(null, filterEvt.entry.OldValue);
- Assert.AreEqual(Entry(1), (filterEvt.entry.Value as IPortableObject)
- .Deserialize<PortableEntry>());
-
- Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
- Assert.AreEqual(1, cbEvt.entries.Count);
- Assert.AreEqual(PrimaryKey(cache1), cbEvt.entries.First().Key);
- Assert.AreEqual(null, cbEvt.entries.First().OldValue);
- Assert.AreEqual(Entry(1), (cbEvt.entries.First().Value as IPortableObject)
- .Deserialize<PortableEntry>());
-
- // 2. Remote put.
- cache1.GetAndPut(PrimaryKey(cache2), Entry(2));
-
- Assert.IsTrue(FILTER_EVTS.TryTake(out filterEvt, 500));
- Assert.AreEqual(PrimaryKey(cache2), filterEvt.entry.Key);
- Assert.AreEqual(null, filterEvt.entry.OldValue);
- Assert.AreEqual(Entry(2), (filterEvt.entry.Value as IPortableObject)
- .Deserialize<PortableEntry>());
-
- Assert.IsTrue(CB_EVTS.TryTake(out cbEvt, 500));
- Assert.AreEqual(1, cbEvt.entries.Count);
- Assert.AreEqual(PrimaryKey(cache2), cbEvt.entries.First().Key);
- Assert.AreEqual(null, cbEvt.entries.First().OldValue);
- Assert.AreEqual(Entry(2),
- (cbEvt.entries.First().Value as IPortableObject).Deserialize<PortableEntry>());
- }
- }
-
- /// <summary>
- /// Test whether buffer size works fine.
- /// </summary>
- [Test]
- public void TestBufferSize()
- {
- // Put two remote keys in advance.
- List<int> rmtKeys = PrimaryKeys(cache2, 2);
-
- ContinuousQuery<int, PortableEntry> qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
-
- qry.BufferSize = 2;
- qry.TimeInterval = TimeSpan.FromMilliseconds(1000000);
-
- using (cache1.QueryContinuous(qry))
- {
- qry.BufferSize = 2;
-
- cache1.GetAndPut(rmtKeys[0], Entry(rmtKeys[0]));
-
- CheckNoCallback(100);
-
- cache1.GetAndPut(rmtKeys[1], Entry(rmtKeys[1]));
-
- CallbackEvent evt;
-
- Assert.IsTrue(CB_EVTS.TryTake(out evt, 1000));
-
- Assert.AreEqual(2, evt.entries.Count);
-
- var entryRmt0 = evt.entries.Single(entry => { return entry.Key.Equals(rmtKeys[0]); });
- var entryRmt1 = evt.entries.Single(entry => { return entry.Key.Equals(rmtKeys[1]); });
-
- Assert.AreEqual(rmtKeys[0], entryRmt0.Key);
- Assert.IsNull(entryRmt0.OldValue);
- Assert.AreEqual(Entry(rmtKeys[0]), entryRmt0.Value);
-
- Assert.AreEqual(rmtKeys[1], entryRmt1.Key);
- Assert.IsNull(entryRmt1.OldValue);
- Assert.AreEqual(Entry(rmtKeys[1]), entryRmt1.Value);
- }
-
- cache1.Remove(rmtKeys[0]);
- cache1.Remove(rmtKeys[1]);
- }
-
- /// <summary>
- /// Test whether timeout works fine.
- /// </summary>
- [Test]
- public void TestTimeout()
- {
- int key1 = PrimaryKey(cache1);
- int key2 = PrimaryKey(cache2);
-
- ContinuousQuery<int, PortableEntry> qry =
- new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
-
- qry.BufferSize = 2;
- qry.TimeInterval = TimeSpan.FromMilliseconds(500);
-
- using (cache1.QueryContinuous(qry))
- {
- // Put from local node.
- cache1.GetAndPut(key1, Entry(key1));
- CheckCallbackSingle(key1, null, Entry(key1));
-
- // Put from remote node.
- cache1.GetAndPut(key2, Entry(key2));
- CheckNoCallback(100);
- CheckCallbackSingle(key2, null, Entry(key2), 1000);
- }
- }
-
- /// <summary>
- /// Test whether nested Ignite API call from callback works fine.
- /// </summary>
- [Test]
- public void TestNestedCallFromCallback()
- {
- var cache = cache1.WithKeepPortable<int, IPortableObject>();
-
- int key = PrimaryKey(cache1);
-
- NestedCallListener cb = new NestedCallListener();
-
- using (cache.QueryContinuous(new ContinuousQuery<int, IPortableObject>(cb)))
- {
- cache1.GetAndPut(key, Entry(key));
-
- cb.countDown.Wait();
- }
-
- cache.Remove(key);
- }
-
- /// <summary>
- /// Tests the initial query.
- /// </summary>
- [Test]
- public void TestInitialQuery()
- {
- // Scan query, GetAll
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.GetAll());
-
- // Scan query, iterator
- TestInitialQuery(new ScanQuery<int, PortableEntry>(new InitialQueryScanFilter()), cur => cur.ToList());
-
- // Sql query, GetAll
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.GetAll());
-
- // Sql query, iterator
- TestInitialQuery(new SqlQuery(typeof(PortableEntry), "val < 33"), cur => cur.ToList());
-
- // Text query, GetAll
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.GetAll());
-
- // Text query, iterator
- TestInitialQuery(new TextQuery(typeof(PortableEntry), "1*"), cur => cur.ToList());
-
- // Test exception: invalid initial query
- var ex = Assert.Throws<IgniteException>(
- () => TestInitialQuery(new TextQuery(typeof (PortableEntry), "*"), cur => cur.GetAll()));
-
- Assert.AreEqual("Cannot parse '*': '*' or '?' not allowed as first character in WildcardQuery", ex.Message);
- }
-
- /// <summary>
- /// Tests the initial query.
- /// </summary>
- private void TestInitialQuery(QueryBase initialQry, Func<IQueryCursor<ICacheEntry<int, PortableEntry>>,
- IEnumerable<ICacheEntry<int, PortableEntry>>> getAllFunc)
- {
- var qry = new ContinuousQuery<int, PortableEntry>(new Listener<PortableEntry>());
-
- cache1.Put(11, Entry(11));
- cache1.Put(12, Entry(12));
- cache1.Put(33, Entry(33));
-
- try
- {
- IContinuousQueryHandle<ICacheEntry<int, PortableEntry>> contQry;
-
- using (contQry = cache1.QueryContinuous(qry, initialQry))
- {
- // Check initial query
- var initialEntries =
- getAllFunc(contQry.GetInitialQueryCursor()).Distinct().OrderBy(x => x.Key).ToList();
-
- Assert.Throws<InvalidOperationException>(() => contQry.GetInitialQueryCursor());
-
- Assert.AreEqual(2, initialEntries.Count);
-
- for (int i = 0; i < initialEntries.Count; i++)
- {
- Assert.AreEqual(i + 11, initialEntries[i].Key);
- Assert.AreEqual(i + 11, initialEntries[i].Value.val);
- }
-
- // Check continuous query
- cache1.Put(44, Entry(44));
- CheckCallbackSingle(44, null, Entry(44));
- }
-
- Assert.Throws<ObjectDisposedException>(() => contQry.GetInitialQueryCursor());
-
- contQry.Dispose(); // multiple dispose calls are ok
- }
- finally
- {
- cache1.Clear();
- }
- }
-
- /// <summary>
- /// Check single filter event.
- /// </summary>
- /// <param name="expKey">Expected key.</param>
- /// <param name="expOldVal">Expected old value.</param>
- /// <param name="expVal">Expected value.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
- {
- CheckFilterSingle(expKey, expOldVal, expVal, 1000);
- }
-
- /// <summary>
- /// Check single filter event.
- /// </summary>
- /// <param name="expKey">Expected key.</param>
- /// <param name="expOldVal">Expected old value.</param>
- /// <param name="expVal">Expected value.</param>
- /// <param name="timeout">Timeout.</param>
- private void CheckFilterSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
- {
- FilterEvent evt;
-
- Assert.IsTrue(FILTER_EVTS.TryTake(out evt, timeout));
-
- Assert.AreEqual(expKey, evt.entry.Key);
- Assert.AreEqual(expOldVal, evt.entry.OldValue);
- Assert.AreEqual(expVal, evt.entry.Value);
- }
-
- /// <summary>
- /// Ensure that no filter events are logged.
- /// </summary>
- /// <param name="timeout">Timeout.</param>
- private void CheckNoFilter(int timeout)
- {
- FilterEvent evt;
-
- Assert.IsFalse(FILTER_EVTS.TryTake(out evt, timeout));
- }
-
- /// <summary>
- /// Check single callback event.
- /// </summary>
- /// <param name="expKey">Expected key.</param>
- /// <param name="expOldVal">Expected old value.</param>
- /// <param name="expVal">Expected new value.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal)
- {
- CheckCallbackSingle(expKey, expOldVal, expVal, 1000);
- }
-
- /// <summary>
- /// Check single callback event.
- /// </summary>
- /// <param name="expKey">Expected key.</param>
- /// <param name="expOldVal">Expected old value.</param>
- /// <param name="expVal">Expected new value.</param>
- /// <param name="timeout">Timeout.</param>
- private void CheckCallbackSingle(int expKey, PortableEntry expOldVal, PortableEntry expVal, int timeout)
- {
- CallbackEvent evt;
-
- Assert.IsTrue(CB_EVTS.TryTake(out evt, timeout));
-
- Assert.AreEqual(1, evt.entries.Count);
-
- Assert.AreEqual(expKey, evt.entries.First().Key);
- Assert.AreEqual(expOldVal, evt.entries.First().OldValue);
- Assert.AreEqual(expVal, evt.entries.First().Value);
- }
-
- /// <summary>
- /// Ensure that no callback events are logged.
- /// </summary>
- /// <param name="timeout">Timeout.</param>
- private void CheckNoCallback(int timeout)
- {
- CallbackEvent evt;
-
- Assert.IsFalse(CB_EVTS.TryTake(out evt, timeout));
- }
-
- /// <summary>
- /// Craate entry.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <returns>Entry.</returns>
- private static PortableEntry Entry(int val)
- {
- return new PortableEntry(val);
- }
-
- /// <summary>
- /// Get primary key for cache.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <returns>Primary key.</returns>
- private static int PrimaryKey<T>(ICache<int, T> cache)
- {
- return PrimaryKeys(cache, 1)[0];
- }
-
- /// <summary>
- /// Get primary keys for cache.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <param name="cnt">Amount of keys.</param>
- /// <param name="startFrom">Value to start from.</param>
- /// <returns></returns>
- private static List<int> PrimaryKeys<T>(ICache<int, T> cache, int cnt, int startFrom = 0)
- {
- IClusterNode node = cache.Ignite.GetCluster().GetLocalNode();
-
- ICacheAffinity aff = cache.Ignite.GetAffinity(cache.Name);
-
- List<int> keys = new List<int>(cnt);
-
- for (int i = startFrom; i < startFrom + 100000; i++)
- {
- if (aff.IsPrimary(node, i))
- {
- keys.Add(i);
-
- if (keys.Count == cnt)
- return keys;
- }
- }
-
- Assert.Fail("Failed to find " + cnt + " primary keys.");
-
- return null;
- }
-
- /// <summary>
- /// Portable entry.
- /// </summary>
- public class PortableEntry
- {
- /** Value. */
- public readonly int val;
-
- /** <inheritDot /> */
- public override int GetHashCode()
- {
- return val;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="val">Value.</param>
- public PortableEntry(int val)
- {
- this.val = val;
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- return obj != null && obj is PortableEntry && ((PortableEntry)obj).val == val;
- }
- }
-
- /// <summary>
- /// Abstract filter.
- /// </summary>
- [Serializable]
- public abstract class AbstractFilter<V> : ICacheEntryEventFilter<int, V>
- {
- /** Result. */
- public static volatile bool res = true;
-
- /** Throw error on invocation. */
- public static volatile bool err;
-
- /** Throw error during marshalling. */
- public static volatile bool marshErr;
-
- /** Throw error during unmarshalling. */
- public static volatile bool unmarshErr;
-
- /** Grid. */
- [InstanceResource]
- public IIgnite ignite;
-
- /** <inheritDoc /> */
- public bool Evaluate(ICacheEntryEvent<int, V> evt)
- {
- if (err)
- throw new Exception("Filter error.");
-
- FILTER_EVTS.Add(new FilterEvent(ignite,
- CQU.CreateEvent<object, object>(evt.Key, evt.OldValue, evt.Value)));
-
- return res;
- }
- }
-
- /// <summary>
- /// Filter which cannot be serialized.
- /// </summary>
- public class LocalFilter : AbstractFilter<PortableEntry>
- {
- // No-op.
- }
-
- /// <summary>
- /// Portable filter.
- /// </summary>
- public class PortableFilter : AbstractFilter<PortableEntry>, IPortableMarshalAware
- {
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- if (marshErr)
- throw new Exception("Filter marshalling error.");
- }
-
- /** <inheritDoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- if (unmarshErr)
- throw new Exception("Filter unmarshalling error.");
- }
- }
-
- /// <summary>
- /// Serializable filter.
- /// </summary>
- [Serializable]
- public class SerializableFilter : AbstractFilter<PortableEntry>, ISerializable
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public SerializableFilter()
- {
- // No-op.
- }
-
- /// <summary>
- /// Serialization constructor.
- /// </summary>
- /// <param name="info">Info.</param>
- /// <param name="context">Context.</param>
- protected SerializableFilter(SerializationInfo info, StreamingContext context)
- {
- if (unmarshErr)
- throw new Exception("Filter unmarshalling error.");
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- if (marshErr)
- throw new Exception("Filter marshalling error.");
- }
- }
-
- /// <summary>
- /// Filter for "keep-portable" scenario.
- /// </summary>
- public class KeepPortableFilter : AbstractFilter<IPortableObject>
- {
- // No-op.
- }
-
- /// <summary>
- /// Listener.
- /// </summary>
- public class Listener<V> : ICacheEntryEventListener<int, V>
- {
- [InstanceResource]
- public IIgnite ignite;
-
- /** <inheritDoc /> */
- public void OnEvent(IEnumerable<ICacheEntryEvent<int, V>> evts)
- {
- ICollection<ICacheEntryEvent<object, object>> entries0 =
- new List<ICacheEntryEvent<object, object>>();
-
- foreach (ICacheEntryEvent<int, V> evt in evts)
- entries0.Add(CQU.CreateEvent<object, object>(evt.Key, evt.OldValue, evt.Value));
-
- CB_EVTS.Add(new CallbackEvent(entries0));
- }
- }
-
- /// <summary>
- /// Listener with nested Ignite API call.
- /// </summary>
- public class NestedCallListener : ICacheEntryEventListener<int, IPortableObject>
- {
- /** Event. */
- public readonly CountdownEvent countDown = new CountdownEvent(1);
-
- public void OnEvent(IEnumerable<ICacheEntryEvent<int, IPortableObject>> evts)
- {
- foreach (ICacheEntryEvent<int, IPortableObject> evt in evts)
- {
- IPortableObject val = evt.Value;
-
- IPortableMetadata meta = val.GetMetadata();
-
- Assert.AreEqual(typeof(PortableEntry).Name, meta.TypeName);
- }
-
- countDown.Signal();
- }
- }
-
- /// <summary>
- /// Filter event.
- /// </summary>
- public class FilterEvent
- {
- /** Grid. */
- public IIgnite ignite;
-
- /** Entry. */
- public ICacheEntryEvent<object, object> entry;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ignite">Grid.</param>
- /// <param name="entry">Entry.</param>
- public FilterEvent(IIgnite ignite, ICacheEntryEvent<object, object> entry)
- {
- this.ignite = ignite;
- this.entry = entry;
- }
- }
-
- /// <summary>
- /// Callbakc event.
- /// </summary>
- public class CallbackEvent
- {
- /** Entries. */
- public ICollection<ICacheEntryEvent<object, object>> entries;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="entries">Entries.</param>
- public CallbackEvent(ICollection<ICacheEntryEvent<object, object>> entries)
- {
- this.entries = entries;
- }
- }
-
- /// <summary>
- /// ScanQuery filter for InitialQuery test.
- /// </summary>
- [Serializable]
- private class InitialQueryScanFilter : ICacheEntryFilter<int, PortableEntry>
- {
- /** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, PortableEntry> entry)
- {
- return entry.Key < 33;
- }
- }
- }
-}
-
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicBackupTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicBackupTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicBackupTest.cs
deleted file mode 100644
index ac44f10..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicBackupTest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- /// <summary>
- /// Continuous query tests for ATOMIC cache with backups.
- /// </summary>
- public class ContinuousQueryAtomiclBackupTest : ContinuousQueryAbstractTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ContinuousQueryAtomiclBackupTest() : base(CACHE_ATOMIC_BACKUP)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicNoBackupTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicNoBackupTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicNoBackupTest.cs
deleted file mode 100644
index 8e1a18f..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryAtomicNoBackupTest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- /// <summary>
- /// Continuous query tests for ATOMIC cache with no backups.
- /// </summary>
- public class ContinuousQueryAtomiclNoBackupTest : ContinuousQueryNoBackupAbstractTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ContinuousQueryAtomiclNoBackupTest()
- : base(CACHE_ATOMIC_NO_BACKUP)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
deleted file mode 100644
index aa7d627..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryNoBackupAbstractTest.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for ocntinuous query when there are no backups.
- /// </summary>
- public abstract class ContinuousQueryNoBackupAbstractTest : ContinuousQueryAbstractTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cacheName">Cache name.</param>
- protected ContinuousQueryNoBackupAbstractTest(string cacheName) : base(cacheName)
- {
- // No-op.
- }
-
- /// <summary>
- /// Test regular callback operations for local query.
- /// </summary>
- [Test]
- public void TestCallbackLocal()
- {
- CheckCallback(true);
- }
-
- /// <summary>
- /// Test portable filter logic.
- /// </summary>
- [Test]
- public void TestFilterPortableLocal()
- {
- CheckFilter(true, true);
- }
-
- /// <summary>
- /// Test serializable filter logic.
- /// </summary>
- [Test]
- public void TestFilterSerializableLocal()
- {
- CheckFilter(false, true);
- }
-
- /// <summary>
- /// Test non-serializable filter for local query.
- /// </summary>
- [Test]
- public void TestFilterNonSerializableLocal()
- {
- CheckFilterNonSerializable(true);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalBackupTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalBackupTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalBackupTest.cs
deleted file mode 100644
index 08ae88c..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalBackupTest.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- /// <summary>
- /// Continuous query tests for TRANSACTIONAL cache with backups.
- /// </summary>
- public class ContinuousQueryTransactionalBackupTest : ContinuousQueryAbstractTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ContinuousQueryTransactionalBackupTest()
- : base(CACHE_TX_BACKUP)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalNoBackupTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalNoBackupTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalNoBackupTest.cs
deleted file mode 100644
index 685f7b4..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Query/Continuous/ContinuousQueryTransactionalNoBackupTest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Query.Continuous
-{
- /// <summary>
- /// Continuous query tests for TRANSACTIONAL cache with no backups.
- /// </summary>
- public class ContinuousQueryTransactionalNoBackupTest : ContinuousQueryNoBackupAbstractTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ContinuousQueryTransactionalNoBackupTest() : base(CACHE_TX_NO_BACKUP)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
deleted file mode 100644
index a7d9adb..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheParallelLoadStoreTest.cs
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Store
-{
- using System;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Portable;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for GridCacheParallelLoadStoreAdapter.
- /// </summary>
- public class CacheParallelLoadStoreTest
- {
- // object store name
- private const string ObjectStoreCacheName = "object_store_parallel";
-
- /// <summary>
- /// Set up test class.
- /// </summary>
- [TestFixtureSetUp]
- public virtual void BeforeTests()
- {
- TestUtils.KillProcesses();
- TestUtils.JvmDebug = true;
-
- Ignition.Start(new IgniteConfiguration
- {
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- SpringConfigUrl = "config\\native-client-test-cache-parallel-store.xml",
- PortableConfiguration = new PortableConfiguration
- {
- Types = new[] {typeof (CacheTestParallelLoadStore.Record).FullName}
- }
- });
- }
-
- /// <summary>
- /// Tear down test class.
- /// </summary>
- [TestFixtureTearDown]
- public virtual void AfterTests()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Test setup.
- /// </summary>
- [SetUp]
- public void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- /// Tests the LoadCache.
- /// </summary>
- [Test]
- public void TestLoadCache()
- {
- var cache = GetCache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- const int minId = 113;
- const int expectedItemCount = CacheTestParallelLoadStore.InputDataLength - minId;
-
- CacheTestParallelLoadStore.ResetCounters();
-
- cache.LocalLoadCache(null, minId);
-
- Assert.AreEqual(expectedItemCount, cache.GetSize());
-
- // check items presence; increment by 100 to speed up the test
- for (var i = minId; i < expectedItemCount; i += 100)
- {
- var rec = cache.Get(i);
- Assert.AreEqual(i, rec.Id);
- }
-
- // check that items were processed in parallel
- Assert.GreaterOrEqual(CacheTestParallelLoadStore.UniqueThreadCount, Environment.ProcessorCount);
- }
-
- /// <summary>
- /// Gets the cache.
- /// </summary>
- private static ICache<int, CacheTestParallelLoadStore.Record> GetCache()
- {
- return Ignition.GetIgnite().GetCache<int, CacheTestParallelLoadStore.Record>(ObjectStoreCacheName);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
deleted file mode 100644
index 137215e..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreSessionTest.cs
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Store
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for store session.
- /// </summary>
- public class CacheStoreSessionTest
- {
- /** Grid name. */
- private const string IgniteName = "grid";
-
- /** Cache 1 name. */
- private const string Cache1 = "cache1";
-
- /** Cache 2 name. */
- private const string Cache2 = "cache2";
-
- /** Operations. */
- private static ConcurrentBag<ICollection<Operation>> _dumps;
-
- /// <summary>
- /// Set up routine.
- /// </summary>
- [TestFixtureSetUp]
- public virtual void BeforeTests()
- {
- //TestUtils.JVM_DEBUG = true;
-
- TestUtils.KillProcesses();
-
- TestUtils.JvmDebug = true;
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx
- {
- GridName = IgniteName,
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- SpringConfigUrl = @"config\cache\store\cache-store-session.xml"
- };
-
-
- Ignition.Start(cfg);
- }
-
- /// <summary>
- /// Tear down routine.
- /// </summary>
- [TestFixtureTearDown]
- public virtual void AfterTests()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Test basic session API.
- /// </summary>
- [Test]
- public void TestSession()
- {
- _dumps = new ConcurrentBag<ICollection<Operation>>();
-
- var ignite = Ignition.GetIgnite(IgniteName);
-
- var cache1 = Ignition.GetIgnite(IgniteName).GetCache<int, int>(Cache1);
- var cache2 = Ignition.GetIgnite(IgniteName).GetCache<int, int>(Cache2);
-
- // 1. Test rollback.
- using (var tx = ignite.GetTransactions().TxStart())
- {
- cache1.Put(1, 1);
- cache2.Put(2, 2);
-
- tx.Rollback();
- }
-
- Assert.AreEqual(1, _dumps.Count);
- var ops = _dumps.First();
- Assert.AreEqual(1, ops.Count);
-
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.SesEnd && !op.Commit));
-
- _dumps = new ConcurrentBag<ICollection<Operation>>();
-
- // 2. Test puts.
- using (var tx = ignite.GetTransactions().TxStart())
- {
- cache1.Put(1, 1);
- cache2.Put(2, 2);
-
- tx.Commit();
- }
-
- Assert.AreEqual(1, _dumps.Count);
- ops = _dumps.First();
- Assert.AreEqual(3, ops.Count);
-
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.Write && Cache1.Equals(op.CacheName) && 1.Equals(op.Key) && 1.Equals(op.Value)));
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.Write && Cache2.Equals(op.CacheName) && 2.Equals(op.Key) && 2.Equals(op.Value)));
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.SesEnd && op.Commit));
-
- _dumps = new ConcurrentBag<ICollection<Operation>>();
-
- // 3. Test removes.
- using (var tx = ignite.GetTransactions().TxStart())
- {
- cache1.Remove(1);
- cache2.Remove(2);
-
- tx.Commit();
- }
-
- Assert.AreEqual(1, _dumps.Count);
- ops = _dumps.First();
- Assert.AreEqual(3, ops.Count);
-
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.Delete && Cache1.Equals(op.CacheName) && 1.Equals(op.Key)));
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.Delete && Cache2.Equals(op.CacheName) && 2.Equals(op.Key)));
- Assert.AreEqual(1, ops.Count(op => op.Type == OperationType.SesEnd && op.Commit));
- }
-
- /// <summary>
- /// Dump operations.
- /// </summary>
- /// <param name="dump">Dump.</param>
- internal static void DumpOperations(ICollection<Operation> dump)
- {
- _dumps.Add(dump);
- }
-
- /// <summary>
- /// Test store implementation.
- /// </summary>
- public class Store : CacheStoreAdapter
- {
- /** Store session. */
- [StoreSessionResource]
-#pragma warning disable 649
- private ICacheStoreSession _ses;
-#pragma warning restore 649
-
- /** <inheritdoc /> */
- public override object Load(object key)
- {
- throw new NotImplementedException();
- }
-
- /** <inheritdoc /> */
- public override void Write(object key, object val)
- {
- GetOperations().Add(new Operation(_ses.CacheName, OperationType.Write, (int)key, (int)val));
- }
-
- /** <inheritdoc /> */
- public override void Delete(object key)
- {
- GetOperations().Add(new Operation(_ses.CacheName, OperationType.Delete, (int)key, 0));
- }
-
- /** <inheritdoc /> */
- public override void SessionEnd(bool commit)
- {
- Operation op = new Operation(_ses.CacheName, OperationType.SesEnd) { Commit = commit };
-
- ICollection<Operation> ops = GetOperations();
-
- ops.Add(op);
-
- DumpOperations(ops);
- }
-
- /// <summary>
- /// Get collection with operations.
- /// </summary>
- /// <returns>Operations.</returns>
- private ICollection<Operation> GetOperations()
- {
- object ops;
-
- if (!_ses.Properties.TryGetValue("ops", out ops))
- {
- ops = new List<Operation>();
-
- _ses.Properties["ops"] = ops;
- }
-
- return (ICollection<Operation>) ops;
- }
- }
-
- /// <summary>
- /// Logged operation.
- /// </summary>
- internal class Operation
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cacheName">Cache name.</param>
- /// <param name="type">Operation type.</param>
- public Operation(string cacheName, OperationType type)
- {
- CacheName = cacheName;
- Type = type;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cacheName">Cache name.</param>
- /// <param name="type">Operation type.</param>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- public Operation(string cacheName, OperationType type, int key, int val) : this(cacheName, type)
- {
- Key = key;
- Value = val;
- }
-
- /// <summary>
- /// Cache name.
- /// </summary>
- public string CacheName { get; set; }
-
- /// <summary>
- /// Operation type.
- /// </summary>
- public OperationType Type { get; set; }
-
- /// <summary>
- /// Key.
- /// </summary>
- public int Key { get; set; }
-
- /// <summary>
- /// Value.
- /// </summary>
- public int Value { get; set; }
-
- /// <summary>
- /// Commit flag.
- /// </summary>
- public bool Commit { get; set; }
- }
-
- /// <summary>
- /// Operation types.
- /// </summary>
- internal enum OperationType
- {
- /** Write. */
- Write,
-
- /** Delete. */
- Delete,
-
- /** Session end. */
- SesEnd
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
deleted file mode 100644
index bfafcf4..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheStoreTest.cs
+++ /dev/null
@@ -1,510 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Store
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using NUnit.Framework;
-
- /// <summary>
- ///
- /// </summary>
- class Key
- {
- private readonly int _idx;
-
- public Key(int idx)
- {
- _idx = idx;
- }
-
- public int Index()
- {
- return _idx;
- }
-
- public override bool Equals(object obj)
- {
- if (obj == null || obj.GetType() != GetType())
- return false;
-
- Key key = (Key)obj;
-
- return key._idx == _idx;
- }
-
- public override int GetHashCode()
- {
- return _idx;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class Value
- {
- private int _idx;
-
- public Value(int idx)
- {
- _idx = idx;
- }
-
- public int Index()
- {
- return _idx;
- }
- }
-
- /// <summary>
- /// Cache entry predicate.
- /// </summary>
- [Serializable]
- public class CacheEntryFilter : ICacheEntryFilter<int, string>
- {
- /** <inheritdoc /> */
- public bool Invoke(ICacheEntry<int, string> entry)
- {
- return entry.Key >= 105;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class CacheStoreTest
- {
- /** */
- private const string PortableStoreCacheName = "portable_store";
-
- /** */
- private const string ObjectStoreCacheName = "object_store";
-
- /** */
- private const string CustomStoreCacheName = "custom_store";
-
- /** */
- private const string TemplateStoreCacheName = "template_store*";
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public void BeforeTests()
- {
- //TestUtils.JVM_DEBUG = true;
-
- TestUtils.KillProcesses();
-
- TestUtils.JvmDebug = true;
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- cfg.GridName = GridName();
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = "config\\native-client-test-cache-store.xml";
-
- PortableConfiguration portCfg = new PortableConfiguration();
-
- portCfg.Types = new List<string> { typeof(Key).FullName, typeof(Value).FullName };
-
- cfg.PortableConfiguration = portCfg;
-
- Ignition.Start(cfg);
- }
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureTearDown]
- public virtual void AfterTests()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- ///
- /// </summary>
- [SetUp]
- public void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- ///
- /// </summary>
- [TearDown]
- public void AfterTest()
- {
- var cache = Cache();
-
- cache.Clear();
-
- Assert.IsTrue(cache.IsEmpty(), "Cache is not empty: " + cache.GetSize());
-
- CacheTestStore.Reset();
-
- Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
- }
-
- [Test]
- public void TestLoadCache()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.LoadCache(new CacheEntryFilter(), 100, 10);
-
- Assert.AreEqual(5, cache.GetSize());
-
- for (int i = 105; i < 110; i++)
- Assert.AreEqual("val_" + i, cache.Get(i));
- }
-
- [Test]
- public void TestLocalLoadCache()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.LocalLoadCache(new CacheEntryFilter(), 100, 10);
-
- Assert.AreEqual(5, cache.GetSize());
-
- for (int i = 105; i < 110; i++)
- Assert.AreEqual("val_" + i, cache.Get(i));
- }
-
- [Test]
- public void TestLoadCacheMetadata()
- {
- CacheTestStore.LoadObjects = true;
-
- var cache = Cache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.LocalLoadCache(null, 0, 3);
-
- Assert.AreEqual(3, cache.GetSize());
-
- var meta = cache.WithKeepPortable<Key, IPortableObject>().Get(new Key(0)).GetMetadata();
-
- Assert.NotNull(meta);
-
- Assert.AreEqual("Value", meta.TypeName);
- }
-
- [Test]
- public void TestLoadCacheAsync()
- {
- var cache = Cache().WithAsync();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.LocalLoadCache(new CacheEntryFilter(), 100, 10);
-
- var fut = cache.GetFuture<object>();
-
- fut.Get();
-
- Assert.IsTrue(fut.IsDone);
-
- cache.GetSize();
- Assert.AreEqual(5, cache.GetFuture<int>().ToTask().Result);
-
- for (int i = 105; i < 110; i++)
- {
- cache.Get(i);
-
- Assert.AreEqual("val_" + i, cache.GetFuture<string>().ToTask().Result);
- }
- }
-
- [Test]
- public void TestPutLoad()
- {
- var cache = Cache();
-
- cache.Put(1, "val");
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(1, map.Count);
-
- cache.LocalEvict(new[] { 1 });
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual("val", cache.Get(1));
-
- Assert.AreEqual(1, cache.GetSize());
- }
-
- [Test]
- public void TestPutLoadPortables()
- {
- var cache = PortableStoreCache<int, Value>();
-
- cache.Put(1, new Value(1));
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(1, map.Count);
-
- IPortableObject v = (IPortableObject)map[1];
-
- Assert.AreEqual(1, v.GetField<int>("_idx"));
-
- cache.LocalEvict(new[] { 1 });
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(1, cache.Get(1).Index());
-
- Assert.AreEqual(1, cache.GetSize());
- }
-
- [Test]
- public void TestPutLoadObjects()
- {
- var cache = ObjectStoreCache<int, Value>();
-
- cache.Put(1, new Value(1));
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(1, map.Count);
-
- Value v = (Value)map[1];
-
- Assert.AreEqual(1, v.Index());
-
- cache.LocalEvict(new[] { 1 });
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(1, cache.Get(1).Index());
-
- Assert.AreEqual(1, cache.GetSize());
- }
-
- [Test]
- public void TestPutLoadAll()
- {
- var putMap = new Dictionary<int, string>();
-
- for (int i = 0; i < 10; i++)
- putMap.Add(i, "val_" + i);
-
- var cache = Cache();
-
- cache.PutAll(putMap);
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(10, map.Count);
-
- for (int i = 0; i < 10; i++)
- Assert.AreEqual("val_" + i, map[i]);
-
- cache.Clear();
-
- Assert.AreEqual(0, cache.GetSize());
-
- ICollection<int> keys = new List<int>();
-
- for (int i = 0; i < 10; i++)
- keys.Add(i);
-
- IDictionary<int, string> loaded = cache.GetAll(keys);
-
- Assert.AreEqual(10, loaded.Count);
-
- for (int i = 0; i < 10; i++)
- Assert.AreEqual("val_" + i, loaded[i]);
-
- Assert.AreEqual(10, cache.GetSize());
- }
-
- [Test]
- public void TestRemove()
- {
- var cache = Cache();
-
- for (int i = 0; i < 10; i++)
- cache.Put(i, "val_" + i);
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(10, map.Count);
-
- for (int i = 0; i < 5; i++)
- cache.Remove(i);
-
- Assert.AreEqual(5, map.Count);
-
- for (int i = 5; i < 10; i++)
- Assert.AreEqual("val_" + i, map[i]);
- }
-
- [Test]
- public void TestRemoveAll()
- {
- var cache = Cache();
-
- for (int i = 0; i < 10; i++)
- cache.Put(i, "val_" + i);
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(10, map.Count);
-
- cache.RemoveAll(new List<int> { 0, 1, 2, 3, 4 });
-
- Assert.AreEqual(5, map.Count);
-
- for (int i = 5; i < 10; i++)
- Assert.AreEqual("val_" + i, map[i]);
- }
-
- [Test]
- public void TestTx()
- {
- var cache = Cache();
-
- using (var tx = cache.Ignite.GetTransactions().TxStart())
- {
- CacheTestStore.ExpCommit = true;
-
- tx.AddMeta("meta", 100);
-
- cache.Put(1, "val");
-
- tx.Commit();
- }
-
- IDictionary map = StoreMap();
-
- Assert.AreEqual(1, map.Count);
-
- Assert.AreEqual("val", map[1]);
- }
-
- [Test]
- public void TestLoadCacheMultithreaded()
- {
- CacheTestStore.LoadMultithreaded = true;
-
- var cache = Cache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.LocalLoadCache(null, 0, null);
-
- Assert.AreEqual(1000, cache.GetSize());
-
- for (int i = 0; i < 1000; i++)
- Assert.AreEqual("val_" + i, cache.Get(i));
- }
-
- [Test]
- public void TestCustomStoreProperties()
- {
- var cache = CustomStoreCache();
- Assert.IsNotNull(cache);
-
- Assert.AreEqual(42, CacheTestStore.intProperty);
- Assert.AreEqual("String value", CacheTestStore.stringProperty);
- }
-
- [Test]
- public void TestDynamicStoreStart()
- {
- var cache = TemplateStoreCache();
-
- Assert.IsNotNull(cache);
-
- cache.Put(1, cache.Name);
-
- Assert.AreEqual(cache.Name, CacheTestStore.Map[1]);
- }
-
- /// <summary>
- /// Get's grid name for this test.
- /// </summary>
- /// <returns>Grid name.</returns>
- protected virtual string GridName()
- {
- return null;
- }
-
- private IDictionary StoreMap()
- {
- return CacheTestStore.Map;
- }
-
- private ICache<int, string> Cache()
- {
- return PortableStoreCache<int, string>();
- }
-
- private ICache<TK, TV> PortableStoreCache<TK, TV>()
- {
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(PortableStoreCacheName);
- }
-
- private ICache<TK, TV> ObjectStoreCache<TK, TV>()
- {
- return Ignition.GetIgnite(GridName()).GetCache<TK, TV>(ObjectStoreCacheName);
- }
-
- private ICache<int, string> CustomStoreCache()
- {
- return Ignition.GetIgnite(GridName()).GetCache<int, string>(CustomStoreCacheName);
- }
-
- private ICache<int, string> TemplateStoreCache()
- {
- var cacheName = TemplateStoreCacheName.Replace("*", Guid.NewGuid().ToString());
-
- return Ignition.GetIgnite(GridName()).GetOrCreateCache<int, string>(cacheName);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class NamedNodeCacheStoreTest : CacheStoreTest
- {
- /** <inheritDoc /> */
- protected override string GridName()
- {
- return "name";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
deleted file mode 100644
index 770ca83..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestParallelLoadStore.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Store
-{
- using System.Collections;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using Apache.Ignite.Core.Cache.Store;
-
- /// <summary>
- /// Test cache store with parallel load.
- /// </summary>
- public class CacheTestParallelLoadStore : CacheParallelLoadStoreAdapter
- {
- /** Length of input data sequence */
- public const int InputDataLength = 10000;
-
- /** list of thread ids where Parse has been executed */
- private static readonly ConcurrentDictionary<int, int> ThreadIds = new ConcurrentDictionary<int, int>();
-
- /// <summary>
- /// Gets the count of unique threads that entered Parse method.
- /// </summary>
- public static int UniqueThreadCount
- {
- get { return ThreadIds.Count; }
- }
-
- /// <summary>
- /// Resets the test counters.
- /// </summary>
- public static void ResetCounters()
- {
- ThreadIds.Clear();
- }
-
- /** <inheritdoc /> */
- protected override IEnumerable GetInputData()
- {
- return Enumerable.Range(0, InputDataLength).Select(x => new Record {Id = x, Name = "Test Record " + x});
- }
-
- /** <inheritdoc /> */
- protected override KeyValuePair<object, object>? Parse(object inputRecord, params object[] args)
- {
- var threadId = Thread.CurrentThread.ManagedThreadId;
- ThreadIds.GetOrAdd(threadId, threadId);
-
- var minId = (int)args[0];
-
- var rec = (Record)inputRecord;
-
- return rec.Id >= minId
- ? new KeyValuePair<object, object>(rec.Id, rec)
- : (KeyValuePair<object, object>?) null;
- }
-
- /// <summary>
- /// Test store record.
- /// </summary>
- public class Record
- {
- /// <summary>
- /// Gets or sets the identifier.
- /// </summary>
- public int Id { get; set; }
-
- /// <summary>
- /// Gets or sets the name.
- /// </summary>
- public string Name { get; set; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
deleted file mode 100644
index 9c381cb..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/Store/CacheTestStore.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache.Store
-{
- using System;
- using System.Collections;
- using System.Collections.Concurrent;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Threading;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Resource;
-
- [SuppressMessage("ReSharper", "FieldCanBeMadeReadOnly.Local")]
- public class CacheTestStore : ICacheStore
- {
- public static readonly IDictionary Map = new ConcurrentDictionary<object, object>();
-
- public static bool ExpCommit;
-
- public static bool LoadMultithreaded;
-
- public static bool LoadObjects;
-
- [InstanceResource]
- private IIgnite _grid = null;
-
- [StoreSessionResource]
-#pragma warning disable 649
- private ICacheStoreSession _ses;
-#pragma warning restore 649
-
- public static int intProperty;
-
- public static string stringProperty;
-
- public static void Reset()
- {
- Map.Clear();
-
- ExpCommit = false;
- LoadMultithreaded = false;
- LoadObjects = false;
- }
-
- public void LoadCache(Action<object, object> act, params object[] args)
- {
- Debug.Assert(_grid != null);
-
- if (LoadMultithreaded)
- {
- int cnt = 0;
-
- TestUtils.RunMultiThreaded(() => {
- int i;
-
- while ((i = Interlocked.Increment(ref cnt) - 1) < 1000)
- act(i, "val_" + i);
- }, 8);
- }
- else
- {
- int start = (int)args[0];
- int cnt = (int)args[1];
-
- for (int i = start; i < start + cnt; i++)
- {
- if (LoadObjects)
- act(new Key(i), new Value(i));
- else
- act(i, "val_" + i);
- }
- }
- }
-
- public object Load(object key)
- {
- Debug.Assert(_grid != null);
-
- return Map[key];
- }
-
- public IDictionary LoadAll(ICollection keys)
- {
- Debug.Assert(_grid != null);
-
- return keys.OfType<object>().ToDictionary(key => key, Load);
- }
-
- public void Write(object key, object val)
- {
- Debug.Assert(_grid != null);
-
- Map[key] = val;
- }
-
- public void WriteAll(IDictionary map)
- {
- Debug.Assert(_grid != null);
-
- foreach (DictionaryEntry e in map)
- Map[e.Key] = e.Value;
- }
-
- public void Delete(object key)
- {
- Debug.Assert(_grid != null);
-
- Map.Remove(key);
- }
-
- public void DeleteAll(ICollection keys)
- {
- Debug.Assert(_grid != null);
-
- foreach (object key in keys)
- Map.Remove(key);
- }
-
- public void SessionEnd(bool commit)
- {
- Debug.Assert(_grid != null);
-
- Debug.Assert(_ses != null);
- }
-
- public int IntProperty
- {
- get { return intProperty; }
- set { intProperty = value; }
- }
-
- public string StringProperty
- {
- get { return stringProperty; }
- set { stringProperty = value; }
- }
- }
-}
[47/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/Makefile.am b/modules/platform/src/main/cpp/core-test/Makefile.am
deleted file mode 100644
index 9ed3111..0000000
--- a/modules/platform/src/main/cpp/core-test/Makefile.am
+++ /dev/null
@@ -1,49 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-SUBDIRS = . include
-DIST_SUBDIRS = . include
-
-AM_CPPFLAGS = -I$(srcdir)/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
-AM_CXXFLAGS = -Wall -std=c++0x
-
-noinst_PROGRAMS = ignite-tests
-
-ignite_tests_SOURCES = src/cache_test.cpp \
- src/cache_query_test.cpp \
- src/concurrent_test.cpp \
- src/ignition_test.cpp \
- src/handle_registry_test.cpp \
- src/portable_test_defs.cpp \
- src/portable_reader_writer_raw_test.cpp \
- src/portable_reader_writer_test.cpp \
- src/portable_session_test.cpp \
- src/teamcity_messages.cpp \
- src/teamcity_boost.cpp
-
-ignite_tests_LDFLAGS = -static-libtool-libs -L/usr/local/lib -lignite
-
-run-check: check
- ./ignite-tests -p
-
-clean-local: clean-check
- $(RM) *.gcno *.gcda
-
-clean-check:
- $(RM) $(ignite_tests_OBJECTS)
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/config/cache-query.xml b/modules/platform/src/main/cpp/core-test/config/cache-query.xml
deleted file mode 100644
index 160fe49..0000000
--- a/modules/platform/src/main/cpp/core-test/config/cache-query.xml
+++ /dev/null
@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Spring configuration file to startup grid cache.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
-
- <property name="affinity">
- <bean class="org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction">
- <property name="partitions" value="256"/>
- </bean>
- </property>
-
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="QueryPerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>name</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/config/cache-test.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/config/cache-test.xml b/modules/platform/src/main/cpp/core-test/config/cache-test.xml
deleted file mode 100644
index f239ba9..0000000
--- a/modules/platform/src/main/cpp/core-test/config/cache-test.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<!--
- Ignite Spring configuration file to startup grid cache.
--->
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean parent="cache-template">
- <property name="name" value="local"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="local_atomic"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="ATOMIC"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_atomic"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_near"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_atomic_near"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="replicated"/>
- <property name="cacheMode" value="REPLICATED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="replicated_atomic"/>
- <property name="cacheMode" value="REPLICATED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="transactionConfiguration">
- <bean class="org.apache.ignite.configuration.TransactionConfiguration">
- <property name="txSerializableEnabled" value="true"/>
- </bean>
- </property>
- </bean>
-
- <bean id="cache-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="rebalanceMode" value="SYNC"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="swapEnabled" value="true"/>
- <property name="backups" value="1"/>
- <property name="eagerTtl" value="true"/>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/configure.ac b/modules/platform/src/main/cpp/core-test/configure.ac
deleted file mode 100644
index b337fba..0000000
--- a/modules/platform/src/main/cpp/core-test/configure.ac
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# 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.
-#
-
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.69])
-AC_INIT([Apache Ignite C++ Test], [1.5.0], [dev@ignite.apache.org], [ignite], [ignite.apache.org])
-AC_CONFIG_SRCDIR(src)
-
-AC_CANONICAL_SYSTEM
-AC_CONFIG_MACRO_DIR([m4])
-AC_LANG([C++])
-
-# Initialize automake
-AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
-AC_CONFIG_HEADER(config.h)
-
-AM_PROG_AR
-
-# Checks for programs.
-GXX="-g -O2"
-
-AC_PROG_CXX
-
-# Initialize Libtool
-LT_INIT
-
-# Checks for libraries.
-AC_CHECK_LIB([pthread], [pthread_mutex_lock])
-
-# Checks for header files.
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_INLINE
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_INT8_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_FUNC_ERROR_AT_LINE
-
-AC_CONFIG_FILES(Makefile include/Makefile)
-
-AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/Makefile.am b/modules/platform/src/main/cpp/core-test/include/Makefile.am
deleted file mode 100644
index c43103e..0000000
--- a/modules/platform/src/main/cpp/core-test/include/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = teamcity_messages.h \
- ignite/portable_test_defs.h \
- ignite/portable_test_utils.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h b/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h
deleted file mode 100644
index bae0118..0000000
--- a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_defs.h
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * 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_PORTABLE_TEST_DEFS
-#define _IGNITE_PORTABLE_TEST_DEFS
-
-#include <stdexcept>
-#include <stdint.h>
-
-#include "ignite/portable/portable.h"
-
-namespace ignite_test
-{
- namespace core
- {
- namespace portable
- {
- class PortableDummy
- {
- // No-op.
- };
-
- class PortableInner
- {
- public:
- PortableInner();
-
- PortableInner(int32_t val);
-
- int32_t GetValue() const;
- private:
- int32_t val;
- };
-
- class PortableOuter
- {
- public:
- PortableOuter(int32_t valIn, int32_t valOut);
-
- PortableInner GetInner() const;
-
- int32_t GetValue() const;
- private:
- PortableInner inner;
- int32_t val;
- };
-
- struct PortableFields
- {
- int32_t val1;
- int32_t val2;
- int32_t rawVal1;
- int32_t rawVal2;
-
- PortableFields() : val1(0), val2(0), rawVal1(0), rawVal2(0)
- {
- // No-op.
- }
-
- PortableFields(int32_t val1, int32_t val2, int32_t rawVal1, int32_t rawVal2) :
- val1(val1), val2(val2), rawVal1(rawVal1), rawVal2(rawVal2)
- {
- // No-op.
- }
- };
- }
- }
-}
-
-namespace ignite
-{
- namespace portable
- {
- namespace gt = ignite_test::core::portable;
-
- template<>
- struct PortableType<gt::PortableDummy>
- {
- /** <inheritdoc /> */
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("PortableDummy");
- }
-
- /** <inheritdoc /> */
- std::string GetTypeName()
- {
- return "PortableDummy";
- }
-
- /** <inheritdoc /> */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /** <inheritdoc /> */
- int32_t GetHashCode(const gt::PortableInner& obj)
- {
- return obj.GetValue();
- }
-
- /** <inheritdoc /> */
- bool IsNull(const gt::PortableInner& obj)
- {
- return obj.GetValue() == 0;
- }
-
- /** <inheritdoc /> */
- gt::PortableInner GetNull()
- {
- return gt::PortableInner(0);
- }
-
- /** <inheritdoc /> */
- void Write(PortableWriter& writer, const gt::PortableDummy& obj)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- gt::PortableDummy Read(PortableReader& reader)
- {
- return gt::PortableDummy();
- }
- };
-
- template<>
- struct PortableType<gt::PortableInner>
- {
- /** <inheritdoc /> */
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("PortableInner");
- }
-
- /** <inheritdoc /> */
- std::string GetTypeName()
- {
- return "PortableInner";
- }
-
- /** <inheritdoc /> */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /** <inheritdoc /> */
- int32_t GetHashCode(const gt::PortableInner& obj)
- {
- return obj.GetValue();
- }
-
- /** <inheritdoc /> */
- bool IsNull(const gt::PortableInner& obj)
- {
- return obj.GetValue() == 0;
- }
-
- /** <inheritdoc /> */
- gt::PortableInner GetNull()
- {
- return gt::PortableInner(0);
- }
-
- /** <inheritdoc /> */
- void Write(PortableWriter& writer, const gt::PortableInner& obj)
- {
- writer.WriteInt32("val", obj.GetValue());
- }
-
- /** <inheritdoc /> */
- gt::PortableInner Read(PortableReader& reader)
- {
- int val = reader.ReadInt32("val");
-
- return gt::PortableInner(val);
- }
- };
-
- template<>
- struct PortableType<gt::PortableOuter>
- {
- /** <inheritdoc /> */
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("PortableOuter");
- }
-
- /** <inheritdoc /> */
- std::string GetTypeName()
- {
- return "PortableOuter";
- }
-
- /** <inheritdoc /> */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /** <inheritdoc /> */
- int32_t GetHashCode(const gt::PortableOuter& obj)
- {
- return obj.GetValue() + obj.GetInner().GetValue();
- }
-
- /** <inheritdoc /> */
- bool IsNull(const gt::PortableOuter& obj)
- {
- return obj.GetValue() == 0 && obj.GetInner().GetValue();
- }
-
- /** <inheritdoc /> */
- gt::PortableOuter GetNull()
- {
- return gt::PortableOuter(0, 0);
- }
-
- /** <inheritdoc /> */
- void Write(PortableWriter& writer, const gt::PortableOuter& obj)
- {
- writer.WriteObject("inner", obj.GetInner());
- writer.WriteInt32("val", obj.GetValue());
- }
-
- /** <inheritdoc /> */
- gt::PortableOuter Read(PortableReader& reader)
- {
- gt::PortableInner inner = reader.ReadObject<gt::PortableInner>("inner");
- int val = reader.ReadInt32("val");
-
- return gt::PortableOuter(inner.GetValue(), val);
- }
- };
-
- template<>
- struct PortableType<gt::PortableFields>
- {
- /** <inheritdoc /> */
- int32_t GetTypeId()
- {
- return GetPortableStringHashCode("PortableFields");
- }
-
- /** <inheritdoc /> */
- std::string GetTypeName()
- {
- return "PortableFields";
- }
-
- /** <inheritdoc /> */
- int32_t GetFieldId(const char* name)
- {
- return GetPortableStringHashCode(name);
- }
-
- /** <inheritdoc /> */
- int32_t GetHashCode(const gt::PortableFields& obj)
- {
- return obj.val1 + obj.val2 + obj.rawVal1 + obj.rawVal2;
- }
-
- /** <inheritdoc /> */
- bool IsNull(const gt::PortableFields& obj)
- {
- return false;
- }
-
- /** <inheritdoc /> */
- gt::PortableFields GetNull()
- {
- throw std::runtime_error("Must not be called.");
- }
-
- /** <inheritdoc /> */
- void Write(PortableWriter& writer, const gt::PortableFields& obj)
- {
- writer.WriteInt32("val1", obj.val1);
- writer.WriteInt32("val2", obj.val2);
-
- PortableRawWriter rawWriter = writer.RawWriter();
-
- rawWriter.WriteInt32(obj.rawVal1);
- rawWriter.WriteInt32(obj.rawVal2);
- }
-
- /** <inheritdoc /> */
- gt::PortableFields Read(PortableReader& reader)
- {
- int32_t val1 = reader.ReadInt32("val1");
- int32_t val2 = reader.ReadInt32("val2");
-
- PortableRawReader rawReader = reader.RawReader();
-
- int32_t rawVal1 = rawReader.ReadInt32();
- int32_t rawVal2 = rawReader.ReadInt32();
-
- return gt::PortableFields(val1, val2, rawVal1, rawVal2);
- }
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h b/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h
deleted file mode 100644
index 62f99f9..0000000
--- a/modules/platform/src/main/cpp/core-test/include/ignite/portable_test_utils.h
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- * 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_PORTABLE_TEST_UTILS
-#define _IGNITE_PORTABLE_TEST_UTILS
-
-#include "ignite/portable/portable.h"
-
-using namespace ignite;
-using namespace ignite::portable;
-using namespace ignite::impl::portable;
-
-namespace ignite_test
-{
- namespace core
- {
- namespace portable
- {
- template<typename T>
- inline void Write(PortableRawWriter& writer, T val)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<typename T>
- inline T Read(PortableRawReader& reader)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, int8_t val)
- {
- writer.WriteInt8(val);
- }
-
- template<>
- inline int8_t Read(PortableRawReader& reader)
- {
- return reader.ReadInt8();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, bool val)
- {
- writer.WriteBool(val);
- }
-
- template<>
- inline bool Read(PortableRawReader& reader)
- {
- return reader.ReadBool();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, int16_t val)
- {
- writer.WriteInt16(val);
- }
-
- template<>
- inline int16_t Read(PortableRawReader& reader)
- {
- return reader.ReadInt16();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, uint16_t val)
- {
- writer.WriteUInt16(val);
- }
-
- template<>
- inline uint16_t Read(PortableRawReader& reader)
- {
- return reader.ReadUInt16();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, int32_t val)
- {
- writer.WriteInt32(val);
- }
-
- template<>
- inline int32_t Read(PortableRawReader& reader)
- {
- return reader.ReadInt32();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, int64_t val)
- {
- writer.WriteInt64(val);
- }
-
- template<>
- inline int64_t Read(PortableRawReader& reader)
- {
- return reader.ReadInt64();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, float val)
- {
- writer.WriteFloat(val);
- }
-
- template<>
- inline float Read(PortableRawReader& reader)
- {
- return reader.ReadFloat();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, double val)
- {
- writer.WriteDouble(val);
- }
-
- template<>
- inline double Read(PortableRawReader& reader)
- {
- return reader.ReadDouble();
- }
-
- template<>
- inline void Write(PortableRawWriter& writer, Guid val)
- {
- writer.WriteGuid(val);
- }
-
- template<>
- inline Guid Read(PortableRawReader& reader)
- {
- return reader.ReadGuid();
- }
-
- template<typename T>
- inline void WriteArray(PortableRawWriter& writer, T* val, int32_t len)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<typename T>
- inline int32_t ReadArray(PortableRawReader& reader, T* val, int32_t len)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, int8_t* val, int32_t len)
- {
- writer.WriteInt8Array(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, int8_t* val, int32_t len)
- {
- return reader.ReadInt8Array(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, bool* val, int32_t len)
- {
- writer.WriteBoolArray(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, bool* val, int32_t len)
- {
- return reader.ReadBoolArray(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, int16_t* val, int32_t len)
- {
- writer.WriteInt16Array(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, int16_t* val, int32_t len)
- {
- return reader.ReadInt16Array(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, uint16_t* val, int32_t len)
- {
- writer.WriteUInt16Array(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, uint16_t* val, int32_t len)
- {
- return reader.ReadUInt16Array(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, int32_t* val, int32_t len)
- {
- writer.WriteInt32Array(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, int32_t* val, int32_t len)
- {
- return reader.ReadInt32Array(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, int64_t* val, int32_t len)
- {
- writer.WriteInt64Array(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, int64_t* val, int32_t len)
- {
- return reader.ReadInt64Array(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, float* val, int32_t len)
- {
- writer.WriteFloatArray(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, float* val, int32_t len)
- {
- return reader.ReadFloatArray(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, double* val, int32_t len)
- {
- writer.WriteDoubleArray(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, double* val, int32_t len)
- {
- return reader.ReadDoubleArray(val, len);
- }
-
- template<>
- inline void WriteArray(PortableRawWriter& writer, Guid* val, int32_t len)
- {
- writer.WriteGuidArray(val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableRawReader& reader, Guid* val, int32_t len)
- {
- return reader.ReadGuidArray(val, len);
- }
-
- template<typename T>
- inline void Write(PortableWriter& writer, const char* fieldName, T val)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<typename T>
- inline T Read(PortableReader& reader, const char* fieldName)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, int8_t val)
- {
- writer.WriteInt8(fieldName, val);
- }
-
- template<>
- inline int8_t Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadInt8(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, bool val)
- {
- writer.WriteBool(fieldName, val);
- }
-
- template<>
- inline bool Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadBool(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, int16_t val)
- {
- writer.WriteInt16(fieldName, val);
- }
-
- template<>
- inline int16_t Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadInt16(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, uint16_t val)
- {
- writer.WriteUInt16(fieldName, val);
- }
-
- template<>
- inline uint16_t Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadUInt16(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, int32_t val)
- {
- writer.WriteInt32(fieldName, val);
- }
-
- template<>
- inline int32_t Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadInt32(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, int64_t val)
- {
- writer.WriteInt64(fieldName, val);
- }
-
- template<>
- inline int64_t Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadInt64(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, float val)
- {
- writer.WriteFloat(fieldName, val);
- }
-
- template<>
- inline float Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadFloat(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, double val)
- {
- writer.WriteDouble(fieldName, val);
- }
-
- template<>
- inline double Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadDouble(fieldName);
- }
-
- template<>
- inline void Write(PortableWriter& writer, const char* fieldName, Guid val)
- {
- writer.WriteGuid(fieldName, val);
- }
-
- template<>
- inline Guid Read(PortableReader& reader, const char* fieldName)
- {
- return reader.ReadGuid(fieldName);
- }
-
- template<typename T>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, T* val, int32_t len)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<typename T>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, T* val, int32_t len)
- {
- throw std::runtime_error("Function is not defined");
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, int8_t* val, int32_t len)
- {
- writer.WriteInt8Array(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int8_t* val, int32_t len)
- {
- return reader.ReadInt8Array(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, bool* val, int32_t len)
- {
- writer.WriteBoolArray(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, bool* val, int32_t len)
- {
- return reader.ReadBoolArray(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, int16_t* val, int32_t len)
- {
- writer.WriteInt16Array(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int16_t* val, int32_t len)
- {
- return reader.ReadInt16Array(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, uint16_t* val, int32_t len)
- {
- writer.WriteUInt16Array(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, uint16_t* val, int32_t len)
- {
- return reader.ReadUInt16Array(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, int32_t* val, int32_t len)
- {
- writer.WriteInt32Array(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int32_t* val, int32_t len)
- {
- return reader.ReadInt32Array(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, int64_t* val, int32_t len)
- {
- writer.WriteInt64Array(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, int64_t* val, int32_t len)
- {
- return reader.ReadInt64Array(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, float* val, int32_t len)
- {
- writer.WriteFloatArray(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, float* val, int32_t len)
- {
- return reader.ReadFloatArray(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, double* val, int32_t len)
- {
- writer.WriteDoubleArray(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, double* val, int32_t len)
- {
- return reader.ReadDoubleArray(fieldName, val, len);
- }
-
- template<>
- inline void WriteArray(PortableWriter& writer, const char* fieldName, Guid* val, int32_t len)
- {
- writer.WriteGuidArray(fieldName, val, len);
- }
-
- template<>
- inline int32_t ReadArray(PortableReader& reader, const char* fieldName, Guid* val, int32_t len)
- {
- return reader.ReadGuidArray(fieldName, val, len);
- }
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h b/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h
deleted file mode 100644
index 8cf23d0..0000000
--- a/modules/platform/src/main/cpp/core-test/include/teamcity_messages.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* Copyright 2011 JetBrains s.r.o.
- *
- * Licensed 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.
- *
- * $Revision: 88625 $
-*/
-
-#ifndef H_TEAMCITY_MESSAGES
-#define H_TEAMCITY_MESSAGES
-
-#include <string>
-#include <iostream>
-
-namespace JetBrains {
-
-std::string getFlowIdFromEnvironment();
-bool underTeamcity();
-
-class TeamcityMessages {
- std::ostream *m_out;
-
-protected:
- std::string escape(std::string s);
-
- void openMsg(const std::string &name);
- void writeProperty(std::string name, std::string value);
- void closeMsg();
-
-public:
- TeamcityMessages();
-
- void setOutput(std::ostream &);
-
- void suiteStarted(std::string name, std::string flowid = "");
- void suiteFinished(std::string name, std::string flowid = "");
-
- void testStarted(std::string name, std::string flowid = "");
- void testFailed(std::string name, std::string message, std::string details, std::string flowid = "");
- void testIgnored(std::string name, std::string message, std::string flowid = "");
- void testFinished(std::string name, int durationMs = -1, std::string flowid = "");
-};
-
-}
-
-#endif /* H_TEAMCITY_MESSAGES */
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/README.TXT b/modules/platform/src/main/cpp/core-test/project/README.TXT
deleted file mode 100644
index 97f4c64..0000000
--- a/modules/platform/src/main/cpp/core-test/project/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains IDE projects artifacts.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/README.TXT b/modules/platform/src/main/cpp/core-test/project/vs/README.TXT
deleted file mode 100644
index f4fb456..0000000
--- a/modules/platform/src/main/cpp/core-test/project/vs/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains Visual Studio project artifacts.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
deleted file mode 100644
index ca6ee1a..0000000
--- a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj
+++ /dev/null
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\..\common\project\vs\common.vcxproj">
- <Project>{4f7e4917-4612-4b96-9838-025711ade391}</Project>
- </ProjectReference>
- <ProjectReference Include="..\..\..\core\project\vs\core.vcxproj">
- <Project>{e2dea693-f2ea-43c2-a813-053378f6e4db}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\config\cache-query.xml" />
- <None Include="..\..\config\cache-test.xml" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\src\cache_test.cpp" />
- <ClCompile Include="..\..\src\concurrent_test.cpp" />
- <ClCompile Include="..\..\src\ignition_test.cpp" />
- <ClCompile Include="..\..\src\handle_registry_test.cpp" />
- <ClCompile Include="..\..\src\portable_reader_writer_raw_test.cpp" />
- <ClCompile Include="..\..\src\portable_reader_writer_test.cpp" />
- <ClCompile Include="..\..\src\portable_session_test.cpp" />
- <ClCompile Include="..\..\src\portable_test_defs.cpp" />
- <ClCompile Include="..\..\src\cache_query_test.cpp" />
- <ClCompile Include="..\..\src\teamcity_boost.cpp" />
- <ClCompile Include="..\..\src\teamcity_messages.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\portable_test_defs.h" />
- <ClInclude Include="..\..\include\ignite\portable_test_utils.h" />
- <ClInclude Include="..\..\include\teamcity_messages.h" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{133A22DB-FD60-44B9-B5E3-6CBB3EA5ABF0}</ProjectGuid>
- <RootNamespace>coretest</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;_CRTDBG_MAP_ALLOC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>Async</ExceptionHandling>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <SubSystem>Console</SubSystem>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_DEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>Async</ExceptionHandling>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-gd-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>Async</ExceptionHandling>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\..\common\include;$(ProjectDir)\..\..\..\common\os\win\include;$(ProjectDir)\..\..\..\core\include;$(ProjectDir)\..\..\..\core\os\win\include;$(ProjectDir)\..\..\include;$(BOOST_HOME)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>NDEBUG;IGNITE_IMPL;BOOST_DATE_TIME_NO_LIB;BOOST_REGEX_NO_LIB;_CRT_SECURE_NO_WARNINGS;IGNITE_FRIEND;IGNITE_TESTS_32%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ExceptionHandling>Async</ExceptionHandling>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(BOOST_HOME)\lib64-msvc-10.0\libboost_unit_test_framework-vc100-mt-1_58.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters b/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
deleted file mode 100644
index 7e8dd95..0000000
--- a/modules/platform/src/main/cpp/core-test/project/vs/core-test.vcxproj.filters
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <ClCompile Include="..\..\src\cache_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\concurrent_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\ignition_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\handle_registry_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable_reader_writer_raw_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable_reader_writer_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable_session_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\portable_test_defs.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\cache_query_test.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\teamcity_boost.cpp">
- <Filter>TeamCity</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\teamcity_messages.cpp">
- <Filter>TeamCity</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\portable_test_defs.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\portable_test_utils.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\teamcity_messages.h">
- <Filter>TeamCity</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <Filter Include="Code">
- <UniqueIdentifier>{486c367c-57e9-430a-80f0-39fd5b09bc64}</UniqueIdentifier>
- </Filter>
- <Filter Include="Configs">
- <UniqueIdentifier>{a46d9d4c-44eb-40da-b4f6-89cc43b70c12}</UniqueIdentifier>
- </Filter>
- <Filter Include="TeamCity">
- <UniqueIdentifier>{76bceab0-e251-445f-88c3-3f6f8739423b}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\config\cache-test.xml">
- <Filter>Configs</Filter>
- </None>
- <None Include="..\..\config\cache-query.xml">
- <Filter>Configs</Filter>
- </None>
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp b/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
deleted file mode 100644
index 47009f4..0000000
--- a/modules/platform/src/main/cpp/core-test/src/cache_query_test.cpp
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
- * 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 _MSC_VER
- #define BOOST_TEST_DYN_LINK
-#endif
-
-#include <sstream>
-
-#include <boost/test/unit_test.hpp>
-
-#include "ignite/impl/utils.h"
-#include "ignite/cache/cache.h"
-#include "ignite/cache/query/query_cursor.h"
-#include "ignite/cache/query/query_sql.h"
-#include "ignite/cache/query/query_text.h"
-#include "ignite/ignite.h"
-#include "ignite/ignition.h"
-
-using namespace boost::unit_test;
-
-using namespace ignite;
-using namespace ignite::cache;
-using namespace ignite::cache::query;
-using namespace ignite::impl::utils;
-
-/**
- * Person class for query tests.
- */
-class IGNITE_IMPORT_EXPORT QueryPerson
-{
-public:
- /**
- * Constructor.
- */
- QueryPerson() : name(NULL), age(0)
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param name Name.
- * @param age Age.
- */
- QueryPerson(std::string name, int age) : name(CopyChars(name.c_str())), age(age)
- {
- // No-op.
- }
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- QueryPerson(const QueryPerson& other)
- {
- name = CopyChars(other.name);
- age = other.age;
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- * @return This instance.
- */
- QueryPerson& operator=(const QueryPerson& other)
- {
- if (&other != this)
- {
- QueryPerson tmp(other);
-
- char* name0 = name;
- int age0 = age;
-
- name = tmp.name;
- age = tmp.age;
-
- tmp.name = name0;
- tmp.age = age0;
- }
-
- return *this;
- }
-
- /**
- * Destructor.
- */
- ~QueryPerson()
- {
- ReleaseChars(name);
- }
-
- /**
- * Get name.
- *
- * @return Name.
- */
- std::string GetName()
- {
- return name ? std::string(name) : std::string();
- }
-
- /**
- * Get age.
- *
- * @return Age.
- */
- int32_t GetAge()
- {
- return age;
- }
-
-private:
- /** Name. */
- char* name;
-
- /** Age. */
- int age;
-};
-
-namespace ignite
-{
- namespace portable
- {
- /**
- * Portable type definition.
- */
- IGNITE_PORTABLE_TYPE_START(QueryPerson)
- IGNITE_PORTABLE_GET_TYPE_ID_AS_HASH(QueryPerson)
- IGNITE_PORTABLE_GET_TYPE_NAME_AS_IS(QueryPerson)
- IGNITE_PORTABLE_GET_FIELD_ID_AS_HASH
- IGNITE_PORTABLE_GET_HASH_CODE_ZERO(QueryPerson)
- IGNITE_PORTABLE_IS_NULL_FALSE(QueryPerson)
- IGNITE_PORTABLE_GET_NULL_DEFAULT_CTOR(QueryPerson)
-
- void Write(PortableWriter& writer, QueryPerson obj)
- {
- writer.WriteString("name", obj.GetName());
- writer.WriteInt32("age", obj.GetAge());
- }
-
- QueryPerson Read(PortableReader& reader)
- {
- std::string name = reader.ReadString("name");
- int age = reader.ReadInt32("age");
-
- return QueryPerson(name, age);
- }
-
- IGNITE_PORTABLE_TYPE_END
- }
-}
-
-/** Node started during the test. */
-Ignite grid = Ignite();
-
-/** Cache accessor. */
-Cache<int, QueryPerson> GetCache()
-{
- return grid.GetCache<int, QueryPerson>("cache");
-}
-
-/**
- * Test setup fixture.
- */
-struct CacheQueryTestSuiteFixture {
- /**
- * Constructor.
- */
- CacheQueryTestSuiteFixture()
- {
- IgniteConfiguration cfg;
-
- IgniteJvmOption opts[5];
-
- opts[0] = IgniteJvmOption("-Xdebug");
- opts[1] = IgniteJvmOption("-Xnoagent");
- opts[2] = IgniteJvmOption("-Djava.compiler=NONE");
- opts[3] = IgniteJvmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005");
- opts[4] = IgniteJvmOption("-XX:+HeapDumpOnOutOfMemoryError");
-
- cfg.jvmOptsLen = 5;
- cfg.jvmOpts = opts;
-
-#ifdef IGNITE_TESTS_32
- cfg.jvmInitMem = 256;
- cfg.jvmMaxMem = 768;
-#else
- cfg.jvmInitMem = 1024;
- cfg.jvmMaxMem = 4096;
-#endif
-
- char* cfgPath = getenv("IGNITE_NATIVE_TEST_CPP_CONFIG_PATH");
-
- std::string cfgPathStr = std::string(cfgPath).append("/").append("cache-query.xml");
-
- cfg.springCfgPath = const_cast<char*>(cfgPathStr.c_str());
-
- IgniteError err;
-
- Ignite grid0 = Ignition::Start(cfg, &err);
-
- if (err.GetCode() != IgniteError::IGNITE_SUCCESS)
- BOOST_ERROR(err.GetText());
-
- grid = grid0;
- }
-
- /**
- * Destructor.
- */
- ~CacheQueryTestSuiteFixture()
- {
- Ignition::Stop(grid.GetName(), true);
- }
-};
-
-/**
- * Ensure that HasNext() fails.
- *
- * @param cur Cursor.
- */
-void CheckHasNextFail(QueryCursor<int, QueryPerson>& cur)
-{
- try
- {
- cur.HasNext();
-
- BOOST_FAIL("Must fail.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
- }
-}
-
-/**
- * Ensure that GetNext() fails.
- *
- * @param cur Cursor.
- */
-void CheckGetNextFail(QueryCursor<int, QueryPerson>& cur)
-{
- try
- {
- cur.GetNext();
-
- BOOST_FAIL("Must fail.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
- }
-}
-
-/**
- * Ensure that GetAll() fails.
- *
- * @param cur Cursor.
- */
-void CheckGetAllFail(QueryCursor<int, QueryPerson>& cur)
-{
- try
- {
- std::vector<CacheEntry<int, QueryPerson>> res;
-
- cur.GetAll(res);
-
- BOOST_FAIL("Must fail.");
- }
- catch (IgniteError& err)
- {
- BOOST_REQUIRE(err.GetCode() == IgniteError::IGNITE_ERR_GENERIC);
- }
-}
-
-/**
- * Check empty result through iteration.
- *
- * @param cur Cursor.
- */
-void CheckEmpty(QueryCursor<int, QueryPerson>& cur)
-{
- BOOST_REQUIRE(!cur.HasNext());
-
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-}
-
-/**
- * Check empty result through GetAll().
- *
- * @param cur Cursor.
- */
-void CheckEmptyGetAll(QueryCursor<int, QueryPerson>& cur)
-{
- std::vector<CacheEntry<int, QueryPerson>> res;
-
- cur.GetAll(res);
-
- BOOST_REQUIRE(res.size() == 0);
-
- CheckHasNextFail(cur);
- CheckGetNextFail(cur);
-}
-
-/**
- * Check single result through iteration.
- *
- * @param cur Cursor.
- * @param key1 Key.
- * @param name1 Name.
- * @param age1 Age.
- */
-void CheckSingle(QueryCursor<int, QueryPerson>& cur, int key, std::string name, int age)
-{
- BOOST_REQUIRE(cur.HasNext());
-
- CheckGetAllFail(cur);
-
- CacheEntry<int, QueryPerson> entry = cur.GetNext();
-
- CheckGetAllFail(cur);
-
- BOOST_REQUIRE(entry.GetKey() == key);
- BOOST_REQUIRE(entry.GetValue().GetName().compare(name) == 0);
- BOOST_REQUIRE(entry.GetValue().GetAge() == age);
-
- BOOST_REQUIRE(!cur.HasNext());
-
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-}
-
-/**
- * Check single result through GetAll().
- *
- * @param cur Cursor.
- * @param key1 Key.
- * @param name1 Name.
- * @param age1 Age.
- */
-void CheckSingleGetAll(QueryCursor<int, QueryPerson>& cur, int key, std::string name, int age)
-{
- std::vector<CacheEntry<int, QueryPerson>> res;
-
- cur.GetAll(res);
-
- CheckHasNextFail(cur);
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-
- BOOST_REQUIRE(res.size() == 1);
-
- BOOST_REQUIRE(res[0].GetKey() == 1);
- BOOST_REQUIRE(res[0].GetValue().GetName().compare(name) == 0);
- BOOST_REQUIRE(res[0].GetValue().GetAge() == age);
-
- CheckHasNextFail(cur);
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-}
-
-/**
- * Check multiple results through iteration.
- *
- * @param cur Cursor.
- * @param key1 Key 1.
- * @param name1 Name 1.
- * @param age1 Age 1.
- * @param key2 Key 2.
- * @param name2 Name 2.
- * @param age2 Age 2.
- */
-void CheckMultiple(QueryCursor<int, QueryPerson>& cur, int key1, std::string name1,
- int age1, int key2, std::string name2, int age2)
-{
- for (int i = 0; i < 2; i++)
- {
- BOOST_REQUIRE(cur.HasNext());
-
- CheckGetAllFail(cur);
-
- CacheEntry<int, QueryPerson> entry = cur.GetNext();
-
- CheckGetAllFail(cur);
-
- if (entry.GetKey() == key1)
- {
- BOOST_REQUIRE(entry.GetValue().GetName().compare(name1) == 0);
- BOOST_REQUIRE(entry.GetValue().GetAge() == age1);
- }
- else if (entry.GetKey() == key2)
- {
- BOOST_REQUIRE(entry.GetValue().GetName().compare(name2) == 0);
- BOOST_REQUIRE(entry.GetValue().GetAge() == age2);
- }
- else
- BOOST_FAIL("Unexpected entry.");
- }
-
- BOOST_REQUIRE(!cur.HasNext());
-
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-}
-
-/**
- * Check multiple results through GetAll().
- *
- * @param cur Cursor.
- * @param key1 Key 1.
- * @param name1 Name 1.
- * @param age1 Age 1.
- * @param key2 Key 2.
- * @param name2 Name 2.
- * @param age2 Age 2.
- */
-void CheckMultipleGetAll(QueryCursor<int, QueryPerson>& cur, int key1, std::string name1, int age1,
- int key2, std::string name2, int age2)
-{
- std::vector<CacheEntry<int, QueryPerson>> res;
-
- cur.GetAll(res);
-
- CheckHasNextFail(cur);
- CheckGetNextFail(cur);
- CheckGetAllFail(cur);
-
- BOOST_REQUIRE(res.size() == 2);
-
- for (int i = 0; i < 2; i++)
- {
- CacheEntry<int, QueryPerson> entry = res[i];
-
- if (entry.GetKey() == key1)
- {
- BOOST_REQUIRE(entry.GetValue().GetName().compare(name1) == 0);
- BOOST_REQUIRE(entry.GetValue().GetAge() == age1);
- }
- else if (entry.GetKey() == key2)
- {
- BOOST_REQUIRE(entry.GetValue().GetName().compare(name2) == 0);
- BOOST_REQUIRE(entry.GetValue().GetAge() == age2);
- }
- else
- BOOST_FAIL("Unexpected entry.");
- }
-}
-
-BOOST_FIXTURE_TEST_SUITE(CacheQueryTestSuite, CacheQueryTestSuiteFixture)
-
-/**
- * Test SQL query.
- */
-BOOST_AUTO_TEST_CASE(TestSqlQuery)
-{
- Cache<int, QueryPerson> cache = GetCache();
-
- // Test query with no results.
- SqlQuery qry("QueryPerson", "age < 20");
-
- QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
- CheckEmpty(cursor);
-
- cursor = cache.Query(qry);
- CheckEmptyGetAll(cursor);
-
- // Test simple query.
- cache.Put(1, QueryPerson("A1", 10));
- cache.Put(2, QueryPerson("A2", 20));
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test simple local query.
- qry.SetLocal(true);
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test query with arguments.
- qry.SetSql("age < ? AND name = ?");
- qry.AddArgument<int>(20);
- qry.AddArgument<std::string>("A1");
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test query returning multiple entries.
- qry = SqlQuery("QueryPerson", "age < 30");
-
- cursor = cache.Query(qry);
- CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
-
- cursor = cache.Query(qry);
- CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
-}
-
-/**
- * Test text query.
- */
-BOOST_AUTO_TEST_CASE(TestTextQuery)
-{
- Cache<int, QueryPerson> cache = GetCache();
-
- // Test query with no results.
- TextQuery qry("QueryPerson", "A1");
-
- QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
- CheckEmpty(cursor);
-
- cursor = cache.Query(qry);
- CheckEmptyGetAll(cursor);
-
- // Test simple query.
- cache.Put(1, QueryPerson("A1", 10));
- cache.Put(2, QueryPerson("A2", 20));
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test simple local query.
- qry.SetLocal(true);
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test query returning multiple entries.
- qry = TextQuery("QueryPerson", "A*");
-
- cursor = cache.Query(qry);
- CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
-
- cursor = cache.Query(qry);
- CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
-}
-
-/**
- * Test scan query.
- */
-BOOST_AUTO_TEST_CASE(TestScanQuery)
-{
- // Test simple query.
- Cache<int, QueryPerson> cache = GetCache();
-
- // Test query with no results.
- ScanQuery qry;
-
- QueryCursor<int, QueryPerson> cursor = cache.Query(qry);
- CheckEmpty(cursor);
-
- cursor = cache.Query(qry);
- CheckEmptyGetAll(cursor);
-
- // Test simple query.
- cache.Put(1, QueryPerson("A1", 10));
-
- cursor = cache.Query(qry);
- CheckSingle(cursor, 1, "A1", 10);
-
- cursor = cache.Query(qry);
- CheckSingleGetAll(cursor, 1, "A1", 10);
-
- // Test query returning multiple entries.
- cache.Put(2, QueryPerson("A2", 20));
-
- cursor = cache.Query(qry);
- CheckMultiple(cursor, 1, "A1", 10, 2, "A2", 20);
-
- cursor = cache.Query(qry);
- CheckMultipleGetAll(cursor, 1, "A1", 10, 2, "A2", 20);
-}
-
-/**
- * Test scan query over partitions.
- */
-BOOST_AUTO_TEST_CASE(TestScanQueryPartitioned)
-{
- // Populate cache with data.
- Cache<int, QueryPerson> cache = GetCache();
-
- int32_t partCnt = 256; // Defined in configuration explicitly.
- int32_t entryCnt = 1000; // Should be greater than partCnt.
-
- for (int i = 0; i < entryCnt; i++)
- {
- std::stringstream stream;
-
- stream << "A" << i;
-
- cache.Put(i, QueryPerson(stream.str(), i * 10));
- }
-
- // Iterate over all partitions and collect data.
- std::set<int> keys;
-
- for (int i = 0; i < partCnt; i++)
- {
- ScanQuery qry(i);
-
- QueryCursor<int, QueryPerson> cur = cache.Query(qry);
-
- while (cur.HasNext())
- {
- CacheEntry<int, QueryPerson> entry = cur.GetNext();
-
- int key = entry.GetKey();
-
- keys.insert(key);
-
- std::stringstream stream;
- stream << "A" << key;
- BOOST_REQUIRE(entry.GetValue().GetName().compare(stream.str()) == 0);
-
- BOOST_REQUIRE(entry.GetValue().GetAge() == key * 10);
- }
- }
-
- // Ensure that all keys were read.
- BOOST_REQUIRE(keys.size() == entryCnt);
-}
-
-BOOST_AUTO_TEST_SUITE_END()
\ No newline at end of file
[44/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/cache.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/cache.h b/modules/platform/src/main/cpp/core/include/ignite/cache/cache.h
deleted file mode 100644
index dcc837b..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/cache.h
+++ /dev/null
@@ -1,1153 +0,0 @@
-/*
- * 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_CACHE
-#define _IGNITE_CACHE
-
-#include <map>
-#include <set>
-
-#include <ignite/common/common.h>
-#include <ignite/common/concurrent.h>
-
-#include "ignite/cache/cache_peek_mode.h"
-#include "ignite/cache/query/query_cursor.h"
-#include "ignite/cache/query/query_scan.h"
-#include "ignite/cache/query/query_sql.h"
-#include "ignite/cache/query/query_text.h"
-#include "ignite/impl/cache/cache_impl.h"
-#include "ignite/impl/operations.h"
-#include "ignite/ignite_error.h"
-
-namespace ignite
-{
- namespace cache
- {
- /**
- * Main entry point for all Data Grid APIs.
- */
- template<typename K, typename V>
- class IGNITE_IMPORT_EXPORT Cache
- {
- public:
- /**
- * Constructor.
- */
- Cache(impl::cache::CacheImpl* impl) : impl(ignite::common::concurrent::SharedPointer<impl::cache::CacheImpl>(impl))
- {
- // No-op.
- }
-
- /**
- * Name of this cache (null for default cache).
- */
- char* GetName()
- {
- return impl.Get()->GetName();
- }
-
- /**
- * Checks whether this cache contains no key-value mappings.
- * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0.
- *
- * @return True if cache is empty.
- */
- bool IsEmpty()
- {
- IgniteError err;
-
- bool res = IsEmpty(err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Checks whether this cache contains no key-value mappings.
- * Semantically equals to Cache.Size(IGNITE_PEEK_MODE_PRIMARY) == 0.
- *
- * @param err Error.
- * @return True if cache is empty.
- */
- bool IsEmpty(IgniteError& err)
- {
- return impl.Get()->IsEmpty(&err);
- }
-
- /**
- * Check if cache contains mapping for this key.
- *
- * @param key Key.
- * @return True if cache contains mapping for this key.
- */
- bool ContainsKey(const K& key)
- {
- IgniteError err;
-
- bool res = ContainsKey(key, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Check if cache contains mapping for this key.
- *
- * @param key Key.
- * @param err Error.
- * @return True if cache contains mapping for this key.
- */
- bool ContainsKey(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> op(&key);
-
- return impl.Get()->ContainsKey(op, &err);
- }
-
- /**
- * Check if cache contains mapping for these keys.
- *
- * @param keys Keys.
- * @return True if cache contains mapping for all these keys.
- */
- bool ContainsKeys(const std::set<K>& keys)
- {
- IgniteError err;
-
- bool res = ContainsKeys(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Check if cache contains mapping for these keys.
- *
- * @param keys Keys.
- * @param err Error.
- * @return True if cache contains mapping for all these keys.
- */
- bool ContainsKeys(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> op(&keys);
-
- return impl.Get()->ContainsKeys(op, &err);
- }
-
- /**
- * Peeks at cached value using optional set of peek modes. This method will sequentially
- * iterate over given peek modes, and try to peek at value using each peek mode. Once a
- * non-null value is found, it will be immediately returned.
- * This method does not participate in any transactions, however, it may peek at transactional
- * value depending on the peek modes used.
- *
- * @param key Key.
- * @param peekModes Peek modes.
- * @return Value.
- */
- V LocalPeek(const K& key, int32_t peekModes)
- {
- IgniteError err;
-
- V res = LocalPeek(key, peekModes, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Peeks at cached value using optional set of peek modes. This method will sequentially
- * iterate over given peek modes, and try to peek at value using each peek mode. Once a
- * non-null value is found, it will be immediately returned.
- * This method does not participate in any transactions, however, it may peek at transactional
- * value depending on the peek modes used.
- *
- * @param key Key.
- * @param peekModes Peek modes.
- * @param err Error.
- * @return Value.
- */
- V LocalPeek(const K& key, int32_t peekModes, IgniteError& err)
- {
- impl::InCacheLocalPeekOperation<K> inOp(&key, peekModes);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->LocalPeek(inOp, outOp, peekModes, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Retrieves value mapped to the specified key from cache.
- * If the value is not present in cache, then it will be looked up from swap storage. If
- * it's not present in swap, or if swap is disabled, and if read-through is allowed, value
- * will be loaded from persistent store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key.
- * @return Value.
- */
- V Get(const K& key)
- {
- IgniteError err;
-
- V res = Get(key, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Retrieves value mapped to the specified key from cache.
- * If the value is not present in cache, then it will be looked up from swap storage. If
- * it's not present in swap, or if swap is disabled, and if read-through is allowed, value
- * will be loaded from persistent store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key.
- * @param err Error.
- * @return Value.
- */
- V Get(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> inOp(&key);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->Get(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Retrieves values mapped to the specified keys from cache.
- * If some value is not present in cache, then it will be looked up from swap storage. If
- * it's not present in swap, or if swap is disabled, and if read-through is allowed, value
- * will be loaded from persistent store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param keys Keys.
- * @return Map of key-value pairs.
- */
- std::map<K, V> GetAll(const std::set<K>& keys)
- {
- IgniteError err;
-
- std::map<K, V> res = GetAll(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Retrieves values mapped to the specified keys from cache.
- * If some value is not present in cache, then it will be looked up from swap storage. If
- * it's not present in swap, or if swap is disabled, and if read-through is allowed, value
- * will be loaded from persistent store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param keys Keys.
- * @param err Error.
- * @return Map of key-value pairs.
- */
- std::map<K, V> GetAll(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> inOp(&keys);
- impl::OutMapOperation<K, V> outOp;
-
- impl.Get()->GetAll(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Associates the specified value with the specified key in the cache.
- * If the cache previously contained a mapping for the key,
- * the old value is replaced by the specified value.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- */
- void Put(const K& key, const V& val)
- {
- IgniteError err;
-
- Put(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Associates the specified value with the specified key in the cache.
- * If the cache previously contained a mapping for the key,
- * the old value is replaced by the specified value.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @param err Error.
- */
- void Put(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> op(&key, &val);
-
- impl.Get()->Put(op, &err);
- }
-
- /**
- * Stores given key-value pairs in cache.
- * If write-through is enabled, the stored values will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param vals Key-value pairs to store in cache.
- */
- void PutAll(const std::map<K, V>& vals)
- {
- IgniteError err;
-
- PutAll(vals, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Stores given key-value pairs in cache.
- * If write-through is enabled, the stored values will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param vals Key-value pairs to store in cache.
- * @param err Error.
- */
- void PutAll(const std::map<K, V>& vals, IgniteError& err)
- {
- impl::InMapOperation<K, V> op(&vals);
-
- impl.Get()->PutAll(op, &err);
- }
-
- /**
- * Associates the specified value with the specified key in this cache,
- * returning an existing value if one existed.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @return The value associated with the key at the start of the
- * operation or null if none was associated.
- */
- V GetAndPut(const K& key, const V& val)
- {
- IgniteError err;
-
- V res = GetAndPut(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Associates the specified value with the specified key in this cache,
- * returning an existing value if one existed.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @param err Error.
- * @return The value associated with the key at the start of the
- * operation or null if none was associated.
- */
- V GetAndPut(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> inOp(&key, &val);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->GetAndPut(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Atomically replaces the value for a given key if and only if there is
- * a value currently mapped by the key.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @return The previous value associated with the specified key, or
- * null if there was no mapping for the key.
- */
- V GetAndReplace(const K& key, const V& val)
- {
- IgniteError err;
-
- V res = GetAndReplace(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Atomically replaces the value for a given key if and only if there is
- * a value currently mapped by the key.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @param err Error.
- * @return The previous value associated with the specified key, or
- * null if there was no mapping for the key.
- */
- V GetAndReplace(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> inOp(&key, &val);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->GetAndReplace(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Atomically removes the entry for a key only if currently mapped to some value.
- *
- * @param key Key with which the specified value is associated.
- * @return The value if one existed or null if no mapping existed for this key.
- */
- V GetAndRemove(const K& key)
- {
- IgniteError err;
-
- V res = GetAndRemove(key, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Atomically removes the entry for a key only if currently mapped to some value.
- *
- * @param key Key with which the specified value is associated.
- * @param err Error.
- * @return The value if one existed or null if no mapping existed for this key.
- */
- V GetAndRemove(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> inOp(&key);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->GetAndRemove(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Atomically associates the specified key with the given value if it is not
- * already associated with a value.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @return True if a value was set.
- */
- bool PutIfAbsent(const K& key, const V& val)
- {
- IgniteError err;
-
- bool res = PutIfAbsent(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Atomically associates the specified key with the given value if it is not
- * already associated with a value.
- *
- * @param key Key with which the specified value is to be associated.
- * @param val Value to be associated with the specified key.
- * @param err Error.
- * @return True if a value was set.
- */
- bool PutIfAbsent(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> op(&key, &val);
-
- return impl.Get()->PutIfAbsent(op, &err);
- }
-
- /**
- * Stores given key-value pair in cache only if cache had no previous mapping for it.
- * If cache previously contained value for the given key, then this value is returned.
- * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- * which in its turn may load the value from the swap storage, and consecutively, if it's not
- * in swap, from the underlying persistent storage.
- * If the returned value is not needed, method putxIfAbsent() should be used instead of this one to
- * avoid the overhead associated with returning of the previous value.
- * If write-through is enabled, the stored value will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param val Value to be associated with the given key.
- * @return Previously contained value regardless of whether put happened or not
- * (null if there was no previous value).
- */
- V GetAndPutIfAbsent(const K& key, const V& val)
- {
- IgniteError err;
-
- V res = GetAndPutIfAbsent(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Stores given key-value pair in cache only if cache had no previous mapping for it.
- * If cache previously contained value for the given key, then this value is returned.
- * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- * which in its turn may load the value from the swap storage, and consecutively, if it's not
- * in swap, from the underlying persistent storage.
- * If the returned value is not needed, method putxIfAbsent() should be used instead of this one to
- * avoid the overhead associated with returning of the previous value.
- * If write-through is enabled, the stored value will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param val Value to be associated with the given key.
- * @param err Error.
- * @return Previously contained value regardless of whether put happened or not
- * (null if there was no previous value).
- */
- V GetAndPutIfAbsent(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> inOp(&key, &val);
- impl::Out1Operation<V> outOp;
-
- impl.Get()->GetAndPutIfAbsent(inOp, outOp, &err);
-
- return outOp.GetResult();
- }
-
- /**
- * Stores given key-value pair in cache only if there is a previous mapping for it.
- * If cache previously contained value for the given key, then this value is returned.
- * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- * which in its turn may load the value from the swap storage, and consecutively, if it's not
- * in swap, rom the underlying persistent storage.
- * If write-through is enabled, the stored value will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param val Value to be associated with the given key.
- * @return True if the value was replaced.
- */
- bool Replace(const K& key, const V& val)
- {
- IgniteError err;
-
- bool res = Replace(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Stores given key-value pair in cache only if there is a previous mapping for it.
- * If cache previously contained value for the given key, then this value is returned.
- * In case of PARTITIONED or REPLICATED caches, the value will be loaded from the primary node,
- * which in its turn may load the value from the swap storage, and consecutively, if it's not
- * in swap, rom the underlying persistent storage.
- * If write-through is enabled, the stored value will be persisted to store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param val Value to be associated with the given key.
- * @param err Error.
- * @return True if the value was replaced.
- */
- bool Replace(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> op(&key, &val);
-
- return impl.Get()->Replace(op, &err);
- }
-
- /**
- * Stores given key-value pair in cache only if only if the previous value is equal to the
- * old value passed as argument.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param oldVal Old value to match.
- * @param newVal Value to be associated with the given key.
- * @return True if replace happened, false otherwise.
- */
- bool Replace(const K& key, const V& oldVal, const V& newVal)
- {
- IgniteError err;
-
- bool res = Replace(key, oldVal, newVal, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Stores given key-value pair in cache only if only if the previous value is equal to the
- * old value passed as argument.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key to store in cache.
- * @param oldVal Old value to match.
- * @param newVal Value to be associated with the given key.
- * @param err Error.
- * @return True if replace happened, false otherwise.
- */
- bool Replace(const K& key, const V& oldVal, const V& newVal, IgniteError& err)
- {
- impl::In3Operation<K, V, V> op(&key, &oldVal, &newVal);
-
- return impl.Get()->ReplaceIfEqual(op, &err);
- }
-
- /**
- * Attempts to evict all entries associated with keys. Note, that entry will be evicted only
- * if it's not used (not participating in any locks or transactions).
- *
- * @param keys Keys to evict from cache.
- */
- void LocalEvict(const std::set<K>& keys)
- {
- IgniteError err;
-
- LocalEvict(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Attempts to evict all entries associated with keys. Note, that entry will be evicted only
- * if it's not used (not participating in any locks or transactions).
- *
- * @param keys Keys to evict from cache.
- * @param err Error.
- */
- void LocalEvict(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> op(&keys);
-
- impl.Get()->LocalEvict(op, &err);
- }
-
- /**
- * Clear cache.
- */
- void Clear()
- {
- IgniteError err;
-
- Clear(err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Clear cache.
- *
- * @param err Error.
- */
- void Clear(IgniteError& err)
- {
- impl.Get()->Clear(&err);
- }
-
- /**
- * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- *
- * @param key Key to clear.
- */
- void Clear(const K& key)
- {
- IgniteError err;
-
- Clear(key, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- *
- * @param key Key to clear.
- * @param err Error.
- */
- void Clear(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> op(&key);
-
- impl.Get()->Clear(op, &err);
- }
-
- /**
- * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- *
- * @param keys Keys to clear.
- */
- void ClearAll(const std::set<K>& keys)
- {
- IgniteError err;
-
- ClearAll(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- *
- * @param keys Keys to clear.
- * @param err Error.
- */
- void ClearAll(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> op(&keys);
-
- impl.Get()->ClearAll(op, &err);
- }
-
- /**
- * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- * Note that this operation is local as it merely clears an entry from local cache, it does not
- * remove entries from remote caches.
- *
- * @param key Key to clear.
- */
- void LocalClear(const K& key)
- {
- IgniteError err;
-
- LocalClear(key, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Clear entry from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- * Note that this operation is local as it merely clears an entry from local cache, it does not
- * remove entries from remote caches.
- *
- * @param key Key to clear.
- * @param err Error.
- */
- void LocalClear(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> op(&key);
-
- impl.Get()->LocalClear(op, &err);
- }
-
- /**
- * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- * Note that this operation is local as it merely clears entries from local cache, it does not
- * remove entries from remote caches.
- *
- * @param keys Keys to clear.
- */
- void LocalClearAll(const std::set<K>& keys)
- {
- IgniteError err;
-
- LocalClearAll(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Clear entries from the cache and swap storage, without notifying listeners or CacheWriters.
- * Entry is cleared only if it is not currently locked, and is not participating in a transaction.
- * Note that this operation is local as it merely clears entries from local cache, it does not
- * remove entries from remote caches.
- *
- * @param keys Keys to clear.
- * @param err Error.
- */
- void LocalClearAll(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> op(&keys);
-
- impl.Get()->LocalClearAll(op, &err);
- }
-
- /**
- * Removes given key mapping from cache. If cache previously contained value for the given key,
- * then this value is returned. In case of PARTITIONED or REPLICATED caches, the value will be
- * loaded from the primary node, which in its turn may load the value from the disk-based swap
- * storage, and consecutively, if it's not in swap, from the underlying persistent storage.
- * If the returned value is not needed, method removex() should always be used instead of this
- * one to avoid the overhead associated with returning of the previous value.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key whose mapping is to be removed from cache.
- * @return False if there was no matching key.
- */
- bool Remove(const K& key)
- {
- IgniteError err;
-
- bool res = Remove(key, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Removes given key mapping from cache. If cache previously contained value for the given key,
- * then this value is returned. In case of PARTITIONED or REPLICATED caches, the value will be
- * loaded from the primary node, which in its turn may load the value from the disk-based swap
- * storage, and consecutively, if it's not in swap, from the underlying persistent storage.
- * If the returned value is not needed, method removex() should always be used instead of this
- * one to avoid the overhead associated with returning of the previous value.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key whose mapping is to be removed from cache.
- * @param err Error.
- * @return False if there was no matching key.
- */
- bool Remove(const K& key, IgniteError& err)
- {
- impl::In1Operation<K> op(&key);
-
- return impl.Get()->Remove(op, &err);
- }
-
- /**
- * Removes given key mapping from cache if one exists and value is equal to the passed in value.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key whose mapping is to be removed from cache.
- * @param val Value to match against currently cached value.
- * @return True if entry was removed, false otherwise.
- */
- bool Remove(const K& key, const V& val)
- {
- IgniteError err;
-
- bool res = Remove(key, val, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Removes given key mapping from cache if one exists and value is equal to the passed in value.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param key Key whose mapping is to be removed from cache.
- * @param val Value to match against currently cached value.
- * @param err Error.
- * @return True if entry was removed, false otherwise.
- */
- bool Remove(const K& key, const V& val, IgniteError& err)
- {
- impl::In2Operation<K, V> op(&key, &val);
-
- return impl.Get()->RemoveIfEqual(op, &err);
- }
-
- /**
- * Removes given key mappings from cache.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param keys Keys whose mappings are to be removed from cache.
- */
- void RemoveAll(const std::set<K>& keys)
- {
- IgniteError err;
-
- RemoveAll(keys, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Removes given key mappings from cache.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param keys Keys whose mappings are to be removed from cache.
- * @param err Error.
- */
- void RemoveAll(const std::set<K>& keys, IgniteError& err)
- {
- impl::InSetOperation<K> op(&keys);
-
- impl.Get()->RemoveAll(op, &err);
- }
-
- /**
- * Removes all mappings from cache.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param err Error.
- */
- void RemoveAll()
- {
- IgniteError err;
-
- RemoveAll(err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Removes all mappings from cache.
- * If write-through is enabled, the value will be removed from store.
- * This method is transactional and will enlist the entry into ongoing transaction if there is one.
- *
- * @param err Error.
- */
- void RemoveAll(IgniteError& err)
- {
- return impl.Get()->RemoveAll(&err);
- }
-
- /**
- * Gets the number of all entries cached on this node.
- *
- * @return Cache size on this node.
- */
- int32_t LocalSize()
- {
- return LocalSize(IGNITE_PEEK_MODE_ALL);
- }
-
- /**
- * Gets the number of all entries cached on this node.
- *
- * @param err Error.
- * @return Cache size on this node.
- */
- int32_t LocalSize(IgniteError& err)
- {
- return LocalSize(IGNITE_PEEK_MODE_ALL, err);
- }
-
- /**
- * Gets the number of all entries cached on this node.
- *
- * @param Peek modes.
- * @return Cache size on this node.
- */
- int32_t LocalSize(int32_t peekModes)
- {
- IgniteError err;
-
- int32_t res = LocalSize(peekModes, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Gets the number of all entries cached on this node.
- *
- * @param Peek modes.
- * @param err Error.
- * @return Cache size on this node.
- */
- int32_t LocalSize(int32_t peekModes, IgniteError& err)
- {
- return impl.Get()->LocalSize(peekModes, &err);
- }
-
- /**
- * Gets the number of all entries cached across all nodes.
- * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
- *
- * @return Cache size across all nodes.
- */
- int32_t Size()
- {
- return Size(ignite::cache::IGNITE_PEEK_MODE_ALL);
- }
-
- /**
- * Gets the number of all entries cached across all nodes.
- * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
- *
- * @param err Error.
- * @return Cache size across all nodes.
- */
- int32_t Size(IgniteError& err)
- {
- return Size(ignite::cache::IGNITE_PEEK_MODE_ALL, err);
- }
-
- /**
- * Gets the number of all entries cached across all nodes.
- * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
- *
- * @param Peek modes.
- * @return Cache size across all nodes.
- */
- int32_t Size(int32_t peekModes)
- {
- IgniteError err;
-
- int32_t res = Size(peekModes, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Gets the number of all entries cached across all nodes.
- * NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
- *
- * @param Peek modes.
- * @param err Error.
- * @return Cache size across all nodes.
- */
- int32_t Size(int32_t peekModes, IgniteError& err)
- {
- return impl.Get()->Size(peekModes, &err);
- }
-
- /**
- * Perform SQL query.
- *
- * @param qry Query.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::SqlQuery& qry)
- {
- IgniteError err;
-
- query::QueryCursor<K, V> res = Query(qry, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Perform SQL query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::SqlQuery& qry, IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QuerySql(qry, &err);
-
- return query::QueryCursor<K, V>(cursorImpl);
- }
-
- /*
- * Perform text query.
- *
- * @param qry Query.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::TextQuery& qry)
- {
- IgniteError err;
-
- query::QueryCursor<K, V> res = Query(qry, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /*
- * Perform text query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::TextQuery& qry, IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryText(qry, &err);
-
- return query::QueryCursor<K, V>(cursorImpl);
- }
-
- /*
- * Perform scan query.
- *
- * @param qry Query.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::ScanQuery& qry)
- {
- IgniteError err;
-
- query::QueryCursor<K, V> res = Query(qry, err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /*
- * Perform scan query.
- *
- * @param qry Query.
- * @param err Error.
- * @return Query cursor.
- */
- query::QueryCursor<K, V> Query(const query::ScanQuery& qry, IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* cursorImpl = impl.Get()->QueryScan(qry, &err);
-
- return query::QueryCursor<K, V>(cursorImpl);
- }
-
- private:
- /** Implementation delegate. */
- ignite::common::concurrent::SharedPointer<impl::cache::CacheImpl> impl;
- };
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/cache_entry.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/cache_entry.h b/modules/platform/src/main/cpp/core/include/ignite/cache/cache_entry.h
deleted file mode 100644
index 2b6c785..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/cache_entry.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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_CACHE_ENTRY
-#define _IGNITE_CACHE_ENTRY
-
-#include <ignite/common/common.h>
-
-namespace ignite
-{
- namespace cache
- {
- /**
- * Cache entry.
- */
- template<typename K, typename V>
- class IGNITE_IMPORT_EXPORT CacheEntry
- {
- public:
- /**
- * Default constructor.
- */
- CacheEntry() : key(K()), val(V())
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param key Key.
- * @param val Value.
- */
- CacheEntry(const K& key, const V& val) : key(key), val(val)
- {
- // No-op.
- }
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- CacheEntry(const CacheEntry& other)
- {
- key = other.key;
- val = other.val;
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- */
- CacheEntry& operator=(const CacheEntry& other)
- {
- if (this != &other)
- {
- CacheEntry tmp(other);
-
- K& key0 = key;
- V& val0 = val;
-
- key = tmp.key;
- val = tmp.val;
-
- tmp.key = key0;
- tmp.val = val0;
- }
-
- return *this;
- }
-
- /**
- * Get key.
- *
- * @return Key.
- */
- K GetKey()
- {
- return key;
- }
-
- /**
- * Get value.
- *
- * @return Value.
- */
- V GetValue()
- {
- return val;
- }
-
- private:
- /** Key. */
- K key;
-
- /** Value. */
- V val;
- };
- }
-}
-
-#endif
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/cache_peek_mode.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/cache_peek_mode.h b/modules/platform/src/main/cpp/core/include/ignite/cache/cache_peek_mode.h
deleted file mode 100644
index be61887..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/cache_peek_mode.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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_CACHE_PEEK_MODE
-#define _IGNITE_CACHE_PEEK_MODE
-
-namespace ignite
-{
- namespace cache
- {
- /**
- * Enumeration of all supported cache peek modes.
- */
- enum CachePeekMode
- {
- /**
- * Peeks into all available cache storages.
- */
- IGNITE_PEEK_MODE_ALL = 0x01,
-
- /**
- * Peek into near cache only (don't peek into partitioned cache).
- * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode.
- */
- IGNITE_PEEK_MODE_NEAR = 0x02,
-
- /**
- * Peek value from primary copy of partitioned cache only (skip near cache).
- * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode.
- */
- IGNITE_PEEK_MODE_PRIMARY = 0x04,
-
- /**
- * Peek value from backup copies of partitioned cache only (skip near cache).
- * In case of LOCAL cache, behaves as IGNITE_PEEK_MODE_ALL mode.
- */
- IGNITE_PEEK_MODE_BACKUP = 0x08,
-
- /**
- * Peeks value from the on-heap storage only.
- */
- IGNITE_PEEK_MODE_ONHEAP = 0x10,
-
- /**
- * Peeks value from the off-heap storage only, without loading off-heap value into cache.
- */
- IGNITE_PEEK_MODE_OFFHEAP = 0x20,
-
- /**
- * Peeks value from the swap storage only, without loading swapped value into cache.
- */
- IGNITE_PEEK_MODE_SWAP = 0x40
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query.h
deleted file mode 100644
index f2d19cd..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * 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_QUERY
-#define _IGNITE_QUERY
-
-#include "ignite/cache/query/query_argument.h"
-#include "ignite/cache/query/query_cursor.h"
-#include "ignite/cache/query/query_scan.h"
-#include "ignite/cache/query/query_sql.h"
-#include "ignite/cache/query/query_text.h"
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_argument.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_argument.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_argument.h
deleted file mode 100644
index 0f41c56..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_argument.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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_CACHE_QUERY_ARGUMENT
-#define _IGNITE_CACHE_QUERY_ARGUMENT
-
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /**
- * Base class for all query arguments.
- */
- class QueryArgumentBase
- {
- public:
- /**
- * Destructor.
- */
- virtual ~QueryArgumentBase()
- {
- // No-op.
- }
-
- /**
- * Copy argument.
- *
- * @return Copy.
- */
- virtual QueryArgumentBase* Copy() = 0;
-
- /**
- * Write argument.
- */
- virtual void Write(ignite::portable::PortableRawWriter& writer) = 0;
- };
-
- /**
- * Query argument.
- */
- template<typename T>
- class QueryArgument : public QueryArgumentBase
- {
- public:
- /**
- * Constructor.
- *
- * @param val Value.
- */
- QueryArgument(const T& val) : val(val)
- {
- // No-op.
- }
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- QueryArgument(const QueryArgument& other)
- {
- val = other.val;
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- */
- QueryArgument& operator=(const QueryArgument& other)
- {
- if (this != &other)
- {
- QueryArgument tmp(other);
-
- T val0 = val;
- val = tmp.val;
- tmp.val = val0;
- }
-
- return *this;
- }
-
- ~QueryArgument()
- {
- // No-op.
- }
-
- QueryArgumentBase* Copy()
- {
- return new QueryArgument(val);
- }
-
- void Write(ignite::portable::PortableRawWriter& writer)
- {
- writer.WriteObject<T>(val);
- }
-
- private:
- /** Value. */
- T val;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_cursor.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_cursor.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_cursor.h
deleted file mode 100644
index 23133e1..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_cursor.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * 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_CACHE_QUERY_CURSOR
-#define _IGNITE_CACHE_QUERY_CURSOR
-
-#include <vector>
-
-#include <ignite/common/concurrent.h>
-
-#include "ignite/cache/cache_entry.h"
-#include "ignite/ignite_error.h"
-#include "ignite/impl/cache/query/query_impl.h"
-#include "ignite/impl/operations.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /**
- * Query cursor.
- */
- template<typename K, typename V>
- class QueryCursor
- {
- public:
- /**
- * Default constructor.
- */
- QueryCursor() : impl(NULL)
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param impl Implementation.
- */
- QueryCursor(impl::cache::query::QueryCursorImpl* impl) :
- impl(ignite::common::concurrent::SharedPointer<impl::cache::query::QueryCursorImpl>(impl))
- {
- // No-op.
- }
-
- /**
- * Check whether next entry exists.
- *
- * @return True if next entry exists.
- */
- bool HasNext()
- {
- IgniteError err;
-
- bool res = HasNext(err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Check whether next entry exists.
- *
- * @param err Error.
- * @return True if next entry exists.
- */
- bool HasNext(IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
-
- if (impl0)
- return impl0->HasNext(&err);
- else
- {
- err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Instance is not usable (did you check for error?).");
-
- return false;
- }
- }
-
- /**
- * Get next entry.
- *
- * @return Next entry.
- */
- CacheEntry<K, V> GetNext()
- {
- IgniteError err;
-
- CacheEntry<K, V> res = GetNext(err);
-
- IgniteError::ThrowIfNeeded(err);
-
- return res;
- }
-
- /**
- * Get next entry.
- *
- * @param err Error.
- * @return Next entry.
- */
- CacheEntry<K, V> GetNext(IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
-
- if (impl0) {
- impl::Out2Operation<K, V> outOp;
-
- impl0->GetNext(outOp, &err);
-
- if (err.GetCode() == IgniteError::IGNITE_SUCCESS)
- {
- K& key = outOp.Get1();
- V& val = outOp.Get2();
-
- return CacheEntry<K, V>(key, val);
- }
- else
- return CacheEntry<K, V>();
- }
- else
- {
- err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Instance is not usable (did you check for error?).");
-
- return CacheEntry<K, V>();
- }
- }
-
- /**
- * Get all entries.
- *
- * @param Vector where query entries will be stored.
- */
- void GetAll(std::vector<CacheEntry<K, V>>& res)
- {
- IgniteError err;
-
- GetAll(res, err);
-
- IgniteError::ThrowIfNeeded(err);
- }
-
- /**
- * Get all entries.
- *
- * @param Vector where query entries will be stored.
- * @param err Error.
- */
- void GetAll(std::vector<CacheEntry<K, V>>& res, IgniteError& err)
- {
- impl::cache::query::QueryCursorImpl* impl0 = impl.Get();
-
- if (impl0) {
- impl::OutQueryGetAllOperation<K, V> outOp(&res);
-
- impl0->GetAll(outOp, &err);
- }
- else
- err = IgniteError(IgniteError::IGNITE_ERR_GENERIC,
- "Instance is not usable (did you check for error?).");
- }
-
- private:
- /** Implementation delegate. */
- ignite::common::concurrent::SharedPointer<impl::cache::query::QueryCursorImpl> impl;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_scan.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_scan.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_scan.h
deleted file mode 100644
index c3ec845..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_scan.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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_CACHE_QUERY_SCAN
-#define _IGNITE_CACHE_QUERY_SCAN
-
-#include <stdint.h>
-#include <string>
-
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /*
- * Scab query.
- */
- class ScanQuery
- {
- public:
- /*
- * Constructor.
- */
- ScanQuery() : part(-1), pageSize(1024), loc(false)
- {
- // No-op.
- }
-
- /*
- * Constructor.
- *
- * @param part Partition.
- */
- ScanQuery(int32_t part) : part(part), pageSize(1024), loc(false)
- {
- // No-op.
- }
-
- /*
- * Get partition to scan.
- *
- * @return Partition to scan.
- */
- int32_t GetPartition()
- {
- return part;
- }
-
- /*
- * Set partition to scan.
- *
- * @param part Partition to scan.
- */
- void SetPartition(int32_t part)
- {
- this->part = part;
- }
-
- /*
- * Get page size.
- *
- * @return Page size.
- */
- int32_t GetPageSize()
- {
- return pageSize;
- }
-
- /*
- * Set page size.
- *
- * @param pageSize Page size.
- */
- void SetPageSize(int32_t pageSize)
- {
- this->pageSize = pageSize;
- }
-
- /*
- * Get local flag.
- *
- * @return Local flag.
- */
- bool IsLocal()
- {
- return loc;
- }
-
- /*
- * Set local flag.
- *
- * @param loc Local flag.
- */
- void SetLocal(bool loc)
- {
- this->loc = loc;
- }
-
- /*
- * Write query info to the stream.
- *
- * @param writer Writer.
- */
- void Write(portable::PortableRawWriter& writer) const
- {
- writer.WriteBool(loc);
- writer.WriteInt32(pageSize);
-
- if (part < 0)
- writer.WriteBool(false);
- else
- {
- writer.WriteBool(true);
- writer.WriteInt32(part);
- }
-
- writer.WriteNull(); // Predicates are not supported yet.
- }
-
- private:
- /* Partition. */
- int32_t part;
-
- /* Page size. */
- int32_t pageSize;
-
- /* Local flag. */
- bool loc;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
deleted file mode 100644
index a2e0f33..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_sql.h
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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_CACHE_QUERY_SQL
-#define _IGNITE_CACHE_QUERY_SQL
-
-#include <stdint.h>
-#include <string>
-#include <vector>
-
-#include "ignite/cache/query/query_argument.h"
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /**
- * Sql query.
- */
- class SqlQuery
- {
- public:
- /**
- * Constructor.
- *
- * @param type Type name.
- * @param sql SQL string.
- */
- SqlQuery(std::string type, std::string sql) : type(type), sql(sql), pageSize(1024),
- loc(false), args(NULL)
- {
- // No-op.
- }
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- SqlQuery(const SqlQuery& other)
- {
- type = other.type;
- sql = other.sql;
- pageSize = other.pageSize;
- loc = other.loc;
-
- if (other.args)
- {
- args = new std::vector<QueryArgumentBase*>();
-
- for (std::vector<QueryArgumentBase*>::iterator it = other.args->begin();
- it != other.args->end(); ++it)
- args->push_back((*it)->Copy());
- }
- else
- args = NULL;
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- */
- SqlQuery& operator=(const SqlQuery& other)
- {
- if (this != &other)
- {
- type = other.type;
- sql = other.sql;
- pageSize = other.pageSize;
- loc = other.loc;
-
- SqlQuery tmp(other);
-
- std::vector<QueryArgumentBase*>* args0 = args;
-
- args = tmp.args;
-
- tmp.args = args0;
- }
-
- return *this;
- }
-
- /**
- * Destructor.
- */
- ~SqlQuery()
- {
- if (args)
- {
- for (std::vector<QueryArgumentBase*>::iterator it = args->begin(); it != args->end(); ++it)
- delete (*it);
-
- delete args;
- }
- }
-
- /**
- * Get type name.
- *
- * @return Type name.
- */
- std::string GetType()
- {
- return type;
- }
-
- /**
- * Set type name.
- *
- * @param sql Type name.
- */
- void SetType(std::string type)
- {
- this->type = type;
- }
-
- /**
- * Get SQL string.
- *
- * @return SQL string.
- */
- std::string GetSql()
- {
- return sql;
- }
-
- /**
- * Set SQL string.
- *
- * @param sql SQL string.
- */
- void SetSql(std::string sql)
- {
- this->sql = sql;
- }
-
- /**
- * Get page size.
- *
- * @return Page size.
- */
- int32_t GetPageSize()
- {
- return pageSize;
- }
-
- /**
- * Set page size.
- *
- * @param pageSize Page size.
- */
- void SetPageSize(int32_t pageSize)
- {
- this->pageSize = pageSize;
- }
-
- /**
- * Get local flag.
- *
- * @return Local flag.
- */
- bool IsLocal()
- {
- return loc;
- }
-
- /**
- * Set local flag.
- *
- * @param loc Local flag.
- */
- void SetLocal(bool loc)
- {
- this->loc = loc;
- }
-
- /**
- * Add argument.
- *
- * @param arg Argument.
- */
- template<typename T>
- void AddArgument(const T& arg)
- {
- if (!args)
- args = new std::vector<QueryArgumentBase*>();
-
- args->push_back(new QueryArgument<T>(arg));
- }
-
- /**
- * Write query info to the stream.
- *
- * @param writer Writer.
- */
- void Write(portable::PortableRawWriter& writer) const
- {
- writer.WriteBool(loc);
- writer.WriteString(sql);
- writer.WriteString(type);
- writer.WriteInt32(pageSize);
-
- if (args)
- {
- writer.WriteInt32(static_cast<int32_t>(args->size()));
-
- for (std::vector<QueryArgumentBase*>::iterator it = args->begin(); it != args->end(); ++it)
- (*it)->Write(writer);
- }
- else
- writer.WriteInt32(0);
- }
-
- private:
- /** Type name. */
- std::string type;
-
- /** SQL string. */
- std::string sql;
-
- /** Page size. */
- int32_t pageSize;
-
- /** Local flag. */
- bool loc;
-
- /** Arguments. */
- std::vector<QueryArgumentBase*>* args;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h b/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
deleted file mode 100644
index 67d3ecc..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/cache/query/query_text.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * 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_CACHE_QUERY_TEXT
-#define _IGNITE_CACHE_QUERY_TEXT
-
-#include <stdint.h>
-#include <string>
-
-#include "ignite/portable/portable_raw_writer.h"
-
-namespace ignite
-{
- namespace cache
- {
- namespace query
- {
- /*
- * Text query.
- */
- class TextQuery
- {
- public:
- /*
- * Constructor.
- *
- * @param type Type name.
- * @param text Text string.
- */
- TextQuery(std::string type, std::string text) : type(type), text(text), pageSize(1024), loc(false)
- {
- // No-op.
- }
-
- /*
- * Get type name.
- *
- * @return Type name.
- */
- std::string GetType()
- {
- return type;
- }
-
- /*
- * Set type name.
- *
- * @param sql Type name.
- */
- void SetType(std::string type)
- {
- this->type = type;
- }
-
- /*
- * Get text string.
- *
- * @return text string.
- */
- std::string GetText()
- {
- return text;
- }
-
- /*
- * Set text string.
- *
- * @param text Text string.
- */
- void SetText(std::string text)
- {
- this->text = text;
- }
-
- /*
- * Get page size.
- *
- * @return Page size.
- */
- int32_t GetPageSize()
- {
- return pageSize;
- }
-
- /*
- * Set page size.
- *
- * @param pageSize Page size.
- */
- void SetPageSize(int32_t pageSize)
- {
- this->pageSize = pageSize;
- }
-
- /*
- * Get local flag.
- *
- * @return Local flag.
- */
- bool IsLocal()
- {
- return loc;
- }
-
- /*
- * Set local flag.
- *
- * @param loc Local flag.
- */
- void SetLocal(bool loc)
- {
- this->loc = loc;
- }
-
- /*
- * Write query info to the stream.
- *
- * @param writer Writer.
- */
- void Write(portable::PortableRawWriter& writer) const
- {
- writer.WriteBool(loc);
- writer.WriteString(text);
- writer.WriteString(type);
- writer.WriteInt32(pageSize);
- }
-
- private:
- /* Type name. */
- std::string type;
-
- /* Text string. */
- std::string text;
-
- /* Page size. */
- int32_t pageSize;
-
- /* Local flag. */
- bool loc;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/core/include/ignite/guid.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/core/include/ignite/guid.h b/modules/platform/src/main/cpp/core/include/ignite/guid.h
deleted file mode 100644
index 9469769..0000000
--- a/modules/platform/src/main/cpp/core/include/ignite/guid.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * 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_GUID
-#define _IGNITE_GUID
-
-#include <stdint.h>
-
-#include <ignite/common/common.h>
-
-namespace ignite
-{
- /**
- * Global universally unique identifier (GUID).
- */
- class IGNITE_IMPORT_EXPORT Guid
- {
- public:
- /**
- * Default constructor.
- */
- Guid();
-
- /**
- * Constructor.
- *
- * @param most Most significant bits.
- * @param least Least significant bits.
- */
- Guid(int64_t most, int64_t least);
-
- /**
- * Returns the most significant 64 bits of this instance.
- *
- * @return The most significant 64 bits of this instance.
- */
- int64_t GetMostSignificantBits() const;
-
- /**
- * Returns the least significant 64 bits of this instance.
- *
- * @return The least significant 64 bits of this instance.
- */
- int64_t GetLeastSignificantBits() const;
-
- /**
- * The version number associated with this instance. The version
- * number describes how this Guid was generated.
- *
- * The version number has the following meaning:
- * 1 Time-based UUID;
- * 2 DCE security UUID;
- * 3 Name-based UUID;
- * 4 Randomly generated UUID.
- *
- * @return The version number of this instance.
- */
- int32_t GetVersion() const;
-
- /**
- * The variant number associated with this instance. The variant
- * number describes the layout of the Guid.
- *
- * The variant number has the following meaning:
- * 0 Reserved for NCS backward compatibility;
- * 2 IETF RFC 4122 (Leach-Salz), used by this class;
- * 6 Reserved, Microsoft Corporation backward compatibility;
- * 7 Reserved for future definition.
- *
- * @return The variant number of this instance.
- */
- int32_t GetVariant() const;
-
- /**
- * Get hash code of this instance (used in serialization).
- *
- * @return Hash code.
- */
- int32_t GetHashCode() const;
-
- /**
- * Comparison operator override.
- *
- * @param val1 First value.
- * @param val2 Second value.
- * @return True if equal.
- */
- friend bool IGNITE_IMPORT_EXPORT operator== (Guid& val1, Guid& val2);
- private:
- /** Most significant bits. */
- int64_t most;
-
- /** Least significant bits. */
- int64_t least;
- };
-}
-
-#endif
\ No newline at end of file
[20/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMode.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMode.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMode.cs
deleted file mode 100644
index 670b091..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableMode.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- /// <summary>
- /// Portable mode.
- /// </summary>
- internal enum PortableMode
- {
- /// <summary>
- /// Deserialize top-level portable objects, but leave nested portable objects in portable form.
- /// </summary>
- Deserialize,
-
- /// <summary>
- /// Keep portable objects in portable form.
- /// </summary>
- KeepPortable,
-
- /// <summary>
- /// Always return IPortableObject.
- /// </summary>
- ForcePortable
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableObjectHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableObjectHandle.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableObjectHandle.cs
deleted file mode 100644
index f2c3842..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableObjectHandle.cs
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- /// <summary>
- /// Object handle. Wraps a single value.
- /// </summary>
- internal class PortableObjectHandle
- {
- /** Value. */
- private readonly object _val;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableObjectHandle"/> class.
- /// </summary>
- /// <param name="val">The value.</param>
- public PortableObjectHandle(object val)
- {
- _val = val;
- }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- public object Value
- {
- get { return _val; }
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- var that = obj as PortableObjectHandle;
-
- return that != null && _val == that._val;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return _val != null ? _val.GetHashCode() : 0;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs
deleted file mode 100644
index 06ccf8b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableOrSerializableObjectHolder.cs
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Wraps portable/serializable item in a portable.
- /// </summary>
- internal class PortableOrSerializableObjectHolder : IPortableWriteAware
- {
- /** */
- private readonly object _item;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SerializableObjectHolder"/> class.
- /// </summary>
- /// <param name="item">The item to wrap.</param>
- public PortableOrSerializableObjectHolder(object item)
- {
- _item = item;
- }
-
- /// <summary>
- /// Gets or sets the item to wrap.
- /// </summary>
- public object Item
- {
- get { return _item; }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
-
- PortableUtils.WritePortableOrSerializable(writer0, Item);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableOrSerializableObjectHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public PortableOrSerializableObjectHolder(IPortableReader reader)
- {
- _item = PortableUtils.ReadPortableOrSerializable<object>((PortableReaderImpl)reader.RawReader());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderHandleDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderHandleDictionary.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderHandleDictionary.cs
deleted file mode 100644
index 6a765c3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderHandleDictionary.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- /// <summary>
- /// Object handle dictionary for PortableReader.
- /// </summary>
- internal class PortableReaderHandleDictionary : PortableHandleDictionary<int, object>
- {
- /// <summary>
- /// Constructor with initial key-value pair.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- public PortableReaderHandleDictionary(int key, object val)
- : base(key, val)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- protected override int EmptyKey
- {
- get { return -1; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs
deleted file mode 100644
index 176ca27..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReaderImpl.cs
+++ /dev/null
@@ -1,1013 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable reader implementation.
- /// </summary>
- internal class PortableReaderImpl : IPortableReader, IPortableRawReader
- {
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Type descriptors. */
- private readonly IDictionary<long, IPortableTypeDescriptor> _descs;
-
- /** Parent builder. */
- private readonly PortableBuilderImpl _builder;
-
- /** Handles. */
- private PortableReaderHandleDictionary _hnds;
-
- /** Current type ID. */
- private int _curTypeId;
-
- /** Current position. */
- private int _curPos;
-
- /** Current raw data offset. */
- private int _curRawOffset;
-
- /** Current converter. */
- private IPortableNameMapper _curConverter;
-
- /** Current mapper. */
- private IPortableIdMapper _curMapper;
-
- /** Current raw flag. */
- private bool _curRaw;
-
- /** Detach flag. */
- private bool _detach;
-
- /** Portable read mode. */
- private PortableMode _mode;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="descs">Descriptors.</param>
- /// <param name="stream">Input stream.</param>
- /// <param name="mode">The mode.</param>
- /// <param name="builder">Builder.</param>
- public PortableReaderImpl
- (PortableMarshaller marsh,
- IDictionary<long, IPortableTypeDescriptor> descs,
- IPortableStream stream,
- PortableMode mode,
- PortableBuilderImpl builder)
- {
- _marsh = marsh;
- _descs = descs;
- _mode = mode;
- _builder = builder;
-
- Stream = stream;
- }
-
- /// <summary>
- /// Gets the marshaller.
- /// </summary>
- public PortableMarshaller Marshaller
- {
- get { return _marsh; }
- }
-
- /** <inheritdoc /> */
- public IPortableRawReader RawReader()
- {
- MarkRaw();
-
- return this;
- }
-
- /** <inheritdoc /> */
- public bool ReadBoolean(string fieldName)
- {
- return ReadField(fieldName, r => r.ReadBoolean());
- }
-
- /** <inheritdoc /> */
- public bool ReadBoolean()
- {
- return Stream.ReadBool();
- }
-
- /** <inheritdoc /> */
- public bool[] ReadBooleanArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadBooleanArray);
- }
-
- /** <inheritdoc /> */
- public bool[] ReadBooleanArray()
- {
- return Read(PortableUtils.ReadBooleanArray);
- }
-
- /** <inheritdoc /> */
- public byte ReadByte(string fieldName)
- {
- return ReadField(fieldName, ReadByte);
- }
-
- /** <inheritdoc /> */
- public byte ReadByte()
- {
- return Stream.ReadByte();
- }
-
- /** <inheritdoc /> */
- public byte[] ReadByteArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadByteArray);
- }
-
- /** <inheritdoc /> */
- public byte[] ReadByteArray()
- {
- return Read(PortableUtils.ReadByteArray);
- }
-
- /** <inheritdoc /> */
- public short ReadShort(string fieldName)
- {
- return ReadField(fieldName, ReadShort);
- }
-
- /** <inheritdoc /> */
- public short ReadShort()
- {
- return Stream.ReadShort();
- }
-
- /** <inheritdoc /> */
- public short[] ReadShortArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadShortArray);
- }
-
- /** <inheritdoc /> */
- public short[] ReadShortArray()
- {
- return Read(PortableUtils.ReadShortArray);
- }
-
- /** <inheritdoc /> */
- public char ReadChar(string fieldName)
- {
- return ReadField(fieldName, ReadChar);
- }
-
- /** <inheritdoc /> */
- public char ReadChar()
- {
- return Stream.ReadChar();
- }
-
- /** <inheritdoc /> */
- public char[] ReadCharArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadCharArray);
- }
-
- /** <inheritdoc /> */
- public char[] ReadCharArray()
- {
- return Read(PortableUtils.ReadCharArray);
- }
-
- /** <inheritdoc /> */
- public int ReadInt(string fieldName)
- {
- return ReadField(fieldName, ReadInt);
- }
-
- /** <inheritdoc /> */
- public int ReadInt()
- {
- return Stream.ReadInt();
- }
-
- /** <inheritdoc /> */
- public int[] ReadIntArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadIntArray);
- }
-
- /** <inheritdoc /> */
- public int[] ReadIntArray()
- {
- return Read(PortableUtils.ReadIntArray);
- }
-
- /** <inheritdoc /> */
- public long ReadLong(string fieldName)
- {
- return ReadField(fieldName, ReadLong);
- }
-
- /** <inheritdoc /> */
- public long ReadLong()
- {
- return Stream.ReadLong();
- }
-
- /** <inheritdoc /> */
- public long[] ReadLongArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadLongArray);
- }
-
- /** <inheritdoc /> */
- public long[] ReadLongArray()
- {
- return Read(PortableUtils.ReadLongArray);
- }
-
- /** <inheritdoc /> */
- public float ReadFloat(string fieldName)
- {
- return ReadField(fieldName, ReadFloat);
- }
-
- /** <inheritdoc /> */
- public float ReadFloat()
- {
- return Stream.ReadFloat();
- }
-
- /** <inheritdoc /> */
- public float[] ReadFloatArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadFloatArray);
- }
-
- /** <inheritdoc /> */
- public float[] ReadFloatArray()
- {
- return Read(PortableUtils.ReadFloatArray);
- }
-
- /** <inheritdoc /> */
- public double ReadDouble(string fieldName)
- {
- return ReadField(fieldName, ReadDouble);
- }
-
- /** <inheritdoc /> */
- public double ReadDouble()
- {
- return Stream.ReadDouble();
- }
-
- /** <inheritdoc /> */
- public double[] ReadDoubleArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadDoubleArray);
- }
-
- /** <inheritdoc /> */
- public double[] ReadDoubleArray()
- {
- return Read(PortableUtils.ReadDoubleArray);
- }
-
- /** <inheritdoc /> */
- public decimal ReadDecimal(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadDecimal);
- }
-
- /** <inheritdoc /> */
- public decimal ReadDecimal()
- {
- return Read(PortableUtils.ReadDecimal);
- }
-
- /** <inheritdoc /> */
- public decimal[] ReadDecimalArray(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadDecimalArray);
- }
-
- /** <inheritdoc /> */
- public decimal[] ReadDecimalArray()
- {
- return Read(PortableUtils.ReadDecimalArray);
- }
-
- /** <inheritdoc /> */
- public DateTime? ReadDate(string fieldName)
- {
- return ReadDate(fieldName, false);
- }
-
- /** <inheritdoc /> */
- public DateTime? ReadDate(string fieldName, bool local)
- {
- return ReadField(fieldName, r => PortableUtils.ReadDate(r, local));
- }
-
- /** <inheritdoc /> */
- public DateTime? ReadDate()
- {
- return ReadDate(false);
- }
-
- /** <inheritdoc /> */
- public DateTime? ReadDate(bool local)
- {
- return Read(r => PortableUtils.ReadDate(r, local));
- }
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray(string fieldName)
- {
- return ReadDateArray(fieldName, false);
- }
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray(string fieldName, bool local)
- {
- return ReadField(fieldName, r => PortableUtils.ReadDateArray(r, local));
- }
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray()
- {
- return ReadDateArray(false);
- }
-
- /** <inheritdoc /> */
- public DateTime?[] ReadDateArray(bool local)
- {
- return Read(r => PortableUtils.ReadDateArray(r, local));
- }
-
- /** <inheritdoc /> */
- public string ReadString(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadString);
- }
-
- /** <inheritdoc /> */
- public string ReadString()
- {
- return Read(PortableUtils.ReadString);
- }
-
- /** <inheritdoc /> */
- public string[] ReadStringArray(string fieldName)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericArray<string>(r, false));
- }
-
- /** <inheritdoc /> */
- public string[] ReadStringArray()
- {
- return Read(r => PortableUtils.ReadGenericArray<string>(r, false));
- }
-
- /** <inheritdoc /> */
- public Guid? ReadGuid(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadGuid);
- }
-
- /** <inheritdoc /> */
- public Guid? ReadGuid()
- {
- return Read(PortableUtils.ReadGuid);
- }
-
- /** <inheritdoc /> */
- public Guid?[] ReadGuidArray(string fieldName)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericArray<Guid?>(r, false));
- }
-
- /** <inheritdoc /> */
- public Guid?[] ReadGuidArray()
- {
- return Read(r => PortableUtils.ReadGenericArray<Guid?>(r, false));
- }
-
- /** <inheritdoc /> */
- public T ReadEnum<T>(string fieldName)
- {
- return ReadField(fieldName, PortableUtils.ReadEnum<T>);
- }
-
- /** <inheritdoc /> */
- public T ReadEnum<T>()
- {
- return Read(PortableUtils.ReadEnum<T>);
- }
-
- /** <inheritdoc /> */
- public T[] ReadEnumArray<T>(string fieldName)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericArray<T>(r, true));
- }
-
- /** <inheritdoc /> */
- public T[] ReadEnumArray<T>()
- {
- return Read(r => PortableUtils.ReadGenericArray<T>(r, true));
- }
-
- /** <inheritdoc /> */
- public T ReadObject<T>(string fieldName)
- {
- if (_curRaw)
- throw new PortableException("Cannot read named fields after raw data is read.");
-
- int fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- if (SeekField(fieldId))
- return Deserialize<T>();
-
- return default(T);
- }
-
- /** <inheritdoc /> */
- public T ReadObject<T>()
- {
- return Deserialize<T>();
- }
-
- /** <inheritdoc /> */
- public T[] ReadObjectArray<T>(string fieldName)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericArray<T>(r, true));
- }
-
- /** <inheritdoc /> */
- public T[] ReadObjectArray<T>()
- {
- return Read(r => PortableUtils.ReadGenericArray<T>(r, true));
- }
-
- /** <inheritdoc /> */
- public ICollection ReadCollection(string fieldName)
- {
- return ReadCollection(fieldName, null, null);
- }
-
- /** <inheritdoc /> */
- public ICollection ReadCollection()
- {
- return ReadCollection(null, null);
- }
-
- /** <inheritdoc /> */
- public ICollection ReadCollection(string fieldName, PortableCollectionFactory factory,
- PortableCollectionAdder adder)
- {
- return ReadField(fieldName, r => PortableUtils.ReadCollection(r, factory, adder));
- }
-
- /** <inheritdoc /> */
- public ICollection ReadCollection(PortableCollectionFactory factory,
- PortableCollectionAdder adder)
- {
- return Read(r => PortableUtils.ReadCollection(r, factory, adder));
- }
-
- /** <inheritdoc /> */
- public ICollection<T> ReadGenericCollection<T>(string fieldName)
- {
- return ReadGenericCollection<T>(fieldName, null);
- }
-
- /** <inheritdoc /> */
- public ICollection<T> ReadGenericCollection<T>()
- {
- return ReadGenericCollection((PortableGenericCollectionFactory<T>) null);
- }
-
- /** <inheritdoc /> */
- public ICollection<T> ReadGenericCollection<T>(string fieldName,
- PortableGenericCollectionFactory<T> factory)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericCollection(r, factory));
- }
-
- /** <inheritdoc /> */
- public ICollection<T> ReadGenericCollection<T>(PortableGenericCollectionFactory<T> factory)
- {
- return Read(r => PortableUtils.ReadGenericCollection(r, factory));
- }
-
- /** <inheritdoc /> */
- public IDictionary ReadDictionary(string fieldName)
- {
- return ReadDictionary(fieldName, null);
- }
-
- /** <inheritdoc /> */
- public IDictionary ReadDictionary()
- {
- return ReadDictionary((PortableDictionaryFactory)null);
- }
-
- /** <inheritdoc /> */
- public IDictionary ReadDictionary(string fieldName, PortableDictionaryFactory factory)
- {
- return ReadField(fieldName, r => PortableUtils.ReadDictionary(r, factory));
- }
-
- /** <inheritdoc /> */
- public IDictionary ReadDictionary(PortableDictionaryFactory factory)
- {
- return Read(r => PortableUtils.ReadDictionary(r, factory));
- }
-
- /** <inheritdoc /> */
- public IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(string fieldName)
- {
- return ReadGenericDictionary<TK, TV>(fieldName, null);
- }
-
- /** <inheritdoc /> */
- public IDictionary<TK, TV> ReadGenericDictionary<TK, TV>()
- {
- return ReadGenericDictionary((PortableGenericDictionaryFactory<TK, TV>) null);
- }
-
- /** <inheritdoc /> */
- public IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(string fieldName,
- PortableGenericDictionaryFactory<TK, TV> factory)
- {
- return ReadField(fieldName, r => PortableUtils.ReadGenericDictionary(r, factory));
- }
-
- /** <inheritdoc /> */
- public IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(PortableGenericDictionaryFactory<TK, TV> factory)
- {
- return Read(r => PortableUtils.ReadGenericDictionary(r, factory));
- }
-
- /// <summary>
- /// Enable detach mode for the next object read.
- /// </summary>
- public void DetachNext()
- {
- _detach = true;
- }
-
- /// <summary>
- /// Deserialize object.
- /// </summary>
- /// <returns>Deserialized object.</returns>
- public T Deserialize<T>()
- {
- int pos = Stream.Position;
-
- byte hdr = Stream.ReadByte();
-
- var doDetach = _detach; // save detach flag into a var and reset so it does not go deeper
-
- _detach = false;
-
- switch (hdr)
- {
- case PortableUtils.HdrNull:
- return default(T);
-
- case PortableUtils.HdrHnd:
- return ReadHandleObject<T>(pos);
-
- case PortableUtils.HdrFull:
- return ReadFullObject<T>(pos);
-
- case PortableUtils.TypePortable:
- return ReadPortableObject<T>(doDetach);
- }
-
- if (PortableUtils.IsPredefinedType(hdr))
- return PortableSystemHandlers.ReadSystemType<T>(hdr, this);
-
- throw new PortableException("Invalid header on deserialization [pos=" + pos + ", hdr=" + hdr + ']');
- }
-
- /// <summary>
- /// Reads the portable object.
- /// </summary>
- private T ReadPortableObject<T>(bool doDetach)
- {
- var len = Stream.ReadInt();
-
- var portablePos = Stream.Position;
-
- if (_mode != PortableMode.Deserialize)
- return TypeCaster<T>.Cast(ReadAsPortable(portablePos, len, doDetach));
-
- Stream.Seek(len, SeekOrigin.Current);
-
- var offset = Stream.ReadInt();
-
- var retPos = Stream.Position;
-
- Stream.Seek(portablePos + offset, SeekOrigin.Begin);
-
- _mode = PortableMode.KeepPortable;
-
- try
- {
- return Deserialize<T>();
- }
- finally
- {
- _mode = PortableMode.Deserialize;
-
- Stream.Seek(retPos, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Reads the portable object in portable form.
- /// </summary>
- private PortableUserObject ReadAsPortable(int dataPos, int dataLen, bool doDetach)
- {
- try
- {
- Stream.Seek(dataLen + dataPos, SeekOrigin.Begin);
-
- var offs = Stream.ReadInt(); // offset inside data
-
- var pos = dataPos + offs;
-
- if (!doDetach)
- return GetPortableUserObject(pos, pos, Stream.Array());
-
- Stream.Seek(pos + 10, SeekOrigin.Begin);
-
- var len = Stream.ReadInt();
-
- Stream.Seek(pos, SeekOrigin.Begin);
-
- return GetPortableUserObject(pos, 0, Stream.ReadByteArray(len));
- }
- finally
- {
- Stream.Seek(dataPos + dataLen + 4, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Reads the full object.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1804:RemoveUnusedLocals", MessageId = "hashCode")]
- private T ReadFullObject<T>(int pos)
- {
- // Read header.
- bool userType = Stream.ReadBool();
- int typeId = Stream.ReadInt();
- // ReSharper disable once UnusedVariable
- int hashCode = Stream.ReadInt();
- int len = Stream.ReadInt();
- int rawOffset = Stream.ReadInt();
-
- try
- {
- // Already read this object?
- object hndObj;
-
- if (_hnds != null && _hnds.TryGetValue(pos, out hndObj))
- return (T) hndObj;
-
- if (userType && _mode == PortableMode.ForcePortable)
- {
- PortableUserObject portObj;
-
- if (_detach)
- {
- Stream.Seek(pos, SeekOrigin.Begin);
-
- portObj = GetPortableUserObject(pos, 0, Stream.ReadByteArray(len));
- }
- else
- portObj = GetPortableUserObject(pos, pos, Stream.Array());
-
- T obj = _builder == null ? TypeCaster<T>.Cast(portObj) : TypeCaster<T>.Cast(_builder.Child(portObj));
-
- AddHandle(pos, obj);
-
- return obj;
- }
- else
- {
- // Find descriptor.
- IPortableTypeDescriptor desc;
-
- if (!_descs.TryGetValue(PortableUtils.TypeKey(userType, typeId), out desc))
- throw new PortableException("Unknown type ID: " + typeId);
-
- // Instantiate object.
- if (desc.Type == null)
- throw new PortableException("No matching type found for object [typeId=" +
- desc.TypeId + ", typeName=" + desc.TypeName + ']');
-
- // Preserve old frame.
- int oldTypeId = _curTypeId;
- int oldPos = _curPos;
- int oldRawOffset = _curRawOffset;
- IPortableNameMapper oldConverter = _curConverter;
- IPortableIdMapper oldMapper = _curMapper;
- bool oldRaw = _curRaw;
-
- // Set new frame.
- _curTypeId = typeId;
- _curPos = pos;
- _curRawOffset = rawOffset;
- _curConverter = desc.NameConverter;
- _curMapper = desc.Mapper;
- _curRaw = false;
-
- // Read object.
- object obj;
-
- var sysSerializer = desc.Serializer as IPortableSystemTypeSerializer;
-
- if (sysSerializer != null)
- obj = sysSerializer.ReadInstance(this);
- else
- {
- try
- {
- obj = FormatterServices.GetUninitializedObject(desc.Type);
-
- // Save handle.
- AddHandle(pos, obj);
- }
- catch (Exception e)
- {
- throw new PortableException("Failed to create type instance: " +
- desc.Type.AssemblyQualifiedName, e);
- }
-
- desc.Serializer.ReadPortable(obj, this);
- }
-
- // Restore old frame.
- _curTypeId = oldTypeId;
- _curPos = oldPos;
- _curRawOffset = oldRawOffset;
- _curConverter = oldConverter;
- _curMapper = oldMapper;
- _curRaw = oldRaw;
-
- var wrappedSerializable = obj as SerializableObjectHolder;
-
- return wrappedSerializable != null ? (T) wrappedSerializable.Item : (T) obj;
- }
- }
- finally
- {
- // Advance stream pointer.
- Stream.Seek(pos + len, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Reads the handle object.
- /// </summary>
- private T ReadHandleObject<T>(int pos)
- {
- // Get handle position.
- int hndPos = pos - Stream.ReadInt();
-
- int retPos = Stream.Position;
-
- try
- {
- object hndObj;
-
- if (_builder == null || !_builder.CachedField(hndPos, out hndObj))
- {
- if (_hnds == null || !_hnds.TryGetValue(hndPos, out hndObj))
- {
- // No such handler, i.e. we trying to deserialize inner object before deserializing outer.
- Stream.Seek(hndPos, SeekOrigin.Begin);
-
- hndObj = Deserialize<T>();
- }
-
- // Notify builder that we deserialized object on other location.
- if (_builder != null)
- _builder.CacheField(hndPos, hndObj);
- }
-
- return (T) hndObj;
- }
- finally
- {
- // Position stream to correct place.
- Stream.Seek(retPos, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Adds a handle to the dictionary.
- /// </summary>
- /// <param name="pos">Position.</param>
- /// <param name="obj">Object.</param>
- private void AddHandle(int pos, object obj)
- {
- if (_hnds == null)
- _hnds = new PortableReaderHandleDictionary(pos, obj);
- else
- _hnds.Add(pos, obj);
- }
-
- /// <summary>
- /// Underlying stream.
- /// </summary>
- public IPortableStream Stream
- {
- get;
- private set;
- }
-
- /// <summary>
- /// Mark current output as raw.
- /// </summary>
- private void MarkRaw()
- {
- if (!_curRaw)
- {
- _curRaw = true;
-
- Stream.Seek(_curPos + _curRawOffset, SeekOrigin.Begin);
- }
- }
-
- /// <summary>
- /// Seek field with the given ID in the current object.
- /// </summary>
- /// <param name="fieldId">Field ID.</param>
- /// <returns>True in case the field was found and position adjusted, false otherwise.</returns>
- private bool SeekField(int fieldId)
- {
- // This method is expected to be called when stream pointer is set either before
- // the field or on raw data offset.
- int start = _curPos + 18;
- int end = _curPos + _curRawOffset;
-
- int initial = Stream.Position;
-
- int cur = initial;
-
- while (cur < end)
- {
- int id = Stream.ReadInt();
-
- if (fieldId == id)
- {
- // Field is found, return.
- Stream.Seek(4, SeekOrigin.Current);
-
- return true;
- }
-
- Stream.Seek(Stream.ReadInt(), SeekOrigin.Current);
-
- cur = Stream.Position;
- }
-
- Stream.Seek(start, SeekOrigin.Begin);
-
- cur = start;
-
- while (cur < initial)
- {
- int id = Stream.ReadInt();
-
- if (fieldId == id)
- {
- // Field is found, return.
- Stream.Seek(4, SeekOrigin.Current);
-
- return true;
- }
-
- Stream.Seek(Stream.ReadInt(), SeekOrigin.Current);
-
- cur = Stream.Position;
- }
-
- return false;
- }
-
- /// <summary>
- /// Determines whether header at current position is HDR_NULL.
- /// </summary>
- private bool IsNullHeader()
- {
- var hdr = ReadByte();
-
- return hdr != PortableUtils.HdrNull;
- }
-
- /// <summary>
- /// Seeks the field by name, reads header and returns true if field is present and header is not null.
- /// </summary>
- private bool SeekField(string fieldName)
- {
- if (_curRaw)
- throw new PortableException("Cannot read named fields after raw data is read.");
-
- var fieldId = PortableUtils.FieldId(_curTypeId, fieldName, _curConverter, _curMapper);
-
- if (!SeekField(fieldId))
- return false;
-
- return IsNullHeader();
- }
-
- /// <summary>
- /// Seeks specified field and invokes provided func.
- /// </summary>
- private T ReadField<T>(string fieldName, Func<IPortableStream, T> readFunc)
- {
- return SeekField(fieldName) ? readFunc(Stream) : default(T);
- }
-
- /// <summary>
- /// Seeks specified field and invokes provided func.
- /// </summary>
- private T ReadField<T>(string fieldName, Func<PortableReaderImpl, T> readFunc)
- {
- return SeekField(fieldName) ? readFunc(this) : default(T);
- }
-
- /// <summary>
- /// Seeks specified field and invokes provided func.
- /// </summary>
- private T ReadField<T>(string fieldName, Func<T> readFunc)
- {
- return SeekField(fieldName) ? readFunc() : default(T);
- }
-
- /// <summary>
- /// Reads header and invokes specified func if the header is not null.
- /// </summary>
- private T Read<T>(Func<PortableReaderImpl, T> readFunc)
- {
- return IsNullHeader() ? readFunc(this) : default(T);
- }
-
- /// <summary>
- /// Reads header and invokes specified func if the header is not null.
- /// </summary>
- private T Read<T>(Func<IPortableStream, T> readFunc)
- {
- return IsNullHeader() ? readFunc(Stream) : default(T);
- }
-
- /// <summary>
- /// Gets the portable user object from a byte array.
- /// </summary>
- /// <param name="pos">Position in the current stream.</param>
- /// <param name="offs">Offset in the byte array.</param>
- /// <param name="bytes">Bytes.</param>
- private PortableUserObject GetPortableUserObject(int pos, int offs, byte[] bytes)
- {
- Stream.Seek(pos + 2, SeekOrigin.Begin);
-
- var id = Stream.ReadInt();
-
- var hash = Stream.ReadInt();
-
- return new PortableUserObject(_marsh, bytes, offs, id, hash);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs
deleted file mode 100644
index d939d29..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveRoutines.cs
+++ /dev/null
@@ -1,483 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections;
- using System.Diagnostics;
- using System.Linq.Expressions;
- using System.Reflection;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Write action delegate.
- /// </summary>
- /// <param name="obj">Target object.</param>
- /// <param name="writer">Writer.</param>
- internal delegate void PortableReflectiveWriteAction(object obj, IPortableWriter writer);
-
- /// <summary>
- /// Read action delegate.
- /// </summary>
- /// <param name="obj">Target object.</param>
- /// <param name="reader">Reader.</param>
- internal delegate void PortableReflectiveReadAction(object obj, IPortableReader reader);
-
- /// <summary>
- /// Routines for reflective reads and writes.
- /// </summary>
- internal static class PortableReflectiveActions
- {
- /** Method: read enum. */
- private static readonly MethodInfo MthdReadEnum =
- typeof(IPortableReader).GetMethod("ReadEnum", new[] { typeof(string) });
-
- /** Method: read enum array. */
- private static readonly MethodInfo MthdReadEnumArray =
- typeof(IPortableReader).GetMethod("ReadEnumArray", new[] { typeof(string) });
-
- /** Method: read array. */
- private static readonly MethodInfo MthdReadObjArray =
- typeof(IPortableReader).GetMethod("ReadObjectArray", new[] { typeof(string) });
-
- /** Method: read generic collection. */
- private static readonly MethodInfo MthdReadGenericCollection =
- typeof(IPortableReader).GetMethod("ReadGenericCollection", new[] { typeof(string) });
-
- /** Method: read generic dictionary. */
- private static readonly MethodInfo MthdReadGenericDictionary =
- typeof(IPortableReader).GetMethod("ReadGenericDictionary", new[] { typeof(string) });
-
- /** Method: read object. */
- private static readonly MethodInfo MthdReadObj=
- typeof(IPortableReader).GetMethod("ReadObject", new[] { typeof(string) });
-
- /** Method: write enum array. */
- private static readonly MethodInfo MthdWriteEnumArray =
- typeof(IPortableWriter).GetMethod("WriteEnumArray");
-
- /** Method: write array. */
- private static readonly MethodInfo MthdWriteObjArray =
- typeof(IPortableWriter).GetMethod("WriteObjectArray");
-
- /** Method: write generic collection. */
- private static readonly MethodInfo MthdWriteGenericCollection =
- typeof(IPortableWriter).GetMethod("WriteGenericCollection");
-
- /** Method: write generic dictionary. */
- private static readonly MethodInfo MthdWriteGenericDictionary =
- typeof(IPortableWriter).GetMethod("WriteGenericDictionary");
-
- /** Method: read object. */
- private static readonly MethodInfo MthdWriteObj =
- typeof(IPortableWriter).GetMethod("WriteObject");
-
- /// <summary>
- /// Lookup read/write actions for the given type.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <param name="writeAction">Write action.</param>
- /// <param name="readAction">Read action.</param>
- public static void TypeActions(FieldInfo field, out PortableReflectiveWriteAction writeAction,
- out PortableReflectiveReadAction readAction)
- {
- var type = field.FieldType;
-
- if (type.IsPrimitive)
- HandlePrimitive(field, out writeAction, out readAction);
- else if (type.IsArray)
- HandleArray(field, out writeAction, out readAction);
- else
- HandleOther(field, out writeAction, out readAction);
- }
-
- /// <summary>
- /// Handle primitive type.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <param name="writeAction">Write action.</param>
- /// <param name="readAction">Read action.</param>
- /// <exception cref="IgniteException">Unsupported primitive type: + type.Name</exception>
- private static void HandlePrimitive(FieldInfo field, out PortableReflectiveWriteAction writeAction,
- out PortableReflectiveReadAction readAction)
- {
- var type = field.FieldType;
-
- if (type == typeof(bool))
- {
- writeAction = GetWriter<bool>(field, (f, w, o) => w.WriteBoolean(f, o));
- readAction = GetReader(field, (f, r) => r.ReadBoolean(f));
- }
- else if (type == typeof(sbyte))
- {
- writeAction = GetWriter<sbyte>(field, (f, w, o) => w.WriteByte(f, unchecked((byte) o)));
- readAction = GetReader(field, (f, r) => unchecked ((sbyte)r.ReadByte(f)));
- }
- else if (type == typeof(byte))
- {
- writeAction = GetWriter<byte>(field, (f, w, o) => w.WriteByte(f, o));
- readAction = GetReader(field, (f, r) => r.ReadByte(f));
- }
- else if (type == typeof(short))
- {
- writeAction = GetWriter<short>(field, (f, w, o) => w.WriteShort(f, o));
- readAction = GetReader(field, (f, r) => r.ReadShort(f));
- }
- else if (type == typeof(ushort))
- {
- writeAction = GetWriter<ushort>(field, (f, w, o) => w.WriteShort(f, unchecked((short) o)));
- readAction = GetReader(field, (f, r) => unchecked((ushort) r.ReadShort(f)));
- }
- else if (type == typeof(char))
- {
- writeAction = GetWriter<char>(field, (f, w, o) => w.WriteChar(f, o));
- readAction = GetReader(field, (f, r) => r.ReadChar(f));
- }
- else if (type == typeof(int))
- {
- writeAction = GetWriter<int>(field, (f, w, o) => w.WriteInt(f, o));
- readAction = GetReader(field, (f, r) => r.ReadInt(f));
- }
- else if (type == typeof(uint))
- {
- writeAction = GetWriter<uint>(field, (f, w, o) => w.WriteInt(f, unchecked((int) o)));
- readAction = GetReader(field, (f, r) => unchecked((uint) r.ReadInt(f)));
- }
- else if (type == typeof(long))
- {
- writeAction = GetWriter<long>(field, (f, w, o) => w.WriteLong(f, o));
- readAction = GetReader(field, (f, r) => r.ReadLong(f));
- }
- else if (type == typeof(ulong))
- {
- writeAction = GetWriter<ulong>(field, (f, w, o) => w.WriteLong(f, unchecked((long) o)));
- readAction = GetReader(field, (f, r) => unchecked((ulong) r.ReadLong(f)));
- }
- else if (type == typeof(float))
- {
- writeAction = GetWriter<float>(field, (f, w, o) => w.WriteFloat(f, o));
- readAction = GetReader(field, (f, r) => r.ReadFloat(f));
- }
- else if (type == typeof(double))
- {
- writeAction = GetWriter<double>(field, (f, w, o) => w.WriteDouble(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDouble(f));
- }
- else
- throw new IgniteException("Unsupported primitive type: " + type.Name);
- }
-
- /// <summary>
- /// Handle array type.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <param name="writeAction">Write action.</param>
- /// <param name="readAction">Read action.</param>
- private static void HandleArray(FieldInfo field, out PortableReflectiveWriteAction writeAction,
- out PortableReflectiveReadAction readAction)
- {
- Type elemType = field.FieldType.GetElementType();
-
- if (elemType == typeof(bool))
- {
- writeAction = GetWriter<bool[]>(field, (f, w, o) => w.WriteBooleanArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadBooleanArray(f));
- }
- else if (elemType == typeof(byte))
- {
- writeAction = GetWriter<byte[]>(field, (f, w, o) => w.WriteByteArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadByteArray(f));
- }
- else if (elemType == typeof(sbyte))
- {
- writeAction = GetWriter<sbyte[]>(field, (f, w, o) => w.WriteByteArray(f, (byte[]) (Array) o));
- readAction = GetReader(field, (f, r) => (sbyte[]) (Array) r.ReadByteArray(f));
- }
- else if (elemType == typeof(short))
- {
- writeAction = GetWriter<short[]>(field, (f, w, o) => w.WriteShortArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadShortArray(f));
- }
- else if (elemType == typeof(ushort))
- {
- writeAction = GetWriter<ushort[]>(field, (f, w, o) => w.WriteShortArray(f, (short[]) (Array) o));
- readAction = GetReader(field, (f, r) => (ushort[]) (Array) r.ReadShortArray(f));
- }
- else if (elemType == typeof(char))
- {
- writeAction = GetWriter<char[]>(field, (f, w, o) => w.WriteCharArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadCharArray(f));
- }
- else if (elemType == typeof(int))
- {
- writeAction = GetWriter<int[]>(field, (f, w, o) => w.WriteIntArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadIntArray(f));
- }
- else if (elemType == typeof(uint))
- {
- writeAction = GetWriter<uint[]>(field, (f, w, o) => w.WriteIntArray(f, (int[]) (Array) o));
- readAction = GetReader(field, (f, r) => (uint[]) (Array) r.ReadIntArray(f));
- }
- else if (elemType == typeof(long))
- {
- writeAction = GetWriter<long[]>(field, (f, w, o) => w.WriteLongArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadLongArray(f));
- }
- else if (elemType == typeof(ulong))
- {
- writeAction = GetWriter<ulong[]>(field, (f, w, o) => w.WriteLongArray(f, (long[]) (Array) o));
- readAction = GetReader(field, (f, r) => (ulong[]) (Array) r.ReadLongArray(f));
- }
- else if (elemType == typeof(float))
- {
- writeAction = GetWriter<float[]>(field, (f, w, o) => w.WriteFloatArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadFloatArray(f));
- }
- else if (elemType == typeof(double))
- {
- writeAction = GetWriter<double[]>(field, (f, w, o) => w.WriteDoubleArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDoubleArray(f));
- }
- else if (elemType == typeof(decimal))
- {
- writeAction = GetWriter<decimal[]>(field, (f, w, o) => w.WriteDecimalArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDecimalArray(f));
- }
- else if (elemType == typeof(string))
- {
- writeAction = GetWriter<string[]>(field, (f, w, o) => w.WriteStringArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadStringArray(f));
- }
- else if (elemType == typeof(Guid?))
- {
- writeAction = GetWriter<Guid?[]>(field, (f, w, o) => w.WriteGuidArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadGuidArray(f));
- }
- else if (elemType == typeof(DateTime?))
- {
- writeAction = GetWriter<DateTime?[]>(field, (f, w, o) => w.WriteDateArray(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDateArray(f));
- }
- else if (elemType.IsEnum)
- {
- writeAction = GetWriter(field, MthdWriteEnumArray, elemType);
- readAction = GetReader(field, MthdReadEnumArray, elemType);
- }
- else
- {
- writeAction = GetWriter(field, MthdWriteObjArray, elemType);
- readAction = GetReader(field, MthdReadObjArray, elemType);
- }
- }
-
- /// <summary>
- /// Handle other type.
- /// </summary>
- /// <param name="field">The field.</param>
- /// <param name="writeAction">Write action.</param>
- /// <param name="readAction">Read action.</param>
- private static void HandleOther(FieldInfo field, out PortableReflectiveWriteAction writeAction,
- out PortableReflectiveReadAction readAction)
- {
- var type = field.FieldType;
-
- var genericDef = type.IsGenericType ? type.GetGenericTypeDefinition() : null;
-
- bool nullable = genericDef == typeof(Nullable<>);
-
- var nullableType = nullable ? type.GetGenericArguments()[0] : null;
-
- if (type == typeof(decimal))
- {
- writeAction = GetWriter<decimal>(field, (f, w, o) => w.WriteDecimal(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDecimal(f));
- }
- else if (type == typeof(string))
- {
- writeAction = GetWriter<string>(field, (f, w, o) => w.WriteString(f, o));
- readAction = GetReader(field, (f, r) => r.ReadString(f));
- }
- else if (type == typeof(Guid))
- {
- writeAction = GetWriter<Guid>(field, (f, w, o) => w.WriteGuid(f, o));
- readAction = GetReader(field, (f, r) => r.ReadGuid(f) ?? default(Guid));
- }
- else if (nullable && nullableType == typeof(Guid))
- {
- writeAction = GetWriter<Guid?>(field, (f, w, o) => w.WriteGuid(f, o));
- readAction = GetReader(field, (f, r) => r.ReadGuid(f));
- }
- else if (type == typeof(DateTime))
- {
- writeAction = GetWriter<DateTime>(field, (f, w, o) => w.WriteDate(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDate(f) ?? default(DateTime));
- }
- else if (nullable && nullableType == typeof(DateTime))
- {
- writeAction = GetWriter<DateTime?>(field, (f, w, o) => w.WriteDate(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDate(f));
- }
- else if (type.IsEnum)
- {
- writeAction = GetWriter<object>(field, (f, w, o) => w.WriteEnum(f, o), true);
- readAction = GetReader(field, MthdReadEnum);
- }
- else if (genericDef == PortableUtils.TypGenericDictionary ||
- type.GetInterface(PortableUtils.TypGenericDictionary.FullName) != null)
- {
- writeAction = GetWriter(field, MthdWriteGenericDictionary, type.GetGenericArguments());
- readAction = GetReader(field, MthdReadGenericDictionary, type.GetGenericArguments());
- }
- else if (genericDef == PortableUtils.TypGenericCollection ||
- type.GetInterface(PortableUtils.TypGenericCollection.FullName) != null)
- {
- writeAction = GetWriter(field, MthdWriteGenericCollection, type.GetGenericArguments());
- readAction = GetReader(field, MthdReadGenericCollection, type.GetGenericArguments());
- }
- else if (type == PortableUtils.TypDictionary || type.GetInterface(PortableUtils.TypDictionary.FullName) != null)
- {
- writeAction = GetWriter<IDictionary>(field, (f, w, o) => w.WriteDictionary(f, o));
- readAction = GetReader(field, (f, r) => r.ReadDictionary(f));
- }
- else if (type == PortableUtils.TypCollection || type.GetInterface(PortableUtils.TypCollection.FullName) != null)
- {
- writeAction = GetWriter<ICollection>(field, (f, w, o) => w.WriteCollection(f, o));
- readAction = GetReader(field, (f, r) => r.ReadCollection(f));
- }
- else
- {
- writeAction = GetWriter(field, MthdWriteObj);
- readAction = GetReader(field, MthdReadObj);
- }
- }
-
- /// <summary>
- /// Gets the reader with a specified write action.
- /// </summary>
- private static PortableReflectiveWriteAction GetWriter<T>(FieldInfo field,
- Expression<Action<string, IPortableWriter, T>> write,
- bool convertFieldValToObject = false)
- {
- Debug.Assert(field != null);
- Debug.Assert(field.DeclaringType != null); // non-static
-
- // Get field value
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
- Expression fldExpr = Expression.Field(targetParamConverted, field);
-
- if (convertFieldValToObject)
- fldExpr = Expression.Convert(fldExpr, typeof (object));
-
- // Call IPortableWriter method
- var writerParam = Expression.Parameter(typeof(IPortableWriter));
- var fldNameParam = Expression.Constant(PortableUtils.CleanFieldName(field.Name));
- var writeExpr = Expression.Invoke(write, fldNameParam, writerParam, fldExpr);
-
- // Compile and return
- return Expression.Lambda<PortableReflectiveWriteAction>(writeExpr, targetParam, writerParam).Compile();
- }
-
- /// <summary>
- /// Gets the writer with a specified generic method.
- /// </summary>
- private static PortableReflectiveWriteAction GetWriter(FieldInfo field, MethodInfo method,
- params Type[] genericArgs)
- {
- Debug.Assert(field != null);
- Debug.Assert(field.DeclaringType != null); // non-static
-
- if (genericArgs.Length == 0)
- genericArgs = new[] {field.FieldType};
-
- // Get field value
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
- var fldExpr = Expression.Field(targetParamConverted, field);
-
- // Call IPortableWriter method
- var writerParam = Expression.Parameter(typeof(IPortableWriter));
- var fldNameParam = Expression.Constant(PortableUtils.CleanFieldName(field.Name));
- var writeMethod = method.MakeGenericMethod(genericArgs);
- var writeExpr = Expression.Call(writerParam, writeMethod, fldNameParam, fldExpr);
-
- // Compile and return
- return Expression.Lambda<PortableReflectiveWriteAction>(writeExpr, targetParam, writerParam).Compile();
- }
-
- /// <summary>
- /// Gets the reader with a specified read action.
- /// </summary>
- private static PortableReflectiveReadAction GetReader<T>(FieldInfo field,
- Expression<Func<string, IPortableReader, T>> read)
- {
- Debug.Assert(field != null);
- Debug.Assert(field.DeclaringType != null); // non-static
-
- // Call IPortableReader method
- var readerParam = Expression.Parameter(typeof(IPortableReader));
- var fldNameParam = Expression.Constant(PortableUtils.CleanFieldName(field.Name));
- Expression readExpr = Expression.Invoke(read, fldNameParam, readerParam);
-
- if (typeof(T) != field.FieldType)
- readExpr = Expression.Convert(readExpr, field.FieldType);
-
- // Assign field value
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
- var assignExpr = Expression.Call(DelegateConverter.GetWriteFieldMethod(field), targetParamConverted,
- readExpr);
-
- // Compile and return
- return Expression.Lambda<PortableReflectiveReadAction>(assignExpr, targetParam, readerParam).Compile();
- }
-
- /// <summary>
- /// Gets the reader with a specified generic method.
- /// </summary>
- private static PortableReflectiveReadAction GetReader(FieldInfo field, MethodInfo method,
- params Type[] genericArgs)
- {
- Debug.Assert(field != null);
- Debug.Assert(field.DeclaringType != null); // non-static
-
- if (genericArgs.Length == 0)
- genericArgs = new[] {field.FieldType};
-
- // Call IPortableReader method
- var readerParam = Expression.Parameter(typeof (IPortableReader));
- var fldNameParam = Expression.Constant(PortableUtils.CleanFieldName(field.Name));
- var readMethod = method.MakeGenericMethod(genericArgs);
- Expression readExpr = Expression.Call(readerParam, readMethod, fldNameParam);
-
- if (readMethod.ReturnType != field.FieldType)
- readExpr = Expression.Convert(readExpr, field.FieldType);
-
- // Assign field value
- var targetParam = Expression.Parameter(typeof(object));
- var targetParamConverted = Expression.Convert(targetParam, field.DeclaringType);
- var assignExpr = Expression.Call(DelegateConverter.GetWriteFieldMethod(field), targetParamConverted,
- readExpr);
-
- // Compile and return
- return Expression.Lambda<PortableReflectiveReadAction>(assignExpr, targetParam, readerParam).Compile();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
deleted file mode 100644
index 3dff691..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableReflectiveSerializer.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable serializer which reflectively writes all fields except of ones with
- /// <see cref="System.NonSerializedAttribute"/>.
- /// <para />
- /// Note that Java platform stores dates as a difference between current time
- /// and predefined absolute UTC date. Therefore, this difference is always the
- /// same for all time zones. .Net, in contrast, stores dates as a difference
- /// between current time and some predefined date relative to the current time
- /// zone. It means that this difference will be different as you change time zones.
- /// To overcome this discrepancy Ignite always converts .Net date to UTC form
- /// before serializing and allows user to decide whether to deserialize them
- /// in UTC or local form using <c>ReadDate(..., true/false)</c> methods in
- /// <see cref="IPortableReader"/> and <see cref="IPortableRawReader"/>.
- /// This serializer always read dates in UTC form. It means that if you have
- /// local date in any field/property, it will be implicitly converted to UTC
- /// form after the first serialization-deserialization cycle.
- /// </summary>
- internal class PortableReflectiveSerializer : IPortableSerializer
- {
- /** Cached binding flags. */
- private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public |
- BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
-
- /** Cached type descriptors. */
- private readonly IDictionary<Type, Descriptor> _types = new Dictionary<Type, Descriptor>();
-
- /// <summary>
- /// Write portalbe object.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <param name="writer">Portable writer.</param>
- /// <exception cref="PortableException">Type is not registered in serializer: + type.Name</exception>
- public void WritePortable(object obj, IPortableWriter writer)
- {
- var portableMarshalAware = obj as IPortableMarshalAware;
-
- if (portableMarshalAware != null)
- portableMarshalAware.WritePortable(writer);
- else
- GetDescriptor(obj).Write(obj, writer);
- }
-
- /// <summary>
- /// Read portable object.
- /// </summary>
- /// <param name="obj">Instantiated empty object.</param>
- /// <param name="reader">Portable reader.</param>
- /// <exception cref="PortableException">Type is not registered in serializer: + type.Name</exception>
- public void ReadPortable(object obj, IPortableReader reader)
- {
- var portableMarshalAware = obj as IPortableMarshalAware;
-
- if (portableMarshalAware != null)
- portableMarshalAware.ReadPortable(reader);
- else
- GetDescriptor(obj).Read(obj, reader);
- }
-
- /// <summary>Register type.</summary>
- /// <param name="type">Type.</param>
- /// <param name="typeId">Type ID.</param>
- /// <param name="converter">Name converter.</param>
- /// <param name="idMapper">ID mapper.</param>
- public void Register(Type type, int typeId, IPortableNameMapper converter,
- IPortableIdMapper idMapper)
- {
- if (type.GetInterface(typeof(IPortableMarshalAware).Name) != null)
- return;
-
- List<FieldInfo> fields = new List<FieldInfo>();
-
- Type curType = type;
-
- while (curType != null)
- {
- foreach (FieldInfo field in curType.GetFields(Flags))
- {
- if (!field.IsNotSerialized)
- fields.Add(field);
- }
-
- curType = curType.BaseType;
- }
-
- IDictionary<int, string> idMap = new Dictionary<int, string>();
-
- foreach (FieldInfo field in fields)
- {
- string fieldName = PortableUtils.CleanFieldName(field.Name);
-
- int fieldId = PortableUtils.FieldId(typeId, fieldName, converter, idMapper);
-
- if (idMap.ContainsKey(fieldId))
- {
- throw new PortableException("Conflicting field IDs [type=" +
- type.Name + ", field1=" + idMap[fieldId] + ", field2=" + fieldName +
- ", fieldId=" + fieldId + ']');
- }
-
- idMap[fieldId] = fieldName;
- }
-
- fields.Sort(Compare);
-
- Descriptor desc = new Descriptor(fields);
-
- _types[type] = desc;
- }
-
- /// <summary>
- /// Gets the descriptor for an object.
- /// </summary>
- private Descriptor GetDescriptor(object obj)
- {
- var type = obj.GetType();
-
- Descriptor desc;
-
- if (!_types.TryGetValue(type, out desc))
- throw new PortableException("Type is not registered in serializer: " + type.Name);
-
- return desc;
- }
-
- /// <summary>
- /// Compare two FieldInfo instances.
- /// </summary>
- private static int Compare(FieldInfo info1, FieldInfo info2) {
- string name1 = PortableUtils.CleanFieldName(info1.Name);
- string name2 = PortableUtils.CleanFieldName(info2.Name);
-
- return string.Compare(name1, name2, StringComparison.OrdinalIgnoreCase);
- }
-
- /// <summary>
- /// Type descriptor.
- /// </summary>
- private class Descriptor
- {
- /** Write actions to be performed. */
- private readonly List<PortableReflectiveWriteAction> _wActions;
-
- /** Read actions to be performed. */
- private readonly List<PortableReflectiveReadAction> _rActions;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fields">Fields.</param>
- public Descriptor(List<FieldInfo> fields)
- {
- _wActions = new List<PortableReflectiveWriteAction>(fields.Count);
- _rActions = new List<PortableReflectiveReadAction>(fields.Count);
-
- foreach (FieldInfo field in fields)
- {
- PortableReflectiveWriteAction writeAction;
- PortableReflectiveReadAction readAction;
-
- PortableReflectiveActions.TypeActions(field, out writeAction, out readAction);
-
- _wActions.Add(writeAction);
- _rActions.Add(readAction);
- }
- }
-
- /// <summary>
- /// Write object.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <param name="writer">Portable writer.</param>
- public void Write(object obj, IPortableWriter writer)
- {
- int cnt = _wActions.Count;
-
- for (int i = 0; i < cnt; i++)
- _wActions[i](obj, writer);
- }
-
- /// <summary>
- /// Read object.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <param name="reader">Portable reader.</param>
- public void Read(object obj, IPortableReader reader)
- {
- int cnt = _rActions.Count;
-
- for (int i = 0; i < cnt; i++ )
- _rActions[i](obj, reader);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSurrogateTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSurrogateTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSurrogateTypeDescriptor.cs
deleted file mode 100644
index c8dcc5a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Portable/PortableSurrogateTypeDescriptor.cs
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Portable
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Surrogate type descriptor. Used in cases when type if identified by name and is not provided in configuration.
- /// </summary>
- internal class PortableSurrogateTypeDescriptor : IPortableTypeDescriptor
- {
- /** Portable configuration. */
- private readonly PortableConfiguration _cfg;
-
- /** Type ID. */
- private readonly int _id;
-
- /** Type name. */
- private readonly string _name;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cfg">Portable configuration.</param>
- /// <param name="id">Type ID.</param>
- public PortableSurrogateTypeDescriptor(PortableConfiguration cfg, int id)
- {
- _cfg = cfg;
- _id = id;
- }
-
- /// <summary>
- /// Constrcutor.
- /// </summary>
- /// <param name="cfg">Portable configuration.</param>
- /// <param name="name">Type name.</param>
- public PortableSurrogateTypeDescriptor(PortableConfiguration cfg, string name)
- {
- _cfg = cfg;
- _name = name;
-
- _id = PortableUtils.TypeId(name, cfg.DefaultNameMapper, cfg.DefaultIdMapper);
- }
-
- /** <inheritDoc /> */
- public Type Type
- {
- get { return null; }
- }
-
- /** <inheritDoc /> */
- public int TypeId
- {
- get { return _id; }
- }
-
- /** <inheritDoc /> */
- public string TypeName
- {
- get { return _name; }
- }
-
- /** <inheritDoc /> */
- public bool UserType
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public bool MetadataEnabled
- {
- get { return _cfg.DefaultMetadataEnabled; }
- }
-
- /** <inheritDoc /> */
- public bool KeepDeserialized
- {
- get { return _cfg.DefaultKeepDeserialized; }
- }
-
- /** <inheritDoc /> */
- public IPortableNameMapper NameConverter
- {
- get { return _cfg.DefaultNameMapper; }
- }
-
- /** <inheritDoc /> */
- public IPortableIdMapper Mapper
- {
- get { return _cfg.DefaultIdMapper; }
- }
-
- /** <inheritDoc /> */
- public IPortableSerializer Serializer
- {
- get { return _cfg.DefaultSerializer; }
- }
-
- /** <inheritDoc /> */
- public string AffinityKeyFieldName
- {
- get { return null; }
- }
-
- /** <inheritDoc /> */
- public object TypedHandler
- {
- get { return null; }
- }
-
- /** <inheritDoc /> */
- public PortableSystemWriteDelegate UntypedHandler
- {
- get { return null; }
- }
- }
-}
[16/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs
deleted file mode 100644
index de5d4c7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Resource/ResourceTypeDescriptor.cs
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Resource
-{
- using System;
- using System.Collections.Generic;
- using System.Reflection;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// Resource type descriptor.
- /// </summary>
- internal class ResourceTypeDescriptor
- {
- /** Attribute type: InstanceResourceAttribute. */
- private static readonly Type TypAttrIgnite = typeof(InstanceResourceAttribute);
-
- /** Attribute type: StoreSessionResourceAttribute. */
- private static readonly Type TypAttrStoreSes = typeof(StoreSessionResourceAttribute);
-
- /** Type: IGrid. */
- private static readonly Type TypIgnite = typeof(IIgnite);
-
- /** Type: ICacheStoreSession. */
- private static readonly Type TypStoreSes = typeof (ICacheStoreSession);
-
- /** Type: ComputeTaskNoResultCacheAttribute. */
- private static readonly Type TypComputeTaskNoResCache = typeof(ComputeTaskNoResultCacheAttribute);
-
- /** Cached binding flags. */
- private static readonly BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public |
- BindingFlags.NonPublic | BindingFlags.DeclaredOnly;
-
- /** Ignite injectors. */
- private readonly IList<IResourceInjector> _igniteInjectors;
-
- /** Session injectors. */
- private readonly IList<IResourceInjector> _storeSesInjectors;
-
- /** Task "no result cache" flag. */
- private readonly bool _taskNoResCache;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="type">Type.</param>
- internal ResourceTypeDescriptor(Type type)
- {
- Collector gridCollector = new Collector(TypAttrIgnite, TypIgnite);
- Collector storeSesCollector = new Collector(TypAttrStoreSes, TypStoreSes);
-
- Type curType = type;
-
- while (curType != null)
- {
- CreateInjectors(curType, gridCollector, storeSesCollector);
-
- curType = curType.BaseType;
- }
-
- _igniteInjectors = gridCollector.Injectors;
- _storeSesInjectors = storeSesCollector.Injectors;
-
- _taskNoResCache = ContainsAttribute(type, TypComputeTaskNoResCache, true);
- }
-
- /// <summary>
- /// Inject resources to the given object.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="ignite">Grid.</param>
- public void InjectIgnite(object target, Ignite ignite)
- {
- InjectIgnite(target, ignite.Proxy);
- }
-
- /// <summary>
- /// Inject resources to the given object.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="igniteProxy">Grid proxy.</param>
- public void InjectIgnite(object target, IgniteProxy igniteProxy)
- {
- Inject0(target, igniteProxy, _igniteInjectors);
- }
-
- /// <summary>
- /// Inject store session.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="ses">Store session.</param>
- public void InjectStoreSession(object target, ICacheStoreSession ses)
- {
- Inject0(target, ses, _storeSesInjectors);
- }
-
- /// <summary>
- /// Perform injection.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="injectee">Injectee.</param>
- /// <param name="injectors">Injectors.</param>
- private static void Inject0(object target, object injectee, ICollection<IResourceInjector> injectors)
- {
- if (injectors != null)
- {
- foreach (IResourceInjector injector in injectors)
- injector.Inject(target, injectee);
- }
- }
-
- /// <summary>
- /// Task "no result cache" flag.
- /// </summary>
- public bool TaskNoResultCache
- {
- get
- {
- return _taskNoResCache;
- }
- }
-
- /// <summary>
- /// Create gridInjectors for the given type.
- /// </summary>
- /// <param name="type">Type.</param>
- /// <param name="collectors">Collectors.</param>
- private static void CreateInjectors(Type type, params Collector[] collectors)
- {
- FieldInfo[] fields = type.GetFields(Flags);
-
- foreach (FieldInfo field in fields)
- {
- foreach (var collector in collectors)
- {
- if (!ContainsAttribute(field, collector.AttributeType, false))
- continue;
-
- if (!field.FieldType.IsAssignableFrom(collector.ResourceType))
- throw new IgniteException("Invalid field type for resource attribute [" +
- "type=" + type.Name +
- ", field=" + field.Name +
- ", fieldType=" + field.FieldType.Name +
- ", resourceType=" + collector.ResourceType.Name + ']');
-
- collector.Add(new ResourceFieldInjector(field));
- }
- }
-
- PropertyInfo[] props = type.GetProperties(Flags);
-
- foreach (var prop in props)
- {
- foreach (var collector in collectors)
- {
- if (!ContainsAttribute(prop, collector.AttributeType, false))
- continue;
-
- if (!prop.CanWrite)
- throw new IgniteException("Property with resource attribute is not writable [" +
- "type=" + type.Name +
- ", property=" + prop.Name +
- ", resourceType=" + collector.ResourceType.Name + ']');
-
- if (!prop.PropertyType.IsAssignableFrom(collector.ResourceType))
- throw new IgniteException("Invalid property type for resource attribute [" +
- "type=" + type.Name +
- ", property=" + prop.Name +
- ", propertyType=" + prop.PropertyType.Name +
- ", resourceType=" + collector.ResourceType.Name + ']');
-
- collector.Add(new ResourcePropertyInjector(prop));
- }
- }
-
- MethodInfo[] mthds = type.GetMethods(Flags);
-
- foreach (MethodInfo mthd in mthds)
- {
- foreach (var collector in collectors)
- {
- if (!ContainsAttribute(mthd, collector.AttributeType, false))
- continue;
-
- ParameterInfo[] parameters = mthd.GetParameters();
-
- if (parameters.Length != 1)
- throw new IgniteException("Method with resource attribute must have only one parameter [" +
- "type=" + type.Name +
- ", method=" + mthd.Name +
- ", resourceType=" + collector.ResourceType.Name + ']');
-
- if (!parameters[0].ParameterType.IsAssignableFrom(collector.ResourceType))
- throw new IgniteException("Invalid method parameter type for resource attribute [" +
- "type=" + type.Name +
- ", method=" + mthd.Name +
- ", methodParameterType=" + parameters[0].ParameterType.Name +
- ", resourceType=" + collector.ResourceType.Name + ']');
-
- collector.Add(new ResourceMethodInjector(mthd));
- }
- }
- }
-
- /// <summary>
- /// Check whether the given member contains the given attribute.
- /// </summary>
- /// <param name="member">Mmeber.</param>
- /// <param name="attrType">Attribute type.</param>
- /// <param name="inherit">Inherit flag.</param>
- /// <returns>True if contains</returns>
- private static bool ContainsAttribute(MemberInfo member, Type attrType, bool inherit)
- {
- return member.GetCustomAttributes(attrType, inherit).Length > 0;
- }
-
- /// <summary>
- /// Collector.
- /// </summary>
- private class Collector
- {
- /** Attribute type. */
- private readonly Type _attrType;
-
- /** Resource type. */
- private readonly Type _resType;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="attrType">Atrribute type.</param>
- /// <param name="resType">Resource type.</param>
- public Collector(Type attrType, Type resType)
- {
- _attrType = attrType;
- _resType = resType;
- }
-
- /// <summary>
- /// Attribute type.
- /// </summary>
- public Type AttributeType
- {
- get { return _attrType; }
- }
-
- /// <summary>
- /// Resource type.
- /// </summary>
- public Type ResourceType
- {
- get { return _resType; }
- }
-
- /// <summary>
- /// Add injector.
- /// </summary>
- /// <param name="injector">Injector.</param>
- public void Add(IResourceInjector injector)
- {
- if (Injectors == null)
- Injectors = new List<IResourceInjector> { injector };
- else
- Injectors.Add(injector);
- }
-
- /// <summary>
- /// Injectors.
- /// </summary>
- public List<IResourceInjector> Injectors { get; private set; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceContext.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceContext.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceContext.cs
deleted file mode 100644
index f5674f3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceContext.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
-
- /// <summary>
- /// Service context.
- /// </summary>
- internal class ServiceContext : IServiceContext
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceContext"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ServiceContext(IPortableRawReader reader)
- {
- Debug.Assert(reader != null);
-
- Name = reader.ReadString();
- ExecutionId = reader.ReadGuid() ?? Guid.Empty;
- IsCancelled = reader.ReadBoolean();
- CacheName = reader.ReadString();
- AffinityKey = reader.ReadObject<object>();
- }
-
- /** <inheritdoc /> */
- public string Name { get; private set; }
-
- /** <inheritdoc /> */
- public Guid ExecutionId { get; private set; }
-
- /** <inheritdoc /> */
- public bool IsCancelled { get; private set; }
-
- /** <inheritdoc /> */
- public string CacheName { get; private set; }
-
- /** <inheritdoc /> */
- public object AffinityKey { get; private set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceDescriptor.cs
deleted file mode 100644
index 9bd9814..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceDescriptor.cs
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Impl.Collections;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Services;
-
- /// <summary>
- /// Service descriptor.
- /// </summary>
- internal class ServiceDescriptor : IServiceDescriptor
- {
- /** Services. */
- private readonly IServices _services;
-
- /** Service type. */
- private Type _type;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceDescriptor" /> class.
- /// </summary>
- /// <param name="name">Name.</param>
- /// <param name="reader">Reader.</param>
- /// <param name="services">Services.</param>
- public ServiceDescriptor(string name, PortableReaderImpl reader, IServices services)
- {
- Debug.Assert(reader != null);
- Debug.Assert(services != null);
- Debug.Assert(!string.IsNullOrEmpty(name));
-
- _services = services;
- Name = name;
-
- CacheName = reader.ReadString();
- MaxPerNodeCount = reader.ReadInt();
- TotalCount = reader.ReadInt();
- OriginNodeId = reader.ReadGuid() ?? Guid.Empty;
- AffinityKey = reader.ReadObject<object>();
-
- var mapSize = reader.ReadInt();
- var snap = new Dictionary<Guid, int>(mapSize);
-
- for (var i = 0; i < mapSize; i++)
- snap[reader.ReadGuid() ?? Guid.Empty] = reader.ReadInt();
-
- TopologySnapshot = snap.AsReadOnly();
- }
-
- /** <inheritdoc /> */
- public string Name { get; private set; }
-
- /** <inheritdoc /> */
- public Type Type
- {
- get
- {
- try
- {
- return _type ?? (_type = _services.GetServiceProxy<IService>(Name).GetType());
- }
- catch (Exception ex)
- {
- throw new ServiceInvocationException(
- "Failed to retrieve service type. It has either been cancelled, or is not a .Net service", ex);
- }
- }
- }
-
- /** <inheritdoc /> */
- public int TotalCount { get; private set; }
-
- /** <inheritdoc /> */
- public int MaxPerNodeCount { get; private set; }
-
- /** <inheritdoc /> */
- public string CacheName { get; private set; }
-
- /** <inheritdoc /> */
- public object AffinityKey { get; private set; }
-
- /** <inheritdoc /> */
- public Guid OriginNodeId { get; private set; }
-
- /** <inheritdoc /> */
- public IDictionary<Guid, int> TopologySnapshot { get; private set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxy.cs
deleted file mode 100644
index ebb4c84..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxy.cs
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Diagnostics;
- using System.Reflection;
- using System.Runtime.Remoting.Messaging;
- using System.Runtime.Remoting.Proxies;
-
- /// <summary>
- /// Service proxy: user works with a remote service as if it is a local object.
- /// </summary>
- /// <typeparam name="T">User type to be proxied.</typeparam>
- internal class ServiceProxy<T> : RealProxy
- {
- /** Services. */
- private readonly Func<MethodBase, object[], object> _invokeAction;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ServiceProxy{T}" /> class.
- /// </summary>
- /// <param name="invokeAction">Method invoke action.</param>
- public ServiceProxy(Func<MethodBase, object[], object> invokeAction)
- : base(typeof (T))
- {
- Debug.Assert(invokeAction != null);
-
- _invokeAction = invokeAction;
- }
-
- /** <inheritdoc /> */
- public override IMessage Invoke(IMessage msg)
- {
- var methodCall = msg as IMethodCallMessage;
-
- if (methodCall == null)
- throw new NotSupportedException("Service proxy operation type not supported: " + msg.GetType() +
- ". Only method and property calls are supported.");
-
- if (methodCall.InArgCount != methodCall.ArgCount)
- throw new NotSupportedException("Service proxy does not support out arguments: "
- + methodCall.MethodBase);
-
- var result = _invokeAction(methodCall.MethodBase, methodCall.Args);
-
- return new ReturnMessage(result, null, 0, methodCall.LogicalCallContext, methodCall);
- }
-
- /** <inheritdoc /> */
- public new T GetTransparentProxy()
- {
- return (T) base.GetTransparentProxy();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs
deleted file mode 100644
index fa5da17..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxyInvoker.cs
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
-
- /// <summary>
- /// Invokes service proxy methods.
- /// </summary>
- internal static class ServiceProxyInvoker
- {
- /// <summary>
- /// Invokes the service method according to data from a stream,
- /// and writes invocation result to the output stream.
- /// </summary>
- /// <param name="svc">Service instance.</param>
- /// <param name="methodName">Name of the method.</param>
- /// <param name="arguments">Arguments.</param>
- /// <returns>Pair of method return value and invocation exception.</returns>
- public static KeyValuePair<object, Exception> InvokeServiceMethod(object svc, string methodName,
- object[] arguments)
- {
- Debug.Assert(svc != null);
- Debug.Assert(!string.IsNullOrWhiteSpace(methodName));
-
- var method = GetMethodOrThrow(svc.GetType(), methodName, arguments);
-
- try
- {
- return new KeyValuePair<object, Exception>(method.Invoke(svc, arguments), null);
- }
- catch (TargetInvocationException invokeErr)
- {
- return new KeyValuePair<object, Exception>(null, invokeErr.InnerException);
- }
- catch (Exception err)
- {
- return new KeyValuePair<object, Exception>(null, err);
- }
- }
-
- /// <summary>
- /// Finds suitable method in the specified type, or throws an exception.
- /// </summary>
- private static MethodBase GetMethodOrThrow(Type svcType, string methodName, object[] arguments)
- {
- Debug.Assert(svcType != null);
- Debug.Assert(!string.IsNullOrWhiteSpace(methodName));
-
- // 1) Find methods by name
- var methods = svcType.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)
- .Where(m => CleanupMethodName(m) == methodName).ToArray();
-
- if (methods.Length == 1)
- return methods[0];
-
- if (methods.Length == 0)
- throw new InvalidOperationException(
- string.Format("Failed to invoke proxy: there is no method '{0}' in type '{1}'",
- methodName, svcType));
-
- // 2) There is more than 1 method with specified name - resolve with argument types.
- methods = methods.Where(m => AreMethodArgsCompatible(arguments, m.GetParameters())).ToArray();
-
- if (methods.Length == 1)
- return methods[0];
-
- // 3) 0 or more than 1 matching method - throw.
- var argsString = arguments == null || arguments.Length == 0
- ? "0"
- : "(" +
- arguments.Select(x => x == null ? "null" : x.GetType().Name).Aggregate((x, y) => x + ", " + y)
- + ")";
-
- if (methods.Length == 0)
- throw new InvalidOperationException(
- string.Format("Failed to invoke proxy: there is no method '{0}' in type '{1}' with {2} arguments",
- methodName, svcType, argsString));
-
- throw new InvalidOperationException(
- string.Format("Failed to invoke proxy: there are {2} methods '{0}' in type '{1}' with {3} " +
- "arguments, can't resolve ambiguity.", methodName, svcType, methods.Length, argsString));
- }
-
- /// <summary>
- /// Cleans up a method name by removing interface part,
- /// which occurs when explicit interface implementation is used.
- /// </summary>
- private static string CleanupMethodName(MethodBase method)
- {
- var name = method.Name;
-
- var dotIdx = name.LastIndexOf(Type.Delimiter);
-
- return dotIdx < 0 ? name : name.Substring(dotIdx + 1);
- }
-
- /// <summary>
- /// Determines whether specified method arguments are comatible with given method parameter definitions.
- /// </summary>
- /// <param name="methodArgs">Method argument types.</param>
- /// <param name="targetParameters">Target method parameter definitions.</param>
- /// <returns>True if a target method can be called with specified set of arguments; otherwise, false.</returns>
- private static bool AreMethodArgsCompatible(object[] methodArgs, ParameterInfo[] targetParameters)
- {
- if (methodArgs == null || methodArgs.Length == 0)
- return targetParameters.Length == 0;
-
- if (methodArgs.Length != targetParameters.Length)
- return false;
-
- return methodArgs
- .Zip(targetParameters, (arg, param) => arg == null || param.ParameterType.IsInstanceOfType(arg))
- .All(x => x);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
deleted file mode 100644
index e7af8da..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServiceProxySerializer.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Diagnostics;
- using System.Reflection;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
-
- /// <summary>
- /// Static proxy methods.
- /// </summary>
- internal static class ServiceProxySerializer
- {
- /// <summary>
- /// Writes proxy method invocation data to the specified writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="method">Method.</param>
- /// <param name="arguments">Arguments.</param>
- public static void WriteProxyMethod(PortableWriterImpl writer, MethodBase method, object[] arguments)
- {
- Debug.Assert(writer != null);
- Debug.Assert(method != null);
-
- writer.WriteString(method.Name);
-
- if (arguments != null)
- {
- writer.WriteBoolean(true);
- writer.WriteInt(arguments.Length);
-
- foreach (var arg in arguments)
- writer.WriteObject(arg);
- }
- else
- writer.WriteBoolean(false);
- }
-
- /// <summary>
- /// Reads proxy method invocation data from the specified reader.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="mthdName">Method name.</param>
- /// <param name="mthdArgs">Method arguments.</param>
- public static void ReadProxyMethod(IPortableStream stream, PortableMarshaller marsh,
- out string mthdName, out object[] mthdArgs)
- {
- var reader = marsh.StartUnmarshal(stream);
-
- var srvKeepPortable = reader.ReadBoolean();
-
- mthdName = reader.ReadString();
-
- if (reader.ReadBoolean())
- {
- mthdArgs = new object[reader.ReadInt()];
-
- if (srvKeepPortable)
- reader = marsh.StartUnmarshal(stream, true);
-
- for (var i = 0; i < mthdArgs.Length; i++)
- mthdArgs[i] = reader.ReadObject<object>();
- }
- else
- mthdArgs = null;
- }
-
- /// <summary>
- /// Writes method invocation result.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="methodResult">Method result.</param>
- /// <param name="invocationError">Method invocation error.</param>
- public static void WriteInvocationResult(IPortableStream stream, PortableMarshaller marsh, object methodResult,
- Exception invocationError)
- {
- Debug.Assert(stream != null);
- Debug.Assert(marsh != null);
-
- var writer = marsh.StartMarshal(stream);
-
- PortableUtils.WriteInvocationResult(writer, invocationError == null, invocationError ?? methodResult);
- }
-
- /// <summary>
- /// Reads method invocation result.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Portable flag.</param>
- /// <returns>
- /// Method invocation result, or exception in case of error.
- /// </returns>
- public static object ReadInvocationResult(IPortableStream stream, PortableMarshaller marsh, bool keepPortable)
- {
- Debug.Assert(stream != null);
- Debug.Assert(marsh != null);
-
- var mode = keepPortable ? PortableMode.ForcePortable : PortableMode.Deserialize;
-
- var reader = marsh.StartUnmarshal(stream, mode);
-
- object err;
-
- var res = PortableUtils.ReadInvocationResult(reader, out err);
-
- if (err == null)
- return res;
-
- var portErr = err as IPortableObject;
-
- throw portErr != null
- ? new ServiceInvocationException("Proxy method invocation failed with a portable error. " +
- "Examine PortableCause for details.", portErr)
- : new ServiceInvocationException("Proxy method invocation failed with an exception. " +
- "Examine InnerException for details.", (Exception) err);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
deleted file mode 100644
index 38a7175..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/Services.cs
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Reflection;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Services;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Services implementation.
- /// </summary>
- internal class Services : PlatformTarget, IServices
- {
- /** */
- private const int OpDeploy = 1;
-
- /** */
- private const int OpDeployMultiple = 2;
-
- /** */
- private const int OpDotnetServices = 3;
-
- /** */
- private const int OpInvokeMethod = 4;
-
- /** */
- private const int OpDescriptors = 5;
-
- /** */
- private readonly IClusterGroup _clusterGroup;
-
- /** Invoker portable flag. */
- protected readonly bool KeepPortable;
-
- /** Server portable flag. */
- protected readonly bool SrvKeepPortable;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Services" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="clusterGroup">Cluster group.</param>
- /// <param name="keepPortable">Invoker portable flag.</param>
- /// <param name="srvKeepPortable">Server portable flag.</param>
- public Services(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup clusterGroup,
- bool keepPortable, bool srvKeepPortable)
- : base(target, marsh)
- {
- Debug.Assert(clusterGroup != null);
-
- _clusterGroup = clusterGroup;
- KeepPortable = keepPortable;
- SrvKeepPortable = srvKeepPortable;
- }
-
- /** <inheritDoc /> */
- public virtual IServices WithKeepPortable()
- {
- if (KeepPortable)
- return this;
-
- return new Services(Target, Marshaller, _clusterGroup, true, SrvKeepPortable);
- }
-
- /** <inheritDoc /> */
- public virtual IServices WithServerKeepPortable()
- {
- if (SrvKeepPortable)
- return this;
-
- return new Services(UU.ServicesWithServerKeepPortable(Target), Marshaller, _clusterGroup, KeepPortable, true);
- }
-
- /** <inheritDoc /> */
- public virtual IServices WithAsync()
- {
- return new ServicesAsync(UU.ServicesWithAsync(Target), Marshaller, _clusterGroup, KeepPortable, SrvKeepPortable);
- }
-
- /** <inheritDoc /> */
- public virtual bool IsAsync
- {
- get { return false; }
- }
-
- /** <inheritDoc /> */
- public virtual IFuture GetFuture()
- {
- throw new InvalidOperationException("Asynchronous mode is disabled");
- }
-
- /** <inheritDoc /> */
- public virtual IFuture<TResult> GetFuture<TResult>()
- {
- throw new InvalidOperationException("Asynchronous mode is disabled");
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ClusterGroup
- {
- get { return _clusterGroup; }
- }
-
- /** <inheritDoc /> */
- public void DeployClusterSingleton(string name, IService service)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- IgniteArgumentCheck.NotNull(service, "service");
-
- DeployMultiple(name, service, 1, 1);
- }
-
- /** <inheritDoc /> */
- public void DeployNodeSingleton(string name, IService service)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- IgniteArgumentCheck.NotNull(service, "service");
-
- DeployMultiple(name, service, 0, 1);
- }
-
- /** <inheritDoc /> */
- public void DeployKeyAffinitySingleton<TK>(string name, IService service, string cacheName, TK affinityKey)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- IgniteArgumentCheck.NotNull(service, "service");
- IgniteArgumentCheck.NotNull(affinityKey, "affinityKey");
-
- Deploy(new ServiceConfiguration
- {
- Name = name,
- Service = service,
- CacheName = cacheName,
- AffinityKey = affinityKey,
- TotalCount = 1,
- MaxPerNodeCount = 1
- });
- }
-
- /** <inheritDoc /> */
- public void DeployMultiple(string name, IService service, int totalCount, int maxPerNodeCount)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- IgniteArgumentCheck.NotNull(service, "service");
-
- DoOutOp(OpDeployMultiple, w =>
- {
- w.WriteString(name);
- w.WriteObject(service);
- w.WriteInt(totalCount);
- w.WriteInt(maxPerNodeCount);
- });
- }
-
- /** <inheritDoc /> */
- public void Deploy(ServiceConfiguration configuration)
- {
- IgniteArgumentCheck.NotNull(configuration, "configuration");
-
- DoOutOp(OpDeploy, w =>
- {
- w.WriteString(configuration.Name);
- w.WriteObject(configuration.Service);
- w.WriteInt(configuration.TotalCount);
- w.WriteInt(configuration.MaxPerNodeCount);
- w.WriteString(configuration.CacheName);
- w.WriteObject(configuration.AffinityKey);
-
- if (configuration.NodeFilter != null)
- w.WriteObject(new PortableOrSerializableObjectHolder(configuration.NodeFilter));
- else
- w.WriteObject<PortableOrSerializableObjectHolder>(null);
- });
- }
-
- /** <inheritDoc /> */
- public void Cancel(string name)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
-
- UU.ServicesCancel(Target, name);
- }
-
- /** <inheritDoc /> */
- public void CancelAll()
- {
- UU.ServicesCancelAll(Target);
- }
-
- /** <inheritDoc /> */
- public ICollection<IServiceDescriptor> GetServiceDescriptors()
- {
- return DoInOp(OpDescriptors, stream =>
- {
- var reader = Marshaller.StartUnmarshal(stream, KeepPortable);
-
- var size = reader.ReadInt();
-
- var result = new List<IServiceDescriptor>(size);
-
- for (var i = 0; i < size; i++)
- {
- var name = reader.ReadString();
-
- result.Add(new ServiceDescriptor(name, reader, this));
- }
-
- return result;
- });
- }
-
- /** <inheritDoc /> */
- public T GetService<T>(string name)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
-
- var services = GetServices<T>(name);
-
- if (services == null)
- return default(T);
-
- return services.FirstOrDefault();
- }
-
- /** <inheritDoc /> */
- public ICollection<T> GetServices<T>(string name)
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
-
- return DoOutInOp<ICollection<T>>(OpDotnetServices, w => w.WriteString(name),
- r =>
- {
- bool hasVal = r.ReadBool();
-
- if (hasVal)
- {
- var count = r.ReadInt();
-
- var res = new List<T>(count);
-
- for (var i = 0; i < count; i++)
- res.Add((T)Marshaller.Ignite.HandleRegistry.Get<IService>(r.ReadLong()));
-
- return res;
- }
- return null;
- });
- }
-
- /** <inheritDoc /> */
- public T GetServiceProxy<T>(string name) where T : class
- {
- return GetServiceProxy<T>(name, false);
- }
-
- /** <inheritDoc /> */
- public T GetServiceProxy<T>(string name, bool sticky) where T : class
- {
- IgniteArgumentCheck.NotNullOrEmpty(name, "name");
- IgniteArgumentCheck.Ensure(typeof(T).IsInterface, "T", "Service proxy type should be an interface: " + typeof(T));
-
- // In local scenario try to return service instance itself instead of a proxy
- // Get as object because proxy interface may be different from real interface
- var locInst = GetService<object>(name) as T;
-
- if (locInst != null)
- return locInst;
-
- var javaProxy = UU.ServicesGetServiceProxy(Target, name, sticky);
-
- return new ServiceProxy<T>((method, args) => InvokeProxyMethod(javaProxy, method, args))
- .GetTransparentProxy();
- }
-
- /// <summary>
- /// Invokes the service proxy method.
- /// </summary>
- /// <param name="proxy">Unmanaged proxy.</param>
- /// <param name="method">Method to invoke.</param>
- /// <param name="args">Arguments.</param>
- /// <returns>
- /// Invocation result.
- /// </returns>
- private unsafe object InvokeProxyMethod(IUnmanagedTarget proxy, MethodBase method, object[] args)
- {
- return DoOutInOp(OpInvokeMethod,
- writer => ServiceProxySerializer.WriteProxyMethod(writer, method, args),
- stream => ServiceProxySerializer.ReadInvocationResult(stream, Marshaller, KeepPortable), proxy.Target);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServicesAsync.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServicesAsync.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServicesAsync.cs
deleted file mode 100644
index 860de45..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Services/ServicesAsync.cs
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Services
-{
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Services;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Async services implementation.
- /// </summary>
- internal class ServicesAsync : Services
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ServicesAsync" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="clusterGroup">Cluster group.</param>
- /// <param name="keepPortable">Portable flag.</param>
- /// <param name="srvKeepPortable">Server portable flag.</param>
- public ServicesAsync(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup clusterGroup,
- bool keepPortable, bool srvKeepPortable)
- : base(target, marsh, clusterGroup, keepPortable, srvKeepPortable)
- {
- // No-op
- }
-
- /** <inheritDoc /> */
- public override bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public override IServices WithKeepPortable()
- {
- if (KeepPortable)
- return this;
-
- return new ServicesAsync(Target, Marshaller, ClusterGroup, true, SrvKeepPortable);
- }
-
- /** <inheritDoc /> */
- public override IServices WithServerKeepPortable()
- {
- if (SrvKeepPortable)
- return this;
-
- return new ServicesAsync(Target, Marshaller, ClusterGroup, KeepPortable, true);
- }
-
- /** <inheritDoc /> */
- public override IServices WithAsync()
- {
- return this;
- }
-
- /** <inheritDoc /> */
- public override IFuture GetFuture()
- {
- return GetFuture<object>();
- }
-
- /** <inheritDoc /> */
- public override IFuture<T> GetFuture<T>()
- {
- return GetFuture<T>((futId, futTyp) => UU.TargetListenFuture(Target, futId, futTyp));
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/AsyncTransaction.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/AsyncTransaction.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/AsyncTransaction.cs
deleted file mode 100644
index 82d1d55..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/AsyncTransaction.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Transactions
-{
- using System;
- using System.Threading;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Grid async transaction facade.
- /// </summary>
- internal class AsyncTransaction : Transaction
- {
- /** */
- private readonly ThreadLocal<IFuture> _curFut = new ThreadLocal<IFuture>();
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AsyncTransaction"/> class.
- /// </summary>
- /// <param name="tx">The tx to wrap.</param>
- public AsyncTransaction(TransactionImpl tx) : base(tx)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- public override bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public override IFuture<TResult> GetFuture<TResult>()
- {
- return GetFuture() as IFuture<TResult>;
- }
-
- /** <inheritDoc /> */
- public override IFuture GetFuture()
- {
- var fut = _curFut.Value;
-
- if (fut == null)
- throw new InvalidOperationException("Asynchronous operation not started.");
-
- _curFut.Value = null;
-
- return fut;
- }
-
- /** <inheritDoc /> */
- public override void Commit()
- {
- _curFut.Value = Tx.GetFutureOrError(() => Tx.CommitAsync());
- }
-
- /** <inheritDoc /> */
- public override void Rollback()
- {
- _curFut.Value = Tx.GetFutureOrError(() => Tx.RollbackAsync());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/Transaction.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/Transaction.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/Transaction.cs
deleted file mode 100644
index 47c9f93..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/Transaction.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Transactions
-{
- using System;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Ignite transaction facade.
- /// </summary>
- internal class Transaction : ITransaction
- {
- /** */
- protected readonly TransactionImpl Tx;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Transaction" /> class.
- /// </summary>
- /// <param name="tx">The tx to wrap.</param>
- public Transaction(TransactionImpl tx)
- {
- Tx = tx;
- }
-
- /** <inheritDoc /> */
- public void Dispose()
- {
- Tx.Dispose();
- }
-
- /** <inheritDoc /> */
- public ITransaction WithAsync()
- {
- return new AsyncTransaction(Tx);
- }
-
- /** <inheritDoc /> */
- public virtual bool IsAsync
- {
- get { return false; }
- }
-
- /** <inheritDoc /> */
- public virtual IFuture GetFuture()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public virtual IFuture<TResult> GetFuture<TResult>()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public Guid NodeId
- {
- get { return Tx.NodeId; }
- }
-
- /** <inheritDoc /> */
- public long ThreadId
- {
- get { return Tx.ThreadId; }
- }
-
- /** <inheritDoc /> */
- public DateTime StartTime
- {
- get { return Tx.StartTime; }
- }
-
- /** <inheritDoc /> */
- public TransactionIsolation Isolation
- {
- get { return Tx.Isolation; }
- }
-
- /** <inheritDoc /> */
- public TransactionConcurrency Concurrency
- {
- get { return Tx.Concurrency; }
- }
-
- /** <inheritDoc /> */
- public TransactionState State
- {
- get { return Tx.State; }
- }
-
- /** <inheritDoc /> */
- public TimeSpan Timeout
- {
- get { return Tx.Timeout; }
- }
-
- /** <inheritDoc /> */
- public bool IsRollbackOnly
- {
- get { return Tx.IsRollbackOnly; }
- }
-
- /** <inheritDoc /> */
- public bool SetRollbackonly()
- {
- return Tx.SetRollbackOnly();
- }
-
- /** <inheritDoc /> */
- public virtual void Commit()
- {
- Tx.Commit();
- }
-
- /** <inheritDoc /> */
- public virtual void Rollback()
- {
- Tx.Rollback();
- }
-
- /** <inheritDoc /> */
- public void AddMeta<TV>(string name, TV val)
- {
- Tx.AddMeta(name, val);
- }
-
- /** <inheritDoc /> */
- public TV Meta<TV>(string name)
- {
- return Tx.Meta<TV>(name);
- }
-
- /** <inheritDoc /> */
- public TV RemoveMeta<TV>(string name)
- {
- return Tx.RemoveMeta<TV>(name);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
deleted file mode 100644
index 9e71181..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionImpl.cs
+++ /dev/null
@@ -1,489 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Transactions
-{
- using System;
- using System.Threading;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Grid cache transaction implementation.
- /// </summary>
- internal sealed class TransactionImpl
- {
- /** Metadatas. */
- private object[] _metas;
-
- /** Unique transaction ID.*/
- private readonly long _id;
-
- /** Cache. */
- private readonly TransactionsImpl _txs;
-
- /** TX concurrency. */
- private readonly TransactionConcurrency _concurrency;
-
- /** TX isolation. */
- private readonly TransactionIsolation _isolation;
-
- /** Timeout. */
- private readonly TimeSpan _timeout;
-
- /** Start time. */
- private readonly DateTime _startTime;
-
- /** Owning thread ID. */
- private readonly int _threadId;
-
- /** Originating node ID. */
- private readonly Guid _nodeId;
-
- /** State holder. */
- private StateHolder _state;
-
- // ReSharper disable once InconsistentNaming
- /** Transaction for this thread. */
- [ThreadStatic]
- private static TransactionImpl THREAD_TX;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- /// <param name="txs">Transactions.</param>
- /// <param name="concurrency">TX concurrency.</param>
- /// <param name="isolation">TX isolation.</param>
- /// <param name="timeout">Timeout.</param>
- /// <param name="nodeId">The originating node identifier.</param>
- public TransactionImpl(long id, TransactionsImpl txs, TransactionConcurrency concurrency,
- TransactionIsolation isolation, TimeSpan timeout, Guid nodeId) {
- _id = id;
- _txs = txs;
- _concurrency = concurrency;
- _isolation = isolation;
- _timeout = timeout;
- _nodeId = nodeId;
-
- _startTime = DateTime.Now;
-
- _threadId = Thread.CurrentThread.ManagedThreadId;
-
- THREAD_TX = this;
- }
-
- /// <summary>
- /// Transaction assigned to this thread.
- /// </summary>
- public static Transaction Current
- {
- get
- {
- var tx = THREAD_TX;
-
- if (tx == null)
- return null;
-
- if (tx.IsClosed)
- {
- THREAD_TX = null;
-
- return null;
- }
-
- return new Transaction(tx);
- }
- }
-
- /// <summary>
- /// Commits this tx and closes it.
- /// </summary>
- public void Commit()
- {
- lock (this)
- {
- ThrowIfClosed();
-
- _state = new StateHolder(_txs.TxCommit(this));
- }
- }
-
- /// <summary>
- /// Rolls this tx back and closes it.
- /// </summary>
- public void Rollback()
- {
- lock (this)
- {
- ThrowIfClosed();
-
- _state = new StateHolder(_txs.TxRollback(this));
- }
- }
-
- /// <summary>
- /// Sets the rollback only flag.
- /// </summary>
- public bool SetRollbackOnly()
- {
- lock (this)
- {
- ThrowIfClosed();
-
- return _txs.TxSetRollbackOnly(this);
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether this instance is rollback only.
- /// </summary>
- public bool IsRollbackOnly
- {
- get
- {
- lock (this)
- {
- var state0 = _state == null ? State : _state.State;
-
- return state0 == TransactionState.MarkedRollback ||
- state0 == TransactionState.RollingBack ||
- state0 == TransactionState.RolledBack;
- }
- }
- }
-
- /// <summary>
- /// Gets the state.
- /// </summary>
- public TransactionState State
- {
- get
- {
- lock (this)
- {
- return _state != null ? _state.State : _txs.TxState(this);
- }
- }
- }
-
- /// <summary>
- /// Gets the isolation.
- /// </summary>
- public TransactionIsolation Isolation
- {
- get { return _isolation; }
- }
-
- /// <summary>
- /// Gets the concurrency.
- /// </summary>
- public TransactionConcurrency Concurrency
- {
- get { return _concurrency; }
- }
-
- /// <summary>
- /// Gets the timeout.
- /// </summary>
- public TimeSpan Timeout
- {
- get { return _timeout; }
- }
-
- /// <summary>
- /// Gets the start time.
- /// </summary>
- public DateTime StartTime
- {
- get { return _startTime; }
- }
-
-
- /// <summary>
- /// Gets the node identifier.
- /// </summary>
- public Guid NodeId
- {
- get { return _nodeId; }
- }
-
- /// <summary>
- /// Gets the thread identifier.
- /// </summary>
- public long ThreadId
- {
- get { return _threadId; }
- }
-
- /// <summary>
- /// Adds a new metadata.
- /// </summary>
- public void AddMeta<TV>(string name, TV val)
- {
- if (name == null)
- throw new ArgumentException("Meta name cannot be null.");
-
- lock (this)
- {
- if (_metas != null)
- {
- int putIdx = -1;
-
- for (int i = 0; i < _metas.Length; i += 2)
- {
- if (name.Equals(_metas[i]))
- {
- _metas[i + 1] = val;
-
- return;
- }
- if (_metas[i] == null && putIdx == -1)
- // Preserve empty space index.
- putIdx = i;
- }
-
- // No meta with the given name found.
- if (putIdx == -1)
- {
- // Extend array.
- putIdx = _metas.Length;
-
- object[] metas0 = new object[putIdx + 2];
-
- Array.Copy(_metas, metas0, putIdx);
-
- _metas = metas0;
- }
-
- _metas[putIdx] = name;
- _metas[putIdx + 1] = val;
- }
- else
- _metas = new object[] { name, val };
- }
- }
-
- /// <summary>
- /// Gets metadata by name.
- /// </summary>
- public TV Meta<TV>(string name)
- {
- if (name == null)
- throw new ArgumentException("Meta name cannot be null.");
-
- lock (this)
- {
- if (_metas != null)
- {
- for (int i = 0; i < _metas.Length; i += 2)
- {
- if (name.Equals(_metas[i]))
- return (TV)_metas[i + 1];
- }
- }
-
- return default(TV);
- }
- }
-
- /// <summary>
- /// Removes metadata by name.
- /// </summary>
- public TV RemoveMeta<TV>(string name)
- {
- if (name == null)
- throw new ArgumentException("Meta name cannot be null.");
-
- lock (this)
- {
- if (_metas != null)
- {
- for (int i = 0; i < _metas.Length; i += 2)
- {
- if (name.Equals(_metas[i]))
- {
- TV val = (TV)_metas[i + 1];
-
- _metas[i] = null;
- _metas[i + 1] = null;
-
- return val;
- }
- }
- }
-
- return default(TV);
- }
- }
-
- /// <summary>
- /// Commits tx in async mode.
- /// </summary>
- internal IFuture CommitAsync()
- {
- lock (this)
- {
- ThrowIfClosed();
-
- var fut = _txs.CommitAsync(this);
-
- CloseWhenComplete(fut);
-
- return fut;
- }
- }
-
- /// <summary>
- /// Rolls tx back in async mode.
- /// </summary>
- internal IFuture RollbackAsync()
- {
- lock (this)
- {
- ThrowIfClosed();
-
- var fut = _txs.RollbackAsync(this);
-
- CloseWhenComplete(fut);
-
- return fut;
- }
- }
-
- /// <summary>
- /// Transaction ID.
- /// </summary>
- internal long Id
- {
- get { return _id; }
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- try
- {
- Close();
- }
- finally
- {
- GC.SuppressFinalize(this);
- }
- }
-
- /// <summary>
- /// Gets a value indicating whether this transaction is closed.
- /// </summary>
- internal bool IsClosed
- {
- get { return _state != null; }
- }
-
- /// <summary>
- /// Gets the closed exception.
- /// </summary>
- private InvalidOperationException GetClosedException()
- {
- return new InvalidOperationException(string.Format("Transaction {0} is closed, state is {1}", Id, State));
- }
-
- /// <summary>
- /// Creates a future via provided factory if IsClosed is false; otherwise, return a future with an error.
- /// </summary>
- internal IFuture GetFutureOrError(Func<IFuture> operationFactory)
- {
- lock (this)
- {
- return IsClosed ? GetExceptionFuture() : operationFactory();
- }
- }
-
- /// <summary>
- /// Gets the future that throws an exception.
- /// </summary>
- private IFuture GetExceptionFuture()
- {
- var fut = new Future<object>();
-
- fut.OnError(GetClosedException());
-
- return fut;
- }
-
- /// <summary>
- /// Closes the transaction and releases unmanaged resources.
- /// </summary>
- private void Close()
- {
- lock (this)
- {
- _state = _state ?? new StateHolder((TransactionState) _txs.TxClose(this));
- }
- }
-
- /// <summary>
- /// Throws and exception if transaction is closed.
- /// </summary>
- private void ThrowIfClosed()
- {
- if (IsClosed)
- throw GetClosedException();
- }
-
- /// <summary>
- /// Closes this transaction upon future completion.
- /// </summary>
- private void CloseWhenComplete(IFuture fut)
- {
- fut.Listen(Close);
- }
-
- /** <inheritdoc /> */
- ~TransactionImpl()
- {
- Dispose();
- }
-
- /// <summary>
- /// State holder.
- /// </summary>
- private class StateHolder
- {
- /** Current state. */
- private readonly TransactionState _state;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="state">State.</param>
- public StateHolder(TransactionState state)
- {
- _state = state;
- }
-
- /// <summary>
- /// Current state.
- /// </summary>
- public TransactionState State
- {
- get { return _state; }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs
deleted file mode 100644
index e2528f4..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionMetricsImpl.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Transactions
-{
- using System;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Transaction metrics.
- /// </summary>
- internal class TransactionMetricsImpl : ITransactionMetrics
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionMetricsImpl"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public TransactionMetricsImpl(IPortableRawReader reader)
- {
- CommitTime = reader.ReadDate() ?? default(DateTime);
- RollbackTime = reader.ReadDate() ?? default(DateTime);
-
- TxCommits = reader.ReadInt();
- TxRollbacks = reader.ReadInt();
- }
-
- /// <summary>
- /// Gets the last time transaction was committed.
- /// </summary>
- public DateTime CommitTime { get; private set; }
-
- /// <summary>
- /// Gets the last time transaction was rolled back.
- /// </summary>
- public DateTime RollbackTime { get; private set; }
-
- /// <summary>
- /// Gets the total number of transaction commits.
- /// </summary>
- public int TxCommits { get; private set; }
-
- /// <summary>
- /// Gets the total number of transaction rollbacks.
- /// </summary>
- public int TxRollbacks { get; private set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
deleted file mode 100644
index 4eaa53f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Transactions/TransactionsImpl.cs
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Transactions
-{
- using System;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Transactions;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Transactions facade.
- /// </summary>
- internal class TransactionsImpl : PlatformTarget, ITransactions
- {
- /** */
- private const int OpCacheConfigParameters = 1;
-
- /** */
- private const int OpMetrics = 2;
-
- /** */
- private readonly TransactionConcurrency _dfltConcurrency;
-
- /** */
- private readonly TransactionIsolation _dfltIsolation;
-
- /** */
- private readonly TimeSpan _dfltTimeout;
-
- /** */
- private readonly Guid _localNodeId;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="TransactionsImpl" /> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="localNodeId">Local node id.</param>
- public TransactionsImpl(IUnmanagedTarget target, PortableMarshaller marsh,
- Guid localNodeId) : base(target, marsh)
- {
- _localNodeId = localNodeId;
-
- TransactionConcurrency concurrency = default(TransactionConcurrency);
- TransactionIsolation isolation = default(TransactionIsolation);
- TimeSpan timeout = default(TimeSpan);
-
- DoInOp(OpCacheConfigParameters, stream =>
- {
- var reader = marsh.StartUnmarshal(stream).RawReader();
-
- concurrency = reader.ReadEnum<TransactionConcurrency>();
- isolation = reader.ReadEnum<TransactionIsolation>();
- timeout = TimeSpan.FromMilliseconds(reader.ReadLong());
- });
-
- _dfltConcurrency = concurrency;
- _dfltIsolation = isolation;
- _dfltTimeout = timeout;
- }
-
- /** <inheritDoc /> */
- public ITransaction TxStart()
- {
- return TxStart(_dfltConcurrency, _dfltIsolation);
- }
-
- /** <inheritDoc /> */
- public ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation)
- {
- return TxStart(concurrency, isolation, _dfltTimeout, 0);
- }
-
- /** <inheritDoc /> */
- public ITransaction TxStart(TransactionConcurrency concurrency, TransactionIsolation isolation,
- TimeSpan timeout, int txSize)
- {
- var id = UU.TransactionsStart(Target, (int)concurrency, (int)isolation, (long)timeout.TotalMilliseconds,
- txSize);
-
- var innerTx = new TransactionImpl(id, this, concurrency, isolation, timeout, _localNodeId);
-
- return new Transaction(innerTx);
- }
-
- /** <inheritDoc /> */
- public ITransaction Tx
- {
- get { return TransactionImpl.Current; }
- }
-
- /** <inheritDoc /> */
- public ITransactionMetrics GetMetrics()
- {
- return DoInOp(OpMetrics, stream =>
- {
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- return new TransactionMetricsImpl(reader);
- });
- }
-
- /** <inheritDoc /> */
- public void ResetMetrics()
- {
- UU.TransactionsResetMetrics(Target);
- }
-
- /// <summary>
- /// Commit transaction.
- /// </summary>
- /// <param name="tx">Transaction.</param>
- /// <returns>Final transaction state.</returns>
- internal TransactionState TxCommit(TransactionImpl tx)
- {
- return (TransactionState) UU.TransactionsCommit(Target, tx.Id);
- }
-
- /// <summary>
- /// Rollback transaction.
- /// </summary>
- /// <param name="tx">Transaction.</param>
- /// <returns>Final transaction state.</returns>
- internal TransactionState TxRollback(TransactionImpl tx)
- {
- return (TransactionState)UU.TransactionsRollback(Target, tx.Id);
- }
-
- /// <summary>
- /// Close transaction.
- /// </summary>
- /// <param name="tx">Transaction.</param>
- /// <returns>Final transaction state.</returns>
- internal int TxClose(TransactionImpl tx)
- {
- return UU.TransactionsClose(Target, tx.Id);
- }
-
- /// <summary>
- /// Get transaction current state.
- /// </summary>
- /// <param name="tx">Transaction.</param>
- /// <returns>Transaction current state.</returns>
- internal TransactionState TxState(TransactionImpl tx)
- {
- return GetTransactionState(UU.TransactionsState(Target, tx.Id));
- }
-
- /// <summary>
- /// Set transaction rollback-only flag.
- /// </summary>
- /// <param name="tx">Transaction.</param>
- /// <returns><c>true</c> if the flag was set.</returns>
- internal bool TxSetRollbackOnly(TransactionImpl tx)
- {
- return UU.TransactionsSetRollbackOnly(Target, tx.Id);
- }
-
- /// <summary>
- /// Commits tx in async mode.
- /// </summary>
- internal IFuture CommitAsync(TransactionImpl tx)
- {
- return GetFuture<object>((futId, futTyp) => UU.TransactionsCommitAsync(Target, tx.Id, futId));
- }
-
- /// <summary>
- /// Rolls tx back in async mode.
- /// </summary>
- internal IFuture RollbackAsync(TransactionImpl tx)
- {
- return GetFuture<object>((futId, futTyp) => UU.TransactionsRollbackAsync(Target, tx.Id, futId));
- }
-
- /// <summary>
- /// Gets the state of the transaction from int.
- /// </summary>
- private static TransactionState GetTransactionState(int state)
- {
- return (TransactionState)state;
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IUnmanagedTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IUnmanagedTarget.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IUnmanagedTarget.cs
deleted file mode 100644
index 235f20d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/IUnmanagedTarget.cs
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System;
-
- /// <summary>
- /// Unmanaged target.
- /// </summary>
- internal unsafe interface IUnmanagedTarget : IDisposable
- {
- /// <summary>
- /// Context.
- /// </summary>
- void* Context { get; }
-
- /// <summary>
- /// Target.
- /// </summary>
- void* Target { get; }
-
- /// <summary>
- /// Creates new instance with same context and different target.
- /// </summary>
- IUnmanagedTarget ChangeTarget(void* target);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
deleted file mode 100644
index 07cf309..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbackHandlers.cs
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Unmanaged callback handler function pointers.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- internal unsafe struct UnmanagedCallbackHandlers
- {
- internal void* target;
-
- internal void* cacheStoreCreate;
- internal void* cacheStoreInvoke;
- internal void* cacheStoreDestroy;
- internal void* cacheStoreSessionCreate;
-
- internal void* cacheEntryFilterCreate;
- internal void* cacheEntryFilterApply;
- internal void* cacheEntryFilterDestroy;
-
- internal void* cacheInvoke;
-
- internal void* computeTaskMap;
- internal void* computeTaskJobResult;
- internal void* computeTaskReduce;
- internal void* computeTaskComplete;
- internal void* computeJobSerialize;
- internal void* computeJobCreate;
- internal void* computeJobExecute;
- internal void* computeJobCancel;
- internal void* computeJobDestroy;
-
- internal void* continuousQueryListenerApply;
- internal void* continuousQueryFilterCreate;
- internal void* continuousQueryFilterApply;
- internal void* continuousQueryFilterRelease;
-
- internal void* dataStreamerTopologyUpdate;
- internal void* dataStreamerStreamReceiverInvoke;
-
- internal void* futureByteResult;
- internal void* futureBoolResult;
- internal void* futureShortResult;
- internal void* futureCharResult;
- internal void* futureIntResult;
- internal void* futureFloatResult;
- internal void* futureLongResult;
- internal void* futureDoubleResult;
- internal void* futureObjectResult;
- internal void* futureNullResult;
- internal void* futureError;
-
- internal void* lifecycleOnEvent;
-
- internal void* memoryReallocate;
-
- internal void* messagingFilterCreate;
- internal void* messagingFilterApply;
- internal void* messagingFilterDestroy;
-
- internal void* eventFilterCreate;
- internal void* eventFilterApply;
- internal void* eventFilterDestroy;
-
- internal void* serviceInit;
- internal void* serviceExecute;
- internal void* serviceCancel;
- internal void* serviceInvokeMethod;
-
- internal void* clusterNodeFilterApply;
-
- internal void* nodeInfo;
-
- internal void* onStart;
- internal void* onStop;
- internal void* error;
-
- internal void* extensionCbInLongOutLong;
- internal void* extensionCbInLongLongOutLong;
- }
-}
[13/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableObject.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableObject.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableObject.cs
deleted file mode 100644
index 3da8dec..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableObject.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Wrapper for serialized portable objects.
- /// </summary>
- public interface IPortableObject
- {
- /// <summary>
- /// Gets portable object type ID.
- /// </summary>
- /// <value>
- /// Type ID.
- /// </value>
- int TypeId { get; }
-
- /// <summary>
- /// Gets object metadata.
- /// </summary>
- /// <returns>Metadata.</returns>
- IPortableMetadata GetMetadata();
-
- /// <summary>
- /// Gets field value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>
- /// Field value.
- /// </returns>
- TF GetField<TF>(string fieldName);
-
- /// <summary>
- /// Gets fully deserialized instance of portable object.
- /// </summary>
- /// <returns>
- /// Fully deserialized instance of portable object.
- /// </returns>
- T Deserialize<T>();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs
deleted file mode 100644
index ee2520d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawReader.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- /// <summary>
- /// Raw reader for portable objects.
- /// </summary>
- public interface IPortableRawReader
- {
- /// <summary>
- /// Read byte value.
- /// </summary>
- /// <returns>Byte value.</returns>
- byte ReadByte();
-
- /// <summary>
- /// Read byte array.
- /// </summary>
- /// <returns>Byte array.</returns>
- byte[] ReadByteArray();
-
- /// <summary>
- /// Read char value.
- /// </summary>
- /// <returns>Char value.</returns>
- char ReadChar();
-
- /// <summary>
- /// Read char array.
- /// </summary>
- /// <returns>Char array.</returns>
- char[] ReadCharArray();
-
- /// <summary>
- /// Read short value.
- /// </summary>
- /// <returns>Short value.</returns>
- short ReadShort();
-
- /// <summary>
- /// Read short array.
- /// </summary>
- /// <returns>Short array.</returns>
- short[] ReadShortArray();
-
- /// <summary>
- /// Read int value.
- /// </summary>
- /// <returns>Int value.</returns>
- int ReadInt();
-
- /// <summary>
- /// Read int array.
- /// </summary>
- /// <returns>Int array.</returns>
- int[] ReadIntArray();
-
- /// <summary>
- /// Read long value.
- /// </summary>
- /// <returns>Long value.</returns>
- long ReadLong();
-
- /// <summary>
- /// Read long array.
- /// </summary>
- /// <returns>Long array.</returns>
- long[] ReadLongArray();
-
- /// <summary>
- /// Read boolean value.
- /// </summary>
- /// <returns>Boolean value.</returns>
- bool ReadBoolean();
-
- /// <summary>
- /// Read boolean array.
- /// </summary>
- /// <returns>Boolean array.</returns>
- bool[] ReadBooleanArray();
-
- /// <summary>
- /// Read float value.
- /// </summary>
- /// <returns>Float value.</returns>
- float ReadFloat();
-
- /// <summary>
- /// Read float array.
- /// </summary>
- /// <returns>Float array.</returns>
- float[] ReadFloatArray();
-
- /// <summary>
- /// Read double value.
- /// </summary>
- /// <returns>Double value.</returns>
- double ReadDouble();
-
- /// <summary>
- /// Read double array.
- /// </summary>
- /// <returns>Double array.</returns>
- double[] ReadDoubleArray();
-
- /// <summary>
- /// Read decimal value.
- /// </summary>
- /// <returns>Decimal value.</returns>
- decimal ReadDecimal();
-
- /// <summary>
- /// Read decimal array.
- /// </summary>
- /// <returns>Decimal array.</returns>
- decimal[] ReadDecimalArray();
-
- /// <summary>
- /// Read date value in UTC form. Shortcut for <c>ReadDate(false)</c>.
- /// </summary>
- /// <returns>Date value.</returns>
- DateTime? ReadDate();
-
- /// <summary>
- /// Read date value.
- /// </summary>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns></returns>
- DateTime? ReadDate(bool local);
-
- /// <summary>
- /// Read date array in UTC form. Shortcut for <c>ReadDateArray(false)</c>.
- /// </summary>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray();
-
- /// <summary>
- /// Read date array.
- /// </summary>
- /// <param name="local">Whether to read date array in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(bool local);
-
- /// <summary>
- /// Read string value.
- /// </summary>
- /// <returns>String value.</returns>
- string ReadString();
-
- /// <summary>
- /// Read string array.
- /// </summary>
- /// <returns>String array.</returns>
- string[] ReadStringArray();
-
- /// <summary>
- /// Read GUID value.
- /// </summary>
- /// <returns>GUID value.</returns>
- Guid? ReadGuid();
-
- /// <summary>
- /// Read GUID array.
- /// </summary>
- /// <returns>GUID array.</returns>
- Guid?[] ReadGuidArray();
-
- /// <summary>
- /// Read enum value.
- /// </summary>
- /// <returns>Enum value.</returns>
- T ReadEnum<T>();
-
- /// <summary>
- /// Read enum array.
- /// </summary>
- /// <returns>Enum array.</returns>
- T[] ReadEnumArray<T>();
-
- /// <summary>
- /// Read object.
- /// </summary>
- /// <returns>Object.</returns>
- T ReadObject<T>();
-
- /// <summary>
- /// Read object array.
- /// </summary>
- /// <returns>Object array.</returns>
- T[] ReadObjectArray<T>();
-
- /// <summary>
- /// Read collection.
- /// </summary>
- /// <returns>Collection.</returns>
- ICollection ReadCollection();
-
- /// <summary>
- /// Read collection.
- /// </summary>
- /// <param name="factory">Factory.</param>
- /// <param name="adder">Adder.</param>
- /// <returns>Collection.</returns>
- ICollection ReadCollection(PortableCollectionFactory factory, PortableCollectionAdder adder);
-
- /// <summary>
- /// Read generic collection.
- /// </summary>
- /// <returns>Collection.</returns>
- ICollection<T> ReadGenericCollection<T>();
-
- /// <summary>
- /// Read generic collection.
- /// </summary>
- /// <param name="factory">Factory.</param>
- /// <returns>Collection.</returns>
- ICollection<T> ReadGenericCollection<T>(PortableGenericCollectionFactory<T> factory);
-
- /// <summary>
- /// Read dictionary.
- /// </summary>
- /// <returns>Dictionary.</returns>
- IDictionary ReadDictionary();
-
- /// <summary>
- /// Read dictionary.
- /// </summary>
- /// <param name="factory">Factory.</param>
- /// <returns>Dictionary.</returns>
- IDictionary ReadDictionary(PortableDictionaryFactory factory);
-
- /// <summary>
- /// Read generic dictionary.
- /// </summary>
- /// <returns>Dictionary.</returns>
- IDictionary<TK, TV> ReadGenericDictionary<TK, TV>();
-
- /// <summary>
- /// Read generic dictionary.
- /// </summary>
- /// <param name="factory">Factory.</param>
- /// <returns>Dictionary.</returns>
- IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(PortableGenericDictionaryFactory<TK, TV> factory);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs
deleted file mode 100644
index eacfde3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableRawWriter.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- /// <summary>
- /// Raw writer for portable objects.
- /// </summary>
- public interface IPortableRawWriter
- {
- /// <summary>
- /// Write byte value.
- /// </summary>
- /// <param name="val">Byte value.</param>
- void WriteByte(byte val);
-
- /// <summary>
- /// Write byte array.
- /// </summary>
- /// <param name="val">Byte array.</param>
- void WriteByteArray(byte[] val);
-
- /// <summary>
- /// Write char value.
- /// </summary>
- /// <param name="val">Char value.</param>
- void WriteChar(char val);
-
- /// <summary>
- /// Write char array.
- /// </summary>
- /// <param name="val">Char array.</param>
- void WriteCharArray(char[] val);
-
- /// <summary>
- /// Write short value.
- /// </summary>
- /// <param name="val">Short value.</param>
- void WriteShort(short val);
-
- /// <summary>
- /// Write short array.
- /// </summary>
- /// <param name="val">Short array.</param>
- void WriteShortArray(short[] val);
-
- /// <summary>
- /// Write int value.
- /// </summary>
- /// <param name="val">Int value.</param>
- void WriteInt(int val);
-
- /// <summary>
- /// Write int array.
- /// </summary>
- /// <param name="val">Int array.</param>
- void WriteIntArray(int[] val);
-
- /// <summary>
- /// Write long value.
- /// </summary>
- /// <param name="val">Long value.</param>
- void WriteLong(long val);
-
- /// <summary>
- /// Write long array.
- /// </summary>
- /// <param name="val">Long array.</param>
- void WriteLongArray(long[] val);
-
- /// <summary>
- /// Write boolean value.
- /// </summary>
- /// <param name="val">Boolean value.</param>
- void WriteBoolean(bool val);
-
- /// <summary>
- /// Write boolean array.
- /// </summary>
- /// <param name="val">Boolean array.</param>
- void WriteBooleanArray(bool[] val);
-
- /// <summary>
- /// Write float value.
- /// </summary>
- /// <param name="val">Float value.</param>
- void WriteFloat(float val);
-
- /// <summary>
- /// Write float array.
- /// </summary>
- /// <param name="val">Float array.</param>
- void WriteFloatArray(float[] val);
-
- /// <summary>
- /// Write double value.
- /// </summary>
- /// <param name="val">Double value.</param>
- void WriteDouble(double val);
-
- /// <summary>
- /// Write double array.
- /// </summary>
- /// <param name="val">Double array.</param>
- void WriteDoubleArray(double[] val);
-
- /// <summary>
- /// Write decimal value.
- /// </summary>
- /// <param name="val">Decimal value.</param>
- void WriteDecimal(decimal val);
-
- /// <summary>
- /// Write decimal array.
- /// </summary>
- /// <param name="val">Decimal array.</param>
- void WriteDecimalArray(decimal[] val);
-
- /// <summary>
- /// Write date value.
- /// </summary>
- /// <param name="val">Date value.</param>
- void WriteDate(DateTime? val);
-
- /// <summary>
- /// Write date array.
- /// </summary>
- /// <param name="val">Date array.</param>
- void WriteDateArray(DateTime?[] val);
-
- /// <summary>
- /// Write string value.
- /// </summary>
- /// <param name="val">String value.</param>
- void WriteString(string val);
-
- /// <summary>
- /// Write string array.
- /// </summary>
- /// <param name="val">String array.</param>
- void WriteStringArray(string[] val);
-
- /// <summary>
- /// Write GUID value.
- /// </summary>
- /// <param name="val">GUID value.</param>
- void WriteGuid(Guid? val);
-
- /// <summary>
- /// Write GUID array.
- /// </summary>
- /// <param name="val">GUID array.</param>
- void WriteGuidArray(Guid?[] val);
-
- /// <summary>
- /// Write enum value.
- /// </summary>
- /// <param name="val">Enum value.</param>
- void WriteEnum<T>(T val);
-
- /// <summary>
- /// Write enum array.
- /// </summary>
- /// <param name="val">Enum array.</param>
- void WriteEnumArray<T>(T[] val);
-
- /// <summary>
- /// Write object value.
- /// </summary>
- /// <param name="val">Object value.</param>
- void WriteObject<T>(T val);
-
- /// <summary>
- /// Write object array.
- /// </summary>
- /// <param name="val">Object array.</param>
- void WriteObjectArray<T>(T[] val);
-
- /// <summary>
- /// Write collection.
- /// </summary>
- /// <param name="val">Collection.</param>
- void WriteCollection(ICollection val);
-
- /// <summary>
- /// Write generic collection.
- /// </summary>
- /// <param name="val">Collection.</param>
- void WriteGenericCollection<T>(ICollection<T> val);
-
- /// <summary>
- /// Write dictionary.
- /// </summary>
- /// <param name="val">Dictionary.</param>
- void WriteDictionary(IDictionary val);
-
- /// <summary>
- /// Write generic dictionary.
- /// </summary>
- /// <param name="val">Dictionary.</param>
- void WriteGenericDictionary<TK, TV>(IDictionary<TK, TV> val);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs
deleted file mode 100644
index 71bd4f2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableReader.cs
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- /// <summary>
- /// Delegate for collection creation.
- /// </summary>
- /// <param name="size">Collection size.</param>
- /// <returns>Collection.</returns>
- public delegate ICollection PortableCollectionFactory(int size);
-
- /// <summary>
- /// Delegate for adding element to collection.
- /// </summary>
- /// <param name="col">Collection.</param>
- /// <param name="elem">Element to add.</param>
- public delegate void PortableCollectionAdder(ICollection col, object elem);
-
- /// <summary>
- /// Delegate for generic collection creation.
- /// </summary>
- /// <param name="size">Collection size.</param>
- /// <returns>Collection.</returns>
- public delegate ICollection<T> PortableGenericCollectionFactory<T>(int size);
-
- /// <summary>
- /// Delegate for dictionary creation.
- /// </summary>
- /// <param name="size">Dictionary size.</param>
- /// <returns>Dictionary.</returns>
- public delegate IDictionary PortableDictionaryFactory(int size);
-
- /// <summary>
- /// Delegate for generic collection creation.
- /// </summary>
- /// <param name="size">Collection size.</param>
- /// <returns>Collection.</returns>
- public delegate IDictionary<TK, TV> PortableGenericDictionaryFactory<TK, TV>(int size);
-
- /// <summary>
- /// Reader for portable objects.
- /// </summary>
- public interface IPortableReader
- {
- /// <summary>
- /// Read named byte value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Byte value.</returns>
- byte ReadByte(string fieldName);
-
- /// <summary>
- /// Read named byte array.
- /// </summary>
- /// <returns>Byte array.</returns>
- byte[] ReadByteArray(string fieldName);
-
- /// <summary>
- /// Read named char value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Char value.</returns>
- char ReadChar(string fieldName);
-
- /// <summary>
- /// Read named char array.
- /// </summary>
- /// <returns>Char array.</returns>
- char[] ReadCharArray(string fieldName);
-
- /// <summary>
- /// Read named short value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Short value.</returns>
- short ReadShort(string fieldName);
-
- /// <summary>
- /// Read named short array.
- /// </summary>
- /// <returns>Short array.</returns>
- short[] ReadShortArray(string fieldName);
-
- /// <summary>
- /// Read named int value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Int value.</returns>
- int ReadInt(string fieldName);
-
- /// <summary>
- /// Read named int array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Int array.</returns>
- int[] ReadIntArray(string fieldName);
-
- /// <summary>
- /// Read named long value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Long value.</returns>
- long ReadLong(string fieldName);
-
- /// <summary>
- /// Read named long array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Long array.</returns>
- long[] ReadLongArray(string fieldName);
-
- /// <summary>
- /// Read named boolean value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Boolean value.</returns>
- bool ReadBoolean(string fieldName);
-
- /// <summary>
- /// Read named boolean array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Boolean array.</returns>
- bool[] ReadBooleanArray(string fieldName);
-
- /// <summary>
- /// Read named float value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Float value.</returns>
- float ReadFloat(string fieldName);
-
- /// <summary>
- /// Read named float array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Float array.</returns>
- float[] ReadFloatArray(string fieldName);
-
- /// <summary>
- /// Read named double value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Double value.</returns>
- double ReadDouble(string fieldName);
-
- /// <summary>
- /// Read named double array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Double array.</returns>
- double[] ReadDoubleArray(string fieldName);
-
- /// <summary>
- /// Read named decimal value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Decimal value.</returns>
- decimal ReadDecimal(string fieldName);
-
- /// <summary>
- /// Read named decimal array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Decimal array.</returns>
- decimal[] ReadDecimalArray(string fieldName);
-
- /// <summary>
- /// Read named date value in UTC form. Shortcut for <c>ReadDate(fieldName, false)</c>.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Date value.</returns>
- DateTime? ReadDate(string fieldName);
-
- /// <summary>
- /// Read named date value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns>Date vaule.</returns>
- DateTime? ReadDate(string fieldName, bool local);
-
- /// <summary>
- /// Read named date array in UTC form. Shortcut for <c>ReadDateArray(fieldName, false)</c>.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(string fieldName);
-
- /// <summary>
- /// Read named date array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="local">Whether to read date in local (<c>true</c>) or UTC (<c>false</c>) form.</param>
- /// <returns>Date array.</returns>
- DateTime?[] ReadDateArray(string fieldName, bool local);
-
- /// <summary>
- /// Read named string value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>String value.</returns>
- string ReadString(string fieldName);
-
- /// <summary>
- /// Read named string array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>String array.</returns>
- string[] ReadStringArray(string fieldName);
-
- /// <summary>
- /// Read named GUID value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>GUID value.</returns>
- Guid? ReadGuid(string fieldName);
-
- /// <summary>
- /// Read named GUID array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>GUID array.</returns>
- Guid?[] ReadGuidArray(string fieldName);
-
- /// <summary>
- /// Read named enum value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Enum value.</returns>
- T ReadEnum<T>(string fieldName);
-
- /// <summary>
- /// Read named enum array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Enum array.</returns>
- T[] ReadEnumArray<T>(string fieldName);
-
- /// <summary>
- /// Read named object.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Object.</returns>
- T ReadObject<T>(string fieldName);
-
- /// <summary>
- /// Read named object array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Object array.</returns>
- T[] ReadObjectArray<T>(string fieldName);
-
- /// <summary>
- /// Read named collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Collection.</returns>
- ICollection ReadCollection(string fieldName);
-
- /// <summary>
- /// Read named collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="factory">Factory.</param>
- /// <param name="adder">Adder.</param>
- /// <returns>Collection.</returns>
- ICollection ReadCollection(string fieldName, PortableCollectionFactory factory, PortableCollectionAdder adder);
-
- /// <summary>
- /// Read named generic collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Collection.</returns>
- ICollection<T> ReadGenericCollection<T>(string fieldName);
-
- /// <summary>
- /// Read named generic collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="factory">Factory.</param>
- /// <returns>Collection.</returns>
- ICollection<T> ReadGenericCollection<T>(string fieldName, PortableGenericCollectionFactory<T> factory);
-
- /// <summary>
- /// Read named dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Dictionary.</returns>
- IDictionary ReadDictionary(string fieldName);
-
- /// <summary>
- /// Read named dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="factory">Factory.</param>
- /// <returns>Dictionary.</returns>
- IDictionary ReadDictionary(string fieldName, PortableDictionaryFactory factory);
-
- /// <summary>
- /// Read named generic dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <returns>Dictionary.</returns>
- IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(string fieldName);
-
- /// <summary>
- /// Read named generic dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="factory">Factory.</param>
- /// <returns>Dictionary.</returns>
- IDictionary<TK, TV> ReadGenericDictionary<TK, TV>(string fieldName, PortableGenericDictionaryFactory<TK, TV> factory);
-
- /// <summary>
- /// Get raw reader.
- /// </summary>
- /// <returns>Raw reader.</returns>
- IPortableRawReader RawReader();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs
deleted file mode 100644
index ac40dd7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableSerializer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Portable serializer.
- /// </summary>
- public interface IPortableSerializer
- {
- /// <summary>
- /// Write portalbe object.
- /// </summary>
- /// <param name="obj">Object.</param>
- /// <param name="writer">Poratble writer.</param>
- void WritePortable(object obj, IPortableWriter writer);
-
- /// <summary>
- /// Read portable object.
- /// </summary>
- /// <param name="obj">Instantiated empty object.</param>
- /// <param name="reader">Poratble reader.</param>
- void ReadPortable(object obj, IPortableReader reader);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs
deleted file mode 100644
index 8df2d50..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortableWriter.cs
+++ /dev/null
@@ -1,259 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
-
- /// <summary>
- /// Writer for portable objects.
- /// </summary>
- public interface IPortableWriter
- {
- /// <summary>
- /// Write named byte value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Byte value.</param>
- void WriteByte(string fieldName, byte val);
-
- /// <summary>
- /// Write named byte array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Byte array.</param>
- void WriteByteArray(string fieldName, byte[] val);
-
- /// <summary>
- /// Write named char value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Char value.</param>
- void WriteChar(string fieldName, char val);
-
- /// <summary>
- /// Write named char array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Char array.</param>
- void WriteCharArray(string fieldName, char[] val);
-
- /// <summary>
- /// Write named short value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Short value.</param>
- void WriteShort(string fieldName, short val);
-
- /// <summary>
- /// Write named short array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Short array.</param>
- void WriteShortArray(string fieldName, short[] val);
-
- /// <summary>
- /// Write named int value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Int value.</param>
- void WriteInt(string fieldName, int val);
-
- /// <summary>
- /// Write named int array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Int array.</param>
- void WriteIntArray(string fieldName, int[] val);
-
- /// <summary>
- /// Write named long value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Long value.</param>
- void WriteLong(string fieldName, long val);
-
- /// <summary>
- /// Write named long array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Long array.</param>
- void WriteLongArray(string fieldName, long[] val);
-
- /// <summary>
- /// Write named boolean value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Boolean value.</param>
- void WriteBoolean(string fieldName, bool val);
-
- /// <summary>
- /// Write named boolean array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Boolean array.</param>
- void WriteBooleanArray(string fieldName, bool[] val);
-
- /// <summary>
- /// Write named float value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Float value.</param>
- void WriteFloat(string fieldName, float val);
-
- /// <summary>
- /// Write named float array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Float array.</param>
- void WriteFloatArray(string fieldName, float[] val);
-
- /// <summary>
- /// Write named double value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Double value.</param>
- void WriteDouble(string fieldName, double val);
-
- /// <summary>
- /// Write named double array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Double array.</param>
- void WriteDoubleArray(string fieldName, double[] val);
-
- /// <summary>
- /// Write named decimal value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Decimal value.</param>
- void WriteDecimal(string fieldName, decimal val);
-
- /// <summary>
- /// Write named decimal array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Decimal array.</param>
- void WriteDecimalArray(string fieldName, decimal[] val);
-
- /// <summary>
- /// Write named date value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Date value.</param>
- void WriteDate(string fieldName, DateTime? val);
-
- /// <summary>
- /// Write named date array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Date array.</param>
- void WriteDateArray(string fieldName, DateTime?[] val);
-
- /// <summary>
- /// Write named string value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">String value.</param>
- void WriteString(string fieldName, string val);
-
- /// <summary>
- /// Write named string array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">String array.</param>
- void WriteStringArray(string fieldName, string[] val);
-
- /// <summary>
- /// Write named GUID value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">GUID value.</param>
- void WriteGuid(string fieldName, Guid? val);
-
- /// <summary>
- /// Write named GUID array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">GUID array.</param>
- void WriteGuidArray(string fieldName, Guid?[] val);
-
- /// <summary>
- /// Write named enum value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Enum value.</param>
- void WriteEnum<T>(string fieldName, T val);
-
- /// <summary>
- /// Write named enum array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Enum array.</param>
- void WriteEnumArray<T>(string fieldName, T[] val);
-
- /// <summary>
- /// Write named object value.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Object value.</param>
- void WriteObject<T>(string fieldName, T val);
-
- /// <summary>
- /// Write named object array.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Object array.</param>
- void WriteObjectArray<T>(string fieldName, T[] val);
-
- /// <summary>
- /// Write named collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Collection.</param>
- void WriteCollection(string fieldName, ICollection val);
-
- /// <summary>
- /// Write named generic collection.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Collection.</param>
- void WriteGenericCollection<T>(string fieldName, ICollection<T> val);
-
- /// <summary>
- /// Write named dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Dictionary.</param>
- void WriteDictionary(string fieldName, IDictionary val);
-
- /// <summary>
- /// Write named generic dictionary.
- /// </summary>
- /// <param name="fieldName">Field name.</param>
- /// <param name="val">Dictionary.</param>
- void WriteGenericDictionary<TK, TV>(string fieldName, IDictionary<TK, TV> val);
-
- /// <summary>
- /// Get raw writer.
- /// </summary>
- /// <returns>Raw writer.</returns>
- IPortableRawWriter RawWriter();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortables.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortables.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortables.cs
deleted file mode 100644
index b1e77a6..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/IPortables.cs
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Defines portable objects functionality. With portable objects you are able to:
- /// <list type="bullet">
- /// <item>
- /// <description>Seamlessly interoperate between Java, .NET, and C++.</description>
- /// </item>
- /// <item>
- /// <description>Make any object portable with zero code change to your existing code.</description>
- /// </item>
- /// <item>
- /// <description>Nest portable objects within each other.</description>
- /// </item>
- /// <item>
- /// <description>Automatically handle <c>circular</c> or <c>null</c> references.</description>
- /// </item>
- /// <item>
- /// <description>Automatically convert collections and maps between Java, .NET, and C++.</description>
- /// </item>
- /// <item>
- /// <description>Optionally avoid deserialization of objects on the server side.</description>
- /// </item>
- /// <item>
- /// <description>Avoid need to have concrete class definitions on the server side.</description>
- /// </item>
- /// <item>
- /// <description>Dynamically change structure of the classes without having to restart the cluster.</description>
- /// </item>
- /// <item>
- /// <description>Index into portable objects for querying purposes.</description>
- /// </item>
- /// </list>
- /// </summary>
- public interface IPortables
- {
- /// <summary>
- /// Converts provided object to portable form.
- /// <para />
- /// Note that object's type needs to be configured in <see cref="PortableConfiguration"/>.
- /// </summary>
- /// <param name="obj">Object to convert.</param>
- /// <returns>Converted object.</returns>
- T ToPortable<T>(object obj);
-
- /// <summary>
- /// Create builder for the given portable object type. Note that this
- /// type must be specified in <see cref="PortableConfiguration"/>.
- /// </summary>
- /// <param name="type"></param>
- /// <returns>Builder.</returns>
- IPortableBuilder GetBuilder(Type type);
-
- /// <summary>
- /// Create builder for the given portable object type name. Note that this
- /// type name must be specified in <see cref="PortableConfiguration"/>.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- /// <returns>Builder.</returns>
- IPortableBuilder GetBuilder(string typeName);
-
- /// <summary>
- /// Create builder over existing portable object.
- /// </summary>
- /// <param name="obj"></param>
- /// <returns>Builder.</returns>
- IPortableBuilder GetBuilder(IPortableObject obj);
-
- /// <summary>
- /// Gets type id for the given type name.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- /// <returns>Type id.</returns>
- int GetTypeId(string typeName);
-
- /// <summary>
- /// Gets metadata for all known types.
- /// </summary>
- /// <returns>Metadata.</returns>
- ICollection<IPortableMetadata> GetMetadata();
-
- /// <summary>
- /// Gets metadata for specified type id.
- /// </summary>
- /// <returns>Metadata.</returns>
- IPortableMetadata GetMetadata(int typeId);
-
- /// <summary>
- /// Gets metadata for specified type name.
- /// </summary>
- /// <returns>Metadata.</returns>
- IPortableMetadata GetMetadata(string typeName);
-
- /// <summary>
- /// Gets metadata for specified type.
- /// </summary>
- /// <returns>Metadata.</returns>
- IPortableMetadata GetMetadata(Type type);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs
deleted file mode 100644
index 39878c2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableConfiguration.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Portable type configuration.
- /// </summary>
- public class PortableConfiguration
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableConfiguration()
- {
- DefaultMetadataEnabled = true;
- DefaultKeepDeserialized = true;
- }
-
- /// <summary>
- /// Copying constructor.
- /// </summary>
- /// <param name="cfg">Configuration to copy.</param>
- public PortableConfiguration(PortableConfiguration cfg)
- {
- DefaultIdMapper = cfg.DefaultIdMapper;
- DefaultNameMapper = cfg.DefaultNameMapper;
- DefaultMetadataEnabled = cfg.DefaultMetadataEnabled;
- DefaultKeepDeserialized = cfg.DefaultKeepDeserialized;
- DefaultSerializer = cfg.DefaultSerializer;
-
- Types = cfg.Types != null ? new List<string>(cfg.Types) : null;
-
- if (cfg.TypeConfigurations != null)
- {
- TypeConfigurations = new List<PortableTypeConfiguration>(cfg.TypeConfigurations.Count);
-
- foreach (PortableTypeConfiguration typeCfg in cfg.TypeConfigurations)
- TypeConfigurations.Add(new PortableTypeConfiguration(typeCfg));
- }
- }
-
- /// <summary>
- /// Type configurations.
- /// </summary>
- public ICollection<PortableTypeConfiguration> TypeConfigurations
- {
- get;
- set;
- }
-
- /// <summary>
- /// Portable types. Shorthand for creating PortableTypeConfiguration.
- /// </summary>
- public ICollection<string> Types
- {
- get;
- set;
- }
-
- /// <summary>
- /// Default name mapper.
- /// </summary>
- public IPortableNameMapper DefaultNameMapper
- {
- get;
- set;
- }
-
- /// <summary>
- /// Default ID mapper.
- /// </summary>
- public IPortableIdMapper DefaultIdMapper
- {
- get;
- set;
- }
-
- /// <summary>
- /// Default serializer.
- /// </summary>
- public IPortableSerializer DefaultSerializer
- {
- get;
- set;
- }
-
- /// <summary>
- /// Default metadata enabled flag. Defaults to true.
- /// </summary>
- public bool DefaultMetadataEnabled
- {
- get;
- set;
- }
-
- /// <summary>
- /// Default keep deserialized flag.
- /// </summary>
- public bool DefaultKeepDeserialized
- {
- get;
- set;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableException.cs
deleted file mode 100644
index 95edbc0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableException.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates an error during portable marshalling.
- /// </summary>
- [Serializable]
- public class PortableException : IgniteException
- {
- /// <summary>
- /// Constructs an exception.
- /// </summary>
- public PortableException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public PortableException(string message)
- : base(message) {
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="PortableException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public PortableException(string message, Exception cause)
- : base(message, cause) {
- }
-
- /// <summary>
- /// Constructs an exception.
- /// </summary>
- /// <param name="info">Serialization info.</param>
- /// <param name="ctx">Streaming context.</param>
- protected PortableException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx) {
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs
deleted file mode 100644
index bbbd4a8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeConfiguration.cs
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- using System;
-
- /// <summary>
- /// Portable type configuration.
- /// </summary>
- public class PortableTypeConfiguration
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableTypeConfiguration()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typeName">Type name.</param>
- public PortableTypeConfiguration(string typeName)
- {
- TypeName = typeName;
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="type">Type.</param>
- public PortableTypeConfiguration(Type type)
- {
- TypeName = type.FullName;
- }
-
- /// <summary>
- /// Copying constructor.
- /// </summary>
- /// <param name="cfg">Configuration to copy.</param>
- public PortableTypeConfiguration(PortableTypeConfiguration cfg)
- {
- AffinityKeyFieldName = cfg.AffinityKeyFieldName;
- AssemblyName = cfg.AssemblyName;
- IdMapper = cfg.IdMapper;
- NameMapper = cfg.NameMapper;
- Serializer = cfg.Serializer;
- TypeName = cfg.TypeName;
- MetadataEnabled = cfg.MetadataEnabled;
- KeepDeserialized = cfg.KeepDeserialized;
- }
-
- /// <summary>
- /// Assembly name.
- /// </summary>
- public string AssemblyName
- {
- get;
- set;
- }
-
- /// <summary>
- /// Fully qualified type name.
- /// </summary>
- public string TypeName
- {
- get;
- set;
- }
-
- /// <summary>
- /// Name mapper for the given type.
- /// </summary>
- public IPortableNameMapper NameMapper
- {
- get;
- set;
- }
-
- /// <summary>
- /// ID mapper for the given type. When it is necessary to resolve class (field) ID, then
- /// this property will be checked first. If not set, then PortableClassIdAttribute
- /// (PortableFieldIdAttribute) will be checked in class through reflection. If required
- /// attribute is not set, then ID will be hash code of the class (field) simple name in lower case.
- /// </summary>
- public IPortableIdMapper IdMapper
- {
- get;
- set;
- }
-
- /// <summary>
- /// Serializer for the given type. If not provided and class implements IPortable
- /// then its custom logic will be used. If not provided and class doesn't implement IPortable
- /// then all fields of the class except of those with [NotSerialized] attribute will be serialized
- ///with help of reflection.
- /// </summary>
- public IPortableSerializer Serializer
- {
- get;
- set;
- }
-
- /// <summary>
- /// Affinity key field name.
- /// </summary>
- public string AffinityKeyFieldName
- {
- get;
- set;
- }
-
- /// <summary>
- /// Metadata enabled flag. If set to non-null value, overrides default value set in
- /// PortableConfiguration.
- /// </summary>
- public bool? MetadataEnabled
- {
- get;
- set;
- }
-
- /// <summary>
- /// Keep deserialized flag. If set to non-null value, overrides default value set in
- /// PortableConfiguration.
- /// </summary>
- public bool? KeepDeserialized
- {
- get;
- set;
- }
-
- /// <summary>
- /// Returns a string that represents the current object.
- /// </summary>
- /// <returns>
- /// A string that represents the current object.
- /// </returns>
- override public string ToString()
- {
- return typeof(PortableTypeConfiguration).Name + " [TypeName=" + TypeName +
- ", NameMapper=" + NameMapper + ", IdMapper=" + IdMapper + ", Serializer=" + Serializer +
- ", AffinityKeyFieldName=" + AffinityKeyFieldName + ']';
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
deleted file mode 100644
index ed792c3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Portable/PortableTypeNames.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Portable
-{
- /// <summary>
- /// Portable type name constants.
- /// </summary>
- public static class PortableTypeNames
- {
- /** Type name: boolean. */
- public const string TypeNameBool = "boolean";
-
- /** Type name: byte. */
- public const string TypeNameByte = "byte";
-
- /** Type name: short. */
- public const string TypeNameShort = "short";
-
- /** Type name: char. */
- public const string TypeNameChar = "char";
-
- /** Type name: int. */
- public const string TypeNameInt = "int";
-
- /** Type name: long. */
- public const string TypeNameLong = "long";
-
- /** Type name: float. */
- public const string TypeNameFloat = "float";
-
- /** Type name: double. */
- public const string TypeNameDouble = "double";
-
- /** Type name: decimal. */
- public const string TypeNameDecimal = "decimal";
-
- /** Type name: String. */
- public const string TypeNameString = "String";
-
- /** Type name: UUID. */
- public const string TypeNameGuid = "UUID";
-
- /** Type name: Date. */
- public const string TypeNameDate = "Date";
-
- /** Type name: Enum. */
- public const string TypeNameEnum = "Enum";
-
- /** Type name: Object. */
- public const string TypeNameObject = "Object";
-
- /** Type name: boolean array. */
- public const string TypeNameArrayBool = "boolean[]";
-
- /** Type name: byte array. */
- public const string TypeNameArrayByte = "byte[]";
-
- /** Type name: short array. */
- public const string TypeNameArrayShort = "short[]";
-
- /** Type name: char array. */
- public const string TypeNameArrayChar = "char[]";
-
- /** Type name: int array. */
- public const string TypeNameArrayInt = "int[]";
-
- /** Type name: long array. */
- public const string TypeNameArrayLong = "long[]";
-
- /** Type name: float array. */
- public const string TypeNameArrayFloat = "float[]";
-
- /** Type name: double array. */
- public const string TypeNameArrayDouble = "double[]";
-
- /** Type name: decimal array. */
- public const string TypeNameArrayDecimal = "decimal[]";
-
- /** Type name: String array. */
- public const string TypeNameArrayString = "String[]";
-
- /** Type name: UUID array. */
- public const string TypeNameArrayGuid = "UUID[]";
-
- /** Type name: Date array. */
- public const string TypeNameArrayDate = "Date[]";
-
- /** Type name: Enum array. */
- public const string TypeNameArrayEnum = "Enum[]";
-
- /** Type name: Object array. */
- public const string TypeNameArrayObject = "Object[]";
-
- /** Type name: Collection. */
- public const string TypeNameCollection = "Collection";
-
- /** Type name: Map. */
- public const string TypeNameMap = "Map";
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
deleted file mode 100644
index 1bcb658..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Apache.Ignite.Core")]
-[assembly: AssemblyDescription("Apache Ignite .NET Core")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Apache Software Foundation")]
-[assembly: AssemblyProduct("Apache Ignite")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("97db45a8-f922-456a-a819-7b3c6e5e03ba")]
-
-[assembly: AssemblyVersion("1.5.0")]
-[assembly: AssemblyFileVersion("1.5.0")]
-
-[assembly: CLSCompliant(true)]
-
-#if !EXCLUDE_INTERNALS_VISIBLE_TO
-
-[assembly: InternalsVisibleTo("Apache.Ignite")]
-[assembly: InternalsVisibleTo("Apache.Ignite.Core.Tests")]
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/InstanceResourceAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/InstanceResourceAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/InstanceResourceAttribute.cs
deleted file mode 100644
index 8b34c10..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/InstanceResourceAttribute.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Resource
-{
- using System;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Compute;
-
- /// <summary>
- /// Attribute which injects <see cref="IIgnite"/> instance. Can be defined inside
- /// implementors of <see cref="IComputeTask{A,T,TR}"/> and <see cref="IComputeJob"/> interfaces.
- /// Can be applied to non-static fields, properties and methods returning <c>void</c> and
- /// accepting a single parameter.
- /// </summary>
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property)]
- public sealed class InstanceResourceAttribute : Attribute
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/StoreSessionResourceAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/StoreSessionResourceAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/StoreSessionResourceAttribute.cs
deleted file mode 100644
index 624c71d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Resource/StoreSessionResourceAttribute.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Resource
-{
- using System;
- using Apache.Ignite.Core.Cache.Store;
-
- /// <summary>
- /// Annotates a field or a setter method for injection of current <see cref="ICacheStoreSession"/>
- /// instance. It can be injected into <see cref="ICacheStore"/>.
- /// </summary>
- [AttributeUsage(AttributeTargets.Field | AttributeTargets.Method | AttributeTargets.Property)]
- public sealed class StoreSessionResourceAttribute : Attribute
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IService.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IService.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IService.cs
deleted file mode 100644
index 3668221..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IService.cs
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- /// <summary>
- /// Represents Ignite-managed service.
- /// </summary>
- public interface IService
- {
- /// <summary>
- /// Initializes this instance before execution.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- void Init(IServiceContext context);
-
- /// <summary>
- /// Starts execution of this service. This method is automatically invoked whenever an instance of the service
- /// is deployed on a Ignite node. Note that service is considered deployed even after it exits the Execute
- /// method and can be cancelled (or undeployed) only by calling any of the Cancel methods on
- /// <see cref="IServices"/> API. Also note that service is not required to exit from Execute method until
- /// Cancel method was called.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- void Execute(IServiceContext context);
-
- /// <summary>
- /// Cancels this instance.
- /// <para/>
- /// Note that Ignite cannot guarantee that the service exits from <see cref="IService.Execute"/>
- /// method whenever <see cref="IService.Cancel"/> is called. It is up to the user to
- /// make sure that the service code properly reacts to cancellations.
- /// </summary>
- /// <param name="context">Service execution context.</param>
- void Cancel(IServiceContext context);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceContext.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceContext.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceContext.cs
deleted file mode 100644
index 50c3f14..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceContext.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- using System;
-
- /// <summary>
- /// Represents service execution context.
- /// </summary>
- public interface IServiceContext
- {
- /// <summary>
- /// Gets service name.
- /// </summary>
- /// <returns>
- /// Service name.
- /// </returns>
- string Name { get; }
-
- /// <summary>
- /// Gets service execution ID. Execution ID is guaranteed to be unique across all service deployments.
- /// </summary>
- /// <returns>
- /// Service execution ID.
- /// </returns>
- Guid ExecutionId { get; }
-
- /// <summary>
- /// Get flag indicating whether service has been cancelled or not.
- /// </summary>
- /// <returns>
- /// Flag indicating whether service has been cancelled or not.
- /// </returns>
- bool IsCancelled { get; }
-
- /// <summary>
- /// Gets cache name used for key-to-node affinity calculation.
- /// This parameter is optional and is set only when key-affinity service was deployed.
- /// </summary>
- /// <returns>
- /// Cache name, possibly null.
- /// </returns>
- string CacheName { get; }
-
- /// <summary>
- /// Gets affinity key used for key-to-node affinity calculation.
- /// This parameter is optional and is set only when key-affinity service was deployed.
- /// </summary>
- /// <value>
- /// Affinity key, possibly null.
- /// </value>
- object AffinityKey { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceDescriptor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceDescriptor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceDescriptor.cs
deleted file mode 100644
index 96bad4f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Services/IServiceDescriptor.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Services
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Service deployment descriptor.
- /// </summary>
- public interface IServiceDescriptor
- {
- /// <summary>
- /// Gets service name.
- /// </summary>
- /// <returns>
- /// Service name.
- /// </returns>
- string Name { get; }
-
- /// <summary>
- /// Gets the service type.
- /// </summary>
- /// <value>
- /// Service type.
- /// </value>
- Type Type { get; }
-
- /// <summary>
- /// Gets maximum allowed total number of deployed services in the grid, 0 for unlimited.
- /// </summary>
- /// <returns>
- /// Maximum allowed total number of deployed services in the grid, 0 for unlimited.
- /// </returns>
- int TotalCount { get; }
-
- /// <summary>
- /// Gets maximum allowed number of deployed services on each node, 0 for unlimited.
- /// </summary>
- /// <returns>
- /// Maximum allowed total number of deployed services on each node, 0 for unlimited.
- /// </returns>
- int MaxPerNodeCount { get; }
-
- /// <summary>
- /// Gets cache name used for key-to-node affinity calculation.
- /// This parameter is optional and is set only when key-affinity service was deployed.
- /// </summary>
- /// <returns>
- /// Cache name, possibly null.
- /// </returns>
- string CacheName { get; }
-
- /// <summary>
- /// Gets affinity key used for key-to-node affinity calculation.
- /// This parameter is optional and is set only when key-affinity service was deployed.
- /// </summary>
- /// <value>
- /// Affinity key, possibly null.
- /// </value>
- object AffinityKey { get; }
-
- /// <summary>
- /// Gets affinity key used for key-to-node affinity calculation.
- /// This parameter is optional and is set only when key-affinity service was deployed.
- /// </summary>
- /// <returns>
- /// Affinity key, possibly null.
- /// </returns>
- Guid OriginNodeId { get; }
-
- /// <summary>
- /// Gets service deployment topology snapshot. Service topology snapshot is represented
- /// by number of service instances deployed on a node mapped to node ID.
- /// </summary>
- /// <value>
- /// Map of number of service instances per node ID.
- /// </value>
- IDictionary<Guid, int> TopologySnapshot { get; }
- }
-}
\ No newline at end of file
[27/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs
deleted file mode 100644
index 5f719cd..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeOutFuncJob.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// System job which wraps over <c>Func</c>.
- /// </summary>
- internal class ComputeOutFuncJob : IComputeJob, IComputeResourceInjector, IPortableWriteAware
- {
- /** Closure. */
- private readonly IComputeOutFunc _clo;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="clo">Closure.</param>
- public ComputeOutFuncJob(IComputeOutFunc clo)
- {
- _clo = clo;
- }
-
- /** <inheritDoc /> */
- public object Execute()
- {
- return _clo.Invoke();
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- throw new NotSupportedException("Func job cannot be cancelled.");
- }
-
- /** <inheritDoc /> */
- public void Inject(Ignite grid)
- {
- ResourceProcessor.Inject(_clo, grid);
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl) writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _clo);
- }
-
- public ComputeOutFuncJob(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl) reader.RawReader();
-
- _clo = PortableUtils.ReadPortableOrSerializable<IComputeOutFunc>(reader0);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs
deleted file mode 100644
index a84d7ce..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeReducingClosureTask.cs
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Resource;
-
- /// <summary>
- /// Closure-based task producing only one job and thus having only single result.
- /// </summary>
- [ComputeTaskNoResultCache]
- internal class ComputeReducingClosureTask<TA, T, TR>
- : ComputeAbstractClosureTask<TA, T, TR>, IComputeResourceInjector
- {
- /** Reducer. */
- private readonly IComputeReducer<T, TR> _rdc;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="rdc">Reducer.</param>
- public ComputeReducingClosureTask(IComputeReducer<T, TR> rdc)
- {
- _rdc = rdc;
- }
-
- /** <inheritDoc /> */
- protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res)
- {
- return _rdc.Collect(res.Data()) ? ComputeJobResultPolicy.Wait : ComputeJobResultPolicy.Reduce;
- }
-
- /** <inheritDoc /> */
- public override TR Reduce(IList<IComputeJobResult<T>> results)
- {
- return _rdc.Reduce();
- }
-
- /** <inheritDoc /> */
- public void Inject(Ignite grid)
- {
- ResourceProcessor.Inject(_rdc, grid);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs
deleted file mode 100644
index 6e82c9b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/ComputeSingleClosureTask.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Closure-based task producing only one job and thus having only single result.
- /// </summary>
- [ComputeTaskNoResultCache]
- internal class ComputeSingleClosureTask<TA, T, TR> : ComputeAbstractClosureTask<TA, T, TR> where TR : T
- {
- /** Result. */
- private TR _res;
-
- /** <inheritDoc /> */
- protected override ComputeJobResultPolicy Result0(IComputeJobResult<T> res)
- {
- _res = (TR) res.Data();
-
- // No more results are expected at this point, but we prefer not to alter regular
- // task flow.
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public override TR Reduce(IList<IComputeJobResult<T>> results)
- {
- return _res;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs
deleted file mode 100644
index 8d3e8d7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Closure/IComputeResourceInjector.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute.Closure
-{
- /// <summary>
- /// Interface denoting entity which must perform custom resource injection.
- /// </summary>
- internal interface IComputeResourceInjector
- {
- /// <summary>
- /// Inject resources.
- /// </summary>
- /// <param name="grid">Grid.</param>
- void Inject(Ignite grid);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
deleted file mode 100644
index 7efabd1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/Compute.cs
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Synchronous Compute facade.
- /// </summary>
- internal class Compute : ICompute
- {
- /** */
- private readonly ComputeImpl _compute;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Compute"/> class.
- /// </summary>
- /// <param name="computeImpl">The compute implementation.</param>
- public Compute(ComputeImpl computeImpl)
- {
- Debug.Assert(computeImpl != null);
-
- _compute = computeImpl;
- }
-
- /** <inheritDoc /> */
- public ICompute WithAsync()
- {
- return new ComputeAsync(_compute);
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return false; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ClusterGroup
- {
- get { return _compute.ClusterGroup; }
- }
-
- /** <inheritDoc /> */
- public ICompute WithNoFailover()
- {
- _compute.WithNoFailover();
-
- return this;
- }
-
- /** <inheritDoc /> */
- public ICompute WithTimeout(long timeout)
- {
- _compute.WithTimeout(timeout);
-
- return this;
- }
-
- /** <inheritDoc /> */
- public ICompute WithKeepPortable()
- {
- _compute.WithKeepPortable();
-
- return this;
- }
-
- /** <inheritDoc /> */
- public T ExecuteJavaTask<T>(string taskName, object taskArg)
- {
- return _compute.ExecuteJavaTask<T>(taskName, taskArg);
- }
-
- /** <inheritDoc /> */
- public TR Execute<TA, T, TR>(IComputeTask<TA, T, TR> task, TA taskArg)
- {
- return _compute.Execute(task, taskArg).Get();
- }
-
- /** <inheritDoc /> */
- public TR Execute<T, TR>(IComputeTask<T, TR> task)
- {
- return _compute.Execute(task, null).Get();
- }
-
- /** <inheritDoc /> */
- public TR Execute<TA, T, TR>(Type taskType, TA taskArg)
- {
- return _compute.Execute<TA, T, TR>(taskType, taskArg).Get();
- }
-
- public TR Execute<T, TR>(Type taskType)
- {
- return _compute.Execute<object, T, TR>(taskType, null).Get();
- }
-
- /** <inheritDoc /> */
- public TR Call<TR>(IComputeFunc<TR> clo)
- {
- return _compute.Execute(clo).Get();
- }
-
- /** <inheritDoc /> */
- public TR AffinityCall<TR>(string cacheName, object affinityKey, IComputeFunc<TR> clo)
- {
- return _compute.AffinityCall(cacheName, affinityKey, clo).Get();
- }
-
- /** <inheritDoc /> */
- public TR Call<TR>(Func<TR> func)
- {
- return _compute.Execute(func).Get();
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Call<TR>(IEnumerable<IComputeFunc<TR>> clos)
- {
- return _compute.Execute(clos).Get();
- }
-
- /** <inheritDoc /> */
- public TR2 Call<TR1, TR2>(IEnumerable<IComputeFunc<TR1>> clos, IComputeReducer<TR1, TR2> rdc)
- {
- return _compute.Execute(clos, rdc).Get();
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Broadcast<TR>(IComputeFunc<TR> clo)
- {
- return _compute.Broadcast(clo).Get();
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Broadcast<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- return _compute.Broadcast(clo, arg).Get();
- }
-
- /** <inheritDoc /> */
- public void Broadcast(IComputeAction action)
- {
- _compute.Broadcast(action).Get();
- }
-
- /** <inheritDoc /> */
- public void Run(IComputeAction action)
- {
- _compute.Run(action).Get();
- }
-
- /** <inheritDoc /> */
- public void AffinityRun(string cacheName, object affinityKey, IComputeAction action)
- {
- _compute.AffinityRun(cacheName, affinityKey, action).Get();
- }
-
- /** <inheritDoc /> */
- public void Run(IEnumerable<IComputeAction> actions)
- {
- _compute.Run(actions).Get();
- }
-
- /** <inheritDoc /> */
- public TR Apply<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- return _compute.Apply(clo, arg).Get();
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Apply<T, TR>(IComputeFunc<T, TR> clo, IEnumerable<T> args)
- {
- return _compute.Apply(clo, args).Get();
- }
-
- /** <inheritDoc /> */
- public TR2 Apply<T, TR1, TR2>(IComputeFunc<T, TR1> clo, IEnumerable<T> args, IComputeReducer<TR1, TR2> rdc)
- {
- return _compute.Apply(clo, args, rdc).Get();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeAsync.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeAsync.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeAsync.cs
deleted file mode 100644
index 199afc2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeAsync.cs
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Asynchronous Compute facade.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class ComputeAsync : ICompute
- {
- /** */
- protected readonly ComputeImpl Compute;
-
- /** Current future. */
- private readonly ThreadLocal<IFuture> _curFut = new ThreadLocal<IFuture>();
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeAsync"/> class.
- /// </summary>
- /// <param name="computeImpl">The compute implementation.</param>
- internal ComputeAsync(ComputeImpl computeImpl)
- {
- Compute = computeImpl;
- }
-
- /** <inheritDoc /> */
- public ICompute WithAsync()
- {
- return this;
- }
-
- /** <inheritDoc /> */
- public bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritDoc /> */
- public IFuture GetFuture()
- {
- return GetFuture<object>();
- }
-
- /** <inheritDoc /> */
- public IFuture<TResult> GetFuture<TResult>()
- {
- var fut = _curFut.Value;
-
- if (fut == null)
- throw new InvalidOperationException("Asynchronous operation not started.");
-
- var fut0 = fut as IFuture<TResult>;
-
- if (fut0 == null)
- throw new InvalidOperationException(
- string.Format("Requested future type {0} is incompatible with current future type {1}",
- typeof(IFuture<TResult>), fut.GetType()));
-
- _curFut.Value = null;
-
- return fut0;
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ClusterGroup
- {
- get { return Compute.ClusterGroup; }
- }
-
- /** <inheritDoc /> */
- public ICompute WithNoFailover()
- {
- Compute.WithNoFailover();
-
- return this;
- }
-
- /** <inheritDoc /> */
- public ICompute WithTimeout(long timeout)
- {
- Compute.WithTimeout(timeout);
-
- return this;
- }
-
- /** <inheritDoc /> */
- public ICompute WithKeepPortable()
- {
- Compute.WithKeepPortable();
-
- return this;
- }
-
- /** <inheritDoc /> */
- public T ExecuteJavaTask<T>(string taskName, object taskArg)
- {
- _curFut.Value = Compute.ExecuteJavaTaskAsync<T>(taskName, taskArg);
-
- return default(T);
- }
-
- /** <inheritDoc /> */
- public TR Execute<TA, T, TR>(IComputeTask<TA, T, TR> task, TA taskArg)
- {
- _curFut.Value = Compute.Execute(task, taskArg);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR Execute<T, TR>(IComputeTask<T, TR> task)
- {
- _curFut.Value = Compute.Execute(task, null);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR Execute<TA, T, TR>(Type taskType, TA taskArg)
- {
- _curFut.Value = Compute.Execute<TA, T, TR>(taskType, taskArg);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR Execute<T, TR>(Type taskType)
- {
- _curFut.Value = Compute.Execute<object, T, TR>(taskType, null);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR Call<TR>(IComputeFunc<TR> clo)
- {
- _curFut.Value = Compute.Execute(clo);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR AffinityCall<TR>(string cacheName, object affinityKey, IComputeFunc<TR> clo)
- {
- Compute.AffinityCall(cacheName, affinityKey, clo);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public TR Call<TR>(Func<TR> func)
- {
- _curFut.Value = Compute.Execute(func);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Call<TR>(IEnumerable<IComputeFunc<TR>> clos)
- {
- _curFut.Value = Compute.Execute(clos);
-
- return null;
- }
-
- /** <inheritDoc /> */
- public TR2 Call<TR1, TR2>(IEnumerable<IComputeFunc<TR1>> clos, IComputeReducer<TR1, TR2> rdc)
- {
- _curFut.Value = Compute.Execute(clos, rdc);
-
- return default(TR2);
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Broadcast<TR>(IComputeFunc<TR> clo)
- {
- _curFut.Value = Compute.Broadcast(clo);
-
- return null;
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Broadcast<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- _curFut.Value = Compute.Broadcast(clo, arg);
-
- return null;
- }
-
- /** <inheritDoc /> */
- public void Broadcast(IComputeAction action)
- {
- _curFut.Value = Compute.Broadcast(action);
- }
-
- /** <inheritDoc /> */
- public void Run(IComputeAction action)
- {
- _curFut.Value = Compute.Run(action);
- }
-
- /** <inheritDoc /> */
- public void AffinityRun(string cacheName, object affinityKey, IComputeAction action)
- {
- Compute.AffinityRun(cacheName, affinityKey, action);
- }
-
- /** <inheritDoc /> */
- public void Run(IEnumerable<IComputeAction> actions)
- {
- _curFut.Value = Compute.Run(actions);
- }
-
- /** <inheritDoc /> */
- public TR Apply<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- _curFut.Value = Compute.Apply(clo, arg);
-
- return default(TR);
- }
-
- /** <inheritDoc /> */
- public ICollection<TR> Apply<T, TR>(IComputeFunc<T, TR> clo, IEnumerable<T> args)
- {
- _curFut.Value = Compute.Apply(clo, args);
-
- return null;
- }
-
- /** <inheritDoc /> */
- public TR2 Apply<T, TR1, TR2>(IComputeFunc<T, TR1> clo, IEnumerable<T> args, IComputeReducer<TR1, TR2> rdc)
- {
- _curFut.Value = Compute.Apply(clo, args, rdc);
-
- return default(TR2);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs
deleted file mode 100644
index a971418..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeFunc.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Reflection;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// Non-generic version of IComputeFunc{T}.
- /// </summary>
- internal interface IComputeFunc : IComputeFunc<object, object>
- {
- // No-op
- }
-
- /// <summary>
- /// Wraps generic func into a non-generic for internal usage.
- /// </summary>
- internal class ComputeFuncWrapper : IComputeFunc, IPortableWriteAware
- {
- /** */
- private readonly object _func;
-
- /** */
- private readonly Func<object, object, object> _invoker;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeFuncWrapper" /> class.
- /// </summary>
- /// <param name="func">The function to wrap.</param>
- /// <param name="invoker">The function invoker.</param>
- public ComputeFuncWrapper(object func, Func<object, object> invoker)
- {
- _func = func;
-
- _invoker = (target, arg) => invoker(arg);
- }
-
- /** <inheritDoc /> */
- public object Invoke(object arg)
- {
- try
- {
- return _invoker(_func, arg);
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _func);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeFuncWrapper"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ComputeFuncWrapper(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _func = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- _invoker = DelegateTypeDescriptor.GetComputeFunc(_func.GetType());
- }
-
- /// <summary>
- /// Injects the Ignite instance.
- /// </summary>
- [InstanceResource]
- public void InjectIgnite(IIgnite ignite)
- {
- // Propagate injection
- ResourceProcessor.Inject(_func, (IgniteProxy) ignite);
- }
- }
-
- /// <summary>
- /// Extension methods for IComputeFunc{T}.
- /// </summary>
- internal static class ComputeFuncExtensions
- {
- /// <summary>
- /// Convert to non-generic wrapper.
- /// </summary>
- public static IComputeFunc ToNonGeneric<T, TR>(this IComputeFunc<T, TR> func)
- {
- return new ComputeFuncWrapper(func, x => func.Invoke((T) x));
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
deleted file mode 100644
index f0ff968..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeImpl.cs
+++ /dev/null
@@ -1,645 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Threading;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Compute.Closure;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Compute implementation.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class ComputeImpl : PlatformTarget
- {
- /** */
- private const int OpAffinity = 1;
-
- /** */
- private const int OpBroadcast = 2;
-
- /** */
- private const int OpExec = 3;
-
- /** */
- private const int OpExecAsync = 4;
-
- /** */
- private const int OpUnicast = 5;
-
- /** Underlying projection. */
- private readonly ClusterGroupImpl _prj;
-
- /** Whether objects must be kept portable. */
- private readonly ThreadLocal<bool> _keepPortable = new ThreadLocal<bool>(() => false);
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="prj">Projection.</param>
- /// <param name="keepPortable">"keepPortable" flag.</param>
- public ComputeImpl(IUnmanagedTarget target, PortableMarshaller marsh, ClusterGroupImpl prj, bool keepPortable)
- : base(target, marsh)
- {
- _prj = prj;
-
- _keepPortable.Value = keepPortable;
- }
-
- /// <summary>
- /// Grid projection to which this compute instance belongs.
- /// </summary>
- public IClusterGroup ClusterGroup
- {
- get
- {
- return _prj;
- }
- }
-
- /// <summary>
- /// Sets no-failover flag for the next executed task on this projection in the current thread.
- /// If flag is set, job will be never failed over even if remote node crashes or rejects execution.
- /// When task starts execution, the no-failover flag is reset, so all other task will use default
- /// failover policy, unless this flag is set again.
- /// </summary>
- public void WithNoFailover()
- {
- UU.ComputeWithNoFailover(Target);
- }
-
- /// <summary>
- /// Sets task timeout for the next executed task on this projection in the current thread.
- /// When task starts execution, the timeout is reset, so one timeout is used only once.
- /// </summary>
- /// <param name="timeout">Computation timeout in milliseconds.</param>
- public void WithTimeout(long timeout)
- {
- UU.ComputeWithTimeout(Target, timeout);
- }
-
- /// <summary>
- /// Sets keep-portable flag for the next executed Java task on this projection in the current
- /// thread so that task argument passed to Java and returned task results will not be
- /// deserialized.
- /// </summary>
- public void WithKeepPortable()
- {
- _keepPortable.Value = true;
- }
-
- /// <summary>
- /// Executes given Java task on the grid projection. If task for given name has not been deployed yet,
- /// then 'taskName' will be used as task class name to auto-deploy the task.
- /// </summary>
- public T ExecuteJavaTask<T>(string taskName, object taskArg)
- {
- IgniteArgumentCheck.NotNullOrEmpty(taskName, "taskName");
-
- ICollection<IClusterNode> nodes = _prj.Predicate == null ? null : _prj.GetNodes();
-
- try
- {
- T res = DoOutInOp<T>(OpExec, writer =>
- {
- WriteTask(writer, taskName, taskArg, nodes);
- });
-
- return res;
- }
- finally
- {
- _keepPortable.Value = false;
- }
- }
-
- /// <summary>
- /// Executes given Java task asynchronously on the grid projection.
- /// If task for given name has not been deployed yet,
- /// then 'taskName' will be used as task class name to auto-deploy the task.
- /// </summary>
- public IFuture<T> ExecuteJavaTaskAsync<T>(string taskName, object taskArg)
- {
- IgniteArgumentCheck.NotNullOrEmpty(taskName, "taskName");
-
- ICollection<IClusterNode> nodes = _prj.Predicate == null ? null : _prj.GetNodes();
-
- try
- {
- IFuture<T> fut = null;
-
- DoOutInOp(OpExecAsync, writer =>
- {
- WriteTask(writer, taskName, taskArg, nodes);
- }, input =>
- {
- fut = GetFuture<T>((futId, futTyp) => UU.TargetListenFuture(Target, futId, futTyp), _keepPortable.Value);
- });
-
- return fut;
- }
- finally
- {
- _keepPortable.Value = false;
- }
- }
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="task">Task to execute.</param>
- /// <param name="taskArg">Optional task argument.</param>
- /// <returns>Task result.</returns>
- public IFuture<TR> Execute<TA, T, TR>(IComputeTask<TA, T, TR> task, TA taskArg)
- {
- IgniteArgumentCheck.NotNull(task, "task");
-
- var holder = new ComputeTaskHolder<TA, T, TR>((Ignite) _prj.Ignite, this, task, taskArg);
-
- long ptr = Marshaller.Ignite.HandleRegistry.Allocate(holder);
-
- UU.ComputeExecuteNative(Target, ptr, _prj.TopologyVersion);
-
- return holder.Future;
- }
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="taskType">Task type.</param>
- /// <param name="taskArg">Optional task argument.</param>
- /// <returns>Task result.</returns>
- public IFuture<TR> Execute<TA, T, TR>(Type taskType, TA taskArg)
- {
- IgniteArgumentCheck.NotNull(taskType, "taskType");
-
- object task = FormatterServices.GetUninitializedObject(taskType);
-
- var task0 = task as IComputeTask<TA, T, TR>;
-
- if (task0 == null)
- throw new IgniteException("Task type doesn't implement IComputeTask: " + taskType.Name);
-
- return Execute(task0, taskArg);
- }
-
- /// <summary>
- /// Executes provided job on a node in this grid projection. The result of the
- /// job execution is returned from the result closure.
- /// </summary>
- /// <param name="clo">Job to execute.</param>
- /// <returns>Job result for this execution.</returns>
- public IFuture<TR> Execute<TR>(IComputeFunc<TR> clo)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, TR, TR>(),
- new ComputeOutFuncJob(clo.ToNonGeneric()), null, false);
- }
-
- /// <summary>
- /// Executes provided delegate on a node in this grid projection. The result of the
- /// job execution is returned from the result closure.
- /// </summary>
- /// <param name="func">Func to execute.</param>
- /// <returns>Job result for this execution.</returns>
- public IFuture<TR> Execute<TR>(Func<TR> func)
- {
- IgniteArgumentCheck.NotNull(func, "func");
-
- var wrappedFunc = new ComputeOutFuncWrapper(func, () => func());
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, TR, TR>(),
- new ComputeOutFuncJob(wrappedFunc), null, false);
- }
-
- /// <summary>
- /// Executes collection of jobs on nodes within this grid projection.
- /// </summary>
- /// <param name="clos">Collection of jobs to execute.</param>
- /// <returns>Collection of job results for this execution.</returns>
- public IFuture<ICollection<TR>> Execute<TR>(IEnumerable<IComputeFunc<TR>> clos)
- {
- IgniteArgumentCheck.NotNull(clos, "clos");
-
- ICollection<IComputeJob> jobs = new List<IComputeJob>(GetCountOrZero(clos));
-
- foreach (IComputeFunc<TR> clo in clos)
- jobs.Add(new ComputeOutFuncJob(clo.ToNonGeneric()));
-
- return ExecuteClosures0(new ComputeMultiClosureTask<object, TR, ICollection<TR>>(jobs.Count),
- null, jobs, false);
- }
-
- /// <summary>
- /// Executes collection of jobs on nodes within this grid projection.
- /// </summary>
- /// <param name="clos">Collection of jobs to execute.</param>
- /// <param name="rdc">Reducer to reduce all job results into one individual return value.</param>
- /// <returns>Collection of job results for this execution.</returns>
- public IFuture<TR2> Execute<TR1, TR2>(IEnumerable<IComputeFunc<TR1>> clos, IComputeReducer<TR1, TR2> rdc)
- {
- IgniteArgumentCheck.NotNull(clos, "clos");
-
- ICollection<IComputeJob> jobs = new List<IComputeJob>(GetCountOrZero(clos));
-
- foreach (var clo in clos)
- jobs.Add(new ComputeOutFuncJob(clo.ToNonGeneric()));
-
- return ExecuteClosures0(new ComputeReducingClosureTask<object, TR1, TR2>(rdc), null, jobs, false);
- }
-
- /// <summary>
- /// Broadcasts given job to all nodes in grid projection. Every participating node will return a job result.
- /// </summary>
- /// <param name="clo">Job to broadcast to all projection nodes.</param>
- /// <returns>Collection of results for this execution.</returns>
- public IFuture<ICollection<TR>> Broadcast<TR>(IComputeFunc<TR> clo)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- return ExecuteClosures0(new ComputeMultiClosureTask<object, TR, ICollection<TR>>(1),
- new ComputeOutFuncJob(clo.ToNonGeneric()), null, true);
- }
-
- /// <summary>
- /// Broadcasts given closure job with passed in argument to all nodes in grid projection.
- /// Every participating node will return a job result.
- /// </summary>
- /// <param name="clo">Job to broadcast to all projection nodes.</param>
- /// <param name="arg">Job closure argument.</param>
- /// <returns>Collection of results for this execution.</returns>
- public IFuture<ICollection<TR>> Broadcast<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- return ExecuteClosures0(new ComputeMultiClosureTask<object, TR, ICollection<TR>>(1),
- new ComputeFuncJob(clo.ToNonGeneric(), arg), null, true);
- }
-
- /// <summary>
- /// Broadcasts given job to all nodes in grid projection.
- /// </summary>
- /// <param name="action">Job to broadcast to all projection nodes.</param>
- public IFuture<object> Broadcast(IComputeAction action)
- {
- IgniteArgumentCheck.NotNull(action, "action");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(),
- new ComputeActionJob(action), opId: OpBroadcast);
- }
-
- /// <summary>
- /// Executes provided job on a node in this grid projection.
- /// </summary>
- /// <param name="action">Job to execute.</param>
- public IFuture<object> Run(IComputeAction action)
- {
- IgniteArgumentCheck.NotNull(action, "action");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(),
- new ComputeActionJob(action));
- }
-
- /// <summary>
- /// Executes collection of jobs on Ignite nodes within this grid projection.
- /// </summary>
- /// <param name="actions">Jobs to execute.</param>
- public IFuture<object> Run(IEnumerable<IComputeAction> actions)
- {
- IgniteArgumentCheck.NotNull(actions, "actions");
-
- var actions0 = actions as ICollection;
-
- if (actions0 == null)
- {
- var jobs = actions.Select(a => new ComputeActionJob(a)).ToList();
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(), jobs: jobs,
- jobsCount: jobs.Count);
- }
- else
- {
- var jobs = actions.Select(a => new ComputeActionJob(a));
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(), jobs: jobs,
- jobsCount: actions0.Count);
- }
- }
-
- /// <summary>
- /// Executes provided closure job on a node in this grid projection.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="arg">Job argument.</param>
- /// <returns>Job result for this execution.</returns>
- public IFuture<TR> Apply<T, TR>(IComputeFunc<T, TR> clo, T arg)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<T, TR, TR>(),
- new ComputeFuncJob(clo.ToNonGeneric(), arg), null, false);
- }
-
- /// <summary>
- /// Executes provided closure job on nodes within this grid projection. A new job is executed for
- /// every argument in the passed in collection. The number of actual job executions will be
- /// equal to size of the job arguments collection.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="args">Job arguments.</param>
- /// <returns>Collection of job results.</returns>
- public IFuture<ICollection<TR>> Apply<T, TR>(IComputeFunc<T, TR> clo, IEnumerable<T> args)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- var jobs = new List<IComputeJob>(GetCountOrZero(args));
-
- var func = clo.ToNonGeneric();
-
- foreach (T arg in args)
- jobs.Add(new ComputeFuncJob(func, arg));
-
- return ExecuteClosures0(new ComputeMultiClosureTask<T, TR, ICollection<TR>>(jobs.Count),
- null, jobs, false);
- }
-
- /// <summary>
- /// Executes provided closure job on nodes within this grid projection. A new job is executed for
- /// every argument in the passed in collection. The number of actual job executions will be
- /// equal to size of the job arguments collection. The returned job results will be reduced
- /// into an individual result by provided reducer.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="args">Job arguments.</param>
- /// <param name="rdc">Reducer to reduce all job results into one individual return value.</param>
- /// <returns>Reduced job result for this execution.</returns>
- public IFuture<TR2> Apply<T, TR1, TR2>(IComputeFunc<T, TR1> clo, IEnumerable<T> args,
- IComputeReducer<TR1, TR2> rdc)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- ICollection<IComputeJob> jobs = new List<IComputeJob>(GetCountOrZero(args));
-
- var func = clo.ToNonGeneric();
-
- foreach (T arg in args)
- jobs.Add(new ComputeFuncJob(func, arg));
-
- return ExecuteClosures0(new ComputeReducingClosureTask<T, TR1, TR2>(rdc),
- null, jobs, false);
- }
-
- /// <summary>
- /// Executes given job on the node where data for provided affinity key is located
- /// (a.k.a. affinity co-location).
- /// </summary>
- /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
- /// <param name="affinityKey">Affinity key.</param>
- /// <param name="action">Job to execute.</param>
- public IFuture AffinityRun(string cacheName, object affinityKey, IComputeAction action)
- {
- IgniteArgumentCheck.NotNull(action, "action");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, object, object>(),
- new ComputeActionJob(action), opId: OpAffinity,
- writeAction: w => WriteAffinity(w, cacheName, affinityKey));
- }
-
- /// <summary>
- /// Executes given job on the node where data for provided affinity key is located
- /// (a.k.a. affinity co-location).
- /// </summary>
- /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
- /// <param name="affinityKey">Affinity key.</param>
- /// <param name="clo">Job to execute.</param>
- /// <returns>Job result for this execution.</returns>
- /// <typeparam name="TR">Type of job result.</typeparam>
- public IFuture<TR> AffinityCall<TR>(string cacheName, object affinityKey, IComputeFunc<TR> clo)
- {
- IgniteArgumentCheck.NotNull(clo, "clo");
-
- return ExecuteClosures0(new ComputeSingleClosureTask<object, TR, TR>(),
- new ComputeOutFuncJob(clo.ToNonGeneric()), opId: OpAffinity,
- writeAction: w => WriteAffinity(w, cacheName, affinityKey));
- }
-
- /** <inheritDoc /> */
- protected override T Unmarshal<T>(IPortableStream stream)
- {
- bool keep = _keepPortable.Value;
-
- return Marshaller.Unmarshal<T>(stream, keep);
- }
-
- /// <summary>
- /// Internal routine for closure-based task execution.
- /// </summary>
- /// <param name="task">Task.</param>
- /// <param name="job">Job.</param>
- /// <param name="jobs">Jobs.</param>
- /// <param name="broadcast">Broadcast flag.</param>
- /// <returns>Future.</returns>
- private IFuture<TR> ExecuteClosures0<TA, T, TR>(IComputeTask<TA, T, TR> task, IComputeJob job,
- ICollection<IComputeJob> jobs, bool broadcast)
- {
- return ExecuteClosures0(task, job, jobs, broadcast ? OpBroadcast : OpUnicast,
- jobs == null ? 1 : jobs.Count);
- }
-
- /// <summary>
- /// Internal routine for closure-based task execution.
- /// </summary>
- /// <param name="task">Task.</param>
- /// <param name="job">Job.</param>
- /// <param name="jobs">Jobs.</param>
- /// <param name="opId">Op code.</param>
- /// <param name="jobsCount">Jobs count.</param>
- /// <param name="writeAction">Custom write action.</param>
- /// <returns>Future.</returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User code can throw any exception")]
- private IFuture<TR> ExecuteClosures0<TA, T, TR>(IComputeTask<TA, T, TR> task, IComputeJob job = null,
- IEnumerable<IComputeJob> jobs = null, int opId = OpUnicast, int jobsCount = 0,
- Action<PortableWriterImpl> writeAction = null)
- {
- Debug.Assert(job != null || jobs != null);
-
- var holder = new ComputeTaskHolder<TA, T, TR>((Ignite) _prj.Ignite, this, task, default(TA));
-
- var taskHandle = Marshaller.Ignite.HandleRegistry.Allocate(holder);
-
- var jobHandles = new List<long>(job != null ? 1 : jobsCount);
-
- try
- {
- Exception err = null;
-
- try
- {
- DoOutOp(opId, writer =>
- {
- writer.WriteLong(taskHandle);
-
- if (job != null)
- {
- writer.WriteInt(1);
-
- jobHandles.Add(WriteJob(job, writer));
- }
- else
- {
- writer.WriteInt(jobsCount);
-
- Debug.Assert(jobs != null, "jobs != null");
-
- jobHandles.AddRange(jobs.Select(jobEntry => WriteJob(jobEntry, writer)));
- }
-
- holder.JobHandles(jobHandles);
-
- if (writeAction != null)
- writeAction(writer);
- });
- }
- catch (Exception e)
- {
- err = e;
- }
-
- if (err != null)
- {
- // Manual job handles release because they were not assigned to the task yet.
- foreach (var hnd in jobHandles)
- Marshaller.Ignite.HandleRegistry.Release(hnd);
-
- holder.CompleteWithError(taskHandle, err);
- }
- }
- catch (Exception e)
- {
- // This exception means that out-op failed.
- holder.CompleteWithError(taskHandle, e);
- }
-
- return holder.Future;
- }
-
- /// <summary>
- /// Writes the job.
- /// </summary>
- /// <param name="job">The job.</param>
- /// <param name="writer">The writer.</param>
- /// <returns>Handle to the job holder</returns>
- private long WriteJob(IComputeJob job, PortableWriterImpl writer)
- {
- var jobHolder = new ComputeJobHolder((Ignite) _prj.Ignite, job);
-
- var jobHandle = Marshaller.Ignite.HandleRegistry.Allocate(jobHolder);
-
- writer.WriteLong(jobHandle);
- writer.WriteObject(jobHolder);
-
- return jobHandle;
- }
-
- /// <summary>
- /// Write task to the writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="taskName">Task name.</param>
- /// <param name="taskArg">Task arg.</param>
- /// <param name="nodes">Nodes.</param>
- private void WriteTask(PortableWriterImpl writer, string taskName, object taskArg,
- ICollection<IClusterNode> nodes)
- {
- writer.WriteString(taskName);
- writer.WriteBoolean(_keepPortable.Value);
- writer.Write(taskArg);
-
- WriteNodeIds(writer, nodes);
- }
-
- /// <summary>
- /// Write node IDs.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="nodes">Nodes.</param>
- private static void WriteNodeIds(PortableWriterImpl writer, ICollection<IClusterNode> nodes)
- {
- if (nodes == null)
- writer.WriteBoolean(false);
- else
- {
- writer.WriteBoolean(true);
- writer.WriteInt(nodes.Count);
-
- foreach (IClusterNode node in nodes)
- writer.WriteGuid(node.Id);
- }
- }
-
- /// <summary>
- /// Writes the affinity info.
- /// </summary>
- /// <param name="writer">The writer.</param>
- /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
- /// <param name="affinityKey">Affinity key.</param>
- private static void WriteAffinity(PortableWriterImpl writer, string cacheName, object affinityKey)
- {
- writer.WriteString(cacheName);
-
- writer.WriteObject(affinityKey);
- }
-
- /// <summary>
- /// Gets element count or zero.
- /// </summary>
- private static int GetCountOrZero(object collection)
- {
- var coll = collection as ICollection;
-
- return coll == null ? 0 : coll.Count;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs
deleted file mode 100644
index f4ed999..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJob.cs
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Reflection;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// Non-generic version of IComputeJob{T}.
- /// </summary>
- internal interface IComputeJob : IComputeJob<object>
- {
- // No-op.
- }
-
- /// <summary>
- /// Wraps generic func into a non-generic for internal usage.
- /// </summary>
- internal class ComputeJobWrapper : IComputeJob, IPortableWriteAware
- {
- /** */
- private readonly Func<object, object> _execute;
-
- /** */
- private readonly Action<object> _cancel;
-
- /** */
- private readonly object _job;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobWrapper"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ComputeJobWrapper(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _job = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- DelegateTypeDescriptor.GetComputeJob(_job.GetType(), out _execute, out _cancel);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeFuncWrapper" /> class.
- /// </summary>
- public ComputeJobWrapper(object job, Func<object, object> execute, Action<object> cancel)
- {
- _job = job;
-
- _execute = execute;
-
- _cancel = cancel;
- }
-
- /** <inheritDoc /> */
- public object Execute()
- {
- try
- {
- return _execute(_job);
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- try
- {
- _cancel(_job);
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, Job);
- }
-
- /// <summary>
- /// Injects Ignite instance into wrapped object.
- /// </summary>
- [InstanceResource]
- public void InjectIgnite(IIgnite ignite)
- {
- // Propagate injection
- ResourceProcessor.Inject(Job, (IgniteProxy)ignite);
- }
-
- /// <summary>
- /// Gets the inner job.
- /// </summary>
- public object Job
- {
- get { return _job; }
- }
- }
-
- /// <summary>
- /// Extension methods for IComputeJob{T}.
- /// </summary>
- internal static class ComputeJobExtensions
- {
- /// <summary>
- /// Convert to non-generic wrapper.
- /// </summary>
- public static IComputeJob ToNonGeneric<T>(this IComputeJob<T> job)
- {
- return new ComputeJobWrapper(job, x => job.Execute(), x => job.Cancel());
- }
-
- /// <summary>
- /// Unwraps job of one type into job of another type.
- /// </summary>
- public static IComputeJob<TR> Unwrap<T, TR>(this IComputeJob<T> job)
- {
- var wrapper = job as ComputeJobWrapper;
-
- return wrapper != null ? (IComputeJob<TR>) wrapper.Job : (IComputeJob<TR>) job;
- }
-
- /// <summary>
- /// Unwraps job of one type into job of another type.
- /// </summary>
- public static object Unwrap(this IComputeJob<object> job)
- {
- var wrapper = job as ComputeJobWrapper;
-
- return wrapper != null ? wrapper.Job : job;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
deleted file mode 100644
index a0de895..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobHolder.cs
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Compute.Closure;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Holder for user-provided compute job.
- /// </summary>
- internal class ComputeJobHolder : IPortableWriteAware
- {
- /** Actual job. */
- private readonly IComputeJob _job;
-
- /** Owning grid. */
- private readonly Ignite _ignite;
-
- /** Result (set for local jobs only). */
- private volatile ComputeJobResultImpl _jobRes;
-
- /// <summary>
- /// Default ctor for marshalling.
- /// </summary>
- /// <param name="reader"></param>
- public ComputeJobHolder(IPortableReader reader)
- {
- Debug.Assert(reader != null);
-
- var reader0 = (PortableReaderImpl) reader.RawReader();
-
- _ignite = reader0.Marshaller.Ignite;
-
- _job = PortableUtils.ReadPortableOrSerializable<IComputeJob>(reader0);
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="job">Job.</param>
- public ComputeJobHolder(Ignite grid, IComputeJob job)
- {
- Debug.Assert(grid != null);
- Debug.Assert(job != null);
-
- _ignite = grid;
- _job = job;
- }
-
- /// <summary>
- /// Executes local job.
- /// </summary>
- /// <param name="cancel">Cancel flag.</param>
- public void ExecuteLocal(bool cancel)
- {
- object res;
- bool success;
-
- Execute0(cancel, out res, out success);
-
- _jobRes = new ComputeJobResultImpl(
- success ? res : null,
- success ? null : res as Exception,
- _job,
- _ignite.GetLocalNode().Id,
- cancel
- );
- }
-
- /// <summary>
- /// Execute job serializing result to the stream.
- /// </summary>
- /// <param name="cancel">Whether the job must be cancelled.</param>
- /// <param name="stream">Stream.</param>
- public void ExecuteRemote(PlatformMemoryStream stream, bool cancel)
- {
- // 1. Execute job.
- object res;
- bool success;
-
- Execute0(cancel, out res, out success);
-
- // 2. Try writing result to the stream.
- ClusterGroupImpl prj = _ignite.ClusterGroup;
-
- PortableWriterImpl writer = prj.Marshaller.StartMarshal(stream);
-
- try
- {
- // 3. Marshal results.
- PortableUtils.WriteWrappedInvocationResult(writer, success, res);
- }
- finally
- {
- // 4. Process metadata.
- prj.FinishMarshal(writer);
- }
- }
-
- /// <summary>
- /// Cancel the job.
- /// </summary>
- public void Cancel()
- {
- _job.Cancel();
- }
-
- /// <summary>
- /// Serialize the job to the stream.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>True if successfull.</returns>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User job can throw any exception")]
- internal bool Serialize(IPortableStream stream)
- {
- ClusterGroupImpl prj = _ignite.ClusterGroup;
-
- PortableWriterImpl writer = prj.Marshaller.StartMarshal(stream);
-
- try
- {
- writer.Write(this);
-
- return true;
- }
- catch (Exception e)
- {
- writer.WriteString("Failed to marshal job [job=" + _job + ", errType=" + e.GetType().Name +
- ", errMsg=" + e.Message + ']');
-
- return false;
- }
- finally
- {
- // 4. Process metadata.
- prj.FinishMarshal(writer);
- }
- }
-
- /// <summary>
- /// Job.
- /// </summary>
- internal IComputeJob Job
- {
- get { return _job; }
- }
-
- /// <summary>
- /// Job result.
- /// </summary>
- internal ComputeJobResultImpl JobResult
- {
- get { return _jobRes; }
- }
-
- /// <summary>
- /// Internal job execution routine.
- /// </summary>
- /// <param name="cancel">Cancel flag.</param>
- /// <param name="res">Result.</param>
- /// <param name="success">Success flag.</param>
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User job can throw any exception")]
- private void Execute0(bool cancel, out object res, out bool success)
- {
- // 1. Inject resources.
- IComputeResourceInjector injector = _job as IComputeResourceInjector;
-
- if (injector != null)
- injector.Inject(_ignite);
- else
- ResourceProcessor.Inject(_job, _ignite);
-
- // 2. Execute.
- try
- {
- if (cancel)
- _job.Cancel();
-
- res = _job.Execute();
-
- success = true;
- }
- catch (Exception e)
- {
- res = e;
-
- success = false;
- }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- PortableWriterImpl writer0 = (PortableWriterImpl) writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _job);
- }
-
- /// <summary>
- /// Create job instance.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="stream">Stream.</param>
- /// <returns></returns>
- internal static ComputeJobHolder CreateJob(Ignite grid, IPortableStream stream)
- {
- try
- {
- return grid.Marshaller.StartUnmarshal(stream).ReadObject<ComputeJobHolder>();
- }
- catch (Exception e)
- {
- throw new IgniteException("Failed to deserialize the job [errType=" + e.GetType().Name +
- ", errMsg=" + e.Message + ']');
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs
deleted file mode 100644
index 8173f71..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultGenericWrapper.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Wraps non-generic IComputeJobResult in generic form.
- /// </summary>
- internal class ComputeJobResultGenericWrapper<T> : IComputeJobResult<T>
- {
- /** */
- private readonly IComputeJobResult<object> _wrappedRes;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeJobResultGenericWrapper{T}"/> class.
- /// </summary>
- /// <param name="jobRes">The job result to wrap.</param>
- public ComputeJobResultGenericWrapper(IComputeJobResult<object> jobRes)
- {
- _wrappedRes = jobRes;
- }
-
- /** <inheritdoc /> */
- public T Data()
- {
- return (T)_wrappedRes.Data();
- }
-
- /** <inheritdoc /> */
- public Exception Exception()
- {
- return _wrappedRes.Exception();
- }
-
- /** <inheritdoc /> */
- public IComputeJob<T> Job()
- {
- return _wrappedRes.Job().Unwrap<object, T>();
- }
-
- /** <inheritdoc /> */
- public Guid NodeId
- {
- get { return _wrappedRes.NodeId; }
- }
-
- /** <inheritdoc /> */
- public bool Cancelled
- {
- get { return _wrappedRes.Cancelled; }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs
deleted file mode 100644
index a35bae0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeJobResultImpl.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using Apache.Ignite.Core.Compute;
-
- /// <summary>
- /// Job result implementation.
- /// </summary>
- internal class ComputeJobResultImpl : IComputeJobResult<object>
- {
- /** Data. */
- private readonly object _data;
-
- /** Exception. */
- private readonly Exception _err;
-
- /** Backing job. */
- private readonly IComputeJob _job;
-
- /** Node ID. */
- private readonly Guid _nodeId;
-
- /** Cancel flag. */
- private readonly bool _cancelled;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="data">Data.</param>
- /// <param name="err">Exception.</param>
- /// <param name="job">Backing job.</param>
- /// <param name="nodeId">Node ID.</param>
- /// <param name="cancelled">Cancel flag.</param>
- public ComputeJobResultImpl(object data, Exception err, IComputeJob job, Guid nodeId, bool cancelled)
- {
- _data = data;
- _err = err;
- _job = job;
- _nodeId = nodeId;
- _cancelled = cancelled;
- }
-
- /** <inheritDoc /> */
- public object Data()
- {
- return _data;
- }
-
- /** <inheritDoc /> */
- public Exception Exception()
- {
- return _err;
- }
-
- /** <inheritDoc /> */
- public IComputeJob<object> Job()
- {
- return _job;
- }
-
- /** <inheritDoc /> */
- public Guid NodeId
- {
- get
- {
- return _nodeId;
- }
- }
-
- /** <inheritDoc /> */
- public bool Cancelled
- {
- get
- {
- return _cancelled;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs
deleted file mode 100644
index dda04b6..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeOutFunc.cs
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Diagnostics;
- using System.Reflection;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// Non-generic version of IComputeFunc{T}.
- /// </summary>
- internal interface IComputeOutFunc : IComputeFunc<object>
- {
- // No-op.
- }
-
- /// <summary>
- /// Wraps generic func into a non-generic for internal usage.
- /// </summary>
- internal class ComputeOutFuncWrapper : IComputeOutFunc, IPortableWriteAware
- {
- /** */
- private readonly object _func;
-
- /** */
- private readonly Func<object, object> _invoker;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeFuncWrapper" /> class.
- /// </summary>
- /// <param name="func">The function to wrap.</param>
- /// <param name="invoker">The function invoker.</param>
- public ComputeOutFuncWrapper(object func, Func<object> invoker)
- {
- Debug.Assert(func != null);
- Debug.Assert(invoker != null);
-
- _func = func;
-
- _invoker = target => invoker();
- }
-
- /** <inheritDoc /> */
- public object Invoke()
- {
- try
- {
- return _invoker(_func);
- }
- catch (TargetInvocationException ex)
- {
- throw ex.InnerException;
- }
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var writer0 = (PortableWriterImpl)writer.RawWriter();
-
- writer0.DetachNext();
- PortableUtils.WritePortableOrSerializable(writer0, _func);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeOutFuncWrapper"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ComputeOutFuncWrapper(IPortableReader reader)
- {
- var reader0 = (PortableReaderImpl)reader.RawReader();
-
- _func = PortableUtils.ReadPortableOrSerializable<object>(reader0);
-
- _invoker = DelegateTypeDescriptor.GetComputeOutFunc(_func.GetType());
- }
-
- /// <summary>
- /// Injects the grid.
- /// </summary>
- [InstanceResource]
- public void InjectIgnite(IIgnite ignite)
- {
- // Propagate injection
- ResourceProcessor.Inject(_func, (IgniteProxy)ignite);
- }
- }
-
- /// <summary>
- /// Extension methods for IComputeOutFunc{T}.
- /// </summary>
- internal static class ComputeOutFuncExtensions
- {
- /// <summary>
- /// Convert to non-generic wrapper.
- /// </summary>
- public static IComputeOutFunc ToNonGeneric<T>(this IComputeFunc<T> func)
- {
- return new ComputeOutFuncWrapper(func, () => func.Invoke());
- }
- }
-}
[02/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
deleted file mode 100644
index 9af4611..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-store.xml
+++ /dev/null
@@ -1,125 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="portable_store"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
-
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheTestStore"/>
- </bean>
- </property>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="object_store"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
- <property name="keepPortableInStore" value="false"/>
-
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheTestStore"/>
- </bean>
- </property>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="template_store*"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
- <property name="keepPortableInStore" value="false"/>
-
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheTestStore"/>
- </bean>
- </property>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="custom_store"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
-
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheTestStore"/>
- <property name="properties">
- <map>
- <entry key="IntProperty">
- <value type="java.lang.Integer">42</value>
- </entry>
- <entry key="StringProperty" value="String value"/>
- </map>
- </property>
- </bean>
- </property>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
deleted file mode 100644
index c48e867..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache.xml
+++ /dev/null
@@ -1,194 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean parent="cache-template">
- <property name="name" value="local"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="local_atomic"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_atomic"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_near"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="partitioned_atomic_near"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- <property name="nearConfiguration">
- <bean class="org.apache.ignite.configuration.NearCacheConfiguration" />
- </property>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="replicated"/>
- <property name="cacheMode" value="REPLICATED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="replicated_atomic"/>
- <property name="cacheMode" value="REPLICATED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="atomicWriteOrderMode" value="PRIMARY"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean parent="cache-template">
- <property name="name" value="template*"/>
- <property name="startSize" value="10"/>
- </bean>
- </list>
- </property>
-
- <property name="swapSpaceSpi">
- <bean class="org.apache.ignite.spi.swapspace.inmemory.GridTestSwapSpaceSpi"/>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="transactionConfiguration">
- <bean class="org.apache.ignite.configuration.TransactionConfiguration">
- <property name="txSerializableEnabled" value="true"/>
- </bean>
- </property>
- </bean>
-
- <bean id="cache-template" abstract="true" class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="rebalanceMode" value="SYNC"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="swapEnabled" value="true"/>
- <property name="backups" value="1"/>
- <property name="eagerTtl" value="true"/>
-
- <!--
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>address</value>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridImplicitPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="GridNoDefPortablePerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- </map>
- </property>
- </bean>
- </list>
- </property>
- -->
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
deleted file mode 100644
index f013749..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/portable.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid"/>
-
- <property name="metricsUpdateFrequency" value="1000"/>
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml
deleted file mode 100644
index 8559173..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid1.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid1"/>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache1"/>
- <property name="rebalanceMode" value="SYNC"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml
deleted file mode 100644
index cb628fe..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid2.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid2"/>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml
deleted file mode 100644
index 753fad1..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/start-test-grid3.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
deleted file mode 100644
index 245ed5f..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Dataload/DataStreamerTest.cs
+++ /dev/null
@@ -1,592 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Dataload
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Tests.Cache;
- using NUnit.Framework;
-
- /// <summary>
- /// Data streamer tests.
- /// </summary>
- public class DataStreamerTest
- {
- /** Node name. */
- protected const string GridName = "grid";
-
- /** Cache name. */
- protected const string CacheName = "partitioned";
-
- /** Node. */
- private IIgnite _grid;
-
- /** Cache. */
- private ICache<int, int?> _cache;
-
- /// <summary>
- /// Initialization routine.
- /// </summary>
- [TestFixtureSetUp]
- public virtual void InitClient()
- {
- _grid = Ignition.Start(GetIgniteConfiguration(GridName));
-
- Ignition.Start(GetIgniteConfiguration(GridName + "_1"));
-
- _cache = _grid.GetCache<int, int?>(CacheName);
- }
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureTearDown]
- public virtual void StopGrids()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- ///
- /// </summary>
- [SetUp]
- public virtual void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
-
- for (int i = 0; i < 100; i++)
- _cache.Remove(i);
- }
-
- [TearDown]
- public void AfterTest()
- {
- TestUtils.AssertHandleRegistryIsEmpty(_grid, 1000);
- }
-
- /// <summary>
- /// Test data streamer property configuration. Ensures that at least no exceptions are thrown.
- /// </summary>
- [Test]
- public void TestPropertyPropagation()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- ldr.AllowOverwrite = true;
- Assert.IsTrue(ldr.AllowOverwrite);
- ldr.AllowOverwrite = false;
- Assert.IsFalse(ldr.AllowOverwrite);
-
- ldr.SkipStore = true;
- Assert.IsTrue(ldr.SkipStore);
- ldr.SkipStore = false;
- Assert.IsFalse(ldr.SkipStore);
-
- ldr.PerNodeBufferSize = 1;
- Assert.AreEqual(1, ldr.PerNodeBufferSize);
- ldr.PerNodeBufferSize = 2;
- Assert.AreEqual(2, ldr.PerNodeBufferSize);
-
- ldr.PerNodeParallelOperations = 1;
- Assert.AreEqual(1, ldr.PerNodeParallelOperations);
- ldr.PerNodeParallelOperations = 2;
- Assert.AreEqual(2, ldr.PerNodeParallelOperations);
- }
- }
-
- /// <summary>
- /// Test data add/remove.
- /// </summary>
- [Test]
- public void TestAddRemove()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- ldr.AllowOverwrite = true;
-
- // Additions.
- ldr.AddData(1, 1);
- ldr.Flush();
- Assert.AreEqual(1, _cache.Get(1));
-
- ldr.AddData(new KeyValuePair<int, int>(2, 2));
- ldr.Flush();
- Assert.AreEqual(2, _cache.Get(2));
-
- ldr.AddData(new List<KeyValuePair<int, int>> { new KeyValuePair<int, int>(3, 3), new KeyValuePair<int, int>(4, 4) });
- ldr.Flush();
- Assert.AreEqual(3, _cache.Get(3));
- Assert.AreEqual(4, _cache.Get(4));
-
- // Removal.
- ldr.RemoveData(1);
- ldr.Flush();
- Assert.IsNull(_cache.Get(1));
-
- // Mixed.
- ldr.AddData(5, 5);
- ldr.RemoveData(2);
- ldr.AddData(new KeyValuePair<int, int>(7, 7));
- ldr.AddData(6, 6);
- ldr.RemoveData(4);
- ldr.AddData(new List<KeyValuePair<int, int>> { new KeyValuePair<int, int>(9, 9), new KeyValuePair<int, int>(10, 10) });
- ldr.AddData(new KeyValuePair<int, int>(8, 8));
- ldr.RemoveData(3);
- ldr.AddData(new List<KeyValuePair<int, int>> { new KeyValuePair<int, int>(11, 11), new KeyValuePair<int, int>(12, 12) });
-
- ldr.Flush();
-
- for (int i = 2; i < 5; i++)
- Assert.IsNull(_cache.Get(i));
-
- for (int i = 5; i < 13; i++)
- Assert.AreEqual(i, _cache.Get(i));
- }
- }
-
- /// <summary>
- /// Test "tryFlush".
- /// </summary>
- [Test]
- public void TestTryFlush()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- var fut = ldr.AddData(1, 1);
-
- ldr.TryFlush();
-
- fut.Get();
-
- Assert.AreEqual(1, _cache.Get(1));
- }
- }
-
- /// <summary>
- /// Test buffer size adjustments.
- /// </summary>
- [Test]
- public void TestBufferSize()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- var fut = ldr.AddData(1, 1);
-
- Thread.Sleep(100);
-
- Assert.IsFalse(fut.IsDone);
-
- ldr.PerNodeBufferSize = 2;
-
- ldr.AddData(2, 2);
- ldr.AddData(3, 3);
- ldr.AddData(4, 4).Get();
- fut.Get();
-
- Assert.AreEqual(1, _cache.Get(1));
- Assert.AreEqual(2, _cache.Get(2));
- Assert.AreEqual(3, _cache.Get(3));
- Assert.AreEqual(4, _cache.Get(4));
-
- ldr.AddData(new List<KeyValuePair<int, int>>
- {
- new KeyValuePair<int, int>(5, 5),
- new KeyValuePair<int, int>(6, 6),
- new KeyValuePair<int, int>(7, 7),
- new KeyValuePair<int, int>(8, 8)
- }).Get();
-
- Assert.AreEqual(5, _cache.Get(5));
- Assert.AreEqual(6, _cache.Get(6));
- Assert.AreEqual(7, _cache.Get(7));
- Assert.AreEqual(8, _cache.Get(8));
- }
- }
-
- /// <summary>
- /// Test close.
- /// </summary>
- [Test]
- public void TestClose()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- var fut = ldr.AddData(1, 1);
-
- ldr.Close(false);
-
- fut.Get();
-
- Assert.AreEqual(1, _cache.Get(1));
- }
- }
-
- /// <summary>
- /// Test close with cancellation.
- /// </summary>
- [Test]
- public void TestCancel()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- var fut = ldr.AddData(1, 1);
-
- ldr.Close(true);
-
- fut.Get();
-
- Assert.IsNull(_cache.Get(1));
- }
- }
-
- /// <summary>
- /// Tests that streamer gets collected when there are no references to it.
- /// </summary>
- [Test]
- public void TestFinalizer()
- {
- var streamer = _grid.GetDataStreamer<int, int>(CacheName);
- var streamerRef = new WeakReference(streamer);
-
- Assert.IsNotNull(streamerRef.Target);
-
- // ReSharper disable once RedundantAssignment
- streamer = null;
-
- GC.Collect();
- GC.WaitForPendingFinalizers();
-
- Assert.IsNull(streamerRef.Target);
- }
-
- /// <summary>
- /// Test auto-flush feature.
- /// </summary>
- [Test]
- public void TestAutoFlush()
- {
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- // Test auto flush turning on.
- var fut = ldr.AddData(1, 1);
- Thread.Sleep(100);
- Assert.IsFalse(fut.IsDone);
- ldr.AutoFlushFrequency = 1000;
- fut.Get();
-
- // Test forced flush after frequency change.
- fut = ldr.AddData(2, 2);
- ldr.AutoFlushFrequency = long.MaxValue;
- fut.Get();
-
- // Test another forced flush after frequency change.
- fut = ldr.AddData(3, 3);
- ldr.AutoFlushFrequency = 1000;
- fut.Get();
-
- // Test flush before stop.
- fut = ldr.AddData(4, 4);
- ldr.AutoFlushFrequency = 0;
- fut.Get();
-
- // Test flush after second turn on.
- fut = ldr.AddData(5, 5);
- ldr.AutoFlushFrequency = 1000;
- fut.Get();
-
- Assert.AreEqual(1, _cache.Get(1));
- Assert.AreEqual(2, _cache.Get(2));
- Assert.AreEqual(3, _cache.Get(3));
- Assert.AreEqual(4, _cache.Get(4));
- Assert.AreEqual(5, _cache.Get(5));
- }
- }
-
- /// <summary>
- /// Test multithreaded behavior.
- /// </summary>
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestMultithreaded()
- {
- int entriesPerThread = 100000;
- int threadCnt = 8;
-
- for (int i = 0; i < 5; i++)
- {
- _cache.Clear();
-
- Assert.AreEqual(0, _cache.GetSize());
-
- Stopwatch watch = new Stopwatch();
-
- watch.Start();
-
- using (IDataStreamer<int, int> ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- ldr.PerNodeBufferSize = 1024;
-
- int ctr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- int threadIdx = Interlocked.Increment(ref ctr);
-
- int startIdx = (threadIdx - 1) * entriesPerThread;
- int endIdx = startIdx + entriesPerThread;
-
- for (int j = startIdx; j < endIdx; j++)
- {
- // ReSharper disable once AccessToDisposedClosure
- ldr.AddData(j, j);
-
- if (j % 100000 == 0)
- Console.WriteLine("Put [thread=" + threadIdx + ", cnt=" + j + ']');
- }
- }, threadCnt);
- }
-
- Console.WriteLine("Iteration " + i + ": " + watch.ElapsedMilliseconds);
-
- watch.Reset();
-
- for (int j = 0; j < threadCnt * entriesPerThread; j++)
- Assert.AreEqual(j, j);
- }
- }
-
- /// <summary>
- /// Tests custom receiver.
- /// </summary>
- [Test]
- public void TestStreamReceiver()
- {
- TestStreamReceiver(new StreamReceiverPortable());
- TestStreamReceiver(new StreamReceiverSerializable());
- }
-
- /// <summary>
- /// Tests StreamVisitor.
- /// </summary>
- [Test]
- public void TestStreamVisitor()
- {
- TestStreamReceiver(new StreamVisitor<int, int>((c, e) => c.Put(e.Key, e.Value + 1)));
- }
-
- /// <summary>
- /// Tests StreamTransformer.
- /// </summary>
- [Test]
- public void TestStreamTransformer()
- {
- TestStreamReceiver(new StreamTransformer<int, int, int, int>(new EntryProcessorSerializable()));
- TestStreamReceiver(new StreamTransformer<int, int, int, int>(new EntryProcessorPortable()));
- }
-
- /// <summary>
- /// Tests specified receiver.
- /// </summary>
- private void TestStreamReceiver(IStreamReceiver<int, int> receiver)
- {
- using (var ldr = _grid.GetDataStreamer<int, int>(CacheName))
- {
- ldr.AllowOverwrite = true;
-
- ldr.Receiver = new StreamReceiverPortable();
-
- ldr.Receiver = receiver; // check double assignment
-
- Assert.AreEqual(ldr.Receiver, receiver);
-
- for (var i = 0; i < 100; i++)
- ldr.AddData(i, i);
-
- ldr.Flush();
-
- for (var i = 0; i < 100; i++)
- Assert.AreEqual(i + 1, _cache.Get(i));
- }
- }
-
- /// <summary>
- /// Tests the stream receiver in keepPortable mode.
- /// </summary>
- [Test]
- public void TestStreamReceiverKeepPortable()
- {
- // ReSharper disable once LocalVariableHidesMember
- var cache = _grid.GetCache<int, PortableEntry>(CacheName);
-
- using (var ldr0 = _grid.GetDataStreamer<int, int>(CacheName))
- using (var ldr = ldr0.WithKeepPortable<int, IPortableObject>())
- {
- ldr.Receiver = new StreamReceiverKeepPortable();
-
- ldr.AllowOverwrite = true;
-
- for (var i = 0; i < 100; i++)
- ldr.AddData(i, _grid.GetPortables().ToPortable<IPortableObject>(new PortableEntry {Val = i}));
-
- ldr.Flush();
-
- for (var i = 0; i < 100; i++)
- Assert.AreEqual(i + 1, cache.Get(i).Val);
- }
- }
-
- /// <summary>
- /// Gets the Ignite configuration.
- /// </summary>
- /// <param name="gridName">Grid name.</param>
- private static IgniteConfigurationEx GetIgniteConfiguration(string gridName)
- {
- return new IgniteConfigurationEx
- {
- GridName = gridName,
- SpringConfigUrl = "config\\native-client-test-cache.xml",
- JvmClasspath = TestUtils.CreateTestClasspath(),
- PortableConfiguration = new PortableConfiguration
- {
- TypeConfigurations = new List<PortableTypeConfiguration>
- {
- new PortableTypeConfiguration(typeof (CacheTestKey)),
- new PortableTypeConfiguration(typeof (TestReferenceObject)),
- new PortableTypeConfiguration(typeof (StreamReceiverPortable)),
- new PortableTypeConfiguration(typeof (EntryProcessorPortable)),
- new PortableTypeConfiguration(typeof (PortableEntry))
- }
- },
- JvmOptions = TestUtils.TestJavaOptions().Concat(new[]
- {
- "-Xms3096m",
- "-Xmx3096m",
- "-XX:+UseParNewGC",
- "-XX:+UseConcMarkSweepGC",
- "-XX:+UseTLAB",
- "-XX:NewSize=128m",
- "-XX:MaxNewSize=128m",
- "-XX:MaxTenuringThreshold=0",
- "-XX:SurvivorRatio=1024",
- "-XX:+UseCMSInitiatingOccupancyOnly",
- "-XX:CMSInitiatingOccupancyFraction=60"
- }).ToArray()
- };
- }
-
- /// <summary>
- /// Test portable receiver.
- /// </summary>
- private class StreamReceiverPortable : IStreamReceiver<int, int>
- {
- /** <inheritdoc /> */
- public void Receive(ICache<int, int> cache, ICollection<ICacheEntry<int, int>> entries)
- {
- cache.PutAll(entries.ToDictionary(x => x.Key, x => x.Value + 1));
- }
- }
-
- /// <summary>
- /// Test portable receiver.
- /// </summary>
- [Serializable]
- private class StreamReceiverKeepPortable : IStreamReceiver<int, IPortableObject>
- {
- /** <inheritdoc /> */
- public void Receive(ICache<int, IPortableObject> cache, ICollection<ICacheEntry<int, IPortableObject>> entries)
- {
- var portables = cache.Ignite.GetPortables();
-
- cache.PutAll(entries.ToDictionary(x => x.Key, x =>
- portables.ToPortable<IPortableObject>(new PortableEntry
- {
- Val = x.Value.Deserialize<PortableEntry>().Val + 1
- })));
- }
- }
-
- /// <summary>
- /// Test serializable receiver.
- /// </summary>
- [Serializable]
- private class StreamReceiverSerializable : IStreamReceiver<int, int>
- {
- /** <inheritdoc /> */
- public void Receive(ICache<int, int> cache, ICollection<ICacheEntry<int, int>> entries)
- {
- cache.PutAll(entries.ToDictionary(x => x.Key, x => x.Value + 1));
- }
- }
-
- /// <summary>
- /// Test entry processor.
- /// </summary>
- [Serializable]
- private class EntryProcessorSerializable : ICacheEntryProcessor<int, int, int, int>
- {
- /** <inheritdoc /> */
- public int Process(IMutableCacheEntry<int, int> entry, int arg)
- {
- entry.Value = entry.Key + 1;
-
- return 0;
- }
- }
-
- /// <summary>
- /// Test entry processor.
- /// </summary>
- private class EntryProcessorPortable : ICacheEntryProcessor<int, int, int, int>, IPortableMarshalAware
- {
- /** <inheritdoc /> */
- public int Process(IMutableCacheEntry<int, int> entry, int arg)
- {
- entry.Value = entry.Key + 1;
-
- return 0;
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- // No-op.
- }
- }
-
- /// <summary>
- /// Portablecache entry.
- /// </summary>
- private class PortableEntry
- {
- public int Val { get; set; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
deleted file mode 100644
index aa103d4..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/EventsTest.cs
+++ /dev/null
@@ -1,961 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
- using System.Threading.Tasks;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Events;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Tests.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// <see cref="IEvents"/> tests.
- /// </summary>
- public class EventsTest
- {
- /** */
- private IIgnite _grid1;
-
- /** */
- private IIgnite _grid2;
-
- /** */
- private IIgnite _grid3;
-
- /** */
- private IIgnite[] _grids;
-
- /** */
- public static int IdGen;
-
- [TestFixtureTearDown]
- public void FixtureTearDown()
- {
- StopGrids();
- }
-
- /// <summary>
- /// Executes before each test.
- /// </summary>
- [SetUp]
- public void SetUp()
- {
- StartGrids();
- EventsTestHelper.ListenResult = true;
- }
-
- /// <summary>
- /// Executes after each test.
- /// </summary>
- [TearDown]
- public virtual void TearDown()
- {
- try
- {
- TestUtils.AssertHandleRegistryIsEmpty(1000, _grid1, _grid2, _grid3);
- }
- catch (Exception)
- {
- // Restart grids to cleanup
- StopGrids();
-
- throw;
- }
- finally
- {
- EventsTestHelper.AssertFailures();
-
- if (TestContext.CurrentContext.Test.Name.StartsWith("TestEventTypes"))
- StopGrids(); // clean events for other tests
- }
- }
-
- /// <summary>
- /// Tests enable/disable of event types.
- /// </summary>
- [Test]
- public void TestEnableDisable()
- {
- var events = _grid1.GetEvents();
-
- Assert.AreEqual(0, events.GetEnabledEvents().Length);
-
- Assert.IsFalse(EventType.EvtsCache.Any(events.IsEnabled));
-
- events.EnableLocal(EventType.EvtsCache);
-
- Assert.AreEqual(EventType.EvtsCache, events.GetEnabledEvents());
-
- Assert.IsTrue(EventType.EvtsCache.All(events.IsEnabled));
-
- events.EnableLocal(EventType.EvtsTaskExecution);
-
- events.DisableLocal(EventType.EvtsCache);
-
- Assert.AreEqual(EventType.EvtsTaskExecution, events.GetEnabledEvents());
- }
-
- /// <summary>
- /// Tests LocalListen.
- /// </summary>
- [Test]
- public void TestLocalListen()
- {
- var events = _grid1.GetEvents();
- var listener = EventsTestHelper.GetListener();
- var eventType = EventType.EvtsTaskExecution;
-
- events.EnableLocal(eventType);
-
- events.LocalListen(listener, eventType);
-
- CheckSend(3); // 3 events per task * 3 grids
-
- // Check unsubscription for specific event
- events.StopLocalListen(listener, EventType.EvtTaskReduced);
-
- CheckSend(2);
-
- // Unsubscribe from all events
- events.StopLocalListen(listener);
-
- CheckNoEvent();
-
- // Check unsubscription by filter
- events.LocalListen(listener, EventType.EvtTaskReduced);
-
- CheckSend();
-
- EventsTestHelper.ListenResult = false;
-
- CheckSend(); // one last event will be received for each listener
-
- CheckNoEvent();
- }
-
- /// <summary>
- /// Tests LocalListen.
- /// </summary>
- [Test]
- [Ignore("IGNITE-879")]
- public void TestLocalListenRepeatedSubscription()
- {
- var events = _grid1.GetEvents();
- var listener = EventsTestHelper.GetListener();
- var eventType = EventType.EvtsTaskExecution;
-
- events.EnableLocal(eventType);
-
- events.LocalListen(listener, eventType);
-
- CheckSend(3); // 3 events per task * 3 grids
-
- events.LocalListen(listener, eventType);
- events.LocalListen(listener, eventType);
-
- CheckSend(9);
-
- events.StopLocalListen(listener, eventType);
-
- CheckSend(6);
-
- events.StopLocalListen(listener, eventType);
-
- CheckSend(3);
-
- events.StopLocalListen(listener, eventType);
-
- CheckNoEvent();
- }
-
- /// <summary>
- /// Tests all available event types/classes.
- /// </summary>
- [Test, TestCaseSource("TestCases")]
- public void TestEventTypes(EventTestCase testCase)
- {
- var events = _grid1.GetEvents();
-
- events.EnableLocal(testCase.EventType);
-
- var listener = EventsTestHelper.GetListener();
-
- events.LocalListen(listener, testCase.EventType);
-
- EventsTestHelper.ClearReceived(testCase.EventCount);
-
- testCase.GenerateEvent(_grid1);
-
- EventsTestHelper.VerifyReceive(testCase.EventCount, testCase.EventObjectType, testCase.EventType);
-
- if (testCase.VerifyEvents != null)
- testCase.VerifyEvents(EventsTestHelper.ReceivedEvents.Reverse(), _grid1);
-
- // Check stop
- events.StopLocalListen(listener);
-
- EventsTestHelper.ClearReceived(0);
-
- testCase.GenerateEvent(_grid1);
-
- Thread.Sleep(EventsTestHelper.Timeout);
- }
-
- /// <summary>
- /// Test cases for TestEventTypes: type id + type + event generator.
- /// </summary>
- public IEnumerable<EventTestCase> TestCases
- {
- get
- {
- yield return new EventTestCase
- {
- EventType = EventType.EvtsCache,
- EventObjectType = typeof (CacheEvent),
- GenerateEvent = g => g.GetCache<int, int>(null).Put(1, 1),
- VerifyEvents = (e, g) => VerifyCacheEvents(e, g),
- EventCount = 1
- };
-
- yield return new EventTestCase
- {
- EventType = EventType.EvtsTaskExecution,
- EventObjectType = typeof (TaskEvent),
- GenerateEvent = g => GenerateTaskEvent(g),
- VerifyEvents = (e, g) => VerifyTaskEvents(e),
- EventCount = 3
- };
-
- yield return new EventTestCase
- {
- EventType = EventType.EvtsJobExecution,
- EventObjectType = typeof (JobEvent),
- GenerateEvent = g => GenerateTaskEvent(g),
- EventCount = 9
- };
-
- yield return new EventTestCase
- {
- EventType = new[] {EventType.EvtCacheQueryExecuted},
- EventObjectType = typeof (CacheQueryExecutedEvent),
- GenerateEvent = g => GenerateCacheQueryEvent(g),
- EventCount = 1
- };
-
- yield return new EventTestCase
- {
- EventType = new[] { EventType.EvtCacheQueryObjectRead },
- EventObjectType = typeof (CacheQueryReadEvent),
- GenerateEvent = g => GenerateCacheQueryEvent(g),
- EventCount = 1
- };
- }
- }
-
- /// <summary>
- /// Tests the LocalQuery.
- /// </summary>
- [Test]
- public void TestLocalQuery()
- {
- var events = _grid1.GetEvents();
-
- var eventType = EventType.EvtsTaskExecution;
-
- events.EnableLocal(eventType);
-
- var oldEvents = events.LocalQuery();
-
- GenerateTaskEvent();
-
- // "Except" works because of overridden equality
- var qryResult = events.LocalQuery(eventType).Except(oldEvents).ToList();
-
- Assert.AreEqual(3, qryResult.Count);
- }
-
- /// <summary>
- /// Tests the WaitForLocal.
- /// </summary>
- [Test]
- public void TestWaitForLocal([Values(true, false)] bool async)
- {
- var events = _grid1.GetEvents();
-
- var timeout = TimeSpan.FromSeconds(3);
-
- if (async)
- events = events.WithAsync();
-
- var eventType = EventType.EvtsTaskExecution;
-
- events.EnableLocal(eventType);
-
- Func<Func<IEvent>, Task<IEvent>> getWaitTask;
-
- if (async)
- getWaitTask = func =>
- {
- Assert.IsNull(func());
- var task = events.GetFuture<IEvent>().ToTask();
- GenerateTaskEvent();
- return task;
- };
- else
- getWaitTask = func =>
- {
- var task = Task.Factory.StartNew(func);
- Thread.Sleep(500); // allow task to start and begin waiting for events
- GenerateTaskEvent();
- return task;
- };
-
- // No params
- var waitTask = getWaitTask(() => events.WaitForLocal());
-
- waitTask.Wait(timeout);
-
- // Event types
- waitTask = getWaitTask(() => events.WaitForLocal(EventType.EvtTaskReduced));
-
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.EvtTaskReduced, waitTask.Result.Type);
-
- // Filter
- waitTask = getWaitTask(() => events.WaitForLocal(
- new EventFilter<IEvent>((g, e) => e.Type == EventType.EvtTaskReduced)));
-
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.EvtTaskReduced, waitTask.Result.Type);
-
- // Filter & types
- waitTask = getWaitTask(() => events.WaitForLocal(
- new EventFilter<IEvent>((g, e) => e.Type == EventType.EvtTaskReduced), EventType.EvtTaskReduced));
-
- Assert.IsTrue(waitTask.Wait(timeout));
- Assert.IsInstanceOf(typeof(TaskEvent), waitTask.Result);
- Assert.AreEqual(EventType.EvtTaskReduced, waitTask.Result.Type);
- }
-
- /// <summary>
- /// Tests RemoteListen.
- /// </summary>
- [Test]
- public void TestRemoteListen(
- [Values(true, false)] bool async,
- [Values(true, false)] bool portable,
- [Values(true, false)] bool autoUnsubscribe)
- {
- foreach (var g in _grids)
- {
- g.GetEvents().EnableLocal(EventType.EvtsJobExecution);
- g.GetEvents().EnableLocal(EventType.EvtsTaskExecution);
- }
-
- var events = _grid1.GetEvents();
-
- var expectedType = EventType.EvtJobStarted;
-
- var remoteFilter = portable
- ? (IEventFilter<IEvent>) new RemoteEventPortableFilter(expectedType)
- : new RemoteEventFilter(expectedType);
-
- var localListener = EventsTestHelper.GetListener();
-
- if (async)
- events = events.WithAsync();
-
- var listenId = events.RemoteListen(localListener: localListener, remoteFilter: remoteFilter,
- autoUnsubscribe: autoUnsubscribe);
-
- if (async)
- listenId = events.GetFuture<Guid>().Get();
-
- CheckSend(3, typeof(JobEvent), expectedType);
-
- _grid3.GetEvents().DisableLocal(EventType.EvtsJobExecution);
-
- CheckSend(2, typeof(JobEvent), expectedType);
-
- events.StopRemoteListen(listenId);
-
- if (async)
- events.GetFuture().Get();
-
- CheckNoEvent();
-
- // Check unsubscription with listener
- events.RemoteListen(localListener: localListener, remoteFilter: remoteFilter,
- autoUnsubscribe: autoUnsubscribe);
-
- if (async)
- events.GetFuture<Guid>().Get();
-
- CheckSend(2, typeof(JobEvent), expectedType);
-
- EventsTestHelper.ListenResult = false;
-
- CheckSend(1, typeof(JobEvent), expectedType); // one last event
-
- CheckNoEvent();
- }
-
- /// <summary>
- /// Tests RemoteQuery.
- /// </summary>
- [Test]
- public void TestRemoteQuery([Values(true, false)] bool async)
- {
- foreach (var g in _grids)
- g.GetEvents().EnableLocal(EventType.EvtsJobExecution);
-
- var events = _grid1.GetEvents();
-
- var eventFilter = new RemoteEventFilter(EventType.EvtJobStarted);
-
- var oldEvents = events.RemoteQuery(eventFilter);
-
- if (async)
- events = events.WithAsync();
-
- GenerateTaskEvent();
-
- var remoteQuery = events.RemoteQuery(eventFilter, EventsTestHelper.Timeout, EventType.EvtsJobExecution);
-
- if (async)
- {
- Assert.IsNull(remoteQuery);
-
- remoteQuery = events.GetFuture<List<IEvent>>().Get().ToList();
- }
-
- var qryResult = remoteQuery.Except(oldEvents).Cast<JobEvent>().ToList();
-
- Assert.AreEqual(_grids.Length, qryResult.Count);
-
- Assert.IsTrue(qryResult.All(x => x.Type == EventType.EvtJobStarted));
- }
-
- /// <summary>
- /// Tests serialization.
- /// </summary>
- [Test]
- public void TestSerialization()
- {
- var grid = (Ignite) _grid1;
- var comp = (Impl.Compute.Compute) grid.GetCluster().ForLocal().GetCompute();
- var locNode = grid.GetCluster().GetLocalNode();
-
- var expectedGuid = Guid.Parse("00000000-0000-0001-0000-000000000002");
- var expectedGridGuid = new IgniteGuid(expectedGuid, 3);
-
- using (var inStream = IgniteManager.Memory.Allocate().Stream())
- {
- var result = comp.ExecuteJavaTask<bool>("org.apache.ignite.platform.PlatformEventsWriteEventTask",
- inStream.MemoryPointer);
-
- Assert.IsTrue(result);
-
- inStream.SynchronizeInput();
-
- var reader = grid.Marshaller.StartUnmarshal(inStream);
-
- var cacheEvent = EventReader.Read<CacheEvent>(reader);
- CheckEventBase(cacheEvent);
- Assert.AreEqual("cacheName", cacheEvent.CacheName);
- Assert.AreEqual(locNode, cacheEvent.EventNode);
- Assert.AreEqual(1, cacheEvent.Partition);
- Assert.AreEqual(true, cacheEvent.IsNear);
- Assert.AreEqual(2, cacheEvent.Key);
- Assert.AreEqual(expectedGridGuid, cacheEvent.Xid);
- Assert.AreEqual(3, cacheEvent.LockId);
- Assert.AreEqual(4, cacheEvent.NewValue);
- Assert.AreEqual(true, cacheEvent.HasNewValue);
- Assert.AreEqual(5, cacheEvent.OldValue);
- Assert.AreEqual(true, cacheEvent.HasOldValue);
- Assert.AreEqual(expectedGuid, cacheEvent.SubjectId);
- Assert.AreEqual("cloClsName", cacheEvent.ClosureClassName);
- Assert.AreEqual("taskName", cacheEvent.TaskName);
-
- var qryExecEvent = EventReader.Read<CacheQueryExecutedEvent>(reader);
- CheckEventBase(qryExecEvent);
- Assert.AreEqual("qryType", qryExecEvent.QueryType);
- Assert.AreEqual("cacheName", qryExecEvent.CacheName);
- Assert.AreEqual("clsName", qryExecEvent.ClassName);
- Assert.AreEqual("clause", qryExecEvent.Clause);
- Assert.AreEqual(expectedGuid, qryExecEvent.SubjectId);
- Assert.AreEqual("taskName", qryExecEvent.TaskName);
-
- var qryReadEvent = EventReader.Read<CacheQueryReadEvent>(reader);
- CheckEventBase(qryReadEvent);
- Assert.AreEqual("qryType", qryReadEvent.QueryType);
- Assert.AreEqual("cacheName", qryReadEvent.CacheName);
- Assert.AreEqual("clsName", qryReadEvent.ClassName);
- Assert.AreEqual("clause", qryReadEvent.Clause);
- Assert.AreEqual(expectedGuid, qryReadEvent.SubjectId);
- Assert.AreEqual("taskName", qryReadEvent.TaskName);
- Assert.AreEqual(1, qryReadEvent.Key);
- Assert.AreEqual(2, qryReadEvent.Value);
- Assert.AreEqual(3, qryReadEvent.OldValue);
- Assert.AreEqual(4, qryReadEvent.Row);
-
- var cacheRebalancingEvent = EventReader.Read<CacheRebalancingEvent>(reader);
- CheckEventBase(cacheRebalancingEvent);
- Assert.AreEqual("cacheName", cacheRebalancingEvent.CacheName);
- Assert.AreEqual(1, cacheRebalancingEvent.Partition);
- Assert.AreEqual(locNode, cacheRebalancingEvent.DiscoveryNode);
- Assert.AreEqual(2, cacheRebalancingEvent.DiscoveryEventType);
- Assert.AreEqual(3, cacheRebalancingEvent.DiscoveryTimestamp);
-
- var checkpointEvent = EventReader.Read<CheckpointEvent>(reader);
- CheckEventBase(checkpointEvent);
- Assert.AreEqual("cpKey", checkpointEvent.Key);
-
- var discoEvent = EventReader.Read<DiscoveryEvent>(reader);
- CheckEventBase(discoEvent);
- Assert.AreEqual(grid.TopologyVersion, discoEvent.TopologyVersion);
- Assert.AreEqual(grid.GetNodes(), discoEvent.TopologyNodes);
-
- var jobEvent = EventReader.Read<JobEvent>(reader);
- CheckEventBase(jobEvent);
- Assert.AreEqual(expectedGridGuid, jobEvent.JobId);
- Assert.AreEqual("taskClsName", jobEvent.TaskClassName);
- Assert.AreEqual("taskName", jobEvent.TaskName);
- Assert.AreEqual(locNode, jobEvent.TaskNode);
- Assert.AreEqual(expectedGridGuid, jobEvent.TaskSessionId);
- Assert.AreEqual(expectedGuid, jobEvent.TaskSubjectId);
-
- var spaceEvent = EventReader.Read<SwapSpaceEvent>(reader);
- CheckEventBase(spaceEvent);
- Assert.AreEqual("space", spaceEvent.Space);
-
- var taskEvent = EventReader.Read<TaskEvent>(reader);
- CheckEventBase(taskEvent);
- Assert.AreEqual(true,taskEvent.Internal);
- Assert.AreEqual(expectedGuid, taskEvent.SubjectId);
- Assert.AreEqual("taskClsName", taskEvent.TaskClassName);
- Assert.AreEqual("taskName", taskEvent.TaskName);
- Assert.AreEqual(expectedGridGuid, taskEvent.TaskSessionId);
- }
- }
-
- /// <summary>
- /// Checks base event fields serialization.
- /// </summary>
- /// <param name="evt">The evt.</param>
- private void CheckEventBase(IEvent evt)
- {
- var locNode = _grid1.GetCluster().GetLocalNode();
-
- Assert.AreEqual(locNode, evt.Node);
- Assert.AreEqual("msg", evt.Message);
- Assert.AreEqual(EventType.EvtSwapSpaceCleared, evt.Type);
- Assert.IsNotNullOrEmpty(evt.Name);
- Assert.AreNotEqual(Guid.Empty, evt.Id.GlobalId);
- Assert.IsTrue((evt.TimeStamp - DateTime.Now).TotalSeconds < 10);
- }
-
- /// <summary>
- /// Sends events in various ways and verifies correct receive.
- /// </summary>
- /// <param name="repeat">Expected event count multiplier.</param>
- /// <param name="eventObjectType">Expected event object type.</param>
- /// <param name="eventType">Type of the event.</param>
- private void CheckSend(int repeat = 1, Type eventObjectType = null, params int[] eventType)
- {
- EventsTestHelper.ClearReceived(repeat);
-
- GenerateTaskEvent();
-
- EventsTestHelper.VerifyReceive(repeat, eventObjectType ?? typeof (TaskEvent),
- eventType.Any() ? eventType : EventType.EvtsTaskExecution);
- }
-
- /// <summary>
- /// Checks that no event has arrived.
- /// </summary>
- private void CheckNoEvent()
- {
- // this will result in an exception in case of a event
- EventsTestHelper.ClearReceived(0);
-
- GenerateTaskEvent();
-
- Thread.Sleep(EventsTestHelper.Timeout);
-
- EventsTestHelper.AssertFailures();
- }
-
- /// <summary>
- /// Gets the Ignite configuration.
- /// </summary>
- private static IgniteConfiguration Configuration(string springConfigUrl)
- {
- return new IgniteConfiguration
- {
- SpringConfigUrl = springConfigUrl,
- JvmClasspath = TestUtils.CreateTestClasspath(),
- JvmOptions = TestUtils.TestJavaOptions(),
- PortableConfiguration = new PortableConfiguration
- {
- TypeConfigurations = new List<PortableTypeConfiguration>
- {
- new PortableTypeConfiguration(typeof (RemoteEventPortableFilter))
- }
- }
- };
- }
-
- /// <summary>
- /// Generates the task event.
- /// </summary>
- private void GenerateTaskEvent(IIgnite grid = null)
- {
- (grid ?? _grid1).GetCompute().Broadcast(new ComputeAction());
- }
-
- /// <summary>
- /// Verifies the task events.
- /// </summary>
- private static void VerifyTaskEvents(IEnumerable<IEvent> events)
- {
- var e = events.Cast<TaskEvent>().ToArray();
-
- // started, reduced, finished
- Assert.AreEqual(
- new[] {EventType.EvtTaskStarted, EventType.EvtTaskReduced, EventType.EvtTaskFinished},
- e.Select(x => x.Type).ToArray());
- }
-
- /// <summary>
- /// Generates the cache query event.
- /// </summary>
- private static void GenerateCacheQueryEvent(IIgnite g)
- {
- var cache = g.GetCache<int, int>(null);
-
- cache.Clear();
-
- cache.Put(1, 1);
-
- cache.Query(new ScanQuery<int, int>()).GetAll();
- }
-
- /// <summary>
- /// Verifies the cache events.
- /// </summary>
- private static void VerifyCacheEvents(IEnumerable<IEvent> events, IIgnite grid)
- {
- var e = events.Cast<CacheEvent>().ToArray();
-
- foreach (var cacheEvent in e)
- {
- Assert.AreEqual(null, cacheEvent.CacheName);
- Assert.AreEqual(null, cacheEvent.ClosureClassName);
- Assert.AreEqual(null, cacheEvent.TaskName);
- Assert.AreEqual(grid.GetCluster().GetLocalNode(), cacheEvent.EventNode);
- Assert.AreEqual(grid.GetCluster().GetLocalNode(), cacheEvent.Node);
-
- Assert.AreEqual(false, cacheEvent.HasOldValue);
- Assert.AreEqual(null, cacheEvent.OldValue);
-
- if (cacheEvent.Type == EventType.EvtCacheObjectPut)
- {
- Assert.AreEqual(true, cacheEvent.HasNewValue);
- Assert.AreEqual(1, cacheEvent.NewValue);
- }
- else if (cacheEvent.Type == EventType.EvtCacheEntryCreated)
- {
- Assert.AreEqual(false, cacheEvent.HasNewValue);
- Assert.AreEqual(null, cacheEvent.NewValue);
- }
- else
- {
- Assert.Fail("Unexpected event type");
- }
- }
- }
-
- /// <summary>
- /// Starts the grids.
- /// </summary>
- private void StartGrids()
- {
- if (_grid1 != null)
- return;
-
- _grid1 = Ignition.Start(Configuration("config\\compute\\compute-grid1.xml"));
- _grid2 = Ignition.Start(Configuration("config\\compute\\compute-grid2.xml"));
- _grid3 = Ignition.Start(Configuration("config\\compute\\compute-grid3.xml"));
-
- _grids = new[] {_grid1, _grid2, _grid3};
- }
-
- /// <summary>
- /// Stops the grids.
- /// </summary>
- private void StopGrids()
- {
- _grid1 = _grid2 = _grid3 = null;
- _grids = null;
-
- Ignition.StopAll(true);
- }
- }
-
- /// <summary>
- /// Event test helper class.
- /// </summary>
- [Serializable]
- public static class EventsTestHelper
- {
- /** */
- public static readonly ConcurrentStack<IEvent> ReceivedEvents = new ConcurrentStack<IEvent>();
-
- /** */
- public static readonly ConcurrentStack<string> Failures = new ConcurrentStack<string>();
-
- /** */
- public static readonly CountdownEvent ReceivedEvent = new CountdownEvent(0);
-
- /** */
- public static readonly ConcurrentStack<Guid> LastNodeIds = new ConcurrentStack<Guid>();
-
- /** */
- public static volatile bool ListenResult = true;
-
- /** */
- public static readonly TimeSpan Timeout = TimeSpan.FromMilliseconds(800);
-
- /// <summary>
- /// Clears received event information.
- /// </summary>
- /// <param name="expectedCount">The expected count of events to be received.</param>
- public static void ClearReceived(int expectedCount)
- {
- ReceivedEvents.Clear();
- ReceivedEvent.Reset(expectedCount);
- LastNodeIds.Clear();
- }
-
- /// <summary>
- /// Verifies received events against events events.
- /// </summary>
- public static void VerifyReceive(int count, Type eventObjectType, params int[] eventTypes)
- {
- // check if expected event count has been received; Wait returns false if there were none.
- Assert.IsTrue(ReceivedEvent.Wait(Timeout),
- "Failed to receive expected number of events. Remaining count: " + ReceivedEvent.CurrentCount);
-
- Assert.AreEqual(count, ReceivedEvents.Count);
-
- Assert.IsTrue(ReceivedEvents.All(x => x.GetType() == eventObjectType));
-
- Assert.IsTrue(ReceivedEvents.All(x => eventTypes.Contains(x.Type)));
-
- AssertFailures();
- }
-
- /// <summary>
- /// Gets the event listener.
- /// </summary>
- /// <returns>New instance of event listener.</returns>
- public static IEventFilter<IEvent> GetListener()
- {
- return new EventFilter<IEvent>(Listen);
- }
-
- /// <summary>
- /// Combines accumulated failures and throws an assertion, if there are any.
- /// Clears accumulated failures.
- /// </summary>
- public static void AssertFailures()
- {
- try
- {
- if (Failures.Any())
- Assert.Fail(Failures.Reverse().Aggregate((x, y) => string.Format("{0}\n{1}", x, y)));
- }
- finally
- {
- Failures.Clear();
- }
- }
-
- /// <summary>
- /// Listen method.
- /// </summary>
- /// <param name="id">Originating node ID.</param>
- /// <param name="evt">Event.</param>
- private static bool Listen(Guid id, IEvent evt)
- {
- try
- {
- LastNodeIds.Push(id);
- ReceivedEvents.Push(evt);
-
- ReceivedEvent.Signal();
-
- return ListenResult;
- }
- catch (Exception ex)
- {
- // When executed on remote nodes, these exceptions will not go to sender,
- // so we have to accumulate them.
- Failures.Push(string.Format("Exception in Listen (msg: {0}, id: {1}): {2}", evt, id, ex));
- throw;
- }
- }
- }
-
- /// <summary>
- /// Test event filter.
- /// </summary>
- [Serializable]
- public class EventFilter<T> : IEventFilter<T> where T : IEvent
- {
- /** */
- private readonly Func<Guid, T, bool> _invoke;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class.
- /// </summary>
- /// <param name="invoke">The invoke delegate.</param>
- public EventFilter(Func<Guid, T, bool> invoke)
- {
- _invoke = invoke;
- }
-
- /** <inheritdoc /> */
- bool IEventFilter<T>.Invoke(Guid nodeId, T evt)
- {
- return _invoke(nodeId, evt);
- }
-
- /** <inheritdoc /> */
- public bool Invoke(Guid nodeId, T evt)
- {
- throw new Exception("Invalid method");
- }
- }
-
- /// <summary>
- /// Remote event filter.
- /// </summary>
- [Serializable]
- public class RemoteEventFilter : IEventFilter<IEvent>
- {
- /** */
- private readonly int _type;
-
- public RemoteEventFilter(int type)
- {
- _type = type;
- }
-
- /** <inheritdoc /> */
- public bool Invoke(Guid nodeId, IEvent evt)
- {
- return evt.Type == _type;
- }
- }
-
- /// <summary>
- /// Portable remote event filter.
- /// </summary>
- public class RemoteEventPortableFilter : IEventFilter<IEvent>, IPortableMarshalAware
- {
- /** */
- private int _type;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RemoteEventPortableFilter"/> class.
- /// </summary>
- /// <param name="type">The event type.</param>
- public RemoteEventPortableFilter(int type)
- {
- _type = type;
- }
-
- /** <inheritdoc /> */
- public bool Invoke(Guid nodeId, IEvent evt)
- {
- return evt.Type == _type;
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- writer.RawWriter().WriteInt(_type);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- _type = reader.RawReader().ReadInt();
- }
- }
-
- /// <summary>
- /// Event test case.
- /// </summary>
- public class EventTestCase
- {
- /// <summary>
- /// Gets or sets the type of the event.
- /// </summary>
- public int[] EventType { get; set; }
-
- /// <summary>
- /// Gets or sets the type of the event object.
- /// </summary>
- public Type EventObjectType { get; set; }
-
- /// <summary>
- /// Gets or sets the generate event action.
- /// </summary>
- public Action<IIgnite> GenerateEvent { get; set; }
-
- /// <summary>
- /// Gets or sets the verify events action.
- /// </summary>
- public Action<IEnumerable<IEvent>, IIgnite> VerifyEvents { get; set; }
-
- /// <summary>
- /// Gets or sets the event count.
- /// </summary>
- public int EventCount { get; set; }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- return EventObjectType.ToString();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs
deleted file mode 100644
index edb04cb..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Examples/Example.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Examples
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text.RegularExpressions;
- using Apache.Ignite.Examples.Compute;
- using Apache.Ignite.ExamplesDll.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Represents an Example to be tested.
- /// </summary>
- public class Example
- {
- /** All examples */
- private static readonly Example[] Examples = GetExamples().ToArray();
-
- /** Execute action */
- private Action _runAction;
-
- /** Config url */
- public string SpringConfigUrl { get; private set; }
-
- /** Source path */
- public string SourceFilePath { get; private set; }
-
- /** Dll load flag */
- public bool NeedsTestDll { get; private set; }
-
- /** Name */
- public string Name { get; private set; }
-
- /// <summary>
- /// Runs this example.
- /// </summary>
- public void Run()
- {
- try
- {
- _runAction();
- }
- catch (InvalidOperationException ex)
- {
- // Each example has a ReadKey at the end, which throws an exception in test environment.
- if (ex.Message != "Cannot read keys when either application does not have a console or " +
- "when console input has been redirected from a file. Try Console.Read.")
- throw;
- }
- }
-
- /// <summary>
- /// Gets all examples.
- /// </summary>
- public static IEnumerable<Example> All
- {
- get { return Examples; }
- }
-
- /// <summary>
- /// Gets all examples.
- /// </summary>
- private static IEnumerable<Example> GetExamples()
- {
- var examplesAsm = typeof (ClosureExample).Assembly;
-
- var sourceFiles = Directory.GetFiles(PathUtil.ExamplesSourcePath, "*.cs", SearchOption.AllDirectories);
-
- Assert.IsTrue(sourceFiles.Any());
-
- var types = examplesAsm.GetTypes().Where(x => x.GetMethod("Main") != null).ToArray();
-
- Assert.IsTrue(types.Any());
-
- var examplesDllName = typeof(AverageSalaryJob).Assembly.GetName().Name;
-
- foreach (var type in types)
- {
- var sourceFile = sourceFiles.Single(x => x.EndsWith(string.Format("\\{0}.cs", type.Name)));
-
- var sourceCode = File.ReadAllText(sourceFile);
-
- yield return new Example
- {
- SourceFilePath = sourceFile,
- SpringConfigUrl = PathUtil.GetFullConfigPath(GetSpringConfigUrl(sourceCode)),
- NeedsTestDll = sourceCode.Contains(examplesDllName),
- _runAction = GetRunAction(type),
- Name = type.Name
- };
- }
- }
-
- /// <summary>
- /// Gets the run action.
- /// </summary>
- private static Action GetRunAction(Type type)
- {
- return (Action) Delegate.CreateDelegate(typeof (Action), type.GetMethod("Main"));
- }
-
- /// <summary>
- /// Gets the spring configuration URL.
- /// </summary>
- private static string GetSpringConfigUrl(string code)
- {
- var match = Regex.Match(code, "-springConfigUrl=(.*?.xml)");
-
- return match.Success ? match.Groups[1].Value : null;
- }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- // This will be displayed in TeamCity and R# test runner
- return Name;
- }
- }
-}
\ No newline at end of file
[03/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
deleted file mode 100644
index e7c5ac9..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskResultTest.cs
+++ /dev/null
@@ -1,437 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests task result.
- /// </summary>
- public class TaskResultTest : AbstractTaskTest
- {
- /** Grid name. */
- private static volatile string _gridName;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public TaskResultTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="forked">Fork flag.</param>
- protected TaskResultTest(bool forked) : base(forked) { }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultInt()
- {
- TestTask<int> task = new TestTask<int>();
-
- int res = Grid1.GetCompute().Execute(task, new Tuple<bool, int>(true, 10));
-
- Assert.AreEqual(10, res);
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, int>(false, 11));
-
- Assert.AreEqual(11, res);
- }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultLong()
- {
- TestTask<long> task = new TestTask<long>();
-
- long res = Grid1.GetCompute().Execute(task, new Tuple<bool, long>(true, 10000000000));
-
- Assert.AreEqual(10000000000, res);
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, long>(false, 10000000001));
-
- Assert.AreEqual(10000000001, res);
- }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultFloat()
- {
- TestTask<float> task = new TestTask<float>();
-
- float res = Grid1.GetCompute().Execute(task, new Tuple<bool, float>(true, 1.1f));
-
- Assert.AreEqual(1.1f, res);
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, float>(false, -1.1f));
-
- Assert.AreEqual(-1.1f, res);
- }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultPortable()
- {
- TestTask<PortableResult> task = new TestTask<PortableResult>();
-
- PortableResult val = new PortableResult(100);
-
- PortableResult res = Grid1.GetCompute().Execute(task, new Tuple<bool, PortableResult>(true, val));
-
- Assert.AreEqual(val.Val, res.Val);
-
- val.Val = 101;
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, PortableResult>(false, val));
-
- Assert.AreEqual(val.Val, res.Val);
- }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultSerializable()
- {
- TestTask<SerializableResult> task = new TestTask<SerializableResult>();
-
- SerializableResult val = new SerializableResult(100);
-
- SerializableResult res = Grid1.GetCompute().Execute(task, new Tuple<bool, SerializableResult>(true, val));
-
- Assert.AreEqual(val.Val, res.Val);
-
- val.Val = 101;
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, SerializableResult>(false, val));
-
- Assert.AreEqual(val.Val, res.Val);
- }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestTaskResultLarge()
- {
- TestTask<byte[]> task = new TestTask<byte[]>();
-
- byte[] res = Grid1.GetCompute().Execute(task,
- new Tuple<bool, byte[]>(true, new byte[100 * 1024]));
-
- Assert.AreEqual(100 * 1024, res.Length);
-
- res = Grid1.GetCompute().Execute(task, new Tuple<bool, byte[]>(false, new byte[101 * 1024]));
-
- Assert.AreEqual(101 * 1024, res.Length);
- }
-
- /** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableResult)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(TestPortableJob)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableOutFunc)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableFunc)));
- }
-
- [Test]
- public void TestOutFuncResultPrimitive1()
- {
- ICollection<int> res = Grid1.GetCompute().Broadcast(new PortableOutFunc());
-
- Assert.AreEqual(3, res.Count);
-
- foreach (int r in res)
- Assert.AreEqual(10, r);
- }
-
- [Test]
- public void TestOutFuncResultPrimitive2()
- {
- ICollection<int> res = Grid1.GetCompute().Broadcast(new SerializableOutFunc());
-
- Assert.AreEqual(3, res.Count);
-
- foreach (int r in res)
- Assert.AreEqual(10, r);
- }
-
- [Test]
- public void TestFuncResultPrimitive1()
- {
- ICollection<int> res = Grid1.GetCompute().Broadcast(new PortableFunc(), 10);
-
- Assert.AreEqual(3, res.Count);
-
- foreach (int r in res)
- Assert.AreEqual(11, r);
- }
-
- [Test]
- public void TestFuncResultPrimitive2()
- {
- ICollection<int> res = Grid1.GetCompute().Broadcast(new SerializableFunc(), 10);
-
- Assert.AreEqual(3, res.Count);
-
- foreach (int r in res)
- Assert.AreEqual(11, r);
- }
-
- interface IUserInterface<in T, out TR>
- {
- TR Invoke(T arg);
- }
-
- /// <summary>
- /// Test function.
- /// </summary>
- public class PortableFunc : IComputeFunc<int, int>, IUserInterface<int, int>
- {
- int IComputeFunc<int, int>.Invoke(int arg)
- {
- return arg + 1;
- }
-
- int IUserInterface<int, int>.Invoke(int arg)
- {
- // Same signature as IComputeFunc<int, int>, but from different interface
- throw new Exception("Invalid method");
- }
-
- public int Invoke(int arg)
- {
- // Same signature as IComputeFunc<int, int>,
- // but due to explicit interface implementation this is a wrong method
- throw new Exception("Invalid method");
- }
- }
-
- /// <summary>
- /// Test function.
- /// </summary>
- [Serializable]
- public class SerializableFunc : IComputeFunc<int, int>
- {
- public int Invoke(int arg)
- {
- return arg + 1;
- }
- }
-
- /// <summary>
- /// Test function.
- /// </summary>
- public class PortableOutFunc : IComputeFunc<int>
- {
- public int Invoke()
- {
- return 10;
- }
- }
-
- /// <summary>
- /// Test function.
- /// </summary>
- [Serializable]
- public class SerializableOutFunc : IComputeFunc<int>
- {
- public int Invoke()
- {
- return 10;
- }
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- public class TestTask<T> : ComputeTaskAdapter<Tuple<bool, T>, T, T>
- {
- /** <inheritDoc /> */
- override public IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, Tuple<bool, T> arg)
- {
- _gridName = null;
-
- Assert.AreEqual(3, subgrid.Count);
-
- bool local = arg.Item1;
- T res = arg.Item2;
-
- var jobs = new Dictionary<IComputeJob<T>, IClusterNode>();
-
- IComputeJob<T> job;
-
- if (res is PortableResult)
- {
- TestPortableJob job0 = new TestPortableJob();
-
- job0.SetArguments(res);
-
- job = (IComputeJob<T>) job0;
- }
- else
- {
- TestJob<T> job0 = new TestJob<T>();
-
- job0.SetArguments(res);
-
- job = job0;
- }
-
- foreach (IClusterNode node in subgrid)
- {
- bool add = local ? node.IsLocal : !node.IsLocal;
-
- if (add)
- {
- jobs.Add(job, node);
-
- break;
- }
- }
-
- Assert.AreEqual(1, jobs.Count);
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- override public T Reduce(IList<IComputeJobResult<T>> results)
- {
- Assert.AreEqual(1, results.Count);
-
- var res = results[0];
-
- Assert.IsNull(res.Exception());
-
- Assert.IsFalse(res.Cancelled);
-
- Assert.IsNotNull(_gridName);
-
- Assert.AreEqual(GridId(_gridName), res.NodeId);
-
- var job = res.Job();
-
- Assert.IsNotNull(job);
-
- return res.Data();
- }
- }
-
- private static Guid GridId(string gridName)
- {
- if (gridName.Equals(Grid1Name))
- return Ignition.GetIgnite(Grid1Name).GetCluster().GetLocalNode().Id;
- if (gridName.Equals(Grid2Name))
- return Ignition.GetIgnite(Grid2Name).GetCluster().GetLocalNode().Id;
- if (gridName.Equals(Grid3Name))
- return Ignition.GetIgnite(Grid3Name).GetCluster().GetLocalNode().Id;
-
- Assert.Fail("Failed to find grid " + gridName);
-
- return new Guid();
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableResult
- {
- /** */
- public int Val;
-
- public PortableResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- class SerializableResult
- {
- /** */
- public int Val;
-
- public SerializableResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- class TestJob<T> : ComputeJobAdapter<T>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- override public T Execute()
- {
- Assert.IsNotNull(_grid);
-
- _gridName = _grid.Name;
-
- T res = Argument<T>(0);
-
- return res;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class TestPortableJob : ComputeJobAdapter<PortableResult>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- override public PortableResult Execute()
- {
- Assert.IsNotNull(_grid);
-
- _gridName = _grid.Name;
-
- PortableResult res = Argument<PortableResult>(0);
-
- return res;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test
deleted file mode 100644
index 2bda365..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Apache.Ignite.exe.config.test
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<!--
- 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.
--->
-
-<configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
- </startup>
-
- <runtime>
- <gcServer enabled="true" />
- </runtime>
-
- <appSettings>
- <add key="Ignite.SpringConfigUrl" value="config\compute\compute-standalone.xml" />
- <add key="Ignite.Assembly.1" value="test-1.dll" />
- <add key="Ignite.Assembly.2" value="test-2.dll" />
- <add key="Ignite.JvmOption.1" value="-DOPT1" />
- <add key="Ignite.JvmOption.2" value="-DOPT2" />
- <add key="Ignite.JvmOption.3" value="-Xms601m" />
- <add key="Ignite.JvmOption.4" value="-Xmx702m" />
- <add key="Ignite.JvmInitialMemoryMB" value="601" />
- <add key="Ignite.JvmMaxMemoryMB" value="702" />
- </appSettings>
-
-</configuration>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Store/cache-store-session.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Store/cache-store-session.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Store/cache-store-session.xml
deleted file mode 100644
index 00837a9..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Cache/Store/cache-store-session.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="storeFactory" class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheStoreSessionTest+Store"/>
- </bean>
-
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache1"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
-
- <property name="cacheStoreFactory" ref="storeFactory" />
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache2"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeThrough" value="true"/>
- <property name="readThrough" value="true"/>
-
- <property name="cacheStoreFactory" ref="storeFactory" />
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
deleted file mode 100644
index 183676b..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid1.xml
+++ /dev/null
@@ -1,90 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid1"/>
-
- <property name="metricsUpdateFrequency" value="1000"/>
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="userAttributes">
- <map>
- <entry key="my_attr" value="value1"/>
- </map>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="startSize" value="10"/>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache1"/>
- <property name="startSize" value="10"/>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache2"/>
- <property name="startSize" value="10"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <!-- Portable marshaller configuration -->
- <property name="marshaller">
- <bean class="org.apache.ignite.marshaller.portable.PortableMarshaller">
- <property name="typeConfigurations">
- <list>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
- <property name="className" value="org.apache.ignite.platform.PlatformComputePortable"/>
- </bean>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
- <property name="className" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
- </bean>
- <bean class="org.apache.ignite.portable.PortableTypeConfiguration">
- <property name="className" value="org.apache.ignite.platform.PlatformComputeEnum"/>
- </bean>
- </list>
- </property>
- </bean>
- </property>
-
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
deleted file mode 100644
index 434f468..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid2.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid2"/>
-
- <property name="metricsUpdateFrequency" value="1000"/>
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="userAttributes">
- <map>
- <entry key="my_attr" value="value2"/>
- </map>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache1"/>
- <property name="startSize" value="10"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid3.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid3.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid3.xml
deleted file mode 100644
index 31ccdf0..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-grid3.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="clientMode" value="true"/>
-
- <property name="gridName" value="grid3"/>
-
- <property name="metricsUpdateFrequency" value="1000"/>
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="forceServerMode" value="true"/>
-
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
deleted file mode 100644
index bd34958..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Compute/compute-standalone.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="metricsLogFrequency" value="0"/>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration" />
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache1"/>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache2"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfiguration</value>
- <value>Apache.Ignite.Core.Tests.ExecutableTest+RemoteConfigurationClosure</value>
- <value>Apache.Ignite.Core.Tests.Compute.TaskAdapterTest+PortableJob</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableOutFunc</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableFunc</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableResult</value>
- <value>Apache.Ignite.Core.Tests.Compute.PortableClosureTaskTest+PortableException</value>
- </list>
- </property>
- <property name="typesConfiguration">
- <list>
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableTypeConfiguration">
- <property name="typeName" value="org.apache.ignite.platform.PlatformComputePortable"/>
- </bean>
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableTypeConfiguration">
- <property name="typeName" value="org.apache.ignite.platform.PlatformComputeJavaPortable"/>
- </bean>
- </list>
- </property>
- </bean>
- </property>
- </bean>
-
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-client.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-client.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-client.xml
deleted file mode 100644
index 8f8893f..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-client.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="clientMode" value="true"/>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="forceServerMode" value="true"/>
-
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data-no-cfg.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data-no-cfg.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data-no-cfg.xml
deleted file mode 100644
index 83c6642..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data-no-cfg.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
deleted file mode 100644
index dbbae90..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Dynamic/dynamic-data.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="p"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="startSize" value="10"/>
- </bean>
-
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="pa"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="startSize" value="10"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-beans.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-beans.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-beans.xml
deleted file mode 100644
index da36032..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-beans.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid"/>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="lifecycleBeans">
- <list>
- <bean class="org.apache.ignite.platform.lifecycle.PlatformJavaLifecycleBean" />
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean">
- <property name="className" value="Apache.Ignite.Core.Tests.Bean" />
- </bean>
- <bean class="org.apache.ignite.platform.lifecycle.PlatformJavaLifecycleBean" />
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetLifecycleBean">
- <property name="className" value="Apache.Ignite.Core.Tests.Bean" />
- <property name="properties">
- <map>
- <entry key="Property1">
- <value type="java.lang.Integer">1</value>
- </entry>
- <entry key="Property2" value="1"/>
- </map>
- </property>
- </bean>
- <bean class="org.apache.ignite.platform.lifecycle.PlatformJavaLifecycleBean" />
- </list>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-no-beans.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-no-beans.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-no-beans.xml
deleted file mode 100644
index 4063e6e..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/Lifecycle/lifecycle-no-beans.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="gridName" value="grid"/>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
deleted file mode 100644
index 84f9e5a..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-portables.xml
+++ /dev/null
@@ -1,78 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Type]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Collections.Generic.List[System.Tuple[System.Int64,System.String]]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,Apache.Ignite.Core.Tests.TestGenericPortable[System.String]]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,System.Type]</value>
- <value>Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,Apache.Ignite.Core.Tests.TestGenericPortable[System.Int64,System.String,System.Type]]</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration" />
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
deleted file mode 100644
index 7f9ce40..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query-continuous.xml
+++ /dev/null
@@ -1,171 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="transactional_no_backup"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="backups" value="0"/>
- <property name="startSize" value="10"/>
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
- <property name="ascendingFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>val</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="transactional_backup"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="backups" value="1"/>
- <property name="startSize" value="10"/>
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
- <property name="ascendingFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>val</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="atomic_no_backup"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="backups" value="0"/>
- <property name="startSize" value="10"/>
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
- <property name="ascendingFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>val</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="atomic_backup"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="ATOMIC"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
- <property name="backups" value="1"/>
- <property name="startSize" value="10"/>
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="PortableEntry"/>
- <property name="ascendingFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="val" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>val</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
deleted file mode 100644
index 787a921..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/cache-query.xml
+++ /dev/null
@@ -1,100 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="types">
- <list>
- <value>Apache.Ignite.Core.Tests.Cache.Query.QueryPerson</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="cache"/>
- <property name="cacheMode" value="PARTITIONED"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="writeSynchronizationMode" value="FULL_SYNC"/>
-
- <property name="typeMetadata">
- <list>
- <bean class="org.apache.ignite.cache.CacheTypeMetadata">
- <property name="valueType" value="QueryPerson"/>
- <property name="ascendingFields">
- <map>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="queryFields">
- <map>
- <entry key="name" value="java.lang.String"/>
- <entry key="age" value="java.lang.Integer"/>
- </map>
- </property>
- <property name="textFields">
- <list>
- <value>name</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-default.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-default.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-default.xml
deleted file mode 100644
index 753fad1..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-default.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-invalid.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-invalid.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-invalid.xml
deleted file mode 100644
index 188781d..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-invalid.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="marshaller">
- <bean class="org.apache.ignite.marshaller.optimized.OptimizedMarshaller" />
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
deleted file mode 100644
index 753fad1..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/marshaller-portable.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47502</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
deleted file mode 100644
index f08018d..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-affinity.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
-
- <property name="connectorConfiguration"><null/></property>
-
- <property name="platformConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetConfiguration">
- <property name="portableConfiguration">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableConfiguration">
- <property name="typesConfiguration">
- <list>
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetPortableTypeConfiguration">
- <property name="typeName"
- value="Apache.Ignite.Core.Tests.Cache.CacheAffinityTest+AffinityTestKey"/>
- <property name="affinityKeyFieldName" value="_affKey"/>
- </bean>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="cacheMode" value="PARTITIONED"/>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
deleted file mode 100644
index 00e8e45..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Config/native-client-test-cache-parallel-store.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- 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.
--->
-
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans.xsd
- http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util.xsd">
- <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
- <property name="localHost" value="127.0.0.1"/>
- <property name="connectorConfiguration"><null/></property>
-
- <property name="includeEventTypes">
- <util:constant static-field="org.apache.ignite.events.EventType.EVTS_CACHE"/>
- </property>
-
- <property name="cacheConfiguration">
- <list>
- <bean class="org.apache.ignite.configuration.CacheConfiguration">
- <property name="name" value="object_store_parallel"/>
- <property name="cacheMode" value="LOCAL"/>
- <property name="atomicityMode" value="TRANSACTIONAL"/>
- <property name="keepPortableInStore" value="false"/>
-
- <property name="cacheStoreFactory">
- <bean class="org.apache.ignite.platform.dotnet.PlatformDotNetCacheStoreFactory">
- <property name="assemblyName" value="Apache.Ignite.Core.Tests"/>
- <property name="className" value="Apache.Ignite.Core.Tests.Cache.Store.CacheTestParallelLoadStore"/>
- </bean>
- </property>
- </bean>
- </list>
- </property>
-
- <property name="discoverySpi">
- <bean class="org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi">
- <property name="ipFinder">
- <bean class="org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder">
- <property name="addresses">
- <list>
- <!-- In distributed environment, replace with actual host IP address. -->
- <value>127.0.0.1:47500..47501</value>
- </list>
- </property>
- </bean>
- </property>
- </bean>
- </property>
- </bean>
-</beans>
[32/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
deleted file mode 100644
index 7338eab..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryReadEvent.cs
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Cache query read event.
- /// </summary>
- public sealed class CacheQueryReadEvent : EventBase
- {
- /** */
- private readonly string _queryType;
-
- /** */
- private readonly string _cacheName;
-
- /** */
- private readonly string _className;
-
- /** */
- private readonly string _clause;
-
- /** */
- private readonly Guid _subjectId;
-
- /** */
- private readonly string _taskName;
-
- /** */
- private readonly object _key;
-
- /** */
- private readonly object _value;
-
- /** */
- private readonly object _oldValue;
-
- /** */
- private readonly object _row;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal CacheQueryReadEvent(IPortableRawReader r) : base(r)
- {
- _queryType = r.ReadString();
- _cacheName = r.ReadString();
- _className = r.ReadString();
- _clause = r.ReadString();
- _subjectId = r.ReadGuid() ?? Guid.Empty;
- _taskName = r.ReadString();
- _key = r.ReadObject<object>();
- _value = r.ReadObject<object>();
- _oldValue = r.ReadObject<object>();
- _row = r.ReadObject<object>();
- }
-
- /// <summary>
- /// Gets query type.
- /// </summary>
- public string QueryType { get { return _queryType; } }
-
- /// <summary>
- /// Gets cache name on which query was executed.
- /// </summary>
- public string CacheName { get { return _cacheName; } }
-
- /// <summary>
- /// Gets queried class name. Applicable for SQL and full text queries.
- /// </summary>
- public string ClassName { get { return _className; } }
-
- /// <summary>
- /// Gets query clause. Applicable for SQL, SQL fields and full text queries.
- /// </summary>
- public string Clause { get { return _clause; } }
-
- /// <summary>
- /// Gets security subject ID.
- /// </summary>
- public Guid SubjectId { get { return _subjectId; } }
-
- /// <summary>
- /// Gets the name of the task that executed the query (if any).
- /// </summary>
- public string TaskName { get { return _taskName; } }
-
- /// <summary>
- /// Gets read entry key.
- /// </summary>
- public object Key { get { return _key; } }
-
- /// <summary>
- /// Gets read entry value.
- /// </summary>
- public object Value { get { return _value; } }
-
- /// <summary>
- /// Gets read entry old value (applicable for continuous queries).
- /// </summary>
- public object OldValue { get { return _oldValue; } }
-
- /// <summary>
- /// Gets read results set row.
- /// </summary>
- public object Row { get { return _row; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: QueryType={1}, CacheName={2}, ClassName={3}, Clause={4}, SubjectId={5}, " +
- "TaskName={6}, Key={7}, Value={8}, OldValue={9}, Row={10}", Name, QueryType,
- CacheName, ClassName, Clause, SubjectId, TaskName, Key, Value, OldValue, Row);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
deleted file mode 100644
index 656550a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheRebalancingEvent.cs
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// In-memory database (cache) rebalancing event. Rebalance event happens every time there is a change
- /// </summary>
- public sealed class CacheRebalancingEvent : EventBase
- {
- /** */
- private readonly string _cacheName;
-
- /** */
- private readonly int _partition;
-
- /** */
- private readonly IClusterNode _discoveryNode;
-
- /** */
- private readonly int _discoveryEventType;
-
- /** */
- private readonly string _discoveryEventName;
-
- /** */
- private readonly long _discoveryTimestamp;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal CacheRebalancingEvent(IPortableRawReader r) : base(r)
- {
- _cacheName = r.ReadString();
- _partition = r.ReadInt();
- _discoveryNode = ReadNode(r);
- _discoveryEventType = r.ReadInt();
- _discoveryEventName = r.ReadString();
- _discoveryTimestamp = r.ReadLong();
- }
-
- /// <summary>
- /// Gets cache name.
- /// </summary>
- public string CacheName { get { return _cacheName; } }
-
- /// <summary>
- /// Gets partition for the event.
- /// </summary>
- public int Partition { get { return _partition; } }
-
- /// <summary>
- /// Gets shadow of the node that triggered this rebalancing event.
- /// </summary>
- public IClusterNode DiscoveryNode { get { return _discoveryNode; } }
-
- /// <summary>
- /// Gets type of discovery event that triggered this rebalancing event.
- /// </summary>
- public int DiscoveryEventType { get { return _discoveryEventType; } }
-
- /// <summary>
- /// Gets name of discovery event that triggered this rebalancing event.
- /// </summary>
- public string DiscoveryEventName { get { return _discoveryEventName; } }
-
- /// <summary>
- /// Gets timestamp of discovery event that caused this rebalancing event.
- /// </summary>
- public long DiscoveryTimestamp { get { return _discoveryTimestamp; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: CacheName={1}, Partition={2}, DiscoveryNode={3}, DiscoveryEventType={4}, " +
- "DiscoveryEventName={5}, DiscoveryTimestamp={6}", Name, CacheName, Partition,
- DiscoveryNode, DiscoveryEventType, DiscoveryEventName, DiscoveryTimestamp);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
deleted file mode 100644
index 7b7ea59..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CheckpointEvent.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Grid checkpoint event.
- /// </summary>
- public sealed class CheckpointEvent : EventBase
- {
- /** */
- private readonly string _key;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal CheckpointEvent(IPortableRawReader r) : base(r)
- {
- _key = r.ReadString();
- }
-
- /// <summary>
- /// Gets checkpoint key associated with this event.
- /// </summary>
- public string Key { get { return _key; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: Key={1}", Name, Key);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
deleted file mode 100644
index 5b5443c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/DiscoveryEvent.cs
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Grid discovery event.
- /// </summary>
- public sealed class DiscoveryEvent : EventBase
- {
- /** */
- private readonly IClusterNode _eventNode;
-
- /** */
- private readonly long _topologyVersion;
-
- /** */
- private readonly ReadOnlyCollection<IClusterNode> _topologyNodes;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal DiscoveryEvent(IPortableRawReader r) : base(r)
- {
- _eventNode = ReadNode(r);
- _topologyVersion = r.ReadLong();
-
- var nodes = IgniteUtils.ReadNodes(r);
-
- _topologyNodes = nodes == null ? null : new ReadOnlyCollection<IClusterNode>(nodes);
- }
-
- /// <summary>
- /// Gets node that caused this event to be generated. It is potentially different from the node on which this
- /// event was recorded. For example, node A locally recorded the event that a remote node B joined the topology.
- /// In this case this method will return ID of B.
- /// </summary>
- public IClusterNode EventNode { get { return _eventNode; } }
-
- /// <summary>
- /// Gets topology version if this event is raised on topology change and configured discovery
- /// SPI implementation supports topology versioning.
- /// </summary>
- public long TopologyVersion { get { return _topologyVersion; } }
-
- /// <summary>
- /// Gets topology nodes from topology snapshot. If SPI implementation does not support versioning, the best
- /// effort snapshot will be captured.
- /// </summary>
- public ICollection<IClusterNode> TopologyNodes { get { return _topologyNodes; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: EventNode={1}, TopologyVersion={2}, TopologyNodes={3}", Name, EventNode,
- TopologyVersion, TopologyNodes.Count);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs
deleted file mode 100644
index 2b905a1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventBase.cs
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Base event implementation.
- /// </summary>
- public abstract class EventBase : IEvent, IEquatable<EventBase>
- {
- /** */
- private readonly IgniteGuid _id;
-
- /** */
- private readonly long _localOrder;
-
- /** */
- private readonly IClusterNode _node;
-
- /** */
- private readonly string _message;
-
- /** */
- private readonly int _type;
-
- /** */
- private readonly string _name;
-
- /** */
- private readonly DateTime _timeStamp;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="EventBase"/> class.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- protected EventBase(IPortableRawReader r)
- {
- _id = IgniteGuid.ReadPortable(r);
-
- _localOrder = r.ReadLong();
-
- _node = ReadNode(r);
-
- _message = r.ReadString();
- _type = r.ReadInt();
- _name = r.ReadString();
- _timeStamp = r.ReadDate() ?? DateTime.Now;
- }
-
- /** <inheritDoc /> */
- public IgniteGuid Id
- {
- get { return _id; }
- }
-
- /** <inheritDoc /> */
- public long LocalOrder
- {
- get { return _localOrder; }
- }
-
- /** <inheritDoc /> */
- public IClusterNode Node
- {
- get { return _node; }
- }
-
- /** <inheritDoc /> */
- public string Message
- {
- get { return _message; }
- }
-
- /** <inheritDoc /> */
- public int Type
- {
- get { return _type; }
- }
-
- /** <inheritDoc /> */
- public string Name
- {
- get { return _name; }
- }
-
- /** <inheritDoc /> */
- public DateTime TimeStamp
- {
- get { return _timeStamp; }
- }
-
- /** <inheritDoc /> */
- public virtual string ToShortString()
- {
- return ToString();
- }
-
- /** <inheritDoc /> */
- public bool Equals(EventBase other)
- {
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
-
- return _id.Equals(other._id);
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != GetType()) return false;
-
- return Equals((EventBase) obj);
- }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- return _id.GetHashCode();
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- return string.Format("CacheEntry [Name={0}, Type={1}, TimeStamp={2}, Message={3}]", Name, Type, TimeStamp,
- Message);
- }
-
- /// <summary>
- /// Reads a node from stream.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Node or null.</returns>
- protected static IClusterNode ReadNode(IPortableRawReader reader)
- {
- return ((PortableReaderImpl)reader).Marshaller.Ignite.GetNode(reader.ReadGuid());
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs
deleted file mode 100644
index aa9f538..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventReader.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Event reader.
- /// </summary>
- internal static class EventReader
- {
- /// <summary>
- /// Reads an event.
- /// </summary>
- /// <typeparam name="T">Type of the event</typeparam>
- /// <param name="reader">Reader.</param>
- /// <returns>Deserialized event.</returns>
- /// <exception cref="System.InvalidCastException">Incompatible event type.</exception>
- public static T Read<T>(IPortableReader reader) where T : IEvent
- {
- var r = reader.RawReader();
-
- var clsId = r.ReadInt();
-
- if (clsId == -1)
- return default(T);
-
- return (T) CreateInstance(clsId, r);
- }
-
- /// <summary>
- /// Creates an event instance by type id.
- /// </summary>
- /// <param name="clsId">Type id.</param>
- /// <param name="reader">Reader.</param>
- /// <returns>Created and deserialized instance.</returns>
- /// <exception cref="System.InvalidOperationException">Invalid event class id: + clsId</exception>
- private static IEvent CreateInstance(int clsId, IPortableRawReader reader)
- {
- switch (clsId)
- {
- case 2: return new CacheEvent(reader);
- case 3: return new CacheQueryExecutedEvent(reader);
- case 4: return new CacheQueryReadEvent(reader);
- case 5: return new CacheRebalancingEvent(reader);
- case 6: return new CheckpointEvent(reader);
- case 7: return new DiscoveryEvent(reader);
- case 8: return new JobEvent(reader);
- case 9: return new SwapSpaceEvent(reader);
- case 10: return new TaskEvent(reader);
- }
-
- throw new InvalidOperationException("Invalid event class id: " + clsId);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventType.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventType.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventType.cs
deleted file mode 100644
index 1e649bb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/EventType.cs
+++ /dev/null
@@ -1,514 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Reflection;
-
- /// <summary>
- /// Contains event type constants. The decision to use class and not enumeration is dictated
- /// by allowing users to create their own events and/or event types which would be impossible with enumerations.
- /// <para />
- /// Note that this interface defines not only individual type constants,
- /// but arrays of types as well to be conveniently used with <see cref="IEvents"/> methods.
- /// <para />
- /// NOTE: all types in range <b>from 1 to 1000 are reserved</b> for internal Ignite events
- /// and should not be used by user-defined events.
- /// </summary>
- public static class EventType
- {
- /// <summary>
- /// Built-in event type: checkpoint was saved.
- /// </summary>
- public static readonly int EvtCheckpointSaved = 1;
-
- /// <summary>
- /// Built-in event type: checkpoint was loaded.
- /// </summary>
- public static readonly int EvtCheckpointLoaded = 2;
-
- /// <summary>
- /// Built-in event type: checkpoint was removed. Reasons are: timeout expired, or or it was manually removed,
- /// or it was automatically removed by the task session.
- /// </summary>
- public static readonly int EvtCheckpointRemoved = 3;
-
- /// <summary>
- /// Built-in event type: node joined topology. New node has been discovered and joined grid topology. Note that
- /// even though a node has been discovered there could be a number of warnings in the log. In certain
- /// situations Ignite doesn't prevent a node from joining but prints warning messages into the log.
- /// </summary>
- public static readonly int EvtNodeJoined = 10;
-
- /// <summary>
- /// Built-in event type: node has normally left topology.
- /// </summary>
- public static readonly int EvtNodeLeft = 11;
-
- /// <summary>
- /// Built-in event type: node failed. Ignite detected that node has presumably crashed and is considered
- /// failed.
- /// </summary>
- public static readonly int EvtNodeFailed = 12;
-
- /// <summary>
- /// Built-in event type: node metrics updated. Generated when node's metrics are updated. In most cases this
- /// callback is invoked with every heartbeat received from a node (including local node).
- /// </summary>
- public static readonly int EvtNodeMetricsUpdated = 13;
-
- /// <summary>
- /// Built-in event type: local node segmented. Generated when node determines that it runs in invalid network
- /// segment.
- /// </summary>
- public static readonly int EvtNodeSegmented = 14;
-
- /// <summary>
- /// Built-in event type: client node disconnected.
- /// </summary>
- public static readonly int EvtClientNodeDisconnected = 16;
-
- /// <summary>
- /// Built-in event type: client node reconnected.
- /// </summary>
- public static readonly int EvtClientNodeReconnected = 17;
-
- /// <summary>
- /// Built-in event type: task started.
- /// </summary>
- public static readonly int EvtTaskStarted = 20;
-
- /// <summary>
- /// Built-in event type: task finished. Task got finished. This event is triggered every time a task finished
- /// without exception.
- /// </summary>
- public static readonly int EvtTaskFinished = 21;
-
- /// <summary>
- /// Built-in event type: task failed. Task failed. This event is triggered every time a task finished with an
- /// exception. Note that prior to this event, there could be other events recorded specific to the failure.
- /// </summary>
- public static readonly int EvtTaskFailed = 22;
-
- /// <summary>
- /// Built-in event type: task timed out.
- /// </summary>
- public static readonly int EvtTaskTimedout = 23;
-
- /// <summary>
- /// Built-in event type: task session attribute set.
- /// </summary>
- public static readonly int EvtTaskSessionAttrSet = 24;
-
- /// <summary>
- /// Built-in event type: task reduced.
- /// </summary>
- public static readonly int EvtTaskReduced = 25;
-
- /// <summary>
- /// Built-in event type: Ignite job was mapped in {@link org.apache.ignite.compute.ComputeTask#map(List, Object)}
- /// method.
- /// </summary>
- public static readonly int EvtJobMapped = 40;
-
- /// <summary>
- /// Built-in event type: Ignite job result was received by {@link
- /// org.apache.ignite.compute.ComputeTask#result(org.apache.ignite.compute.ComputeJobResult, List)} method.
- /// </summary>
- public static readonly int EvtJobResulted = 41;
-
- /// <summary>
- /// Built-in event type: Ignite job failed over.
- /// </summary>
- public static readonly int EvtJobFailedOver = 43;
-
- /// <summary>
- /// Built-in event type: Ignite job started.
- /// </summary>
- public static readonly int EvtJobStarted = 44;
-
- /// <summary>
- /// Built-in event type: Ignite job finished. Job has successfully completed and produced a result which from the
- /// user perspective can still be either negative or positive.
- /// </summary>
- public static readonly int EvtJobFinished = 45;
-
- /// <summary>
- /// Built-in event type: Ignite job timed out.
- /// </summary>
- public static readonly int EvtJobTimedout = 46;
-
- /// <summary>
- /// Built-in event type: Ignite job rejected during collision resolution.
- /// </summary>
- public static readonly int EvtJobRejected = 47;
-
- /// <summary>
- /// Built-in event type: Ignite job failed. Job has failed. This means that there was some error event during job
- /// execution and job did not produce a result.
- /// </summary>
- public static readonly int EvtJobFailed = 48;
-
- /// <summary>
- /// Built-in event type: Ignite job queued. Job arrived for execution and has been queued (added to passive queue
- /// during collision resolution).
- /// </summary>
- public static readonly int EvtJobQueued = 49;
-
- /// <summary>
- /// Built-in event type: Ignite job cancelled.
- /// </summary>
- public static readonly int EvtJobCancelled = 50;
-
- /// <summary>
- /// Built-in event type: entry created.
- /// </summary>
- public static readonly int EvtCacheEntryCreated = 60;
-
- /// <summary>
- /// Built-in event type: entry destroyed.
- /// </summary>
- public static readonly int EvtCacheEntryDestroyed = 61;
-
- /// <summary>
- /// Built-in event type: entry evicted.
- /// </summary>
- public static readonly int EvtCacheEntryEvicted = 62;
-
- /// <summary>
- /// Built-in event type: object put.
- /// </summary>
- public static readonly int EvtCacheObjectPut = 63;
-
- /// <summary>
- /// Built-in event type: object read.
- /// </summary>
- public static readonly int EvtCacheObjectRead = 64;
-
- /// <summary>
- /// Built-in event type: object removed.
- /// </summary>
- public static readonly int EvtCacheObjectRemoved = 65;
-
- /// <summary>
- /// Built-in event type: object locked.
- /// </summary>
- public static readonly int EvtCacheObjectLocked = 66;
-
- /// <summary>
- /// Built-in event type: object unlocked.
- /// </summary>
- public static readonly int EvtCacheObjectUnlocked = 67;
-
- /// <summary>
- /// Built-in event type: cache object swapped from swap storage.
- /// </summary>
- public static readonly int EvtCacheObjectSwapped = 68;
-
- /// <summary>
- /// Built-in event type: cache object unswapped from swap storage.
- /// </summary>
- public static readonly int EvtCacheObjectUnswapped = 69;
-
- /// <summary>
- /// Built-in event type: cache object was expired when reading it.
- /// </summary>
- public static readonly int EvtCacheObjectExpired = 70;
-
- /// <summary>
- /// Built-in event type: swap space data read.
- /// </summary>
- public static readonly int EvtSwapSpaceDataRead = 71;
-
- /// <summary>
- /// Built-in event type: swap space data stored.
- /// </summary>
- public static readonly int EvtSwapSpaceDataStored = 72;
-
- /// <summary>
- /// Built-in event type: swap space data removed.
- /// </summary>
- public static readonly int EvtSwapSpaceDataRemoved = 73;
-
- /// <summary>
- /// Built-in event type: swap space cleared.
- /// </summary>
- public static readonly int EvtSwapSpaceCleared = 74;
-
- /// <summary>
- /// Built-in event type: swap space data evicted.
- /// </summary>
- public static readonly int EvtSwapSpaceDataEvicted = 75;
-
- /// <summary>
- /// Built-in event type: cache object stored in off-heap storage.
- /// </summary>
- public static readonly int EvtCacheObjectToOffheap = 76;
-
- /// <summary>
- /// Built-in event type: cache object moved from off-heap storage back into memory.
- /// </summary>
- public static readonly int EvtCacheObjectFromOffheap = 77;
-
- /// <summary>
- /// Built-in event type: cache rebalance started.
- /// </summary>
- public static readonly int EvtCacheRebalanceStarted = 80;
-
- /// <summary>
- /// Built-in event type: cache rebalance stopped.
- /// </summary>
- public static readonly int EvtCacheRebalanceStopped = 81;
-
- /// <summary>
- /// Built-in event type: cache partition loaded.
- /// </summary>
- public static readonly int EvtCacheRebalancePartLoaded = 82;
-
- /// <summary>
- /// Built-in event type: cache partition unloaded.
- /// </summary>
- public static readonly int EvtCacheRebalancePartUnloaded = 83;
-
- /// <summary>
- /// Built-in event type: cache entry rebalanced.
- /// </summary>
- public static readonly int EvtCacheRebalanceObjectLoaded = 84;
-
- /// <summary>
- /// Built-in event type: cache entry unloaded.
- /// </summary>
- public static readonly int EvtCacheRebalanceObjectUnloaded = 85;
-
- /// <summary>
- /// Built-in event type: all nodes that hold partition left topology.
- /// </summary>
- public static readonly int EvtCacheRebalancePartDataLost = 86;
-
- /// <summary>
- /// Built-in event type: query executed.
- /// </summary>
- public static readonly int EvtCacheQueryExecuted = 96;
-
- /// <summary>
- /// Built-in event type: query entry read.
- /// </summary>
- public static readonly int EvtCacheQueryObjectRead = 97;
-
- /// <summary>
- /// Built-in event type: cache started.
- /// </summary>
- public static readonly int EvtCacheStarted = 98;
-
- /// <summary>
- /// Built-in event type: cache started.
- /// </summary>
- public static readonly int EvtCacheStopped = 99;
-
- /// <summary>
- /// Built-in event type: cache nodes left.
- /// </summary>
- public static readonly int EvtCacheNodesLeft = 100;
-
- /// <summary>
- /// All events indicating an error or failure condition. It is convenient to use when fetching all events
- /// indicating error or failure.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsError =
- {
- EvtJobTimedout,
- EvtJobFailed,
- EvtJobFailedOver,
- EvtJobRejected,
- EvtJobCancelled,
- EvtTaskTimedout,
- EvtTaskFailed,
- EvtCacheRebalanceStarted,
- EvtCacheRebalanceStopped
- };
-
- /// <summary>
- /// All discovery events except for <see cref="EvtNodeMetricsUpdated" />. Subscription to <see
- /// cref="EvtNodeMetricsUpdated" /> can generate massive amount of event processing in most cases is not
- /// necessary. If this event is indeed required you can subscribe to it individually or use <see
- /// cref="EvtsDiscoveryAll" /> array.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsDiscovery =
- {
- EvtNodeJoined,
- EvtNodeLeft,
- EvtNodeFailed,
- EvtNodeSegmented,
- EvtClientNodeDisconnected,
- EvtClientNodeReconnected
- };
-
- /// <summary>
- /// All discovery events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsDiscoveryAll =
- {
- EvtNodeJoined,
- EvtNodeLeft,
- EvtNodeFailed,
- EvtNodeSegmented,
- EvtNodeMetricsUpdated,
- EvtClientNodeDisconnected,
- EvtClientNodeReconnected
- };
-
- /// <summary>
- /// All Ignite job execution events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsJobExecution =
- {
- EvtJobMapped,
- EvtJobResulted,
- EvtJobFailedOver,
- EvtJobStarted,
- EvtJobFinished,
- EvtJobTimedout,
- EvtJobRejected,
- EvtJobFailed,
- EvtJobQueued,
- EvtJobCancelled
- };
-
- /// <summary>
- /// All Ignite task execution events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsTaskExecution =
- {
- EvtTaskStarted,
- EvtTaskFinished,
- EvtTaskFailed,
- EvtTaskTimedout,
- EvtTaskSessionAttrSet,
- EvtTaskReduced
- };
-
- /// <summary>
- /// All cache events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsCache =
- {
- EvtCacheEntryCreated,
- EvtCacheEntryDestroyed,
- EvtCacheObjectPut,
- EvtCacheObjectRead,
- EvtCacheObjectRemoved,
- EvtCacheObjectLocked,
- EvtCacheObjectUnlocked,
- EvtCacheObjectSwapped,
- EvtCacheObjectUnswapped,
- EvtCacheObjectExpired
- };
-
- /// <summary>
- /// All cache rebalance events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsCacheRebalance =
- {
- EvtCacheRebalanceStarted,
- EvtCacheRebalanceStopped,
- EvtCacheRebalancePartLoaded,
- EvtCacheRebalancePartUnloaded,
- EvtCacheRebalanceObjectLoaded,
- EvtCacheRebalanceObjectUnloaded,
- EvtCacheRebalancePartDataLost
- };
-
- /// <summary>
- /// All cache lifecycle events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsCacheLifecycle =
- {
- EvtCacheStarted,
- EvtCacheStopped,
- EvtCacheNodesLeft
- };
-
- /// <summary>
- /// All cache query events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsCacheQuery =
- {
- EvtCacheQueryExecuted,
- EvtCacheQueryObjectRead
- };
-
- /// <summary>
- /// All swap space events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsSwapspace =
- {
- EvtSwapSpaceCleared,
- EvtSwapSpaceDataRemoved,
- EvtSwapSpaceDataRead,
- EvtSwapSpaceDataStored,
- EvtSwapSpaceDataEvicted
- };
-
- /// <summary>
- /// All Ignite events.
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsAll = GetAllEvents();
-
- /// <summary>
- /// All Ignite events (<b>excluding</b> metric update event).
- /// </summary>
- [SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly",
- Justification = "Breaking change. Should be fixed in the next non-compatible release.")]
- public static readonly int[] EvtsAllMinusMetricUpdate =
- EvtsAll.Where(x => x != EvtNodeMetricsUpdated).ToArray();
-
- /// <summary>
- /// Gets all the events.
- /// </summary>
- /// <returns>All event ids.</returns>
- private static int[] GetAllEvents()
- {
- return typeof (EventType).GetFields(BindingFlags.Public | BindingFlags.Static)
- .Where(x => x.FieldType == typeof (int))
- .Select(x => (int) x.GetValue(null)).ToArray();
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvent.cs
deleted file mode 100644
index 181aeef..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvent.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Represents a Ignite event.
- /// </summary>
- public interface IEvent
- {
- /// <summary>
- /// Gets globally unique ID of this event.
- /// </summary>
- IgniteGuid Id { get; }
-
- /// <summary>
- /// Gets locally unique ID that is atomically incremented for each event. Unlike global <see cref="Id" />
- /// this local ID can be used for ordering events on this node.
- /// <para/>
- /// Note that for performance considerations Ignite doesn't order events globally.
- /// </summary>
- long LocalOrder { get; }
-
- /// <summary>
- /// Node where event occurred and was recorded.
- /// </summary>
- IClusterNode Node { get; }
-
- /// <summary>
- /// Gets optional message for this event.
- /// </summary>
- string Message { get; }
-
- /// <summary>
- /// Gets type of this event. All system event types are defined in <see cref="EventType"/>
- /// </summary>
- int Type { get; }
-
- /// <summary>
- /// Gets name of this event.
- /// </summary>
- string Name { get; }
-
- /// <summary>
- /// Gets event timestamp. Timestamp is local to the node on which this event was produced.
- /// Note that more than one event can be generated with the same timestamp.
- /// For ordering purposes use <see cref="LocalOrder"/> instead.
- /// </summary>
- DateTime TimeStamp { get; }
-
- /// <summary>
- /// Gets shortened version of ToString result.
- /// </summary>
- string ToShortString();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs
deleted file mode 100644
index 7523c52..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEventFilter.cs
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
-
- /// <summary>
- /// Represents an event filter.
- /// </summary>
- /// <typeparam name="T">Event type.</typeparam>
- public interface IEventFilter<in T> where T : IEvent
- {
- /// <summary>
- /// Determines whether specified event passes this filtger.
- /// </summary>
- /// <param name="nodeId">Node identifier.</param>
- /// <param name="evt">Event.</param>
- /// <returns>Value indicating whether specified event passes this filtger.</returns>
- bool Invoke(Guid nodeId, T evt);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvents.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvents.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvents.cs
deleted file mode 100644
index e13513c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/IEvents.cs
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Provides functionality for local and remote event notifications on nodes defined by <see cref="ClusterGroup"/>.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IEvents : IAsyncSupport<IEvents>
- {
- /// <summary>
- /// Gets the cluster group to which this instance belongs.
- /// </summary>
- IClusterGroup ClusterGroup { get; }
-
- /// <summary>
- /// Queries nodes in this cluster group for events using passed in predicate filter for event selection.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="filter">Predicate filter used to query events on remote nodes.</param>
- /// <param name="timeout">Maximum time to wait for result, null or 0 to wait forever.</param>
- /// <param name="types">Event types to be queried.</param>
- /// <returns>Collection of Ignite events returned from specified nodes.</returns>
- [AsyncSupported]
- [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
- List<T> RemoteQuery<T>(IEventFilter<T> filter, TimeSpan? timeout = null, params int[] types)
- where T : IEvent;
-
- /// <summary>
- /// Adds event listener for specified events to all nodes in the cluster group (possibly including local node
- /// if it belongs to the cluster group as well). This means that all events occurring on any node within this
- /// cluster group that pass remote filter will be sent to local node for local listener notifications.
- /// <para/>
- /// The listener can be unsubscribed automatically if local node stops, if localListener callback
- /// returns false or if <see cref="StopRemoteListen"/> is called.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="bufSize">Remote events buffer size. Events from remote nodes won't be sent until buffer
- /// is full or time interval is exceeded.</param>
- /// <param name="interval">Maximum time interval after which events from remote node will be sent. Events
- /// from remote nodes won't be sent until buffer is full or time interval is exceeded.</param>
- /// <param name="autoUnsubscribe">Flag indicating that event listeners on remote nodes should be automatically
- /// unregistered if master node (node that initiated event listening) leaves topology.
- /// If this flag is false, listeners will be unregistered only when <see cref="StopRemoteListen"/>
- /// method is called, or the localListener returns false.</param>
- /// <param name="localListener"> Listener callback that is called on local node. If null, these events will
- /// be handled on remote nodes by passed in remoteFilter.</param>
- /// <param name="remoteFilter">
- /// Filter callback that is called on remote node. Only events that pass the remote filter will be
- /// sent to local node. If null, all events of specified types will be sent to local node.
- /// This remote filter can be used to pre-handle events remotely, before they are passed in to local callback.
- /// It will be auto-unsubscribed on the node where event occurred in case if it returns false.
- /// </param>
- /// <param name="types">
- /// Types of events to listen for. If not provided, all events that pass the provided remote filter
- /// will be sent to local node.
- /// </param>
- /// <returns>
- /// Operation ID that can be passed to <see cref="StopRemoteListen"/> method to stop listening.
- /// </returns>
- [AsyncSupported]
- Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true,
- IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types)
- where T : IEvent;
-
- /// <summary>
- /// Stops listening to remote events. This will unregister all listeners identified with provided operation ID
- /// on all nodes defined by <see cref="ClusterGroup"/>.
- /// </summary>
- /// <param name="opId">Operation ID that was returned from <see cref="RemoteListen{T}"/>.</param>
- [AsyncSupported]
- void StopRemoteListen(Guid opId);
-
- /// <summary>
- /// Waits for the specified events.
- /// </summary>
- /// <param name="types">Types of the events to wait for.
- /// If not provided, all events will be passed to the filter.</param>
- /// <returns>Ignite event.</returns>
- [AsyncSupported]
- IEvent WaitForLocal(params int[] types);
-
- /// <summary>
- /// Waits for the specified events.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="filter">Optional filtering predicate. Event wait will end as soon as it returns false.</param>
- /// <param name="types">Types of the events to wait for.
- /// If not provided, all events will be passed to the filter.</param>
- /// <returns>Ignite event.</returns>
- [AsyncSupported]
- T WaitForLocal<T>(IEventFilter<T> filter, params int[] types) where T : IEvent;
-
- /// <summary>
- /// Queries local node for events using of specified types.
- /// </summary>
- /// <param name="types">Event types to be queried. Optional.</param>
- /// <returns>Collection of Ignite events found on local node.</returns>
- [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
- List<IEvent> LocalQuery(params int[] types);
-
- /// <summary>
- /// Records customer user generated event. All registered local listeners will be notified.
- /// <para/>
- /// NOTE: all types in range <b>from 1 to 1000 are reserved</b> for
- /// internal Ignite events and should not be used by user-defined events.
- /// Attempt to record internal event with this method will cause <see cref="ArgumentException"/> to be thrown.
- /// </summary>
- /// <param name="evt">Locally generated event.</param>
- /// <exception cref="ArgumentException">If event type is within Ignite reserved range (1 � 1000)</exception>
- void RecordLocal(IEvent evt);
-
- /// <summary>
- /// Adds an event listener for local events. Note that listener will be added regardless of whether
- /// local node is in this cluster group or not.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="listener">Predicate that is called on each received event. If predicate returns false,
- /// it will be unregistered and will stop receiving events.</param>
- /// <param name="types">Event types for which this listener will be notified, should not be empty.</param>
- void LocalListen<T>(IEventFilter<T> listener, params int[] types) where T : IEvent;
-
- /// <summary>
- /// Removes local event listener.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="listener">Local event listener to remove.</param>
- /// <param name="types">Types of events for which to remove listener. If not specified, then listener
- /// will be removed for all types it was registered for.</param>
- /// <returns>True if listener was removed, false otherwise.</returns>
- bool StopLocalListen<T>(IEventFilter<T> listener, params int[] types) where T : IEvent;
-
- /// <summary>
- /// Enables provided events. Allows to start recording events that were disabled before.
- /// Note that provided events will be enabled regardless of whether local node is in this cluster group or not.
- /// </summary>
- /// <param name="types">Events to enable.</param>
- void EnableLocal(params int[] types);
-
- /// <summary>
- /// Disables provided events. Allows to stop recording events that were enabled before. Note that specified
- /// events will be disabled regardless of whether local node is in this cluster group or not.
- /// </summary>
- /// <param name="types">Events to disable.</param>
- void DisableLocal(params int[] types);
-
- /// <summary>
- /// Gets types of enabled events.
- /// </summary>
- /// <returns>Types of enabled events.</returns>
- int[] GetEnabledEvents();
-
- /// <summary>
- /// Determines whether the specified event is enabled.
- /// </summary>
- /// <param name="type">Event type.</param>
- /// <returns>Value indicating whether the specified event is enabled.</returns>
- bool IsEnabled(int type);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/JobEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
deleted file mode 100644
index 81d537f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/JobEvent.cs
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Ignite job event.
- /// </summary>
- public sealed class JobEvent : EventBase
- {
- /** */
- private readonly string _taskName;
-
- /** */
- private readonly string _taskClassName;
-
- /** */
- private readonly IgniteGuid _taskSessionId;
-
- /** */
- private readonly IgniteGuid _jobId;
-
- /** */
- private readonly IClusterNode _taskNode;
-
- /** */
- private readonly Guid _taskSubjectId;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal JobEvent(IPortableRawReader r) : base(r)
- {
- _taskName = r.ReadString();
- _taskClassName = r.ReadString();
- _taskSessionId = IgniteGuid.ReadPortable(r);
- _jobId = IgniteGuid.ReadPortable(r);
- _taskNode = ReadNode(r);
- _taskSubjectId = r.ReadGuid() ?? Guid.Empty;
- }
-
- /// <summary>
- /// Gets name of the task that triggered the event.
- /// </summary>
- public string TaskName { get { return _taskName; } }
-
- /// <summary>
- /// Gets name of task class that triggered this event.
- /// </summary>
- public string TaskClassName { get { return _taskClassName; } }
-
- /// <summary>
- /// Gets task session ID of the task that triggered this event.
- /// </summary>
- public IgniteGuid TaskSessionId { get { return _taskSessionId; } }
-
- /// <summary>
- /// Gets job ID.
- /// </summary>
- public IgniteGuid JobId { get { return _jobId; } }
-
- /// <summary>
- /// Get node where parent task of the job has originated.
- /// </summary>
- public IClusterNode TaskNode { get { return _taskNode; } }
-
- /// <summary>
- /// Gets task subject ID.
- /// </summary>
- public Guid TaskSubjectId { get { return _taskSubjectId; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: TaskName={1}, TaskClassName={2}, TaskSessionId={3}, JobId={4}, TaskNode={5}, " +
- "TaskSubjectId={6}", Name, TaskName, TaskClassName, TaskSessionId, JobId, TaskNode,
- TaskSubjectId);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/SwapSpaceEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/SwapSpaceEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/SwapSpaceEvent.cs
deleted file mode 100644
index 676c2e0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/SwapSpaceEvent.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Grid swap space event.
- /// </summary>
- public sealed class SwapSpaceEvent : EventBase
- {
- /** */
- private readonly string _space;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal SwapSpaceEvent(IPortableRawReader r) : base(r)
- {
- _space = r.ReadString();
- }
-
- /// <summary>
- /// Gets swap space name.
- /// </summary>
- public string Space { get { return _space; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: Space={1}", Name, Space);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
deleted file mode 100644
index 7149fb3..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/TaskEvent.cs
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Ignite task event.
- /// </summary>
- public sealed class TaskEvent : EventBase
- {
- /** */
- private readonly string _taskName;
-
- /** */
- private readonly string _taskClassName;
-
- /** */
- private readonly IgniteGuid _taskSessionId;
-
- /** */
- private readonly bool _internal;
-
- /** */
- private readonly Guid _subjectId;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal TaskEvent(IPortableRawReader r) : base(r)
- {
- _taskName = r.ReadString();
- _taskClassName = r.ReadString();
- _taskSessionId = IgniteGuid.ReadPortable(r);
- _internal = r.ReadBoolean();
- _subjectId = r.ReadGuid() ?? Guid.Empty;
- }
-
- /// <summary>
- /// Gets name of the task that triggered the event.
- /// </summary>
- public string TaskName { get { return _taskName; } }
-
- /// <summary>
- /// Gets name of task class that triggered this event.
- /// </summary>
- public string TaskClassName { get { return _taskClassName; } }
-
- /// <summary>
- /// Gets session ID of the task that triggered the event.
- /// </summary>
- public IgniteGuid TaskSessionId { get { return _taskSessionId; } }
-
- /// <summary>
- /// Returns true if task is created by Ignite and is used for system needs.
- /// </summary>
- public bool Internal { get { return _internal; } }
-
- /// <summary>
- /// Gets security subject ID initiated this task event, if available. This property is not available for
- /// <see cref="EventType.EvtTaskSessionAttrSet" /> task event.
- /// Subject ID will be set either to node ID or client ID initiated task execution.
- /// </summary>
- public Guid SubjectId { get { return _subjectId; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: TaskName={1}, TaskClassName={2}, TaskSessionId={3}, Internal={4}, " +
- "SubjectId={5}", Name, TaskName, TaskClassName, TaskSessionId, Internal, SubjectId);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/IIgnite.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/IIgnite.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/IIgnite.cs
deleted file mode 100644
index a9fae89..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/IIgnite.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core
-{
- using System;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Main entry point for all Ignite APIs.
- /// You can obtain an instance of <c>IGrid</c> through <see cref="Ignition.GetIgnite()"/>,
- /// or for named grids you can use <see cref="Ignition.GetIgnite(string)"/>. Note that you
- /// can have multiple instances of <c>IGrid</c> running in the same process by giving
- /// each instance a different name.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IIgnite : IDisposable
- {
- /// <summary>
- /// Gets the name of the grid this Ignite instance (and correspondingly its local node) belongs to.
- /// Note that single process can have multiple Ignite instances all belonging to different grids. Grid
- /// name allows to indicate to what grid this particular Ignite instance (i.e. Ignite runtime and its
- /// local node) belongs to.
- /// <p/>
- /// If default Ignite instance is used, then <c>null</c> is returned. Refer to <see cref="Ignition"/> documentation
- /// for information on how to start named grids.
- /// </summary>
- /// <returns>Name of the grid, or <c>null</c> for default grid.</returns>
- string Name { get; }
-
- /// <summary>
- /// Gets an instance of <see cref="ICluster" /> interface.
- /// </summary>
- ICluster GetCluster();
-
- /// <summary>
- /// Gets compute functionality over this grid projection. All operations
- /// on the returned ICompute instance will only include nodes from
- /// this projection.
- /// </summary>
- /// <returns>Compute instance over this grid projection.</returns>
- ICompute GetCompute();
-
- /// <summary>
- /// Gets the cache instance for the given name to work with keys and values of specified types.
- /// <para/>
- /// You can get instances of ICache of the same name, but with different key/value types.
- /// These will use the same named cache, but only allow working with entries of specified types.
- /// Attempt to retrieve an entry of incompatible type will result in <see cref="InvalidCastException"/>.
- /// Use <see cref="GetCache{TK,TV}"/> in order to work with entries of arbitrary types.
- /// </summary>
- /// <param name="name">Cache name.</param>
- /// <returns>Cache instance for given name.</returns>
- /// <typeparam name="TK">Cache key type.</typeparam>
- /// <typeparam name="TV">Cache value type.</typeparam>
- ICache<TK, TV> GetCache<TK, TV>(string name);
-
- /// <summary>
- /// Gets existing cache with the given name or creates new one using template configuration.
- /// </summary>
- /// <typeparam name="TK">Cache key type.</typeparam>
- /// <typeparam name="TV">Cache value type.</typeparam>
- /// <param name="name">Cache name.</param>
- /// <returns>Existing or newly created cache.</returns>
- ICache<TK, TV> GetOrCreateCache<TK, TV>(string name);
-
- /// <summary>
- /// Dynamically starts new cache using template configuration.
- /// </summary>
- /// <typeparam name="TK">Cache key type.</typeparam>
- /// <typeparam name="TV">Cache value type.</typeparam>
- /// <param name="name">Cache name.</param>
- /// <returns>Existing or newly created cache.</returns>
- ICache<TK, TV> CreateCache<TK, TV>(string name);
-
- /// <summary>
- /// Gets a new instance of data streamer associated with given cache name. Data streamer
- /// is responsible for loading external data into Ignite. For more information
- /// refer to <see cref="IDataStreamer{K,V}"/> documentation.
- /// </summary>
- /// <param name="cacheName">Cache name (<c>null</c> for default cache).</param>
- /// <returns>Data streamer.</returns>
- IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName);
-
- /// <summary>
- /// Gets an instance of <see cref="IPortables"/> interface.
- /// </summary>
- /// <returns>Instance of <see cref="IPortables"/> interface</returns>
- IPortables GetPortables();
-
- /// <summary>
- /// Gets affinity service to provide information about data partitioning and distribution.
- /// </summary>
- /// <param name="name">Cache name.</param>
- /// <returns>Cache data affinity service.</returns>
- ICacheAffinity GetAffinity(string name);
-
- /// <summary>
- /// Gets Ignite transactions facade.
- /// </summary>
- ITransactions GetTransactions();
-
- /// <summary>
- /// Gets messaging facade over all cluster nodes.
- /// </summary>
- /// <returns>Messaging instance over all cluster nodes.</returns>
- IMessaging GetMessaging();
-
- /// <summary>
- /// Gets events facade over all cluster nodes.
- /// </summary>
- /// <returns>Events facade over all cluster nodes.</returns>
- IEvents GetEvents();
-
- /// <summary>
- /// Gets services facade over all cluster nodes.
- /// </summary>
- /// <returns>Services facade over all cluster nodes.</returns>
- IServices GetServices();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
deleted file mode 100644
index 5a03e93..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/IgniteConfiguration.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core
-{
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Lifecycle;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Grid configuration.
- /// </summary>
- public class IgniteConfiguration
- {
- /// <summary>
- /// Default initial JVM memory in megabytes.
- /// </summary>
- public const int DefaultJvmInitMem = 512;
-
- /// <summary>
- /// Default maximum JVM memory in megabytes.
- /// </summary>
- public const int DefaultJvmMaxMem = 1024;
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public IgniteConfiguration()
- {
- JvmInitialMemoryMb = DefaultJvmInitMem;
- JvmMaxMemoryMb = DefaultJvmMaxMem;
- }
-
- /// <summary>
- /// Copying constructor.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- internal IgniteConfiguration(IgniteConfiguration cfg)
- {
- SpringConfigUrl = cfg.SpringConfigUrl;
- JvmDllPath = cfg.JvmDllPath;
- IgniteHome = cfg.IgniteHome;
- JvmClasspath = cfg.JvmClasspath;
- SuppressWarnings = cfg.SuppressWarnings;
-
- JvmOptions = cfg.JvmOptions != null ? new List<string>(cfg.JvmOptions) : null;
- Assemblies = cfg.Assemblies != null ? new List<string>(cfg.Assemblies) : null;
-
- PortableConfiguration = cfg.PortableConfiguration != null
- ? new PortableConfiguration(cfg.PortableConfiguration)
- : null;
-
- LifecycleBeans = cfg.LifecycleBeans != null ? new List<ILifecycleBean>(cfg.LifecycleBeans) : null;
-
- JvmInitialMemoryMb = cfg.JvmInitialMemoryMb;
- JvmMaxMemoryMb = cfg.JvmMaxMemoryMb;
- }
-
- /// <summary>
- /// Gets or sets the portable configuration.
- /// </summary>
- /// <value>
- /// The portable configuration.
- /// </value>
- public PortableConfiguration PortableConfiguration { get; set; }
-
- /// <summary>
- /// URL to Spring configuration file.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
- public string SpringConfigUrl { get; set; }
-
- /// <summary>
- /// Path jvm.dll file. If not set, it's location will be determined
- /// using JAVA_HOME environment variable.
- /// If path is neither set nor determined automatically, an exception
- /// will be thrown.
- /// </summary>
- public string JvmDllPath { get; set; }
-
- /// <summary>
- /// Path to Ignite home. If not set environment variable IGNITE_HOME will be used.
- /// </summary>
- public string IgniteHome { get; set; }
-
- /// <summary>
- /// Classpath used by JVM on Ignite start.
- /// </summary>
- public string JvmClasspath { get; set; }
-
- /// <summary>
- /// Collection of options passed to JVM on Ignite start.
- /// </summary>
- public ICollection<string> JvmOptions { get; set; }
-
- /// <summary>
- /// List of additional .Net assemblies to load on Ignite start. Each item can be either
- /// fully qualified assembly name, path to assembly to DLL or path to a directory when
- /// assemblies reside.
- /// </summary>
- public IList<string> Assemblies { get; set; }
-
- /// <summary>
- /// Whether to suppress warnings.
- /// </summary>
- public bool SuppressWarnings { get; set; }
-
- /// <summary>
- /// Lifecycle beans.
- /// </summary>
- public ICollection<ILifecycleBean> LifecycleBeans { get; set; }
-
- /// <summary>
- /// Initial amount of memory in megabytes given to JVM. Maps to -Xms Java option.
- /// Defaults to <see cref="DefaultJvmInitMem"/>.
- /// </summary>
- public int JvmInitialMemoryMb { get; set; }
-
- /// <summary>
- /// Maximum amount of memory in megabytes given to JVM. Maps to -Xmx Java option.
- /// Defaults to <see cref="DefaultJvmMaxMem"/>.
- /// </summary>
- public int JvmMaxMemoryMb { get; set; }
- }
-}
[33/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
deleted file mode 100644
index 6fa0808..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeJobResultPolicy.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// This enumeration provides different types of actions following the last received job result. See
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// for more details.
- /// </summary>
- public enum ComputeJobResultPolicy
- {
- /// <summary>
- /// Wait for results if any are still expected. If all results have been received -
- /// it will start reducing results.
- /// </summary>
- Wait = 0,
-
- /// <summary>
- /// Ignore all not yet received results and start reducing results.
- /// </summary>
- Reduce = 1,
-
- /// <summary>
- /// Fail-over job to execute on another node.
- /// </summary>
- Failover = 2
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
deleted file mode 100644
index 67f7432..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskAdapter.cs
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Convenience adapter for <see cref="IComputeTask{A,T,R}"/> interface
- /// </summary>
- public abstract class ComputeTaskAdapter<TA, T, TR> : IComputeTask<TA, T, TR>
- {
- /// <summary>
- /// Default implementation which will wait for all jobs to complete before
- /// calling <see cref="IComputeTask{A,T,R}.Reduce"/> method.
- /// <p/>
- /// If remote job resulted in exception <see cref="IComputeJobResult{T}.Exception()"/>
- /// is not <c>null</c>),
- /// then <see cref="ComputeJobResultPolicy.Failover"/> policy will be returned if
- /// the exception is instance of <see cref="ClusterTopologyException"/>
- /// or <see cref="ComputeExecutionRejectedException"/>, which means that
- /// remote node either failed or job execution was rejected before it got a chance to start. In all
- /// other cases the exception will be rethrown which will ultimately cause task to fail.
- /// </summary>
- /// <param name="res">Received remote Ignite executable result.</param>
- /// <param name="rcvd">All previously received results.</param>
- /// <returns>Result policy that dictates how to process further upcoming job results.</returns>
- public virtual ComputeJobResultPolicy Result(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd)
- {
- Exception err = res.Exception();
-
- if (err != null)
- {
- if (err is ComputeExecutionRejectedException || err is ClusterTopologyException ||
- err is ComputeJobFailoverException)
- return ComputeJobResultPolicy.Failover;
-
- throw new IgniteException("Remote job threw user exception (override or implement IComputeTask.result(..) " +
- "method if you would like to have automatic failover for this exception).", err);
- }
-
- return ComputeJobResultPolicy.Wait;
- }
-
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>
- /// Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.
- /// </returns>
- public abstract IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg);
-
- /// <summary>
- /// Reduces (or aggregates) results received so far into one compound result to be returned to
- /// caller via future.
- /// <para />
- /// Note, that if some jobs did not succeed and could not be failed over then the list of
- /// results passed into this method will include the failed results. Otherwise, failed
- /// results will not be in the list.
- /// </summary>
- /// <param name="results">Received job results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute" /> attribute, then this list will be empty.</param>
- /// <returns>
- /// Task result constructed from results of remote executions.
- /// </returns>
- public abstract TR Reduce(IList<IComputeJobResult<T>> results);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
deleted file mode 100644
index 460e9b0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskCancelledException.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This exception indicates that Ignite task was cancelled.
- /// </summary>
- [Serializable]
- public class ComputeTaskCancelledException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- public ComputeTaskCancelledException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeTaskCancelledException(string message)
- : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeTaskCancelledException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskCancelledException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeTaskCancelledException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
deleted file mode 100644
index a58aa87..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskNoResultCacheAttribute.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
-
- /// <summary>
- /// This attribute disables caching of task results when attached to <see cref="IComputeTask{A,T,R}"/>
- /// instance. Use it when number of jobs within task grows too big, or jobs themselves are too large
- /// to keep in memory throughout task execution. By default all results are cached and passed into
- /// <see cref="IComputeTask{A,T,R}.Result"/>
- /// and <see cref="IComputeTask{A,T,R}.Reduce"/> methods. When this
- /// attribute is attached to a task class, then this list of job results will always be empty.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
- public sealed class ComputeTaskNoResultCacheAttribute : Attribute
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
deleted file mode 100644
index bf4685a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskSplitAdapter.cs
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Compute;
-
- /// <summary>
- /// This class defines simplified adapter for <see cref="IComputeTask{A,T,R}"/>. This adapter can be used
- /// when jobs can be randomly assigned to available Ignite nodes. This adapter is sufficient
- /// in most homogeneous environments where all nodes are equally suitable for executing grid
- /// job, see <see cref="Split"/> method for more details.
- /// </summary>
- public abstract class ComputeTaskSplitAdapter<TA, T, TR> : ComputeTaskAdapter<TA, T, TR>
- {
- /** Random generator */
- [ThreadStatic]
- // ReSharper disable once StaticMemberInGenericType
- private static Random _rnd;
-
- /// <summary>
- /// This is a simplified version of <see cref="IComputeTask{A,T,R}.Map"/> method.
- /// <p/>
- /// This method basically takes given argument and splits it into a collection
- /// of <see cref="IComputeJob"/> using provided grid size as indication of how many node are
- /// available. These jobs will be randomly mapped to available Ignite nodes. Note that
- /// if number of jobs is greater than number of Ignite nodes (i.e, grid size), the grid
- /// nodes will be reused and some jobs will end up on the same Ignite nodes.
- /// </summary>
- /// <param name="gridSize">Number of available Ignite nodes. Note that returned number of jobs can be less,
- /// equal or greater than this grid size.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>.</param>
- protected abstract ICollection<IComputeJob<T>> Split(int gridSize, TA arg);
-
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>
- /// Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.
- /// </returns>
- /// <exception cref="IgniteException">Split returned no jobs.</exception>
- override public IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg)
- {
- Debug.Assert(subgrid != null && subgrid.Count > 0);
-
- var jobs = Split(subgrid.Count, arg);
-
- if (jobs == null || jobs.Count == 0)
- throw new IgniteException("Split returned no jobs.");
-
- var map = new Dictionary<IComputeJob<T>, IClusterNode>(jobs.Count);
-
- if (_rnd == null)
- _rnd = new Random();
-
- foreach (var job in jobs)
- {
- int idx = _rnd.Next(subgrid.Count);
-
- IClusterNode node = subgrid[idx];
-
- map[job] = node;
- }
-
- return map;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
deleted file mode 100644
index 71fc568..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeTaskTimeoutException.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Indicates that task execution timed out.
- /// </summary>
- [Serializable]
- public class ComputeTaskTimeoutException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- public ComputeTaskTimeoutException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeTaskTimeoutException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeTaskTimeoutException(SerializationInfo info, StreamingContext ctx) : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeTaskTimeoutException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeTaskTimeoutException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
deleted file mode 100644
index e3c090e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ComputeUserUndeclaredException.cs
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// This exception is thrown when user's code throws undeclared runtime exception. By user core it is
- /// assumed the code in Ignite task, Ignite job or SPI. In most cases it should be an indication of unrecoverable
- /// error condition such as assertion, out of memory error, etc.
- /// </summary>
- [Serializable]
- public class ComputeUserUndeclaredException : IgniteException
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- public ComputeUserUndeclaredException()
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="message">The message that describes the error.</param>
- public ComputeUserUndeclaredException(string message) : base(message)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="info">Serialization information.</param>
- /// <param name="ctx">Streaming context.</param>
- protected ComputeUserUndeclaredException(SerializationInfo info, StreamingContext ctx)
- : base(info, ctx)
- {
- // No-op.
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ComputeUserUndeclaredException"/> class.
- /// </summary>
- /// <param name="message">The message.</param>
- /// <param name="cause">The cause.</param>
- public ComputeUserUndeclaredException(string message, Exception cause) : base(message, cause)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs
deleted file mode 100644
index c124f84..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/ICompute.cs
+++ /dev/null
@@ -1,271 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Defines Ignite functionality for executing tasks and closures over nodes
- /// in the <see cref="IClusterGroup"/>. Instance of <see cref="ICompute"/>
- /// is obtained from grid projection using <see cref="IClusterGroup.GetCompute"/> method.
- /// <para />
- /// Note that if attempt is made to execute a computation over an empty projection (i.e. projection that does
- /// not have any alive nodes), <c>ClusterGroupEmptyException</c> will be thrown out of result future.
- /// <para />
- /// Ignite must select a node for a computation to be executed. The node will be selected based on the
- /// underlying <c>GridLoadBalancingSpi</c>, which by default sequentially picks next available node from
- /// grid projection. Other load balancing policies, such as <c>random</c> or <c>adaptive</c>, can be
- /// configured as well by selecting different load balancing SPI in Ignite configuration. If your logic requires
- /// some custom load balancing behavior, consider implementing <c>ComputeTask</c> in Java directly.
- /// <para />
- /// Ignite guarantees that as long as there is at least one Ignite node standing, every job will be
- /// executed. Jobs will automatically failover to another node if a remote node crashed or has rejected
- /// execution due to lack of resources. By default, in case of failover, next load balanced node will be
- /// picked for job execution. Also jobs will never be re-routed to the nodes they have failed on. This
- /// behavior can be changed by configuring any of the existing or a custom <c>FailoverSpi</c> in Ignite
- /// configuration.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface ICompute : IAsyncSupport<ICompute>
- {
- /// <summary>
- /// Grid projection to which this compute instance belongs.
- /// </summary>
- IClusterGroup ClusterGroup { get; }
-
- /// <summary>
- /// Sets no-failover flag for the next executed task on this projection in the current thread.
- /// If flag is set, job will be never failed over even if remote node crashes or rejects execution.
- /// When task starts execution, the no-failover flag is reset, so all other task will use default
- /// failover policy, unless this flag is set again.
- /// </summary>
- /// <returns>This compute instance for chaining calls.</returns>
- ICompute WithNoFailover();
-
- /// <summary>
- /// Sets task timeout for the next executed task on this projection in the current thread.
- /// When task starts execution, the timeout is reset, so one timeout is used only once.
- /// </summary>
- /// <param name="timeout">Computation timeout in milliseconds.</param>
- /// <returns>This compute instance for chaining calls.</returns>
- ICompute WithTimeout(long timeout);
-
- /// <summary>
- /// Sets keep-portable flag for the next executed Java task on this projection in the current
- /// thread so that task argument passed to Java and returned task results will not be
- /// deserialized.
- /// </summary>
- /// <returns>This compute instance for chaining calls.</returns>
- ICompute WithKeepPortable();
-
- /// <summary>
- /// Executes given Java task on the grid projection. If task for given name has not been deployed yet,
- /// then 'taskName' will be used as task class name to auto-deploy the task.
- /// </summary>
- /// <param name="taskName">Java task name</param>
- /// <param name="taskArg">Optional argument of task execution, can be null.</param>
- /// <returns>Task result.</returns>
- /// <typeparam name="T">Type of task result.</typeparam>
- T ExecuteJavaTask<T>(string taskName, object taskArg);
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="task">Task to execute.</param>
- /// <param name="taskArg">Optional task argument.</param>
- /// <returns>Task result.</returns>
- /// <typeparam name="TA">Argument type.</typeparam>
- /// <typeparam name="T">Type of job result.</typeparam>
- /// <typeparam name="TR">Type of reduce result.</typeparam>
- [AsyncSupported]
- TR Execute<TA, T, TR>(IComputeTask<TA, T, TR> task, TA taskArg);
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="task">Task to execute.</param>
- /// <returns>Task result.</returns>
- /// <typeparam name="T">Type of job result.</typeparam>
- /// <typeparam name="TR">Type of reduce result.</typeparam>
- [AsyncSupported]
- TR Execute<T, TR>(IComputeTask<T, TR> task);
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="taskType">Task type.</param>
- /// <param name="taskArg">Optional task argument.</param>
- /// <returns>Task result.</returns>
- /// <typeparam name="TA">Argument type.</typeparam>
- /// <typeparam name="T">Type of job result.</typeparam>
- /// <typeparam name="TR">Type of reduce result.</typeparam>
- [AsyncSupported]
- TR Execute<TA, T, TR>(Type taskType, TA taskArg);
-
- /// <summary>
- /// Executes given task on the grid projection. For step-by-step explanation of task execution process
- /// refer to <see cref="IComputeTask{A,T,R}"/> documentation.
- /// </summary>
- /// <param name="taskType">Task type.</param>
- /// <returns>Task result.</returns>
- /// <typeparam name="T">Type of job result.</typeparam>
- /// <typeparam name="TR">Type of reduce result.</typeparam>
- [AsyncSupported]
- TR Execute<T, TR>(Type taskType);
-
- /// <summary>
- /// Executes provided job on a node in this grid projection. The result of the
- /// job execution is returned from the result closure.
- /// </summary>
- /// <param name="clo">Job to execute.</param>
- /// <returns>Job result for this execution.</returns>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- TR Call<TR>(IComputeFunc<TR> clo);
-
- /// <summary>
- /// Executes given job on the node where data for provided affinity key is located
- /// (a.k.a. affinity co-location).
- /// </summary>
- /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
- /// <param name="affinityKey">Affinity key.</param>
- /// <param name="clo">Job to execute.</param>
- /// <returns>Job result for this execution.</returns>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- TR AffinityCall<TR>(string cacheName, object affinityKey, IComputeFunc<TR> clo);
-
- /// <summary>
- /// Executes collection of jobs on nodes within this grid projection.
- /// </summary>
- /// <param name="clos">Collection of jobs to execute.</param>
- /// <param name="rdc">Reducer to reduce all job results into one individual return value.</param>
- /// <returns>Reduced job result for this execution.</returns>
- /// <typeparam name="TR1">Type of job result.</typeparam>
- /// <typeparam name="TR2">Type of reduced result.</typeparam>
- [AsyncSupported]
- TR2 Call<TR1, TR2>(IEnumerable<IComputeFunc<TR1>> clos, IComputeReducer<TR1, TR2> rdc);
-
- /// <summary>
- /// Executes collection of jobs on nodes within this grid projection.
- /// </summary>
- /// <param name="clos">Collection of jobs to execute.</param>
- /// <returns>Collection of job results for this execution.</returns>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- ICollection<TR> Call<TR>(IEnumerable<IComputeFunc<TR>> clos);
-
- /// <summary>
- /// Broadcasts given job to all nodes in grid projection. Every participating node will return a job result.
- /// </summary>
- /// <param name="clo">Job to broadcast to all projection nodes.</param>
- /// <returns>Collection of results for this execution.</returns>
- [AsyncSupported]
- ICollection<TR> Broadcast<TR>(IComputeFunc<TR> clo);
-
- /// <summary>
- /// Broadcasts given closure job with passed in argument to all nodes in grid projection.
- /// Every participating node will return a job result.
- /// </summary>
- /// <param name="clo">Job to broadcast to all projection nodes.</param>
- /// <param name="arg">Job closure argument.</param>
- /// <returns>Collection of results for this execution.</returns>
- /// <typeparam name="T">Type of argument.</typeparam>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- ICollection<TR> Broadcast<T, TR>(IComputeFunc<T, TR> clo, T arg);
-
- /// <summary>
- /// Broadcasts given job to all nodes in grid projection.
- /// </summary>
- /// <param name="action">Job to broadcast to all projection nodes.</param>
- [AsyncSupported]
- void Broadcast(IComputeAction action);
-
- /// <summary>
- /// Executes provided job on a node in this grid projection.
- /// </summary>
- /// <param name="action">Job to execute.</param>
- [AsyncSupported]
- void Run(IComputeAction action);
-
- /// <summary>
- /// Executes given job on the node where data for provided affinity key is located
- /// (a.k.a. affinity co-location).
- /// </summary>
- /// <param name="cacheName">Name of the cache to use for affinity co-location.</param>
- /// <param name="affinityKey">Affinity key.</param>
- /// <param name="action">Job to execute.</param>
- [AsyncSupported]
- void AffinityRun(string cacheName, object affinityKey, IComputeAction action);
-
- /// <summary>
- /// Executes collection of jobs on Ignite nodes within this grid projection.
- /// </summary>
- /// <param name="actions">Jobs to execute.</param>
- [AsyncSupported]
- void Run(IEnumerable<IComputeAction> actions);
-
- /// <summary>
- /// Executes provided closure job on a node in this grid projection.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="arg">Job argument.</param>
- /// <returns>Job result for this execution.</returns>
- /// <typeparam name="T">Type of argument.</typeparam>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- TR Apply<T, TR>(IComputeFunc<T, TR> clo, T arg);
-
- /// <summary>
- /// Executes provided closure job on nodes within this grid projection. A new job is executed for
- /// every argument in the passed in collection. The number of actual job executions will be
- /// equal to size of the job arguments collection.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="args">Job arguments.</param>
- /// <returns>Сollection of job results.</returns>
- /// <typeparam name="T">Type of argument.</typeparam>
- /// <typeparam name="TR">Type of job result.</typeparam>
- [AsyncSupported]
- ICollection<TR> Apply<T, TR>(IComputeFunc<T, TR> clo, IEnumerable<T> args);
-
- /// <summary>
- /// Executes provided closure job on nodes within this grid projection. A new job is executed for
- /// every argument in the passed in collection. The number of actual job executions will be
- /// equal to size of the job arguments collection. The returned job results will be reduced
- /// into an individual result by provided reducer.
- /// </summary>
- /// <param name="clo">Job to run.</param>
- /// <param name="args">Job arguments.</param>
- /// <param name="rdc">Reducer to reduce all job results into one individual return value.</param>
- /// <returns>Reduced job result for this execution.</returns>
- /// <typeparam name="T">Type of argument.</typeparam>
- /// <typeparam name="TR1">Type of job result.</typeparam>
- /// <typeparam name="TR2">Type of reduced result.</typeparam>
- [AsyncSupported]
- TR2 Apply<T, TR1, TR2>(IComputeFunc<T, TR1> clo, IEnumerable<T> args, IComputeReducer<TR1, TR2> rdc);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs
deleted file mode 100644
index 4a43f11..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeFunc.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- /// <summary>
- /// Defines function having a single argument.
- /// </summary>
- public interface IComputeFunc<in T, out TR>
- {
- /// <summary>
- /// Invoke function.
- /// </summary>
- /// <param name="arg">Argument.</param>
- /// <returns>Result.</returns>
- TR Invoke(T arg);
- }
-
- /// <summary>
- /// Defines function having no arguments.
- /// </summary>
- public interface IComputeFunc<out T>
- {
- /// <summary>
- /// Invoke function.
- /// </summary>
- /// <returns>Result.</returns>
- T Invoke();
- }
-
- /// <summary>
- /// Defines a void function having no arguments.
- /// </summary>
- public interface IComputeAction
- {
- /// <summary>
- /// Invokes action.
- /// </summary>
- void Invoke();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs
deleted file mode 100644
index 3b8ac60..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJob.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Resource;
-
- /// <summary>
- /// Defines executable unit for <see cref="IComputeTask{A,T,R}"/>. Ignite task gets split into jobs
- /// when <see cref="IComputeTask{A,T,R}.Map(IList{IClusterNode}, A)"/> method is called. This
- /// method returns all jobs for the task mapped to their corresponding Ignite nodes for execution.
- /// Grid will then serialize this jobs and send them to requested nodes for execution.
- /// <para />
- /// Once job execution is complete, the return value will be sent back to parent task and will
- /// be passed into
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// method via <see cref="IComputeJobResult{T}"/> instance.
- /// <para />
- /// Ignite job implementation can be injected with <see cref="IIgnite"/> using
- /// <see cref="InstanceResourceAttribute"/> attribute.
- /// </summary>
- public interface IComputeJob<out T>
- {
- /// <summary>
- /// Executes this job.
- /// </summary>
- /// <returns>Job execution result (possibly <c>null</c>). This result will be returned
- /// in <see cref="IComputeJobResult{T}"/> object passed into
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// on caller node.</returns>
- T Execute();
-
- /// <summary>
- /// This method is called when system detects that completion of this
- /// job can no longer alter the overall outcome (for example, when parent task
- /// has already reduced the results).
- /// <para />
- /// Note that job cancellation is only a hint, and it is really up to the actual job
- /// instance to gracefully finish execution and exit.
- /// </summary>
- void Cancel();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs
deleted file mode 100644
index 5891fd7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeJobResult.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Job execution result which gets passed to
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// method.
- /// </summary>
- public interface IComputeJobResult<out T>
- {
- /// <summary>
- /// Gets data returned by remote job if it didn't fail. This data is the
- /// object returned from <see cref="IComputeJob{T}.Execute()"/> method.
- /// <para />
- /// Note that if task is annotated with <see cref="ComputeTaskNoResultCacheAttribute"/>
- /// attribute, then job results will not be cached and will be available only in
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// method for every individual job, but not in
- /// <see cref="IComputeTask{A,T,R}.Reduce(IList{IComputeJobResult{T}})"/> method.
- ///
- /// </summary>
- /// <returns>Data returned by job.</returns>
- T Data();
-
- /// <summary>
- /// Gets local instance of remote job produced this result.
- /// </summary>
- /// <returns></returns>
- IComputeJob<T> Job();
-
- /// <summary>
- /// Gets exception produced by execution of remote job, or <c>null</c> if no
- /// exception was produced.
- /// </summary>
- /// <returns>Exception or <c>null</c> in case of success.</returns>
- Exception Exception();
-
- /// <summary>
- /// ID of the node where actual job execution occurred.
- /// </summary>
- Guid NodeId
- {
- get;
- }
-
- /// <summary>
- /// Whether the job was cancelled.
- /// </summary>
- bool Cancelled
- {
- get;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs
deleted file mode 100644
index 46dcbd9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeReducer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- /// <summary>
- /// Compute reducer which is capable of result collecting and reducing.
- /// </summary>
- public interface IComputeReducer<in TR1, out TR2>
- {
- /// <summary>
- /// Collect closure execution result.
- /// </summary>
- /// <param name="res">Result.</param>
- /// <returns><c>True</c> to continue collecting results until all closures are finished,
- /// <c>false</c> to start reducing.</returns>
- bool Collect(TR1 res);
-
- /// <summary>
- /// Reduce closure execution results collected earlier.
- /// </summary>
- /// <returns>Reduce result.</returns>
- TR2 Reduce();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs
deleted file mode 100644
index 21b6c48..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Compute/IComputeTask.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Compute
-{
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Cluster;
-
- /// <summary>
- /// Ignite task interface defines a task that can be executed on the grid. Ignite task
- /// is responsible for splitting business logic into multiple Ignite jobs, receiving
- /// results from individual Ignite jobs executing on remote nodes, and reducing
- /// (aggregating) received jobs' results into final Ignite task result.
- /// <para />
- /// Upon request to execute a task, the system will do the following:
- /// <list type="bullet">
- /// <item>
- /// <description>Inject annotated resources into task instance.</description>
- /// </item>
- /// <item>
- /// <description>Apply <see cref="IComputeTask{A,T,R}.Map(IList{IClusterNode}, TA)"/>.
- /// This method is responsible for splitting business logic into multiple jobs
- /// (units of execution) and mapping them to Ignite nodes.</description>
- /// </item>
- /// <item>
- /// <description>System will send mapped Ignite jobs to their respective nodes.</description>
- /// </item>
- /// <item>
- /// <description>Once job execution results become available method
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// will be called for ech received job result. The policy returned by this method will
- /// determine the way task reacts to every job result.
- /// <para />
- /// If <see cref="ComputeJobResultPolicy.Wait"/> is returned, task will continue to wait
- /// for other job results. If this result is the last job result, then reduce phase will be
- /// started.
- /// <para />
- /// If <see cref="ComputeJobResultPolicy.Reduce"/> is returned, reduce phase will be started
- /// right away without waiting for other jobs completion (all remaining jobs will receive cancel
- /// request).
- /// <para />
- /// If <see cref="ComputeJobResultPolicy.Failover"/> is returned, job will be failed over to
- /// another node for execution. Note that if you use <see cref="ComputeTaskAdapter{A,T,R}"/>, it will
- /// automatically fail jobs to another node for 2 well-known failure cases: 1) job has failed to due
- /// to node crash (in this case <see cref="IComputeJobResult{T}.Exception()"/> will return
- /// <see cref="ClusterTopologyException"/>); 2) job execution was rejected, i.e. remote node
- /// has cancelled job before it got a chance to execute, while it still was on the waiting list.
- /// (in this case <see cref="IComputeJobResult{T}.Exception()"/> will return
- /// <see cref="ComputeExecutionRejectedException"/>).
- /// </description>
- /// </item>
- /// <item>
- /// <description>Once all results are received or
- /// <see cref="IComputeTask{A,T,R}.Result(IComputeJobResult{T}, IList{IComputeJobResult{T}})"/>
- /// method returned <see cref="ComputeJobResultPolicy.Reduce"/> policy, method
- /// <see cref="IComputeTask{A,T,R}.Reduce(IList{IComputeJobResult{T}})"/>
- /// is called to aggregate received results into one final result. Once this method is finished the
- /// execution of the Ignite task is complete. This result will be returned to the user through future.
- /// </description>
- /// </item>
- /// </list>
- /// </summary>
- /// <typeparam name="TA">Argument type.</typeparam>
- /// <typeparam name="T">Type of job result.</typeparam>
- /// <typeparam name="TR">Type of reduce result.</typeparam>
- public interface IComputeTask<in TA, T, out TR>
- {
- /// <summary>
- /// This method is called to map or split Ignite task into multiple Ignite jobs. This is the
- /// first method that gets called when task execution starts.
- /// </summary>
- /// <param name="subgrid">Nodes available for this task execution. Note that order of nodes is
- /// guaranteed to be randomized by container. This ensures that every time you simply iterate
- /// through Ignite nodes, the order of nodes will be random which over time should result into
- /// all nodes being used equally.</param>
- /// <param name="arg">Task execution argument. Can be <c>null</c>. This is the same argument
- /// as the one passed into <c>ICompute.Execute()</c> methods.</param>
- /// <returns>Map of Ignite jobs assigned to subgrid node. If <c>null</c> or empty map is returned,
- /// exception will be thrown.</returns>
- IDictionary<IComputeJob<T>, IClusterNode> Map(IList<IClusterNode> subgrid, TA arg);
-
- /// <summary>
- /// Asynchronous callback invoked every time a result from remote execution is
- /// received. It is ultimately upto this method to return a policy based
- /// on which the system will either wait for more results, reduce results
- /// received so far, or failover this job to another node. See
- /// <see cref="ComputeJobResultPolicy"/> for more information.
- /// </summary>
- /// <param name="res">Received remote Ignite executable result.</param>
- /// <param name="rcvd">All previously received results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute"/> attribute, then this list will be empty.</param>
- /// <returns>Result policy that dictates how to process further upcoming job results.</returns>
- ComputeJobResultPolicy Result(IComputeJobResult<T> res, IList<IComputeJobResult<T>> rcvd);
-
- /// <summary>
- /// Reduces (or aggregates) results received so far into one compound result to be returned to
- /// caller via future.
- /// <para />
- /// Note, that if some jobs did not succeed and could not be failed over then the list of
- /// results passed into this method will include the failed results. Otherwise, failed
- /// results will not be in the list.
- /// </summary>
- /// <param name="results">Received job results. Note that if task class has
- /// <see cref="ComputeTaskNoResultCacheAttribute"/> attribute, then this list will be empty.</param>
- /// <returns>Task result constructed from results of remote executions.</returns>
- TR Reduce(IList<IComputeJobResult<T>> results);
- }
-
- /// <summary>
- /// IComputeTask without an argument.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
- public interface IComputeTask<T, out TR> : IComputeTask<object, T, TR>
- {
- // No-op.
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
deleted file mode 100644
index 2713040..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IDataStreamer.cs
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Datastream
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Data streamer is responsible for loading external data into cache. It achieves it by
- /// properly buffering updates and properly mapping keys to nodes responsible for the data
- /// to make sure that there is the least amount of data movement possible and optimal
- /// network and memory utilization.
- /// <para />
- /// Note that streamer will load data concurrently by multiple internal threads, so the
- /// data may get to remote nodes in different order from which it was added to
- /// the streamer.
- /// <para />
- /// Also note that <c>IDataStreamer</c> is not the only way to load data into cache.
- /// Alternatively you can use
- /// <see cref="ICacheStore.LoadCache(Action{object, object}, object[])"/>
- /// method to load data from underlying data store. You can also use standard cache
- /// <c>put</c> and <c>putAll</c> operations as well, but they most likely will not perform
- /// as well as this class for loading data. And finally, data can be loaded from underlying
- /// data store on demand, whenever it is accessed - for this no explicit data loading step
- /// is needed.
- /// <para />
- /// <c>IDataStreamer</c> supports the following configuration properties:
- /// <list type="bullet">
- /// <item>
- /// <term>PerNodeBufferSize</term>
- /// <description>When entries are added to data streamer they are not sent to Ignite
- /// right away and are buffered internally for better performance and network utilization.
- /// This setting controls the size of internal per-node buffer before buffered data is sent to
- /// remote node. Default value is 1024.</description>
- /// </item>
- /// <item>
- /// <term>PerNodeParallelOperations</term>
- /// <description>Sometimes data may be added to the data streamer faster than it can be put
- /// in cache. In this case, new buffered load messages are sent to remote nodes before
- /// responses from previous ones are received. This could cause unlimited heap memory
- /// utilization growth on local and remote nodes. To control memory utilization, this
- /// setting limits maximum allowed number of parallel buffered load messages that are
- /// being processed on remote nodes. If this number is exceeded, then data streamer add/remove
- /// methods will block to control memory utilization. Default value is 16.</description>
- /// </item>
- /// <item>
- /// <term>AutoFlushFrequency</term>
- /// <description>Automatic flush frequency in milliseconds. Essentially, this is the time
- /// after which the streamer will make an attempt to submit all data added so far to remote
- /// nodes. Note that there is no guarantee that data will be delivered after this concrete
- /// attempt (e.g., it can fail when topology is changing), but it won't be lost anyway.
- /// Disabled by default (default value is <c>0</c>).</description>
- /// </item>
- /// <item>
- /// <term>Isolated</term>
- /// <description>Defines if data streamer will assume that there are no other concurrent
- /// updates and allow data streamer choose most optimal concurrent implementation. Default value
- /// is <c>false</c>.</description>
- /// </item>
- /// </list>
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface IDataStreamer<TK, TV> : IDisposable
- {
- /// <summary>
- /// Name of the cache to load data to.
- /// </summary>
- string CacheName { get; }
-
- /// <summary>
- /// Flag value indicating that this data streamer assumes that there could be concurrent updates to the cache.
- /// <para />
- /// Default is <code>false</code>.
- /// </summary>
- bool AllowOverwrite { get; set; }
-
- /// <summary>
- /// Flag indicating that write-through behavior should be disabled for data loading.
- /// <para />
- /// Default is <code>false</code>.
- /// </summary>
- bool SkipStore { get; set; }
-
- /// <summary>
- /// Size of per node key-value pairs buffer.
- /// <para />
- /// Setter must be called before any add/remove operation.
- /// <para />
- /// Default is <code>1024</code>.
- /// </summary>
- int PerNodeBufferSize { get; set; }
-
- /// <summary>
- /// Maximum number of parallel load operations for a single node.
- /// <para />
- /// Setter must be called before any add/remove operation.
- /// <para />
- /// Default is <code>16</code>.
- /// </summary>
- int PerNodeParallelOperations { get; set; }
-
- /// <summary>
- /// Automatic flush frequency in milliseconds. Essentially, this is the time after which the
- /// streamer will make an attempt to submit all data added so far to remote nodes.
- /// Note that there is no guarantee that data will be delivered after this concrete
- /// attempt (e.g., it can fail when topology is changing), but it won't be lost anyway.
- /// <para />
- /// If set to <code>0</code>, automatic flush is disabled.
- /// <para />
- /// Default is <code>0</code> (disabled).
- /// </summary>
- long AutoFlushFrequency { get; set; }
-
- /// <summary>
- /// Gets future for this loading process. This future completes whenever method
- /// <see cref="IDataStreamer{K,V}.Close(bool)"/> completes.
- /// </summary>
- IFuture Future { get; }
-
- /// <summary>
- /// Gets or sets custom stream receiver.
- /// </summary>
- IStreamReceiver<TK, TV> Receiver { get; set; }
-
- /// <summary>
- /// Adds single key-value pair for loading. Passing <c>null</c> as value will be
- /// interpreted as removal.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- /// <returns>Future for this operation.</returns>
- IFuture AddData(TK key, TV val);
-
- /// <summary>
- /// Adds single key-value pair for loading. Passing <c>null</c> as pair's value will
- /// be interpreted as removal.
- /// </summary>
- /// <param name="pair">Key-value pair.</param>
- /// <returns>Future for this operation.</returns>
- IFuture AddData(KeyValuePair<TK, TV> pair);
-
- /// <summary>
- /// Adds collection of key-value pairs for loading.
- /// </summary>
- /// <param name="entries">Entries.</param>
- /// <returns>Future for this operation.</returns>
- IFuture AddData(ICollection<KeyValuePair<TK, TV>> entries);
-
- /// <summary>
- /// Adds key for removal.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <returns>Future for this operation.</returns>
- IFuture RemoveData(TK key);
-
- /// <summary>
- /// Makes an attempt to load remaining data. This method is mostly similar to
- /// <see cref="IDataStreamer{K,V}.Flush()"/> with the difference that it won't wait and
- /// will exit immediately.
- /// </summary>
- void TryFlush();
-
- /// <summary>
- /// Loads any remaining data, but doesn't close the streamer. Data can be still added after
- /// flush is finished. This method blocks and doesn't allow to add any data until all data
- /// is loaded.
- /// </summary>
- void Flush();
-
- /// <summary>
- /// Closes this streamer optionally loading any remaining data.
- /// </summary>
- /// <param name="cancel">Whether to cancel ongoing loading operations. When set to <c>true</c>
- /// there is not guarantees what data will be actually loaded to cache.</param>
- void Close(bool cancel);
-
- /// <summary>
- /// Gets streamer instance with portable mode enabled, changing key and/or value types if necessary.
- /// In portable mode stream receiver gets data in portable format.
- /// You can only change key/value types when transitioning from non-portable to portable streamer;
- /// Changing type of portable streamer is not allowed and will throw an <see cref="InvalidOperationException"/>
- /// </summary>
- /// <typeparam name="TK1">Key type in portable mode.</typeparam>
- /// <typeparam name="TV1">Value type in protable mode.</typeparam>
- /// <returns>Streamer instance with portable mode enabled.</returns>
- IDataStreamer<TK1, TV1> WithKeepPortable<TK1, TV1>();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs
deleted file mode 100644
index d75dc54..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/IStreamReceiver.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Datastream
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
-
- /// <summary>
- /// Updates cache with batch of entries.
- /// Usually it is enough to configure <see cref="IDataStreamer{K,V}.AllowOverwrite" /> property and appropriate
- /// internal cache receiver will be chosen automatically. But in some cases custom implementation may help
- /// to achieve better performance.
- /// </summary>
- public interface IStreamReceiver<TK, TV>
- {
- /// <summary>
- /// Updates cache with batch of entries.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <param name="entries">Entries.</param>
- void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, TV>> entries);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
deleted file mode 100644
index 0398342..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamTransformer.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Datastream
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Datastream;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Convenience adapter to transform update existing values in streaming cache
- /// based on the previously cached value.
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- /// <typeparam name="TA">The type of the processor argument.</typeparam>
- /// <typeparam name="TR">The type of the processor result.</typeparam>
- public sealed class StreamTransformer<TK, TV, TA, TR> : IStreamReceiver<TK, TV>,
- IPortableWriteAware
- {
- /** Entry processor. */
- private readonly ICacheEntryProcessor<TK, TV, TA, TR> _proc;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StreamTransformer{K, V, A, R}"/> class.
- /// </summary>
- /// <param name="proc">Entry processor.</param>
- public StreamTransformer(ICacheEntryProcessor<TK, TV, TA, TR> proc)
- {
- IgniteArgumentCheck.NotNull(proc, "proc");
-
- _proc = proc;
- }
-
- /** <inheritdoc /> */
- public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, TV>> entries)
- {
- var keys = new List<TK>(entries.Count);
-
- foreach (var entry in entries)
- keys.Add(entry.Key);
-
- cache.InvokeAll(keys, _proc, default(TA));
- }
-
- /** <inheritdoc /> */
- void IPortableWriteAware.WritePortable(IPortableWriter writer)
- {
- var w = (PortableWriterImpl)writer;
-
- w.WriteByte(StreamReceiverHolder.RcvTransformer);
-
- PortableUtils.WritePortableOrSerializable(w, _proc);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
deleted file mode 100644
index 5d155d7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Datastream/StreamVisitor.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Datastream
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Common;
-
- /// <summary>
- /// Convenience adapter to visit every key-value tuple in the stream.
- /// Note that the visitor does not update the cache.
- /// </summary>
- /// <typeparam name="TK">The type of the cache key.</typeparam>
- /// <typeparam name="TV">The type of the cache value.</typeparam>
- [Serializable]
- public sealed class StreamVisitor<TK, TV> : IStreamReceiver<TK, TV>
- {
- /** Visitor action */
- private readonly Action<ICache<TK, TV>, ICacheEntry<TK, TV>> _action;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StreamVisitor{K, V}"/> class.
- /// </summary>
- /// <param name="action">The action to be called on each stream entry.</param>
- public StreamVisitor(Action<ICache<TK, TV>, ICacheEntry<TK, TV>> action)
- {
- IgniteArgumentCheck.NotNull(action, "action");
-
- _action = action;
- }
-
- /** <inheritdoc /> */
- public void Receive(ICache<TK, TV> cache, ICollection<ICacheEntry<TK, TV>> entries)
- {
- foreach (var entry in entries)
- _action(cache, entry);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
deleted file mode 100644
index ff5084b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheEvent.cs
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// In-memory database (cache) event.
- /// </summary>
- public sealed class CacheEvent : EventBase
- {
- /** */
- private readonly string _cacheName;
-
- /** */
- private readonly int _partition;
-
- /** */
- private readonly bool _isNear;
-
- /** */
- private readonly IClusterNode _eventNode;
-
- /** */
- private readonly object _key;
-
- /** */
- private readonly IgniteGuid _xid;
-
- /** */
- private readonly object _lockId;
-
- /** */
- private readonly object _newValue;
-
- /** */
- private readonly object _oldValue;
-
- /** */
- private readonly bool _hasOldValue;
-
- /** */
- private readonly bool _hasNewValue;
-
- /** */
- private readonly Guid _subjectId;
-
- /** */
- private readonly string _closureClassName;
-
- /** */
- private readonly string _taskName;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal CacheEvent(IPortableRawReader r) : base(r)
- {
- _cacheName = r.ReadString();
- _partition = r.ReadInt();
- _isNear = r.ReadBoolean();
- _eventNode = ReadNode(r);
- _key = r.ReadObject<object>();
- _xid = IgniteGuid.ReadPortable(r);
- _lockId = r.ReadObject<object>();
- _newValue = r.ReadObject<object>();
- _oldValue = r.ReadObject<object>();
- _hasOldValue = r.ReadBoolean();
- _hasNewValue = r.ReadBoolean();
- _subjectId = r.ReadGuid() ?? Guid.Empty;
- _closureClassName = r.ReadString();
- _taskName = r.ReadString();
- }
-
- /// <summary>
- /// Gets cache name.
- /// </summary>
- public string CacheName { get { return _cacheName; } }
-
- /// <summary>
- /// Gets partition for the event which is the partition the key belongs to.
- /// </summary>
- public int Partition { get { return _partition; } }
-
- /// <summary>
- /// Gets flag indicating whether event happened on near or partitioned cache.
- /// </summary>
- public bool IsNear { get { return _isNear; } }
-
- /// <summary>
- /// Gets node which initiated cache operation or null if that node is not available.
- /// </summary>
- public IClusterNode EventNode { get { return _eventNode; } }
-
- /// <summary>
- /// Gets cache entry associated with event.
- /// </summary>
- public object Key { get { return _key; } }
-
- /// <summary>
- /// ID of surrounding cache cache transaction or null if there is no surrounding transaction.
- /// </summary>
- public IgniteGuid Xid { get { return _xid; } }
-
- /// <summary>
- /// ID of the lock if held or null if no lock held.
- /// </summary>
- public object LockId { get { return _lockId; } }
-
- /// <summary>
- /// Gets new value for this event.
- /// </summary>
- public object NewValue { get { return _newValue; } }
-
- /// <summary>
- /// Gets old value associated with this event.
- /// </summary>
- public object OldValue { get { return _oldValue; } }
-
- /// <summary>
- /// Gets flag indicating whether cache entry has old value in case if we only have old value in serialized form
- /// in which case <see cref="OldValue" /> will return null.
- /// </summary>
- public bool HasOldValue { get { return _hasOldValue; } }
-
- /// <summary>
- /// Gets flag indicating whether cache entry has new value in case if we only have new value in serialized form
- /// in which case <see cref="NewValue" /> will return null.
- /// </summary>
- public bool HasNewValue { get { return _hasNewValue; } }
-
- /// <summary>
- /// Gets security subject ID initiated this cache event, if available. This property is available only for <see
- /// cref="EventType.EvtCacheObjectPut" />, <see cref="EventType.EvtCacheObjectRemoved" /> and <see
- /// cref="EventType.EvtCacheObjectRead" /> cache events. Subject ID will be set either to nodeId initiated
- /// cache update or read or client ID initiated cache update or read.
- /// </summary>
- public Guid SubjectId { get { return _subjectId; } }
-
- /// <summary>
- /// Gets closure class name (applicable only for TRANSFORM operations).
- /// </summary>
- public string ClosureClassName { get { return _closureClassName; } }
-
- /// <summary>
- /// Gets task name if cache event was caused by an operation initiated within task execution.
- /// </summary>
- public string TaskName { get { return _taskName; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: IsNear={1}, Key={2}, HasNewValue={3}, HasOldValue={4}, NodeId={5}", Name,
- _isNear, _key, HasNewValue, HasOldValue, Node.Id);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
deleted file mode 100644
index 8443c68..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Events/CacheQueryExecutedEvent.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Events
-{
- using System;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Cache query execution event.
- /// </summary>
- public sealed class CacheQueryExecutedEvent : EventBase
- {
- /** */
- private readonly string _queryType;
-
- /** */
- private readonly string _cacheName;
-
- /** */
- private readonly string _className;
-
- /** */
- private readonly string _clause;
-
- /** */
- private readonly Guid _subjectId;
-
- /** */
- private readonly string _taskName;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="r">The reader to read data from.</param>
- internal CacheQueryExecutedEvent(IPortableRawReader r) : base(r)
- {
- _queryType = r.ReadString();
- _cacheName = r.ReadString();
- _className = r.ReadString();
- _clause = r.ReadString();
- _subjectId = r.ReadGuid() ?? Guid.Empty;
- _taskName = r.ReadString();
- }
-
- /// <summary>
- /// Gets query type.
- /// </summary>
- public string QueryType { get { return _queryType; } }
-
- /// <summary>
- /// Gets cache name on which query was executed.
- /// </summary>
- public string CacheName { get { return _cacheName; } }
-
- /// <summary>
- /// Gets queried class name. Applicable for SQL and full text queries.
- /// </summary>
- public string ClassName { get { return _className; } }
-
- /// <summary>
- /// Gets query clause. Applicable for SQL, SQL fields and full text queries.
- /// </summary>
- public string Clause { get { return _clause; } }
-
- /// <summary>
- /// Gets security subject ID.
- /// </summary>
- public Guid SubjectId { get { return _subjectId; } }
-
- /// <summary>
- /// Gets the name of the task that executed the query (if any).
- /// </summary>
- public string TaskName { get { return _taskName; } }
-
- /** <inheritDoc /> */
- public override string ToShortString()
- {
- return string.Format("{0}: QueryType={1}, CacheName={2}, ClassName={3}, Clause={4}, SubjectId={5}, " +
- "TaskName={6}", Name, QueryType, CacheName, ClassName, Clause, SubjectId, TaskName);
- }
- }
-}
[15/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
deleted file mode 100644
index 9efaf5f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedCallbacks.cs
+++ /dev/null
@@ -1,1154 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Runtime.InteropServices;
- using System.Threading;
- using Apache.Ignite.Core.Cache.Event;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Cache.Query.Continuous;
- using Apache.Ignite.Core.Impl.Cache.Store;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Compute;
- using Apache.Ignite.Core.Impl.Datastream;
- using Apache.Ignite.Core.Impl.Events;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Messaging;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Impl.Services;
- using Apache.Ignite.Core.Lifecycle;
- using Apache.Ignite.Core.Services;
- using UU = UnmanagedUtils;
-
- /// <summary>
- /// Unmanaged callbacks.
- /// </summary>
- [SuppressMessage("ReSharper", "UnusedMember.Local")]
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
- Justification = "This class instance usually lives as long as the app runs.")]
- [SuppressMessage("Microsoft.Design", "CA1049:TypesThatOwnNativeResourcesShouldBeDisposable",
- Justification = "This class instance usually lives as long as the app runs.")]
- internal unsafe class UnmanagedCallbacks
- {
- /** Unmanaged context. */
- private volatile UnmanagedContext _ctx;
-
- /** Handle registry. */
- private readonly HandleRegistry _handleRegistry = new HandleRegistry();
-
- /** Grid. */
- private volatile Ignite _ignite;
-
- /** Keep references to created delegates. */
- // ReSharper disable once CollectionNeverQueried.Local
- private readonly List<Delegate> _delegates = new List<Delegate>(50);
-
- /** Initialized flag. */
- private readonly ManualResetEventSlim _initEvent = new ManualResetEventSlim(false);
-
- /** Actions to be called upon Ignite initialisation. */
- private readonly List<Action<Ignite>> _initActions = new List<Action<Ignite>>();
-
- /** GC handle to UnmanagedCallbacks instance to prevent it from being GCed. */
- private readonly GCHandle _thisHnd;
-
- /** Callbacks pointer. */
- private readonly IntPtr _cbsPtr;
-
- /** Error type: generic. */
- private const int ErrGeneric = 1;
-
- /** Error type: initialize. */
- private const int ErrJvmInit = 2;
-
- /** Error type: attach. */
- private const int ErrJvmAttach = 3;
-
- /** Opeartion: prepare .Net. */
- private const int OpPrepareDotNet = 1;
-
- private delegate long CacheStoreCreateCallbackDelegate(void* target, long memPtr);
- private delegate int CacheStoreInvokeCallbackDelegate(void* target, long objPtr, long memPtr, void* cb);
- private delegate void CacheStoreDestroyCallbackDelegate(void* target, long objPtr);
- private delegate long CacheStoreSessionCreateCallbackDelegate(void* target, long storePtr);
-
- private delegate long CacheEntryFilterCreateCallbackDelegate(void* target, long memPtr);
- private delegate int CacheEntryFilterApplyCallbackDelegate(void* target, long objPtr, long memPtr);
- private delegate void CacheEntryFilterDestroyCallbackDelegate(void* target, long objPtr);
-
- private delegate void CacheInvokeCallbackDelegate(void* target, long inMemPtr, long outMemPtr);
-
- private delegate void ComputeTaskMapCallbackDelegate(void* target, long taskPtr, long inMemPtr, long outMemPtr);
- private delegate int ComputeTaskJobResultCallbackDelegate(void* target, long taskPtr, long jobPtr, long memPtr);
- private delegate void ComputeTaskReduceCallbackDelegate(void* target, long taskPtr);
- private delegate void ComputeTaskCompleteCallbackDelegate(void* target, long taskPtr, long memPtr);
- private delegate int ComputeJobSerializeCallbackDelegate(void* target, long jobPtr, long memPtr);
- private delegate long ComputeJobCreateCallbackDelegate(void* target, long memPtr);
- private delegate void ComputeJobExecuteCallbackDelegate(void* target, long jobPtr, int cancel, long memPtr);
- private delegate void ComputeJobCancelCallbackDelegate(void* target, long jobPtr);
- private delegate void ComputeJobDestroyCallbackDelegate(void* target, long jobPtr);
-
- private delegate void ContinuousQueryListenerApplyCallbackDelegate(void* target, long lsnrPtr, long memPtr);
- private delegate long ContinuousQueryFilterCreateCallbackDelegate(void* target, long memPtr);
- private delegate int ContinuousQueryFilterApplyCallbackDelegate(void* target, long filterPtr, long memPtr);
- private delegate void ContinuousQueryFilterReleaseCallbackDelegate(void* target, long filterPtr);
-
- private delegate void DataStreamerTopologyUpdateCallbackDelegate(void* target, long ldrPtr, long topVer, int topSize);
- private delegate void DataStreamerStreamReceiverInvokeCallbackDelegate(void* target, long ptr, void* cache, long memPtr, byte keepPortable);
-
- private delegate void FutureByteResultCallbackDelegate(void* target, long futPtr, int res);
- private delegate void FutureBoolResultCallbackDelegate(void* target, long futPtr, int res);
- private delegate void FutureShortResultCallbackDelegate(void* target, long futPtr, int res);
- private delegate void FutureCharResultCallbackDelegate(void* target, long futPtr, int res);
- private delegate void FutureIntResultCallbackDelegate(void* target, long futPtr, int res);
- private delegate void FutureFloatResultCallbackDelegate(void* target, long futPtr, float res);
- private delegate void FutureLongResultCallbackDelegate(void* target, long futPtr, long res);
- private delegate void FutureDoubleResultCallbackDelegate(void* target, long futPtr, double res);
- private delegate void FutureObjectResultCallbackDelegate(void* target, long futPtr, long memPtr);
- private delegate void FutureNullResultCallbackDelegate(void* target, long futPtr);
- private delegate void FutureErrorCallbackDelegate(void* target, long futPtr, long memPtr);
-
- private delegate void LifecycleOnEventCallbackDelegate(void* target, long ptr, int evt);
-
- private delegate void MemoryReallocateCallbackDelegate(void* target, long memPtr, int cap);
-
- private delegate long MessagingFilterCreateCallbackDelegate(void* target, long memPtr);
- private delegate int MessagingFilterApplyCallbackDelegate(void* target, long ptr, long memPtr);
- private delegate void MessagingFilterDestroyCallbackDelegate(void* target, long ptr);
-
- private delegate long EventFilterCreateCallbackDelegate(void* target, long memPtr);
- private delegate int EventFilterApplyCallbackDelegate(void* target, long ptr, long memPtr);
- private delegate void EventFilterDestroyCallbackDelegate(void* target, long ptr);
-
- private delegate long ServiceInitCallbackDelegate(void* target, long memPtr);
- private delegate void ServiceExecuteCallbackDelegate(void* target, long svcPtr, long memPtr);
- private delegate void ServiceCancelCallbackDelegate(void* target, long svcPtr, long memPtr);
- private delegate void ServiceInvokeMethodCallbackDelegate(void* target, long svcPtr, long inMemPtr, long outMemPtr);
-
- private delegate int СlusterNodeFilterApplyCallbackDelegate(void* target, long memPtr);
-
- private delegate void NodeInfoCallbackDelegate(void* target, long memPtr);
-
- private delegate void OnStartCallbackDelegate(void* target, void* proc, long memPtr);
- private delegate void OnStopCallbackDelegate(void* target);
-
- private delegate void ErrorCallbackDelegate(void* target, int errType, sbyte* errClsChars, int errClsCharsLen, sbyte* errMsgChars, int errMsgCharsLen, void* errData, int errDataLen);
-
- private delegate long ExtensionCallbackInLongOutLongDelegate(void* target, int typ, long arg1);
- private delegate long ExtensionCallbackInLongLongOutLongDelegate(void* target, int typ, long arg1, long arg2);
-
- /// <summary>
- /// constructor.
- /// </summary>
- public UnmanagedCallbacks()
- {
- var cbs = new UnmanagedCallbackHandlers
- {
- target = IntPtr.Zero.ToPointer(), // Target is not used in .Net as we rely on dynamic FP creation.
-
- cacheStoreCreate = CreateFunctionPointer((CacheStoreCreateCallbackDelegate) CacheStoreCreate),
- cacheStoreInvoke = CreateFunctionPointer((CacheStoreInvokeCallbackDelegate) CacheStoreInvoke),
- cacheStoreDestroy = CreateFunctionPointer((CacheStoreDestroyCallbackDelegate) CacheStoreDestroy),
-
- cacheStoreSessionCreate = CreateFunctionPointer((CacheStoreSessionCreateCallbackDelegate) CacheStoreSessionCreate),
-
- cacheEntryFilterCreate = CreateFunctionPointer((CacheEntryFilterCreateCallbackDelegate)CacheEntryFilterCreate),
- cacheEntryFilterApply = CreateFunctionPointer((CacheEntryFilterApplyCallbackDelegate)CacheEntryFilterApply),
- cacheEntryFilterDestroy = CreateFunctionPointer((CacheEntryFilterDestroyCallbackDelegate)CacheEntryFilterDestroy),
-
- cacheInvoke = CreateFunctionPointer((CacheInvokeCallbackDelegate) CacheInvoke),
-
- computeTaskMap = CreateFunctionPointer((ComputeTaskMapCallbackDelegate) ComputeTaskMap),
- computeTaskJobResult =
- CreateFunctionPointer((ComputeTaskJobResultCallbackDelegate) ComputeTaskJobResult),
- computeTaskReduce = CreateFunctionPointer((ComputeTaskReduceCallbackDelegate) ComputeTaskReduce),
- computeTaskComplete = CreateFunctionPointer((ComputeTaskCompleteCallbackDelegate) ComputeTaskComplete),
- computeJobSerialize = CreateFunctionPointer((ComputeJobSerializeCallbackDelegate) ComputeJobSerialize),
- computeJobCreate = CreateFunctionPointer((ComputeJobCreateCallbackDelegate) ComputeJobCreate),
- computeJobExecute = CreateFunctionPointer((ComputeJobExecuteCallbackDelegate) ComputeJobExecute),
- computeJobCancel = CreateFunctionPointer((ComputeJobCancelCallbackDelegate) ComputeJobCancel),
- computeJobDestroy = CreateFunctionPointer((ComputeJobDestroyCallbackDelegate) ComputeJobDestroy),
- continuousQueryListenerApply =
- CreateFunctionPointer((ContinuousQueryListenerApplyCallbackDelegate) ContinuousQueryListenerApply),
- continuousQueryFilterCreate =
- CreateFunctionPointer((ContinuousQueryFilterCreateCallbackDelegate) ContinuousQueryFilterCreate),
- continuousQueryFilterApply =
- CreateFunctionPointer((ContinuousQueryFilterApplyCallbackDelegate) ContinuousQueryFilterApply),
- continuousQueryFilterRelease =
- CreateFunctionPointer((ContinuousQueryFilterReleaseCallbackDelegate) ContinuousQueryFilterRelease),
- dataStreamerTopologyUpdate =
- CreateFunctionPointer((DataStreamerTopologyUpdateCallbackDelegate) DataStreamerTopologyUpdate),
- dataStreamerStreamReceiverInvoke =
- CreateFunctionPointer((DataStreamerStreamReceiverInvokeCallbackDelegate) DataStreamerStreamReceiverInvoke),
-
- futureByteResult = CreateFunctionPointer((FutureByteResultCallbackDelegate) FutureByteResult),
- futureBoolResult = CreateFunctionPointer((FutureBoolResultCallbackDelegate) FutureBoolResult),
- futureShortResult = CreateFunctionPointer((FutureShortResultCallbackDelegate) FutureShortResult),
- futureCharResult = CreateFunctionPointer((FutureCharResultCallbackDelegate) FutureCharResult),
- futureIntResult = CreateFunctionPointer((FutureIntResultCallbackDelegate) FutureIntResult),
- futureFloatResult = CreateFunctionPointer((FutureFloatResultCallbackDelegate) FutureFloatResult),
- futureLongResult = CreateFunctionPointer((FutureLongResultCallbackDelegate) FutureLongResult),
- futureDoubleResult = CreateFunctionPointer((FutureDoubleResultCallbackDelegate) FutureDoubleResult),
- futureObjectResult = CreateFunctionPointer((FutureObjectResultCallbackDelegate) FutureObjectResult),
- futureNullResult = CreateFunctionPointer((FutureNullResultCallbackDelegate) FutureNullResult),
- futureError = CreateFunctionPointer((FutureErrorCallbackDelegate) FutureError),
- lifecycleOnEvent = CreateFunctionPointer((LifecycleOnEventCallbackDelegate) LifecycleOnEvent),
- memoryReallocate = CreateFunctionPointer((MemoryReallocateCallbackDelegate) MemoryReallocate),
- nodeInfo = CreateFunctionPointer((NodeInfoCallbackDelegate) NodeInfo),
-
- messagingFilterCreate = CreateFunctionPointer((MessagingFilterCreateCallbackDelegate)MessagingFilterCreate),
- messagingFilterApply = CreateFunctionPointer((MessagingFilterApplyCallbackDelegate)MessagingFilterApply),
- messagingFilterDestroy = CreateFunctionPointer((MessagingFilterDestroyCallbackDelegate)MessagingFilterDestroy),
-
- eventFilterCreate = CreateFunctionPointer((EventFilterCreateCallbackDelegate)EventFilterCreate),
- eventFilterApply = CreateFunctionPointer((EventFilterApplyCallbackDelegate)EventFilterApply),
- eventFilterDestroy = CreateFunctionPointer((EventFilterDestroyCallbackDelegate)EventFilterDestroy),
-
- serviceInit = CreateFunctionPointer((ServiceInitCallbackDelegate)ServiceInit),
- serviceExecute = CreateFunctionPointer((ServiceExecuteCallbackDelegate)ServiceExecute),
- serviceCancel = CreateFunctionPointer((ServiceCancelCallbackDelegate)ServiceCancel),
- serviceInvokeMethod = CreateFunctionPointer((ServiceInvokeMethodCallbackDelegate)ServiceInvokeMethod),
-
- clusterNodeFilterApply = CreateFunctionPointer((СlusterNodeFilterApplyCallbackDelegate)СlusterNodeFilterApply),
-
- onStart = CreateFunctionPointer((OnStartCallbackDelegate)OnStart),
- onStop = CreateFunctionPointer((OnStopCallbackDelegate)OnStop),
- error = CreateFunctionPointer((ErrorCallbackDelegate)Error),
-
- extensionCbInLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongOutLongDelegate)ExtensionCallbackInLongOutLong),
- extensionCbInLongLongOutLong = CreateFunctionPointer((ExtensionCallbackInLongLongOutLongDelegate)ExtensionCallbackInLongLongOutLong)
- };
-
- _cbsPtr = Marshal.AllocHGlobal(UU.HandlersSize());
-
- Marshal.StructureToPtr(cbs, _cbsPtr, false);
-
- _thisHnd = GCHandle.Alloc(this);
- }
-
- /// <summary>
- /// Gets the handle registry.
- /// </summary>
- public HandleRegistry HandleRegistry
- {
- get { return _handleRegistry; }
- }
-
- #region IMPLEMENTATION: CACHE
-
- private long CacheStoreCreate(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- var cacheStore = CacheStore.CreateInstance(memPtr, _handleRegistry);
-
- if (_ignite != null)
- cacheStore.Init(_ignite);
- else
- {
- lock (_initActions)
- {
- if (_ignite != null)
- cacheStore.Init(_ignite);
- else
- _initActions.Add(g => cacheStore.Init(g));
- }
- }
-
- return cacheStore.Handle;
- }, true);
- }
-
- private int CacheStoreInvoke(void* target, long objPtr, long memPtr, void* cb)
- {
- return SafeCall(() =>
- {
- var t = _handleRegistry.Get<CacheStore>(objPtr, true);
-
- IUnmanagedTarget cb0 = null;
-
- if ((long) cb != 0)
- cb0 = new UnmanagedNonReleaseableTarget(_ctx.NativeContext, cb);
-
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return t.Invoke(stream, cb0, _ignite);
- }
- });
- }
-
- private void CacheStoreDestroy(void* target, long objPtr)
- {
- SafeCall(() => _ignite.HandleRegistry.Release(objPtr));
- }
-
- private long CacheStoreSessionCreate(void* target, long storePtr)
- {
- return SafeCall(() => _ignite.HandleRegistry.Allocate(new CacheStoreSession()));
- }
-
- private long CacheEntryFilterCreate(void* target, long memPtr)
- {
- return SafeCall(() => CacheEntryFilterHolder.CreateInstance(memPtr, _ignite).Handle);
- }
-
- private int CacheEntryFilterApply(void* target, long objPtr, long memPtr)
- {
- return SafeCall(() =>
- {
- var t = _ignite.HandleRegistry.Get<CacheEntryFilterHolder>(objPtr);
-
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return t.Invoke(stream);
- }
- });
- }
-
- private void CacheEntryFilterDestroy(void* target, long objPtr)
- {
- SafeCall(() => _ignite.HandleRegistry.Release(objPtr));
- }
-
- private void CacheInvoke(void* target, long inMemPtr, long outMemPtr)
- {
- SafeCall(() =>
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Get(inMemPtr).Stream())
- {
- var result = ReadAndRunCacheEntryProcessor(inStream, _ignite);
-
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Get(outMemPtr).Stream())
- {
- result.Write(outStream, _ignite.Marshaller);
-
- outStream.SynchronizeOutput();
- }
- }
- });
- }
-
- /// <summary>
- /// Reads cache entry processor and related data from stream, executes it and returns the result.
- /// </summary>
- /// <param name="inOutStream">Stream.</param>
- /// <param name="grid">Grid.</param>
- /// <returns>CacheEntryProcessor result.</returns>
- private CacheEntryProcessorResultHolder ReadAndRunCacheEntryProcessor(IPortableStream inOutStream,
- Ignite grid)
- {
- var marsh = grid.Marshaller;
-
- var key = marsh.Unmarshal<object>(inOutStream);
- var val = marsh.Unmarshal<object>(inOutStream);
- var isLocal = inOutStream.ReadBool();
-
- var holder = isLocal
- ? _handleRegistry.Get<CacheEntryProcessorHolder>(inOutStream.ReadLong(), true)
- : marsh.Unmarshal<CacheEntryProcessorHolder>(inOutStream);
-
- return holder.Process(key, val, val != null, grid);
- }
-
- #endregion
-
- #region IMPLEMENTATION: COMPUTE
-
- private void ComputeTaskMap(void* target, long taskPtr, long inMemPtr, long outMemPtr)
- {
- SafeCall(() =>
- {
- using (PlatformMemoryStream inStream = IgniteManager.Memory.Get(inMemPtr).Stream())
- {
- using (PlatformMemoryStream outStream = IgniteManager.Memory.Get(outMemPtr).Stream())
- {
- Task(taskPtr).Map(inStream, outStream);
- }
- }
- });
- }
-
- private int ComputeTaskJobResult(void* target, long taskPtr, long jobPtr, long memPtr)
- {
- return SafeCall(() =>
- {
- var task = Task(taskPtr);
-
- if (memPtr == 0)
- {
- return task.JobResultLocal(Job(jobPtr));
- }
-
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return task.JobResultRemote(Job(jobPtr), stream);
- }
- });
- }
-
- private void ComputeTaskReduce(void* target, long taskPtr)
- {
- SafeCall(() =>
- {
- var task = _handleRegistry.Get<IComputeTaskHolder>(taskPtr, true);
-
- task.Reduce();
- });
- }
-
- private void ComputeTaskComplete(void* target, long taskPtr, long memPtr)
- {
- SafeCall(() =>
- {
- var task = _handleRegistry.Get<IComputeTaskHolder>(taskPtr, true);
-
- if (memPtr == 0)
- task.Complete(taskPtr);
- else
- {
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- task.CompleteWithError(taskPtr, stream);
- }
- }
- });
- }
-
- private int ComputeJobSerialize(void* target, long jobPtr, long memPtr)
- {
- return SafeCall(() =>
- {
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return Job(jobPtr).Serialize(stream) ? 1 : 0;
- }
- });
- }
-
- private long ComputeJobCreate(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- ComputeJobHolder job = ComputeJobHolder.CreateJob(_ignite, stream);
-
- return _handleRegistry.Allocate(job);
- }
- });
- }
-
- private void ComputeJobExecute(void* target, long jobPtr, int cancel, long memPtr)
- {
- SafeCall(() =>
- {
- var job = Job(jobPtr);
-
- if (memPtr == 0)
- job.ExecuteLocal(cancel == 1);
- else
- {
- using (PlatformMemoryStream stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- job.ExecuteRemote(stream, cancel == 1);
- }
- }
- });
- }
-
- private void ComputeJobCancel(void* target, long jobPtr)
- {
- SafeCall(() =>
- {
- Job(jobPtr).Cancel();
- });
- }
-
- private void ComputeJobDestroy(void* target, long jobPtr)
- {
- SafeCall(() =>
- {
- _handleRegistry.Release(jobPtr);
- });
- }
-
- /// <summary>
- /// Get compute task using it's GC handle pointer.
- /// </summary>
- /// <param name="taskPtr">Task pointer.</param>
- /// <returns>Compute task.</returns>
- private IComputeTaskHolder Task(long taskPtr)
- {
- return _handleRegistry.Get<IComputeTaskHolder>(taskPtr);
- }
-
- /// <summary>
- /// Get comptue job using it's GC handle pointer.
- /// </summary>
- /// <param name="jobPtr">Job pointer.</param>
- /// <returns>Compute job.</returns>
- private ComputeJobHolder Job(long jobPtr)
- {
- return _handleRegistry.Get<ComputeJobHolder>(jobPtr);
- }
-
- #endregion
-
- #region IMPLEMENTATION: CONTINUOUS QUERY
-
- private void ContinuousQueryListenerApply(void* target, long lsnrPtr, long memPtr)
- {
- SafeCall(() =>
- {
- var hnd = _handleRegistry.Get<IContinuousQueryHandleImpl>(lsnrPtr);
-
- hnd.Apply(IgniteManager.Memory.Get(memPtr).Stream());
- });
- }
-
- [SuppressMessage("ReSharper", "PossibleNullReferenceException")]
- private long ContinuousQueryFilterCreate(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- // 1. Unmarshal filter holder.
- IPortableStream stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- ContinuousQueryFilterHolder filterHolder = reader.ReadObject<ContinuousQueryFilterHolder>();
-
- // 2. Create real filter from it's holder.
- Type filterWrapperTyp = typeof(ContinuousQueryFilter<,>)
- .MakeGenericType(filterHolder.KeyType, filterHolder.ValueType);
-
- Type filterTyp = typeof(ICacheEntryEventFilter<,>)
- .MakeGenericType(filterHolder.KeyType, filterHolder.ValueType);
-
- var filter = (IContinuousQueryFilter)filterWrapperTyp
- .GetConstructor(new[] { filterTyp, typeof(bool) })
- .Invoke(new[] { filterHolder.Filter, filterHolder.KeepPortable });
-
- // 3. Inject grid.
- filter.Inject(_ignite);
-
- // 4. Allocate GC handle.
- return filter.Allocate();
- });
- }
-
- private int ContinuousQueryFilterApply(void* target, long filterPtr, long memPtr)
- {
- return SafeCall(() =>
- {
- var holder = _handleRegistry.Get<IContinuousQueryFilter>(filterPtr);
-
- return holder.Evaluate(IgniteManager.Memory.Get(memPtr).Stream()) ? 1 : 0;
- });
- }
-
- private void ContinuousQueryFilterRelease(void* target, long filterPtr)
- {
- SafeCall(() =>
- {
- var holder = _handleRegistry.Get<IContinuousQueryFilter>(filterPtr);
-
- holder.Release();
- });
- }
-
- #endregion
-
- #region IMPLEMENTATION: DATA STREAMER
-
- private void DataStreamerTopologyUpdate(void* target, long ldrPtr, long topVer, int topSize)
- {
- SafeCall(() =>
- {
- var ldrRef = _handleRegistry.Get<WeakReference>(ldrPtr);
-
- if (ldrRef == null)
- return;
-
- var ldr = ldrRef.Target as IDataStreamer;
-
- if (ldr != null)
- ldr.TopologyChange(topVer, topSize);
- else
- _handleRegistry.Release(ldrPtr, true);
- });
- }
-
- private void DataStreamerStreamReceiverInvoke(void* target, long rcvPtr, void* cache, long memPtr,
- byte keepPortable)
- {
- SafeCall(() =>
- {
- var stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- var reader = _ignite.Marshaller.StartUnmarshal(stream, PortableMode.ForcePortable);
-
- var portableReceiver = reader.ReadObject<PortableUserObject>();
-
- var receiver = _handleRegistry.Get<StreamReceiverHolder>(rcvPtr) ??
- portableReceiver.Deserialize<StreamReceiverHolder>();
-
- if (receiver != null)
- receiver.Receive(_ignite, new UnmanagedNonReleaseableTarget(_ctx.NativeContext, cache), stream,
- keepPortable != 0);
- });
- }
-
- #endregion
-
- #region IMPLEMENTATION: FUTURES
-
- private void FutureByteResult(void* target, long futPtr, int res)
- {
- SafeCall(() =>
- {
- ProcessFuture<byte>(futPtr, fut => { fut.OnResult((byte)res); });
- });
- }
-
- private void FutureBoolResult(void* target, long futPtr, int res)
- {
- SafeCall(() =>
- {
- ProcessFuture<bool>(futPtr, fut => { fut.OnResult(res == 1); });
- });
- }
-
- private void FutureShortResult(void* target, long futPtr, int res)
- {
- SafeCall(() =>
- {
- ProcessFuture<short>(futPtr, fut => { fut.OnResult((short)res); });
- });
- }
-
- private void FutureCharResult(void* target, long futPtr, int res)
- {
- SafeCall(() =>
- {
- ProcessFuture<char>(futPtr, fut => { fut.OnResult((char)res); });
- });
- }
-
- private void FutureIntResult(void* target, long futPtr, int res)
- {
- SafeCall(() =>
- {
- ProcessFuture<int>(futPtr, fut => { fut.OnResult(res); });
- });
- }
-
- private void FutureFloatResult(void* target, long futPtr, float res)
- {
- SafeCall(() =>
- {
- ProcessFuture<float>(futPtr, fut => { fut.OnResult(res); });
- });
- }
-
- private void FutureLongResult(void* target, long futPtr, long res)
- {
- SafeCall(() =>
- {
- ProcessFuture<long>(futPtr, fut => { fut.OnResult(res); });
- });
- }
-
- private void FutureDoubleResult(void* target, long futPtr, double res)
- {
- SafeCall(() =>
- {
- ProcessFuture<double>(futPtr, fut => { fut.OnResult(res); });
- });
- }
-
- private void FutureObjectResult(void* target, long futPtr, long memPtr)
- {
- SafeCall(() =>
- {
- ProcessFuture(futPtr, fut =>
- {
- IPortableStream stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- fut.OnResult(stream);
- });
- });
- }
-
- private void FutureNullResult(void* target, long futPtr)
- {
- SafeCall(() =>
- {
- ProcessFuture(futPtr, fut => { fut.OnNullResult(); });
- });
- }
-
- private void FutureError(void* target, long futPtr, long memPtr)
- {
- SafeCall(() =>
- {
- IPortableStream stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- PortableReaderImpl reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- string errCls = reader.ReadString();
- string errMsg = reader.ReadString();
-
- Exception err = ExceptionUtils.GetException(errCls, errMsg, reader);
-
- ProcessFuture(futPtr, fut => { fut.OnError(err); });
- });
- }
-
- /// <summary>
- /// Process future.
- /// </summary>
- /// <param name="futPtr">Future pointer.</param>
- /// <param name="action">Action.</param>
- private void ProcessFuture(long futPtr, Action<IFutureInternal> action)
- {
- try
- {
- action(_handleRegistry.Get<IFutureInternal>(futPtr, true));
- }
- finally
- {
- _handleRegistry.Release(futPtr);
- }
- }
-
- /// <summary>
- /// Process future.
- /// </summary>
- /// <param name="futPtr">Future pointer.</param>
- /// <param name="action">Action.</param>
- private void ProcessFuture<T>(long futPtr, Action<Future<T>> action)
- {
- try
- {
- action(_handleRegistry.Get<Future<T>>(futPtr, true));
- }
- finally
- {
- _handleRegistry.Release(futPtr);
- }
- }
-
- #endregion
-
- #region IMPLEMENTATION: LIFECYCLE
-
- private void LifecycleOnEvent(void* target, long ptr, int evt)
- {
- SafeCall(() =>
- {
- var bean = _handleRegistry.Get<LifecycleBeanHolder>(ptr);
-
- bean.OnLifecycleEvent((LifecycleEventType)evt);
- }, true);
- }
-
- #endregion
-
- #region IMPLEMENTATION: MESSAGING
-
- private long MessagingFilterCreate(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- MessageFilterHolder holder = MessageFilterHolder.CreateRemote(_ignite, memPtr);
-
- return _ignite.HandleRegistry.AllocateSafe(holder);
- });
- }
-
- private int MessagingFilterApply(void* target, long ptr, long memPtr)
- {
- return SafeCall(() =>
- {
- var holder = _ignite.HandleRegistry.Get<MessageFilterHolder>(ptr, false);
-
- if (holder == null)
- return 0;
-
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return holder.Invoke(stream);
- }
- });
- }
-
- private void MessagingFilterDestroy(void* target, long ptr)
- {
- SafeCall(() =>
- {
- _ignite.HandleRegistry.Release(ptr);
- });
- }
-
- #endregion
-
- #region IMPLEMENTATION: EXTENSIONS
-
- private long ExtensionCallbackInLongOutLong(void* target, int op, long arg1)
- {
- throw new InvalidOperationException("Unsupported operation type: " + op);
- }
-
- private long ExtensionCallbackInLongLongOutLong(void* target, int op, long arg1, long arg2)
- {
- return SafeCall(() =>
- {
- switch (op)
- {
- case OpPrepareDotNet:
- var inMem = IgniteManager.Memory.Get(arg1);
- var outMem = IgniteManager.Memory.Get(arg2);
-
- PlatformMemoryStream inStream = inMem.Stream();
- PlatformMemoryStream outStream = outMem.Stream();
-
- Ignition.OnPrepare(inStream, outStream, _handleRegistry);
-
- return 0;
-
- default:
- throw new InvalidOperationException("Unsupported operation type: " + op);
- }
- }, op == OpPrepareDotNet);
- }
-
- #endregion
-
- #region IMPLEMENTATION: EVENTS
-
- private long EventFilterCreate(void* target, long memPtr)
- {
- return SafeCall(() => _handleRegistry.Allocate(RemoteListenEventFilter.CreateInstance(memPtr, _ignite)));
- }
-
- private int EventFilterApply(void* target, long ptr, long memPtr)
- {
- return SafeCall(() =>
- {
- var holder = _ignite.HandleRegistry.Get<IInteropCallback>(ptr, false);
-
- if (holder == null)
- return 0;
-
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- return holder.Invoke(stream);
- }
- });
- }
-
- private void EventFilterDestroy(void* target, long ptr)
- {
- SafeCall(() =>
- {
- _ignite.HandleRegistry.Release(ptr);
- });
- }
-
- #endregion
-
- #region IMPLEMENTATION: SERVICES
-
- private long ServiceInit(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- bool srvKeepPortable = reader.ReadBoolean();
- var svc = reader.ReadObject<IService>();
-
- ResourceProcessor.Inject(svc, _ignite);
-
- svc.Init(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
-
- return _handleRegistry.Allocate(svc);
- }
- });
- }
-
- private void ServiceExecute(void* target, long svcPtr, long memPtr)
- {
- SafeCall(() =>
- {
- var svc = _handleRegistry.Get<IService>(svcPtr, true);
-
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- bool srvKeepPortable = reader.ReadBoolean();
-
- svc.Execute(new ServiceContext(
- _ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
- }
- });
- }
-
- private void ServiceCancel(void* target, long svcPtr, long memPtr)
- {
- SafeCall(() =>
- {
- var svc = _handleRegistry.Get<IService>(svcPtr, true);
-
- try
- {
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- bool srvKeepPortable = reader.ReadBoolean();
-
- svc.Cancel(new ServiceContext(_ignite.Marshaller.StartUnmarshal(stream, srvKeepPortable)));
- }
- }
- finally
- {
- _ignite.HandleRegistry.Release(svcPtr);
- }
- });
- }
-
- private void ServiceInvokeMethod(void* target, long svcPtr, long inMemPtr, long outMemPtr)
- {
- SafeCall(() =>
- {
- using (var inStream = IgniteManager.Memory.Get(inMemPtr).Stream())
- using (var outStream = IgniteManager.Memory.Get(outMemPtr).Stream())
- {
- var svc = _handleRegistry.Get<IService>(svcPtr, true);
-
- string mthdName;
- object[] mthdArgs;
-
- ServiceProxySerializer.ReadProxyMethod(inStream, _ignite.Marshaller, out mthdName, out mthdArgs);
-
- var result = ServiceProxyInvoker.InvokeServiceMethod(svc, mthdName, mthdArgs);
-
- ServiceProxySerializer.WriteInvocationResult(outStream, _ignite.Marshaller, result.Key, result.Value);
-
- outStream.SynchronizeOutput();
- }
- });
- }
-
- private int СlusterNodeFilterApply(void* target, long memPtr)
- {
- return SafeCall(() =>
- {
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- var filter = (IClusterNodeFilter) reader.ReadObject<PortableOrSerializableObjectHolder>().Item;
-
- return filter.Invoke(_ignite.GetNode(reader.ReadGuid())) ? 1 : 0;
- }
- });
- }
-
- #endregion
-
- #region IMPLEMENTATION: MISCELLANEOUS
-
- private void NodeInfo(void* target, long memPtr)
- {
- SafeCall(() => _ignite.UpdateNodeInfo(memPtr));
- }
-
- private void MemoryReallocate(void* target, long memPtr, int cap)
- {
- SafeCall(() =>
- {
- IgniteManager.Memory.Get(memPtr).Reallocate(cap);
- }, true);
- }
-
- private void OnStart(void* target, void* proc, long memPtr)
- {
- SafeCall(() =>
- {
- var proc0 = UnmanagedUtils.Acquire(_ctx, proc);
-
- Ignition.OnStart(proc0, IgniteManager.Memory.Get(memPtr).Stream());
- }, true);
- }
-
- private void OnStop(void* target)
- {
- Marshal.FreeHGlobal(_cbsPtr);
-
- // ReSharper disable once ImpureMethodCallOnReadonlyValueField
- _thisHnd.Free();
-
- // Allow context to be collected, which will cause resource cleanup in finalizer.
- _ctx = null;
- }
-
- private void Error(void* target, int errType, sbyte* errClsChars, int errClsCharsLen, sbyte* errMsgChars,
- int errMsgCharsLen, void* errData, int errDataLen)
- {
- string errCls = IgniteUtils.Utf8UnmanagedToString(errClsChars, errClsCharsLen);
- string errMsg = IgniteUtils.Utf8UnmanagedToString(errMsgChars, errMsgCharsLen);
-
- switch (errType)
- {
- case ErrGeneric:
- if (_ignite != null && errDataLen > 0)
- throw ExceptionUtils.GetException(errCls, errMsg,
- _ignite.Marshaller.StartUnmarshal(new PlatformRawMemory(errData, errDataLen).Stream()));
-
- throw ExceptionUtils.GetException(errCls, errMsg);
-
- case ErrJvmInit:
- throw ExceptionUtils.GetJvmInitializeException(errCls, errMsg);
-
- case ErrJvmAttach:
- throw new IgniteException("Failed to attach to JVM.");
-
- default:
- throw new IgniteException("Unknown exception [cls=" + errCls + ", msg=" + errMsg + ']');
- }
- }
-
- #endregion
-
- #region HELPERS
-
- private void SafeCall(Action func, bool allowUnitialized = false)
- {
- if (!allowUnitialized)
- _initEvent.Wait();
-
- try
- {
- func();
- }
- catch (Exception e)
- {
- UU.ThrowToJava(_ctx.NativeContext, e);
- }
- }
-
- private T SafeCall<T>(Func<T> func, bool allowUnitialized = false)
- {
- if (!allowUnitialized)
- _initEvent.Wait();
-
- try
- {
- return func();
- }
- catch (Exception e)
- {
- UU.ThrowToJava(_ctx.NativeContext, e);
-
- return default(T);
- }
- }
-
- #endregion
-
- /// <summary>
- /// Callbacks pointer.
- /// </summary>
- public void* CallbacksPointer
- {
- get { return _cbsPtr.ToPointer(); }
- }
-
- /// <summary>
- /// Gets the context.
- /// </summary>
- public UnmanagedContext Context
- {
- get { return _ctx; }
- }
-
- /// <summary>
- /// Create function pointer for the given function.
- /// </summary>
- private void* CreateFunctionPointer(Delegate del)
- {
- _delegates.Add(del); // Prevent delegate from being GC-ed.
-
- return Marshal.GetFunctionPointerForDelegate(del).ToPointer();
- }
-
- /// <param name="context">Context.</param>
- public void SetContext(void* context)
- {
- Debug.Assert(context != null);
- Debug.Assert(_ctx == null);
-
- _ctx = new UnmanagedContext(context);
- }
-
- /// <summary>
- /// Initializes this instance with grid.
- /// </summary>
- /// <param name="grid">Grid.</param>
- public void Initialize(Ignite grid)
- {
- Debug.Assert(grid != null);
-
- _ignite = grid;
-
- lock (_initActions)
- {
- _initActions.ForEach(x => x(grid));
-
- _initActions.Clear();
- }
-
- _initEvent.Set();
- }
-
- /// <summary>
- /// Cleanups this instance.
- /// </summary>
- public void Cleanup()
- {
- _ignite = null;
-
- _handleRegistry.Close();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedContext.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedContext.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedContext.cs
deleted file mode 100644
index 89d2071..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedContext.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- /// <summary>
- /// Unmanaged context.
- /// Wrapper around native ctx pointer to track finalization.
- /// </summary>
- internal unsafe class UnmanagedContext
- {
- /** Context */
- private readonly void* _nativeCtx;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public UnmanagedContext(void* ctx)
- {
- _nativeCtx = ctx;
- }
-
- /// <summary>
- /// Gets the native context pointer.
- /// </summary>
- public void* NativeContext
- {
- get { return _nativeCtx; }
- }
-
- /// <summary>
- /// Destructor.
- /// </summary>
- ~UnmanagedContext()
- {
- UnmanagedUtils.DeleteContext(_nativeCtx); // Release CPP object.
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedNonReleaseableTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedNonReleaseableTarget.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedNonReleaseableTarget.cs
deleted file mode 100644
index 24db5a5..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedNonReleaseableTarget.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System;
-
- /// <summary>
- /// Unmanaged target which does not require explicit release.
- /// </summary>
- internal unsafe class UnmanagedNonReleaseableTarget : IUnmanagedTarget
- {
- /** Context. */
- private readonly void* _ctx;
-
- /** Target. */
- private readonly void* _target;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="target">Target.</param>
- public UnmanagedNonReleaseableTarget(void* ctx, void* target)
- {
- _ctx = ctx;
- _target = target;
- }
-
- /** <inheritdoc /> */
- public void* Context
- {
- get { return _ctx; }
- }
-
- /** <inheritdoc /> */
- public void* Target
- {
- get { return _target; }
- }
-
- /** <inheritdoc /> */
- public IUnmanagedTarget ChangeTarget(void* target)
- {
- throw new NotSupportedException();
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedTarget.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedTarget.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedTarget.cs
deleted file mode 100644
index e54a199..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Unmanaged/UnmanagedTarget.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Unmanaged
-{
- using System;
- using System.Runtime.InteropServices;
- using UU = UnmanagedUtils;
-
- /// <summary>
- /// Base unmanaged target implementation.
- /// </summary>
- internal unsafe sealed class UnmanagedTarget : CriticalHandle, IUnmanagedTarget
- {
- /** Context. */
- private readonly UnmanagedContext _ctx;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ctx">Context.</param>
- /// <param name="target">Target.</param>
- public UnmanagedTarget(UnmanagedContext ctx, void* target)
- : base(IntPtr.Zero)
- {
- _ctx = ctx;
-
- SetHandle(new IntPtr(target));
- }
-
- /** <inheritdoc /> */
- public void* Context
- {
- get { return _ctx.NativeContext; }
- }
-
- /** <inheritdoc /> */
- public void* Target
- {
- get { return handle.ToPointer(); }
- }
-
- /** <inheritdoc /> */
- public IUnmanagedTarget ChangeTarget(void* target)
- {
- return new UnmanagedTarget(_ctx, target);
- }
-
- /** <inheritdoc /> */
- protected override bool ReleaseHandle()
- {
- UU.Release(this);
-
- return true;
- }
-
- /** <inheritdoc /> */
- public override bool IsInvalid
- {
- get { return handle == IntPtr.Zero; }
- }
- }
-}
[49/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/linux/src/concurrent_os.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/linux/src/concurrent_os.cpp b/modules/platform/src/main/cpp/common/os/linux/src/concurrent_os.cpp
deleted file mode 100644
index 44f0b22..0000000
--- a/modules/platform/src/main/cpp/common/os/linux/src/concurrent_os.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/common/concurrent_os.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /** Key indicating that the thread is attached. */
- static pthread_key_t tlsKey;
-
- /** Helper to ensure that attach key is allocated only once. */
- static pthread_once_t tlsKeyInit = PTHREAD_ONCE_INIT;
-
- /**
- * Routine to destroy TLS key.
- *
- * @param key Key.
- */
- void DestroyTlsKey(void* key) {
- ThreadLocal::Clear0(key);
- }
-
- /**
- * Routine to allocate TLS key.
- */
- void AllocateTlsKey() {
- pthread_key_create(&tlsKey, DestroyTlsKey);
- }
-
- void Memory::Fence() {
- __asm__ volatile ("" ::: "memory");
- }
-
- CriticalSection::CriticalSection() {
- pthread_mutex_init(&mux, NULL);
-
- Memory::Fence();
- }
-
- CriticalSection::~CriticalSection() {
- Memory::Fence();
-
- pthread_mutex_destroy(&mux);
- }
-
- void CriticalSection::Enter() {
- Memory::Fence();
-
- pthread_mutex_lock(&mux);
- }
-
- void CriticalSection::Leave() {
- Memory::Fence();
-
- pthread_mutex_unlock(&mux);
- }
-
- SingleLatch::SingleLatch()
- {
- pthread_mutex_init(&mux, NULL);
- pthread_cond_init(&cond, NULL);
- ready = false;
-
- Memory::Fence();
- }
-
- SingleLatch::~SingleLatch()
- {
- Memory::Fence();
-
- pthread_cond_destroy(&cond);
- pthread_mutex_destroy(&mux);
- }
-
- void SingleLatch::CountDown()
- {
- pthread_mutex_lock(&mux);
-
- if (!ready) {
- ready = true;
-
- pthread_cond_broadcast(&cond);
- }
-
- pthread_mutex_unlock(&mux);
-
- Memory::Fence();
- }
-
- void SingleLatch::Await()
- {
- pthread_mutex_lock(&mux);
-
- while (!ready)
- pthread_cond_wait(&cond, &mux);
-
- pthread_mutex_unlock(&mux);
-
- Memory::Fence();
- }
-
- bool Atomics::CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal)
- {
- return __sync_bool_compare_and_swap(ptr, expVal, newVal);
- }
-
- int32_t Atomics::CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal)
- {
- return __sync_val_compare_and_swap(ptr, expVal, newVal);
- }
-
- int32_t Atomics::IncrementAndGet32(int32_t* ptr)
- {
- return __sync_fetch_and_add(ptr, 1) + 1;
- }
-
- int32_t Atomics::DecrementAndGet32(int32_t* ptr)
- {
- return __sync_fetch_and_sub(ptr, 1) - 1;
- }
-
- bool Atomics::CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal)
- {
- return __sync_bool_compare_and_swap(ptr, expVal, newVal);
- }
-
- int64_t Atomics::CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal)
- {
- return __sync_val_compare_and_swap(ptr, expVal, newVal);
- }
-
- int64_t Atomics::IncrementAndGet64(int64_t* ptr)
- {
- return __sync_fetch_and_add(ptr, 1) + 1;
- }
-
- int64_t Atomics::DecrementAndGet64(int64_t* ptr)
- {
- return __sync_fetch_and_sub(ptr, 1) - 1;
- }
-
- void* ThreadLocal::Get0()
- {
- pthread_once(&tlsKeyInit, AllocateTlsKey);
-
- return pthread_getspecific(tlsKey);
- }
-
- void ThreadLocal::Set0(void* ptr)
- {
- pthread_once(&tlsKeyInit, AllocateTlsKey);
-
- pthread_setspecific(tlsKey, ptr);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
deleted file mode 100644
index 9e57bde..0000000
--- a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/common.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * 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_COMMON_COMMON
-#define _IGNITE_COMMON_COMMON
-
-#define IGNITE_EXPORT __declspec(dllexport)
-#define IGNITE_IMPORT __declspec(dllimport)
-#define IGNITE_CALL __stdcall
-
-#define IGNITE_IMPORT_EXPORT IGNITE_EXPORT
-
-#include <iostream>
-
-#define IGNITE_TRACE_ALLOC(addr) \
- std::cout << "ALLOC " << __FILE__ << "(" << __LINE__ << "): 0x" << (void*)addr << std::endl;
-
-/**
- * Common construction to disable copy constructor and assignment for class.
- */
-#define IGNITE_NO_COPY_ASSIGNMENT(cls) \
- cls(const cls& src); \
- cls& operator= (const cls& other);
-
-namespace ignite
-{
- namespace common
- {
- /**
- * Helper class to manage attached threads.
- */
- class AttachHelper
- {
- public:
- /**
- * Callback invoked on successful thread attach ot JVM.
- */
- static void OnThreadAttach();
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h b/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
deleted file mode 100644
index 0a47beb..0000000
--- a/modules/platform/src/main/cpp/common/os/win/include/ignite/common/concurrent_os.h
+++ /dev/null
@@ -1,406 +0,0 @@
-/*
- * 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_COMMON_CONCURRENT_OS
-#define _IGNITE_COMMON_CONCURRENT_OS
-
-#include <map>
-#include <stdint.h>
-#include <windows.h>
-
-#include "ignite/common/common.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /**
- * Static class to manage memory visibility semantics.
- */
- class IGNITE_IMPORT_EXPORT Memory {
- public:
- /**
- * Full fence.
- */
- static void Fence();
- };
-
- /**
- * Critical section.
- */
- class IGNITE_IMPORT_EXPORT CriticalSection {
- public:
- /**
- * Constructor.
- */
- CriticalSection();
-
- /**
- * Destructor.
- */
- ~CriticalSection();
-
- /**
- * Enter critical section.
- */
- void Enter();
-
- /**
- * Leave critical section.
- */
- void Leave();
- private:
- /** Handle. */
- CRITICAL_SECTION* hnd;
-
- IGNITE_NO_COPY_ASSIGNMENT(CriticalSection)
- };
-
- /**
- * Special latch with count = 1.
- */
- class IGNITE_IMPORT_EXPORT SingleLatch
- {
- public:
- /**
- * Constructor.
- */
- SingleLatch();
-
- /**
- * Destructor.
- */
- ~SingleLatch();
-
- /**
- * Perform the countdown.
- */
- void CountDown();
-
- /**
- * Await the countdown.
- */
- void Await();
- private:
- /** Handle. */
- void* hnd;
-
- IGNITE_NO_COPY_ASSIGNMENT(SingleLatch)
- };
-
- /**
- * Primitives for atomic access.
- */
- class IGNITE_IMPORT_EXPORT Atomics
- {
- public:
- /**
- * Update the 32-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return True if update occurred as a result of this call, false otherwise.
- */
- static bool CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal);
-
- /**
- * Update the 32-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return Value which were observed during CAS attempt.
- */
- static int32_t CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal);
-
- /**
- * Increment 32-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after increment.
- */
- static int32_t IncrementAndGet32(int32_t* ptr);
-
- /**
- * Decrement 32-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after decrement.
- */
- static int32_t DecrementAndGet32(int32_t* ptr);
-
- /**
- * Update the 64-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return True if update occurred as a result of this call, false otherwise.
- */
- static bool CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal);
-
- /**
- * Update the 64-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return Value which were observed during CAS attempt.
- */
- static int64_t CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal);
-
- /**
- * Increment 64-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after increment.
- */
- static int64_t IncrementAndGet64(int64_t* ptr);
-
- /**
- * Decrement 64-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after decrement.
- */
- static int64_t DecrementAndGet64(int64_t* ptr);
- };
-
- /**
- * Thread-local entry.
- */
- class IGNITE_IMPORT_EXPORT ThreadLocalEntry
- {
- public:
- /**
- * Virtual destructor to allow for correct typed entries cleanup.
- */
- virtual ~ThreadLocalEntry()
- {
- // No-op.
- }
- };
-
- /**
- * Typed thread-local entry.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT ThreadLocalTypedEntry : public ThreadLocalEntry
- {
- public:
- /**
- * Constructor.
- *
- * @param val Value.
- */
- ThreadLocalTypedEntry(T val) : val(val)
- {
- // No-op.
- }
-
- ~ThreadLocalTypedEntry()
- {
- // No-op.
- }
-
- /**
- * Get value.
- *
- * @return Value.
- */
- T Get()
- {
- return val;
- }
- private:
- /** Value. */
- T val;
- };
-
- /**
- * Thread-local abstraction.
- */
- class IGNITE_IMPORT_EXPORT ThreadLocal
- {
- public:
- /**
- * Allocate thread-local index. Invoked once on DLL process attach.
- *
- * @return True if allocation was successful.
- */
- static bool OnProcessAttach();
-
- /**
- * Release thread-local entry. Invoked on DLL thread detach.
- */
- static void OnThreadDetach();
-
- /**
- * Release thread-local index. Invoked once on DLL process detach.
- */
- static void OnProcessDetach();
-
- /**
- * Get next available index to be used in thread-local storage.
- *
- * @return Index.
- */
- static int32_t NextIndex();
-
- /**
- * Get value by index.
- *
- * @param idx Index.
- * @return Value associated with the index or NULL.
- */
- template<typename T>
- static T Get(int32_t idx)
- {
- void* winVal = Get0();
-
- if (winVal)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(winVal);
-
- ThreadLocalTypedEntry<T>* entry = static_cast<ThreadLocalTypedEntry<T>*>((*map)[idx]);
-
- if (entry)
- return entry->Get();
- }
-
- return T();
- }
-
- /**
- * Set value at the given index.
- *
- * @param idx Index.
- * @param val Value to be associated with the index.
- */
- template<typename T>
- static void Set(int32_t idx, const T& val)
- {
- void* winVal = Get0();
-
- if (winVal)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(winVal);
-
- ThreadLocalEntry* appVal = (*map)[idx];
-
- if (appVal)
- delete appVal;
-
- (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
- }
- else
- {
- std::map<int32_t, ThreadLocalEntry*>* map = new std::map<int32_t, ThreadLocalEntry*>();
-
- Set0(map);
-
- (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
- }
- }
-
- /**
- * Remove value at the given index.
- *
- * @param idx Index.
- */
- static void Remove(int32_t idx);
-
- private:
- /**
- * Internal get routine.
- *
- * @param Associated value.
- */
- static void* Get0();
-
- /**
- * Internal set routine.
- *
- * @param ptr Pointer.
- */
- static void Set0(void* ptr);
-
- /**
- * Internal thread-local map clear routine.
- *
- * @param mapPtr Pointer to map.
- */
- static void Clear0(void* mapPtr);
- };
-
- /**
- * Thread-local instance. Simplifies API avoiding direct index allocations.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT ThreadLocalInstance
- {
- public:
- /**
- * Constructor.
- */
- ThreadLocalInstance() : idx(ThreadLocal::NextIndex())
- {
- // No-op.
- }
-
- /**
- * Get value.
- *
- * @return Value.
- */
- T Get()
- {
- return ThreadLocal::Get<T>(idx);
- }
-
- /**
- * Set instance.
- *
- * @param val Value.
- */
- void Set(const T& val)
- {
- ThreadLocal::Set<T>(idx, val);
- }
-
- /**
- * Remove instance.
- */
- void Remove()
- {
- ThreadLocal::Remove(idx);
- }
-
- private:
- /** Index. */
- int32_t idx;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/win/src/common.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/src/common.cpp b/modules/platform/src/main/cpp/common/os/win/src/common.cpp
deleted file mode 100644
index e83e736..0000000
--- a/modules/platform/src/main/cpp/common/os/win/src/common.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.
- */
-
-#include <windows.h>
-
-#include "ignite/common/common.h"
-#include "ignite/common/concurrent.h"
-#include "ignite/common/java.h"
-
-using namespace ignite::common::concurrent;
-using namespace ignite::common::java;
-
-namespace ignite
-{
- namespace common
- {
- void AttachHelper::OnThreadAttach()
- {
- // No-op.
- }
- }
-}
-
-BOOL WINAPI DllMain(_In_ HINSTANCE hinstDLL, _In_ DWORD fdwReason, _In_ LPVOID lpvReserved)
-{
- switch (fdwReason)
- {
- case DLL_PROCESS_ATTACH:
- if (!ThreadLocal::OnProcessAttach())
- return FALSE;
-
- break;
-
- case DLL_THREAD_DETACH:
- ThreadLocal::OnThreadDetach();
-
- JniContext::Detach();
-
- break;
-
- case DLL_PROCESS_DETACH:
- ThreadLocal::OnProcessDetach();
-
- break;
-
- default:
- break;
- }
-
- return TRUE;
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp b/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
deleted file mode 100644
index a21f7ec..0000000
--- a/modules/platform/src/main/cpp/common/os/win/src/concurrent_os.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/common/concurrent_os.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /** Thread-local index for Windows. */
- DWORD winTlsIdx;
-
- void Memory::Fence() {
- MemoryBarrier();
- }
-
- CriticalSection::CriticalSection() : hnd(new CRITICAL_SECTION) {
- InitializeCriticalSection(hnd);
-
- Memory::Fence();
- }
-
- CriticalSection::~CriticalSection() {
- Memory::Fence();
-
- delete hnd;
- }
-
- void CriticalSection::Enter() {
- Memory::Fence();
-
- EnterCriticalSection(hnd);
- }
-
- void CriticalSection::Leave() {
- Memory::Fence();
-
- LeaveCriticalSection(hnd);
- }
-
- SingleLatch::SingleLatch() : hnd(CreateEvent(NULL, TRUE, FALSE, NULL))
- {
- Memory::Fence();
- }
-
- SingleLatch::~SingleLatch()
- {
- Memory::Fence();
-
- CloseHandle(hnd);
- }
-
- void SingleLatch::CountDown()
- {
- SetEvent(hnd);
- }
-
- void SingleLatch::Await()
- {
- WaitForSingleObject(hnd, INFINITE);
- }
-
- bool Atomics::CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal)
- {
- return CompareAndSet32Val(ptr, expVal, newVal) == expVal;
- }
-
- int32_t Atomics::CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal)
- {
- return InterlockedCompareExchange(reinterpret_cast<LONG*>(ptr), newVal, expVal);
- }
-
- int32_t Atomics::IncrementAndGet32(int32_t* ptr)
- {
- return InterlockedIncrement(reinterpret_cast<LONG*>(ptr));
- }
-
- int32_t Atomics::DecrementAndGet32(int32_t* ptr)
- {
- return InterlockedDecrement(reinterpret_cast<LONG*>(ptr));
- }
-
- bool Atomics::CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal)
- {
- return CompareAndSet64Val(ptr, expVal, newVal) == expVal;
- }
-
- int64_t Atomics::CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal)
- {
- return InterlockedCompareExchange64(reinterpret_cast<LONG64*>(ptr), newVal, expVal);
- }
-
- int64_t Atomics::IncrementAndGet64(int64_t* ptr)
- {
- return InterlockedIncrement64(reinterpret_cast<LONG64*>(ptr));
- }
-
- int64_t Atomics::DecrementAndGet64(int64_t* ptr)
- {
- return InterlockedDecrement64(reinterpret_cast<LONG64*>(ptr));
- }
-
- bool ThreadLocal::OnProcessAttach()
- {
- return (winTlsIdx = TlsAlloc()) != TLS_OUT_OF_INDEXES;
- }
-
- void ThreadLocal::OnThreadDetach()
- {
- if (winTlsIdx != TLS_OUT_OF_INDEXES)
- {
- void* mapPtr = Get0();
-
- Clear0(mapPtr);
- }
- }
-
- void ThreadLocal::OnProcessDetach()
- {
- if (winTlsIdx != TLS_OUT_OF_INDEXES)
- TlsFree(winTlsIdx);
- }
-
- void* ThreadLocal::Get0()
- {
- return TlsGetValue(winTlsIdx);
- }
-
- void ThreadLocal::Set0(void* ptr)
- {
- TlsSetValue(winTlsIdx, ptr);
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/README.TXT b/modules/platform/src/main/cpp/common/project/README.TXT
deleted file mode 100644
index 97f4c64..0000000
--- a/modules/platform/src/main/cpp/common/project/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains IDE projects artifacts.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/vs/README.TXT
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/README.TXT b/modules/platform/src/main/cpp/common/project/vs/README.TXT
deleted file mode 100644
index f4fb456..0000000
--- a/modules/platform/src/main/cpp/common/project/vs/README.TXT
+++ /dev/null
@@ -1 +0,0 @@
-Contains Visual Studio project artifacts.
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
deleted file mode 100644
index b7cfb8a..0000000
--- a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj
+++ /dev/null
@@ -1,202 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{4F7E4917-4612-4B96-9838-025711ADE391}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>common</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v100</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- <TargetName>ignite.common</TargetName>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <TargetName>ignite.common</TargetName>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- <TargetName>ignite.common</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <TargetName>ignite.common</TargetName>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
- <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
- <OptimizeReferences>false</OptimizeReferences>
- <EnableCOMDATFolding>false</EnableCOMDATFolding>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <OptimizeReferences>true</OptimizeReferences>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>NotUsing</PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;IGNITEJVM_EXPORTS;_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <StringPooling>true</StringPooling>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
- <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Full</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>false</SDLCheck>
- <AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\..\..\include;$(ProjectDir)\..\..\os\win\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
- <FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
- <OmitFramePointers>true</OmitFramePointers>
- <StringPooling>true</StringPooling>
- <BufferSecurityCheck>false</BufferSecurityCheck>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;IGNITE_IMPL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ClCompile>
- <Link>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- <AdditionalDependencies>$(JAVA_HOME)\lib\jvm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <DelayLoadDLLs>jvm.dll</DelayLoadDLLs>
- <ModuleDefinitionFile>module.def</ModuleDefinitionFile>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\ignite\common\concurrent.h" />
- <ClInclude Include="..\..\include\ignite\common\exports.h" />
- <ClInclude Include="..\..\include\ignite\common\java.h" />
- <ClInclude Include="..\..\os\win\include\ignite\common\common.h" />
- <ClInclude Include="..\..\os\win\include\ignite\common\concurrent_os.h" />
- <ClInclude Include="targetver.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\os\win\src\common.cpp" />
- <ClCompile Include="..\..\os\win\src\concurrent_os.cpp" />
- <ClCompile Include="..\..\src\concurrent.cpp" />
- <ClCompile Include="..\..\src\exports.cpp" />
- <ClCompile Include="..\..\src\java.cpp" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
- <ItemGroup>
- <None Include="module.def" />
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters b/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
deleted file mode 100644
index 3d4ae54..0000000
--- a/modules/platform/src/main/cpp/common/project/vs/common.vcxproj.filters
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Misc">
- <UniqueIdentifier>{1dbec2be-5cb4-4f70-aef6-b4627d39b99b}</UniqueIdentifier>
- </Filter>
- <Filter Include="Code">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\os\win\include\ignite\common\common.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\os\win\include\ignite\common\concurrent_os.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\common\exports.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\common\java.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="..\..\include\ignite\common\concurrent.h">
- <Filter>Code</Filter>
- </ClInclude>
- <ClInclude Include="targetver.h">
- <Filter>Misc</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\os\win\src\common.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\concurrent.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\os\win\src\concurrent_os.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\exports.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- <ClCompile Include="..\..\src\java.cpp">
- <Filter>Code</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <None Include="module.def">
- <Filter>Misc</Filter>
- </None>
- </ItemGroup>
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/vs/module.def
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/module.def b/modules/platform/src/main/cpp/common/project/vs/module.def
deleted file mode 100644
index d9e8d2b..0000000
--- a/modules/platform/src/main/cpp/common/project/vs/module.def
+++ /dev/null
@@ -1,99 +0,0 @@
-LIBRARY ignite.common.dll
-EXPORTS
-IgniteReallocate @1
-IgniteIgnitionStart @2
-IgniteIgnitionInstance @3
-IgniteIgnitionEnvironmentPointer @4
-IgniteIgnitionStop @5
-IgniteIgnitionStopAll @6
-IgniteTargetOutLong @7
-IgniteProcessorReleaseStart @8
-IgniteProcessorProjection @9
-IgniteProcessorCache @10
-IgniteProcessorCreateCache @11
-IgniteProcessorGetOrCreateCache @12
-IgniteProcessorAffinity @13
-IgniteProcessorDataStreamer @14
-IgniteProcessorTransactions @15
-IgniteProcessorServices @16
-IgniteTargetInStreamOutObject @17
-IgniteTargetInStreamOutLong @18
-IgniteTargetOutStream @19
-IgniteTargetInStreamOutStream @20
-IgniteTargetInObjectStreamOutStream @21
-IgniteTargetListenFuture @22
-IgniteTargetListenFutureForOperation @23
-IgniteAffinityPartitions @24
-IgniteCacheWithSkipStore @25
-IgniteCacheWithNoRetries @26
-IgniteCacheWithExpiryPolicy @27
-IgniteCacheWithAsync @28
-IgniteCacheWithKeepPortable @29
-IgniteCacheClear @30
-IgniteCacheRemoveAll @31
-IgniteCacheOutOpQueryCursor @32
-IgniteCacheOutOpContinuousQuery @33
-IgniteCacheIterator @34
-IgniteCacheLocalIterator @35
-IgniteCacheEnterLock @36
-IgniteCacheExitLock @37
-IgniteCacheTryEnterLock @38
-IgniteCacheCloseLock @39
-IgniteCacheRebalance @40
-IgniteCacheSize @41
-IgniteCacheStoreCallbackInvoke @42
-IgniteComputeWithNoFailover @43
-IgniteComputeWithTimeout @44
-IgniteComputeExecuteNative @45
-IgniteContinuousQueryClose @46
-IgniteContinuousQueryGetInitialQueryCursor @47
-IgniteDataStreamerListenTopology @48
-IgniteDataStreamerAllowOverwriteGet @49
-IgniteDataStreamerAllowOverwriteSet @50
-IgniteDataStreamerSkipStoreGet @51
-IgniteDataStreamerSkipStoreSet @52
-IgniteDataStreamerPerNodeBufferSizeGet @53
-IgniteDataStreamerPerNodeBufferSizeSet @54
-IgniteDataStreamerPerNodeParallelOperationsGet @55
-IgniteDataStreamerPerNodeParallelOperationsSet @56
-IgniteMessagingWithAsync @57
-IgniteProjectionForOthers @58
-IgniteProjectionForRemotes @59
-IgniteProjectionForDaemons @60
-IgniteProjectionForRandom @61
-IgniteProjectionForOldest @62
-IgniteProjectionForYoungest @63
-IgniteProcessorCompute @64
-IgniteProcessorMessage @65
-IgniteProcessorEvents @66
-IgniteProjectionResetMetrics @67
-IgniteProjectionOutOpRet @68
-IgniteQueryCursorIterator @69
-IgniteQueryCursorClose @70
-IgniteTransactionsStart @71
-IgniteTransactionsCommit @72
-IgniteTransactionsCommitAsync @73
-IgniteTransactionsRollback @74
-IgniteTransactionsRollbackAsync @75
-IgniteTransactionsClose @76
-IgniteTransactionsState @77
-IgniteTransactionsSetRollbackOnly @78
-IgniteTransactionsResetMetrics @79
-IgniteAcquire @80
-IgniteRelease @81
-IgniteThrowToJava @82
-IgniteHandlersSize @83
-IgniteCreateContext @84
-IgniteDeleteContext @85
-IgniteDestroyJvm @86
-IgniteEventsWithAsync @87
-IgniteEventsStopLocalListen @88
-IgniteEventsLocalListen @89
-IgniteEventsIsEnabled @90
-IgniteTargetOutObject @91
-IgniteServicesWithAsync @92
-IgniteServicesWithServerKeepPortable @93
-IgniteServicesCancel @94
-IgniteServicesCancelAll @95
-IgniteServicesGetServiceProxy @96
-IgniteProcessorExtensions @97
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/project/vs/targetver.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/project/vs/targetver.h b/modules/platform/src/main/cpp/common/project/vs/targetver.h
deleted file mode 100644
index 4bea158..0000000
--- a/modules/platform/src/main/cpp/common/project/vs/targetver.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-// Including SDKDDKVer.h defines the highest available Windows platform.
-
-// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and
-// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
-
-#include <SDKDDKVer.h>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/src/concurrent.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/concurrent.cpp b/modules/platform/src/main/cpp/common/src/concurrent.cpp
deleted file mode 100644
index 3f85b65..0000000
--- a/modules/platform/src/main/cpp/common/src/concurrent.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/common/concurrent.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /** Thread-local index generator for application. */
- int32_t appTlsIdxGen = 0;
-
- int32_t ThreadLocal::NextIndex()
- {
- return Atomics::IncrementAndGet32(&appTlsIdxGen);
- }
-
- void ThreadLocal::Remove(int32_t idx)
- {
- void* val = Get0();
-
- if (val)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(val);
-
- ThreadLocalEntry* appVal = (*map)[idx];
-
- if (appVal)
- delete appVal;
-
- map->erase(idx);
-
- if (map->size() == 0)
- {
- delete map;
-
- Set0(NULL);
- }
- }
- }
-
- void ThreadLocal::Clear0(void* mapPtr)
- {
- if (mapPtr)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(mapPtr);
-
- for (std::map<int32_t, ThreadLocalEntry*>::iterator it = map->begin(); it != map->end(); ++it)
- delete it->second;
-
- delete map;
- }
- }
-
- SharedPointerImpl::SharedPointerImpl(void* ptr) : ptr(ptr), refCnt(1)
- {
- Memory::Fence();
- }
-
- void* SharedPointerImpl::Pointer()
- {
- return ptr;
- }
-
- void SharedPointerImpl::Increment()
- {
- Atomics::IncrementAndGet32(&refCnt);
- }
-
- bool SharedPointerImpl::Decrement()
- {
- return Atomics::DecrementAndGet32(&refCnt) == 0;
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/src/exports.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/src/exports.cpp b/modules/platform/src/main/cpp/common/src/exports.cpp
deleted file mode 100644
index 2ac3340..0000000
--- a/modules/platform/src/main/cpp/common/src/exports.cpp
+++ /dev/null
@@ -1,413 +0,0 @@
-/*
- * 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.
- */
-
-#include "ignite/common/exports.h"
-#include "ignite/common/java.h"
-
-namespace gcj = ignite::common::java;
-
-/* --- Target methods. --- */
-extern "C" {
- int IGNITE_CALL IgniteReallocate(long long memPtr, int cap) {
- return gcj::JniContext::Reallocate(memPtr, cap);
- }
-
- void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr) {
- return ctx->IgnitionStart(cfgPath, name, factoryId, dataPtr);
- }
-
- void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name) {
- return ctx->IgnitionInstance(name);
- }
-
- long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name) {
- return ctx->IgnitionEnvironmentPointer(name);
- }
-
- bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* name, bool cancel) {
- return ctx->IgnitionStop(name, cancel);
- }
-
- void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel) {
- return ctx->IgnitionStopAll(cancel);
- }
-
- void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorReleaseStart(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorProjection(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorProjection(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorCreateCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorGetOrCreateCache(static_cast<jobject>(obj), name);
- }
-
- void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name) {
- return ctx->ProcessorAffinity(static_cast<jobject>(obj), name);
- }
-
- void*IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable) {
- return ctx->ProcessorDataStreamer(static_cast<jobject>(obj), name, keepPortable);
- }
-
- void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorTransactions(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorCompute(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorMessage(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorMessage(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorEvents(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProcessorServices(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj) {
- return ctx->ProcessorExtensions(static_cast<jobject>(obj));
- }
-
- long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
- return ctx->TargetInStreamOutLong(static_cast<jobject>(obj), opType, memPtr);
- }
-
- void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr) {
- ctx->TargetInStreamOutStream(static_cast<jobject>(obj), opType, inMemPtr, outMemPtr);
- }
-
- void* IGNITE_CALL IgniteTargetInStreamOutObject(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
- return ctx->TargetInStreamOutObject(static_cast<jobject>(obj), opType, memPtr);
- }
-
- void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr) {
- ctx->TargetInObjectStreamOutStream(static_cast<jobject>(obj), opType, arg, inMemPtr, outMemPtr);
- }
-
- long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType) {
- return ctx->TargetOutLong(static_cast<jobject>(obj), opType);
- }
-
- void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr) {
- ctx->TargetOutStream(static_cast<jobject>(obj), opType, memPtr);
- }
-
- void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType) {
- return ctx->TargetOutObject(static_cast<jobject>(obj), opType);
- }
-
- void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ) {
- ctx->TargetListenFuture(static_cast<jobject>(obj), futId, typ);
- }
-
- void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId) {
- ctx->TargetListenFutureForOperation(static_cast<jobject>(obj), futId, typ, opId);
- }
-
- int IGNITE_CALL IgniteAffinityPartitions(gcj::JniContext* ctx, void* obj) {
- return ctx->AffinityPartitions(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheWithSkipStore(gcj::JniContext* ctx, void* obj) {
- return ctx->CacheWithSkipStore(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheWithNoRetries(gcj::JniContext* ctx, void* obj) {
- return ctx->CacheWithNoRetries(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheWithExpiryPolicy(gcj::JniContext* ctx, void* obj, long long create, long long update, long long access) {
- return ctx->CacheWithExpiryPolicy(static_cast<jobject>(obj), create, update, access);
- }
-
- void* IGNITE_CALL IgniteCacheWithAsync(gcj::JniContext* ctx, void* obj) {
- return ctx->CacheWithAsync(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheWithKeepPortable(gcj::JniContext* ctx, void* obj)
- {
- return ctx->CacheWithKeepPortable(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteCacheClear(gcj::JniContext* ctx, void* obj) {
- ctx->CacheClear(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteCacheRemoveAll(gcj::JniContext* ctx, void* obj) {
- ctx->CacheRemoveAll(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheOutOpQueryCursor(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
- return ctx->CacheOutOpQueryCursor(static_cast<jobject>(obj), type, memPtr);
- }
-
- void* IGNITE_CALL IgniteCacheOutOpContinuousQuery(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
- return ctx->CacheOutOpContinuousQuery(static_cast<jobject>(obj), type, memPtr);
- }
-
- void* IGNITE_CALL IgniteCacheIterator(gcj::JniContext* ctx, void* obj) {
- return ctx->CacheIterator(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteCacheLocalIterator(gcj::JniContext* ctx, void* obj, int peekModes) {
- return ctx->CacheLocalIterator(static_cast<jobject>(obj), peekModes);
- }
-
- void IGNITE_CALL IgniteCacheEnterLock(gcj::JniContext* ctx, void* obj, long long id) {
- ctx->CacheEnterLock(static_cast<jobject>(obj), id);
- }
-
- void IGNITE_CALL IgniteCacheExitLock(gcj::JniContext* ctx, void* obj, long long id) {
- ctx->CacheExitLock(static_cast<jobject>(obj), id);
- }
-
- bool IGNITE_CALL IgniteCacheTryEnterLock(gcj::JniContext* ctx, void* obj, long long id, long long timeout) {
- return ctx->CacheTryEnterLock(static_cast<jobject>(obj), id, timeout);
- }
-
- void IGNITE_CALL IgniteCacheCloseLock(gcj::JniContext* ctx, void* obj, long long id) {
- ctx->CacheCloseLock(static_cast<jobject>(obj), id);
- }
-
- void IGNITE_CALL IgniteCacheRebalance(gcj::JniContext* ctx, void* obj, long long futId) {
- ctx->CacheRebalance(static_cast<jobject>(obj), futId);
- }
-
- int IGNITE_CALL IgniteCacheSize(gcj::JniContext* ctx, void* obj, int peekModes, bool loc) {
- return ctx->CacheSize(static_cast<jobject>(obj), peekModes, loc);
- }
-
- void IGNITE_CALL IgniteComputeWithNoFailover(gcj::JniContext* ctx, void* obj) {
- ctx->ComputeWithNoFailover(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteComputeWithTimeout(gcj::JniContext* ctx, void* obj, long long timeout) {
- ctx->ComputeWithTimeout(static_cast<jobject>(obj), timeout);
- }
-
- void IGNITE_CALL IgniteComputeExecuteNative(gcj::JniContext* ctx, void* obj, long long taskPtr, long long topVer) {
- ctx->ComputeExecuteNative(static_cast<jobject>(obj), taskPtr, topVer);
- }
-
- void IGNITE_CALL IgniteContinuousQueryClose(gcj::JniContext* ctx, void* obj) {
- ctx->ContinuousQueryClose(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteContinuousQueryGetInitialQueryCursor(gcj::JniContext* ctx, void* obj) {
- return ctx->ContinuousQueryGetInitialQueryCursor(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteCacheStoreCallbackInvoke(gcj::JniContext* ctx, void* obj, long long memPtr) {
- ctx->CacheStoreCallbackInvoke(static_cast<jobject>(obj), memPtr);
- }
-
- void IGNITE_CALL IgniteDataStreamerListenTopology(gcj::JniContext* ctx, void* obj, long long ptr) {
- ctx->DataStreamerListenTopology(static_cast<jobject>(obj), ptr);
- }
-
- bool IGNITE_CALL IgniteDataStreamerAllowOverwriteGet(gcj::JniContext* ctx, void* obj) {
- return ctx->DataStreamerAllowOverwriteGet(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteDataStreamerAllowOverwriteSet(gcj::JniContext* ctx, void* obj, bool val) {
- ctx->DataStreamerAllowOverwriteSet(static_cast<jobject>(obj), val);
- }
-
- bool IGNITE_CALL IgniteDataStreamerSkipStoreGet(gcj::JniContext* ctx, void* obj) {
- return ctx->DataStreamerSkipStoreGet(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteDataStreamerSkipStoreSet(gcj::JniContext* ctx, void* obj, bool val) {
- ctx->DataStreamerSkipStoreSet(static_cast<jobject>(obj), val);
- }
-
- int IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeGet(gcj::JniContext* ctx, void* obj) {
- return ctx->DataStreamerPerNodeBufferSizeGet(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeSet(gcj::JniContext* ctx, void* obj, int val) {
- ctx->DataStreamerPerNodeBufferSizeSet(static_cast<jobject>(obj), val);
- }
-
- int IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsGet(gcj::JniContext* ctx, void* obj) {
- return ctx->DataStreamerPerNodeParallelOperationsGet(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsSet(gcj::JniContext* ctx, void* obj, int val) {
- ctx->DataStreamerPerNodeParallelOperationsSet(static_cast<jobject>(obj), val);
- }
-
- void* IGNITE_CALL IgniteMessagingWithAsync(gcj::JniContext* ctx, void* obj) {
- return ctx->MessagingWithAsync(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionForOthers(gcj::JniContext* ctx, void* obj, void* prj) {
- return ctx->ProjectionForOthers(static_cast<jobject>(obj), static_cast<jobject>(prj));
- }
-
- void* IGNITE_CALL IgniteProjectionForRemotes(gcj::JniContext* ctx, void* obj) {
- return ctx->ProjectionForRemotes(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionForDaemons(gcj::JniContext* ctx, void* obj) {
- return ctx->ProjectionForDaemons(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionForRandom(gcj::JniContext* ctx, void* obj) {
- return ctx->ProjectionForRandom(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionForOldest(gcj::JniContext* ctx, void* obj) {
- return ctx->ProjectionForOldest(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionForYoungest(gcj::JniContext* ctx, void* obj) {
- return ctx->ProjectionForYoungest(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteProjectionResetMetrics(gcj::JniContext* ctx, void* obj) {
- ctx->ProjectionResetMetrics(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteProjectionOutOpRet(gcj::JniContext* ctx, void* obj, int type, long long memPtr) {
- return ctx->ProjectionOutOpRet(static_cast<jobject>(obj), type, memPtr);
- }
-
- void IGNITE_CALL IgniteQueryCursorIterator(gcj::JniContext* ctx, void* obj) {
- ctx->QueryCursorIterator(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteQueryCursorClose(gcj::JniContext* ctx, void* obj) {
- ctx->QueryCursorClose(static_cast<jobject>(obj));
- }
-
- long long IGNITE_CALL IgniteTransactionsStart(gcj::JniContext* ctx, void* obj, int concurrency, int isolation, long long timeout, int txSize) {
- return ctx->TransactionsStart(static_cast<jobject>(obj), concurrency, isolation, timeout, txSize);
- }
-
- int IGNITE_CALL IgniteTransactionsCommit(gcj::JniContext* ctx, void* obj, long long id) {
- return ctx->TransactionsCommit(static_cast<jobject>(obj), id);
- }
-
- void IGNITE_CALL IgniteTransactionsCommitAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId) {
- return ctx->TransactionsCommitAsync(static_cast<jobject>(obj), id, futId);
- }
-
- int IGNITE_CALL IgniteTransactionsRollback(gcj::JniContext* ctx, void* obj, long long id) {
- return ctx->TransactionsRollback(static_cast<jobject>(obj), id);
- }
-
- void IGNITE_CALL IgniteTransactionsRollbackAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId) {
- return ctx->TransactionsRollbackAsync(static_cast<jobject>(obj), id, futId);
- }
-
- int IGNITE_CALL IgniteTransactionsClose(gcj::JniContext* ctx, void* obj, long long id) {
- return ctx->TransactionsClose(static_cast<jobject>(obj), id);
- }
-
- int IGNITE_CALL IgniteTransactionsState(gcj::JniContext* ctx, void* obj, long long id) {
- return ctx->TransactionsState(static_cast<jobject>(obj), id);
- }
-
- bool IGNITE_CALL IgniteTransactionsSetRollbackOnly(gcj::JniContext* ctx, void* obj, long long id) {
- return ctx->TransactionsSetRollbackOnly(static_cast<jobject>(obj), id);
- }
-
- void IGNITE_CALL IgniteTransactionsResetMetrics(gcj::JniContext* ctx, void* obj) {
- ctx->TransactionsResetMetrics(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteAcquire(gcj::JniContext* ctx, void* obj) {
- return ctx->Acquire(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteRelease(void* obj) {
- gcj::JniContext::Release(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteThrowToJava(gcj::JniContext* ctx, char* err) {
- ctx->ThrowToJava(err);
- }
-
- int IGNITE_CALL IgniteHandlersSize() {
- return sizeof(gcj::JniHandlers);
- }
-
- void* IGNITE_CALL IgniteCreateContext(char** opts, int optsLen, gcj::JniHandlers* cbs) {
- return gcj::JniContext::Create(opts, optsLen, *cbs);
- }
-
- void IGNITE_CALL IgniteDeleteContext(gcj::JniContext* ctx) {
- delete ctx;
- }
-
- void IGNITE_CALL IgniteDestroyJvm(gcj::JniContext* ctx) {
- ctx->DestroyJvm();
- }
-
- void* IGNITE_CALL IgniteEventsWithAsync(gcj::JniContext* ctx, void* obj) {
- return ctx->EventsWithAsync(static_cast<jobject>(obj));
- }
-
- bool IGNITE_CALL IgniteEventsStopLocalListen(gcj::JniContext* ctx, void* obj, long long hnd) {
- return ctx->EventsStopLocalListen(static_cast<jobject>(obj), hnd);
- }
-
- void IGNITE_CALL IgniteEventsLocalListen(gcj::JniContext* ctx, void* obj, long long hnd, int type) {
- ctx->EventsLocalListen(static_cast<jobject>(obj), hnd, type);
- }
-
- bool IGNITE_CALL IgniteEventsIsEnabled(gcj::JniContext* ctx, void* obj, int type) {
- return ctx->EventsIsEnabled(static_cast<jobject>(obj), type);
- }
-
- void* IGNITE_CALL IgniteServicesWithAsync(gcj::JniContext* ctx, void* obj) {
- return ctx->ServicesWithAsync(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteServicesWithServerKeepPortable(gcj::JniContext* ctx, void* obj) {
- return ctx->ServicesWithServerKeepPortable(static_cast<jobject>(obj));
- }
-
- void IGNITE_CALL IgniteServicesCancel(gcj::JniContext* ctx, void* obj, char* name) {
- ctx->ServicesCancel(static_cast<jobject>(obj), name);
- }
-
- void IGNITE_CALL IgniteServicesCancelAll(gcj::JniContext* ctx, void* obj) {
- ctx->ServicesCancelAll(static_cast<jobject>(obj));
- }
-
- void* IGNITE_CALL IgniteServicesGetServiceProxy(gcj::JniContext* ctx, void* obj, char* name, bool sticky) {
- return ctx->ServicesGetServiceProxy(static_cast<jobject>(obj), name, sticky);
- }
-}
\ No newline at end of file
[50/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/README.txt
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/README.txt b/modules/platform/src/main/cpp/README.txt
deleted file mode 100644
index c9e6999..0000000
--- a/modules/platform/src/main/cpp/README.txt
+++ /dev/null
@@ -1,101 +0,0 @@
-Apache Ignite for C++
-==================================
-
-Ignite C++ provides data grid functionality.
-Using Ignite C++ APIs you can execute perform concurrent operations on
-the data stored in cache.
-
-Ignite C++ can access cluster and share data with .Net and
-Java applications using portable object format.
-
-Support for the following will be added in next releases:
- * ACID transactions management.
- * Distributed locks.
- * Async operations.
- * Cache SQL queries and continuous queries.
- * Event listening.
- * Compute grid functionality.
-
-Full source code is provided. Users should build the library for intended platform.
-
-Building on Linux With Autotools
-----------------------------------
-
-Common Requirements:
-
- * GCC, g++, autotools, automake, and libtool must be installed
- * Java Development Kit (JDK) must be installed: https://java.com/en/download/index.jsp
- * JAVA_HOME environment variable must be set pointing to Java installation directory.
-
-Building the library:
-
- * Build Ignite C++ helper "common" library:
- * Navigate to the directory $IGNITE_HOME/platforms/cpp/src/common
- * Execute the following commands one by one:
- * libtoolize
- * aclocal
- * autoheader
- * automake --add-missing
- * autoreconf
- * ./configure
- * make
- * make install
- * Build Ignite C++ library:
- * Navigate to the directory $IGNITE_HOME/platforms/cpp/src/core
- * Execute the following commands one by one:
- * libtoolize
- * aclocal
- * autoheader
- * automake --add-missing
- * autoreconf
- * ./configure
- * make
- * make install
-
-NOTE: "make install" command may require superuser privileges. In this case it must be
-executed as "sudo make install".
-
-Development:
-
- * IGNITE_HOME environment variable must be set to Ignite installation directory.
- * Once both libraries are built and installed, required headers are placed in the
- "/usr/local/include/ignite" directory.
- * Ignite C++ depends on jni.h file located inside ${JAVA_HOME}/include directory.
- Add this directory to headers search path: "-I${JAVA_HOME}/include".
- * Library is placed in the "/usr/local/lib" directory. Link it to your project: "-lignite".
- * Ignite depends on "libjvm.so" library shipped with Java. Typically this library is located inside
- $JAVA_HOME/jre/lib/amd64/server directory. Ensure that LD_LIBRARY_PATH environment variable points to this directory.
-
-
-Building on Windows with Visual Studio (tm)
-----------------------------------
-
-Common Requirements:
-
- * Microsoft Visual Studio (tm) 2010 or later
- * Windows SDK 7.1
- * Java Development Kit (JDK) must be installed: https://java.com/en/download/index.jsp
- * JAVA_HOME environment variable must be set pointing to Java installation directory.
-
-Building the library:
-
- * Open and build %IGNITE_HOME%\platforms\cpp\src\project\vs\ignite.sln (or ignite_86.sln if you are running
- 32-bit platform).
-
-Development:
-
- * IGNITE_HOME environment variable must be set to Ignite installation directory.
- * Update Include Directories in Project Properties with paths to:
- * $(IGNITE_HOME)\platforms\cpp\src\core\include
- * $(IGNITE_HOME)\platforms\cpp\src\core\os\win\include
- * $(IGNITE_HOME)\platforms\cpp\src\common\include
- * $(IGNITE_HOME)\platforms\cpp\src\common\os\win\include
- * $(JAVA_HOME)\include
- * $(JAVA_HOME)\include\win32
- * Update Library Directories with path to the built binaries
- * Update Linker\Input\Additional Dependencies in Project Properties with path to
- * ignite.common.lib
- * ignite.core.lib
- * Make sure that your application is aware about ignite.common.dll and ignite.core.dll libraries. The easiest way
- to achieve this is to either make sure these files are in %PATH%, or to put them into the output directory of
- your project with help of PostBuild events.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/Makefile.am b/modules/platform/src/main/cpp/common/Makefile.am
deleted file mode 100644
index f5ca5dd..0000000
--- a/modules/platform/src/main/cpp/common/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-SUBDIRS = . include os/linux/include
-DIST_SUBDIRS = . include os/linux/include
-
-AM_CPPFLAGS = -I$(srcdir)/include -I$(srcdir)/os/linux/include -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -DIGNITE_IMPL
-AM_CXXFLAGS = -Wall -std=c++0x
-LIB_LDFLAGS = -no-undefined -version-info 1
-
-COMMON_SRC = os/linux/src/concurrent_os.cpp \
- src/concurrent.cpp \
- src/java.cpp \
- src/exports.cpp \
- os/linux/src/common.cpp
-
-lib_LTLIBRARIES = libignite-common.la
-libignite_common_la_SOURCES = $(COMMON_SRC)
-libignite_common_la_LIBADD = -L$(JAVA_HOME)/jre/lib/amd64/server
-libignite_common_la_LDFLAGS = $(LIB_LDFLAGS) -L/usr/local/lib -ljvm -version-info 0:0:0 -release $(PACKAGE_VERSION)
-
-pkgconfigdir = $(libdir)/pkgconfig
-pkgconfig_DATA = ignite-common.pc
-
-clean-local:
- $(RM) *.gcno *.gcda
-
-clean-docs:
- $(RM) $(DX_CLEANFILES)
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/configure.ac
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/configure.ac b/modules/platform/src/main/cpp/common/configure.ac
deleted file mode 100644
index 5cab969..0000000
--- a/modules/platform/src/main/cpp/common/configure.ac
+++ /dev/null
@@ -1,62 +0,0 @@
-#
-# 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.
-#
-
-# -*- Autoconf -*-
-# Process this file with autoconf to produce a configure script.
-
-AC_PREREQ([2.69])
-AC_INIT([Apache Ignite JNI bridge for C++], [1.5.0], [dev@ignite.apache.org], [ignite-common], [ignite.apache.org])
-AC_CONFIG_SRCDIR(src)
-
-AC_CANONICAL_SYSTEM
-AC_CONFIG_MACRO_DIR([m4])
-AC_LANG([C++])
-
-# Initialize automake
-AM_INIT_AUTOMAKE([-Wall foreign subdir-objects])
-AC_CONFIG_HEADER(config.h)
-
-AM_PROG_AR
-
-# Checks for programs.
-GXX="-g -O2"
-
-AC_PROG_CXX
-
-# Initialize Libtool
-LT_INIT
-
-# Checks for libraries.
-AC_CHECK_LIB([pthread], [pthread_mutex_lock])
-
-# Checks for header files.
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_INLINE
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_INT8_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-
-# Checks for library functions.
-AC_FUNC_ERROR_AT_LINE
-
-AC_CONFIG_FILES(Makefile include/Makefile os/linux/include/Makefile ignite-common.pc)
-
-AC_OUTPUT
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/ignite-common.pc.in
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/ignite-common.pc.in b/modules/platform/src/main/cpp/common/ignite-common.pc.in
deleted file mode 100644
index b8c40d2..0000000
--- a/modules/platform/src/main/cpp/common/ignite-common.pc.in
+++ /dev/null
@@ -1,9 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: ignite-common
-Description: Apache Ignite JNI bridge for C++.
-Version: @PACKAGE_VERSION@
-Libs: -L${libdir} -lignite-common
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/include/Makefile.am b/modules/platform/src/main/cpp/common/include/Makefile.am
deleted file mode 100644
index 5db1d4a..0000000
--- a/modules/platform/src/main/cpp/common/include/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/common/concurrent.h \
- ignite/common/java.h \
- ignite/common/exports.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/include/ignite/common/concurrent.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/include/ignite/common/concurrent.h b/modules/platform/src/main/cpp/common/include/ignite/common/concurrent.h
deleted file mode 100644
index 1c9ab22..0000000
--- a/modules/platform/src/main/cpp/common/include/ignite/common/concurrent.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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_COMMON_CONCURRENT
-#define _IGNITE_COMMON_CONCURRENT
-
-#include "ignite/common/concurrent_os.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /**
- * Default deleter implementation.
- *
- * @param obj Object to be deleted.
- */
- template<typename T>
- IGNITE_IMPORT_EXPORT void SharedPointerDefaultDeleter(T* obj)
- {
- delete obj;
- }
-
- /**
- * Holder of shared pointer data.
- */
- class IGNITE_IMPORT_EXPORT SharedPointerImpl
- {
- public:
- /**
- * Constructor.
- *
- * @param ptr Raw pointer.
- */
- SharedPointerImpl(void* ptr);
-
- /**
- * Get raw pointer.
- *
- * @return Raw pointer.
- */
- void* Pointer();
-
- /**
- * Increment usage counter.
- */
- void Increment();
-
- /**
- * Decrement usage counter.
- *
- * @return True if counter reached zero.
- */
- bool Decrement();
- private:
- /** Raw pointer. */
- void* ptr;
-
- /** Reference count. */
- int32_t refCnt;
-
- IGNITE_NO_COPY_ASSIGNMENT(SharedPointerImpl)
- };
-
- /**
- * Shared pointer.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT SharedPointer
- {
- public:
- /**
- * Constructor.
- */
- SharedPointer() : impl(NULL), deleter(NULL)
- {
- // No-op.
- }
-
- /**
- * Constructor.
- *
- * @param ptr Raw pointer.
- */
- explicit SharedPointer(T* ptr)
- {
- if (ptr)
- {
- impl = new SharedPointerImpl(ptr);
- deleter = SharedPointerDefaultDeleter;
- }
- else
- {
- impl = NULL;
- deleter = NULL;
- }
- }
-
- /**
- * Constructor.
- *
- * @param ptr Raw pointer.
- * @param deleter Delete function.
- */
- SharedPointer(T* ptr, void(*deleter)(T*))
- {
- if (ptr)
- {
- this->impl = new SharedPointerImpl(ptr);
- this->deleter = deleter;
- }
- else
- {
- this->impl = NULL;
- this->deleter = NULL;
- }
- }
-
- /**
- * Copy constructor.
- *
- * @param other Instance to copy.
- */
- SharedPointer(const SharedPointer& other)
- {
- impl = other.impl;
- deleter = other.deleter;
-
- if (impl)
- impl->Increment();
- }
-
- /**
- * Assignment operator.
- *
- * @param other Other instance.
- */
- SharedPointer& operator=(const SharedPointer& other)
- {
- if (this != &other)
- {
- // 1. Create new instance.
- SharedPointer tmp(other);
-
- // 2. Swap with temp.
- SharedPointerImpl* impl0 = impl;
- void(*deleter0)(T*) = deleter;
-
- impl = tmp.impl;
- deleter = tmp.deleter;
-
- tmp.impl = impl0;
- tmp.deleter = deleter0;
- }
-
- return *this;
- }
-
- /**
- * Destructor.
- */
- ~SharedPointer()
- {
- if (impl && impl->Decrement())
- {
- T* ptr = Get();
-
- delete impl;
-
- deleter(ptr);
- }
- }
-
- /**
- * Get raw pointer.
- *
- * @return Raw pointer.
- */
- T* Get()
- {
- return impl ? static_cast<T*>(impl->Pointer()) : NULL;
- }
- private:
- /** Implementation. */
- SharedPointerImpl* impl;
-
- /** Delete function. */
- void(*deleter)(T*);
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/include/ignite/common/exports.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/include/ignite/common/exports.h b/modules/platform/src/main/cpp/common/include/ignite/common/exports.h
deleted file mode 100644
index 930fad3..0000000
--- a/modules/platform/src/main/cpp/common/include/ignite/common/exports.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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_COMMON_EXPORTS
-#define _IGNITE_COMMON_EXPORTS
-
-#include "ignite/common/java.h"
-
-namespace gcj = ignite::common::java;
-
-extern "C" {
- int IGNITE_CALL IgniteReallocate(long long memPtr, int cap);
-
- void* IGNITE_CALL IgniteIgnitionStart(gcj::JniContext* ctx, char* cfgPath, char* name, int factoryId, long long dataPtr);
- void* IGNITE_CALL IgniteIgnitionInstance(gcj::JniContext* ctx, char* name);
- long long IGNITE_CALL IgniteIgnitionEnvironmentPointer(gcj::JniContext* ctx, char* name);
- bool IGNITE_CALL IgniteIgnitionStop(gcj::JniContext* ctx, char* name, bool cancel);
- void IGNITE_CALL IgniteIgnitionStopAll(gcj::JniContext* ctx, bool cancel);
-
- void IGNITE_CALL IgniteProcessorReleaseStart(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorProjection(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorCreateCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorGetOrCreateCache(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorAffinity(gcj::JniContext* ctx, void* obj, char* name);
- void* IGNITE_CALL IgniteProcessorDataStreamer(gcj::JniContext* ctx, void* obj, char* name, bool keepPortable);
- void* IGNITE_CALL IgniteProcessorTransactions(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProcessorCompute(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorMessage(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorEvents(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorServices(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProcessorExtensions(gcj::JniContext* ctx, void* obj);
-
- long long IGNITE_CALL IgniteTargetInStreamOutLong(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
- void IGNITE_CALL IgniteTargetInStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, long long inMemPtr, long long outMemPtr);
- void* IGNITE_CALL IgniteTargetInStreamOutObject(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
- void IGNITE_CALL IgniteTargetInObjectStreamOutStream(gcj::JniContext* ctx, void* obj, int opType, void* arg, long long inMemPtr, long long outMemPtr);
- long long IGNITE_CALL IgniteTargetOutLong(gcj::JniContext* ctx, void* obj, int opType);
- void IGNITE_CALL IgniteTargetOutStream(gcj::JniContext* ctx, void* obj, int opType, long long memPtr);
- void* IGNITE_CALL IgniteTargetOutObject(gcj::JniContext* ctx, void* obj, int opType);
- void IGNITE_CALL IgniteTargetListenFuture(gcj::JniContext* ctx, void* obj, long long futId, int typ);
- void IGNITE_CALL IgniteTargetListenFutureForOperation(gcj::JniContext* ctx, void* obj, long long futId, int typ, int opId);
-
- int IGNITE_CALL IgniteAffinityPartitions(gcj::JniContext* ctx, void* obj);
-
- void* IGNITE_CALL IgniteCacheWithSkipStore(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteCacheWithNoRetries(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteCacheWithExpiryPolicy(gcj::JniContext* ctx, void* obj, long long create, long long update, long long access);
- void* IGNITE_CALL IgniteCacheWithAsync(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteCacheWithKeepPortable(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteCacheClear(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteCacheRemoveAll(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteCacheOutOpQueryCursor(gcj::JniContext* ctx, void* obj, int type, long long memPtr);
- void* IGNITE_CALL IgniteCacheOutOpContinuousQuery(gcj::JniContext* ctx, void* obj, int type, long long memPtr);
- void* IGNITE_CALL IgniteCacheIterator(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteCacheLocalIterator(gcj::JniContext* ctx, void* obj, int peekModes);
- void IGNITE_CALL IgniteCacheEnterLock(gcj::JniContext* ctx, void* obj, long long id);
- void IGNITE_CALL IgniteCacheExitLock(gcj::JniContext* ctx, void* obj, long long id);
- bool IGNITE_CALL IgniteCacheTryEnterLock(gcj::JniContext* ctx, void* obj, long long id, long long timeout);
- void IGNITE_CALL IgniteCacheCloseLock(gcj::JniContext* ctx, void* obj, long long id);
- void IGNITE_CALL IgniteCacheRebalance(gcj::JniContext* ctx, void* obj, long long futId);
- int IGNITE_CALL IgniteCacheSize(gcj::JniContext* ctx, void* obj, int peekModes, bool loc);
-
- void IGNITE_CALL IgniteCacheStoreCallbackInvoke(gcj::JniContext* ctx, void* obj, long long memPtr);
-
- void IGNITE_CALL IgniteComputeWithNoFailover(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteComputeWithTimeout(gcj::JniContext* ctx, void* obj, long long timeout);
- void IGNITE_CALL IgniteComputeExecuteNative(gcj::JniContext* ctx, void* obj, long long taskPtr, long long topVer);
-
- void IGNITE_CALL IgniteContinuousQueryClose(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteContinuousQueryGetInitialQueryCursor(gcj::JniContext* ctx, void* obj);
-
- void IGNITE_CALL IgniteDataStreamerListenTopology(gcj::JniContext* ctx, void* obj, long long ptr);
- bool IGNITE_CALL IgniteDataStreamerAllowOverwriteGet(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteDataStreamerAllowOverwriteSet(gcj::JniContext* ctx, void* obj, bool val);
- bool IGNITE_CALL IgniteDataStreamerSkipStoreGet(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteDataStreamerSkipStoreSet(gcj::JniContext* ctx, void* obj, bool val);
- int IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeGet(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteDataStreamerPerNodeBufferSizeSet(gcj::JniContext* ctx, void* obj, int val);
- int IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsGet(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteDataStreamerPerNodeParallelOperationsSet(gcj::JniContext* ctx, void* obj, int val);
-
- void* IGNITE_CALL IgniteMessagingWithAsync(gcj::JniContext* ctx, void* obj);
-
- void* IGNITE_CALL IgniteProjectionForOthers(gcj::JniContext* ctx, void* obj, void* prj);
- void* IGNITE_CALL IgniteProjectionForRemotes(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProjectionForDaemons(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProjectionForRandom(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProjectionForOldest(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProjectionForYoungest(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteProjectionResetMetrics(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteProjectionOutOpRet(gcj::JniContext* ctx, void* obj, int type, long long memPtr);
-
- void IGNITE_CALL IgniteQueryCursorIterator(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteQueryCursorClose(gcj::JniContext* ctx, void* obj);
-
- long long IGNITE_CALL IgniteTransactionsStart(gcj::JniContext* ctx, void* obj, int concurrency, int isolation, long long timeout, int txSize);
- int IGNITE_CALL IgniteTransactionsCommit(gcj::JniContext* ctx, void* obj, long long id);
- void IGNITE_CALL IgniteTransactionsCommitAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId);
- int IGNITE_CALL IgniteTransactionsRollback(gcj::JniContext* ctx, void* obj, long long id);
- void IGNITE_CALL IgniteTransactionsRollbackAsync(gcj::JniContext* ctx, void* obj, long long id, long long futId);
- int IGNITE_CALL IgniteTransactionsClose(gcj::JniContext* ctx, void* obj, long long id);
- int IGNITE_CALL IgniteTransactionsState(gcj::JniContext* ctx, void* obj, long long id);
- bool IGNITE_CALL IgniteTransactionsSetRollbackOnly(gcj::JniContext* ctx, void* obj, long long id);
- void IGNITE_CALL IgniteTransactionsResetMetrics(gcj::JniContext* ctx, void* obj);
-
- void* IGNITE_CALL IgniteAcquire(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteRelease(void* obj);
-
- void IGNITE_CALL IgniteThrowToJava(gcj::JniContext* ctx, char* errMsg);
-
- int IGNITE_CALL IgniteHandlersSize();
-
- void* IGNITE_CALL IgniteCreateContext(char** opts, int optsLen, gcj::JniHandlers* cbs);
- void IGNITE_CALL IgniteDeleteContext(gcj::JniContext* ctx);
-
- void IGNITE_CALL IgniteDestroyJvm(gcj::JniContext* ctx);
-
- void* IGNITE_CALL IgniteEventsWithAsync(gcj::JniContext* ctx, void* obj);
- bool IGNITE_CALL IgniteEventsStopLocalListen(gcj::JniContext* ctx, void* obj, long long hnd);
- void IGNITE_CALL IgniteEventsLocalListen(gcj::JniContext* ctx, void* obj, long long hnd, int type);
- bool IGNITE_CALL IgniteEventsIsEnabled(gcj::JniContext* ctx, void* obj, int type);
-
- void* IGNITE_CALL IgniteServicesWithAsync(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteServicesWithServerKeepPortable(gcj::JniContext* ctx, void* obj);
- void IGNITE_CALL IgniteServicesCancel(gcj::JniContext* ctx, void* obj, char* name);
- void IGNITE_CALL IgniteServicesCancelAll(gcj::JniContext* ctx, void* obj);
- void* IGNITE_CALL IgniteServicesGetServiceProxy(gcj::JniContext* ctx, void* obj, char* name, bool sticky);
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/include/ignite/common/java.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/include/ignite/common/java.h b/modules/platform/src/main/cpp/common/include/ignite/common/java.h
deleted file mode 100644
index 01ecbe3..0000000
--- a/modules/platform/src/main/cpp/common/include/ignite/common/java.h
+++ /dev/null
@@ -1,652 +0,0 @@
-/*
- * 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_COMMON_JVM
-#define _IGNITE_COMMON_JVM
-
-#include <jni.h>
-
-#include "ignite/common/common.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace java
- {
- /* Error constants. */
- const int IGNITE_JNI_ERR_SUCCESS = 0;
- const int IGNITE_JNI_ERR_GENERIC = 1;
- const int IGNITE_JNI_ERR_JVM_INIT = 2;
- const int IGNITE_JNI_ERR_JVM_ATTACH = 3;
-
- /* Handlers for callbacks from Java. */
- typedef long long(JNICALL *CacheStoreCreateHandler)(void* target, long long memPtr);
- typedef int(JNICALL *CacheStoreInvokeHandler)(void* target, long long objPtr, long long memPtr, void* cb);
- typedef void(JNICALL *CacheStoreDestroyHandler)(void* target, long long objPtr);
- typedef long long(JNICALL *CacheStoreSessionCreateHandler)(void* target, long long storePtr);
-
- typedef long long(JNICALL *CacheEntryFilterCreateHandler)(void* target, long long memPtr);
- typedef int(JNICALL *CacheEntryFilterApplyHandler)(void* target, long long ptr, long long memPtr);
- typedef void(JNICALL *CacheEntryFilterDestroyHandler)(void* target, long long ptr);
-
- typedef void(JNICALL *CacheInvokeHandler)(void* target, long long inMemPtr, long long outMemPtr);
-
- typedef void(JNICALL *ComputeTaskMapHandler)(void* target, long long taskPtr, long long inMemPtr, long long outMemPtr);
- typedef int(JNICALL *ComputeTaskJobResultHandler)(void* target, long long taskPtr, long long jobPtr, long long memPtr);
- typedef void(JNICALL *ComputeTaskReduceHandler)(void* target, long long taskPtr);
- typedef void(JNICALL *ComputeTaskCompleteHandler)(void* target, long long taskPtr, long long memPtr);
- typedef int(JNICALL *ComputeJobSerializeHandler)(void* target, long long jobPtr, long long memPtr);
- typedef long long(JNICALL *ComputeJobCreateHandler)(void* target, long long memPtr);
- typedef void(JNICALL *ComputeJobExecuteHandler)(void* target, long long jobPtr, int cancel, long long memPtr);
- typedef void(JNICALL *ComputeJobCancelHandler)(void* target, long long jobPtr);
- typedef void(JNICALL *ComputeJobDestroyHandler)(void* target, long long jobPtr);
-
- typedef void(JNICALL *ContinuousQueryListenerApplyHandler)(void* target, long long lsnrPtr, long long memPtr);
- typedef long long(JNICALL *ContinuousQueryFilterCreateHandler)(void* target, long long memPtr);
- typedef int(JNICALL *ContinuousQueryFilterApplyHandler)(void* target, long long filterPtr, long long memPtr);
- typedef void(JNICALL *ContinuousQueryFilterReleaseHandler)(void* target, long long filterPtr);
-
- typedef void(JNICALL *DataStreamerTopologyUpdateHandler)(void* target, long long ldrPtr, long long topVer, int topSize);
- typedef void(JNICALL *DataStreamerStreamReceiverInvokeHandler)(void* target, long long ptr, void* cache, long long memPtr, unsigned char keepPortable);
-
- typedef void(JNICALL *FutureByteResultHandler)(void* target, long long futAddr, int res);
- typedef void(JNICALL *FutureBoolResultHandler)(void* target, long long futAddr, int res);
- typedef void(JNICALL *FutureShortResultHandler)(void* target, long long futAddr, int res);
- typedef void(JNICALL *FutureCharResultHandler)(void* target, long long futAddr, int res);
- typedef void(JNICALL *FutureIntResultHandler)(void* target, long long futAddr, int res);
- typedef void(JNICALL *FutureFloatResultHandler)(void* target, long long futAddr, float res);
- typedef void(JNICALL *FutureLongResultHandler)(void* target, long long futAddr, long long res);
- typedef void(JNICALL *FutureDoubleResultHandler)(void* target, long long futAddr, double res);
- typedef void(JNICALL *FutureObjectResultHandler)(void* target, long long futAddr, long long memPtr);
- typedef void(JNICALL *FutureNullResultHandler)(void* target, long long futAddr);
- typedef void(JNICALL *FutureErrorHandler)(void* target, long long futAddr, long long memPtr);
-
- typedef void(JNICALL *LifecycleEventHandler)(void* target, long long ptr, int evt);
-
- typedef void(JNICALL *MemoryReallocateHandler)(void* target, long long memPtr, int cap);
-
- typedef long long(JNICALL *MessagingFilterCreateHandler)(void* target, long long memPtr);
- typedef int(JNICALL *MessagingFilterApplyHandler)(void* target, long long ptr, long long memPtr);
- typedef void(JNICALL *MessagingFilterDestroyHandler)(void* target, long long ptr);
-
- typedef long long(JNICALL *EventFilterCreateHandler)(void* target, long long memPtr);
- typedef int(JNICALL *EventFilterApplyHandler)(void* target, long long ptr, long long memPtr);
- typedef void(JNICALL *EventFilterDestroyHandler)(void* target, long long ptr);
-
- typedef long long(JNICALL *ServiceInitHandler)(void* target, long long memPtr);
- typedef void(JNICALL *ServiceExecuteHandler)(void* target, long long svcPtr, long long memPtr);
- typedef void(JNICALL *ServiceCancelHandler)(void* target, long long svcPtr, long long memPtr);
- typedef void(JNICALL *ServiceInvokeMethodHandler)(void* target, long long svcPtr, long long inMemPtr, long long outMemPtr);
- typedef int(JNICALL *ClusterNodeFilterApplyHandler)(void* target, long long memPtr);
-
- typedef long long(JNICALL *NodeInfoHandler)(void* target, long long memPtr);
-
- typedef void(JNICALL *OnStartHandler)(void* target, void* proc, long long memPtr);
- typedef void(JNICALL *OnStopHandler)(void* target);
- typedef void(JNICALL *ErrorHandler)(void* target, int errCode, const char* errClsChars, int errClsCharsLen, const char* errMsgChars, int errMsgCharsLen, void* errData, int errDataLen);
-
- typedef long long(JNICALL *ExtensionCallbackInLongOutLongHandler)(void* target, int typ, long long arg1);
- typedef long long(JNICALL *ExtensionCallbackInLongLongOutLongHandler)(void* target, int typ, long long arg1, long long arg2);
-
- /**
- * JNI handlers holder.
- */
- struct JniHandlers {
- void* target;
-
- CacheStoreCreateHandler cacheStoreCreate;
- CacheStoreInvokeHandler cacheStoreInvoke;
- CacheStoreDestroyHandler cacheStoreDestroy;
- CacheStoreSessionCreateHandler cacheStoreSessionCreate;
-
- CacheEntryFilterCreateHandler cacheEntryFilterCreate;
- CacheEntryFilterApplyHandler cacheEntryFilterApply;
- CacheEntryFilterDestroyHandler cacheEntryFilterDestroy;
-
- CacheInvokeHandler cacheInvoke;
-
- ComputeTaskMapHandler computeTaskMap;
- ComputeTaskJobResultHandler computeTaskJobRes;
- ComputeTaskReduceHandler computeTaskReduce;
- ComputeTaskCompleteHandler computeTaskComplete;
- ComputeJobSerializeHandler computeJobSerialize;
- ComputeJobCreateHandler computeJobCreate;
- ComputeJobExecuteHandler computeJobExec;
- ComputeJobCancelHandler computeJobCancel;
- ComputeJobDestroyHandler computeJobDestroy;
-
- ContinuousQueryListenerApplyHandler contQryLsnrApply;
- ContinuousQueryFilterCreateHandler contQryFilterCreate;
- ContinuousQueryFilterApplyHandler contQryFilterApply;
- ContinuousQueryFilterReleaseHandler contQryFilterRelease;
-
- DataStreamerTopologyUpdateHandler dataStreamerTopologyUpdate;
- DataStreamerStreamReceiverInvokeHandler streamReceiverInvoke;
-
- FutureByteResultHandler futByteRes;
- FutureBoolResultHandler futBoolRes;
- FutureShortResultHandler futShortRes;
- FutureCharResultHandler futCharRes;
- FutureIntResultHandler futIntRes;
- FutureFloatResultHandler futFloatRes;
- FutureLongResultHandler futLongRes;
- FutureDoubleResultHandler futDoubleRes;
- FutureObjectResultHandler futObjRes;
- FutureNullResultHandler futNullRes;
- FutureErrorHandler futErr;
-
- LifecycleEventHandler lifecycleEvt;
-
- MemoryReallocateHandler memRealloc;
-
- MessagingFilterCreateHandler messagingFilterCreate;
- MessagingFilterApplyHandler messagingFilterApply;
- MessagingFilterDestroyHandler messagingFilterDestroy;
-
- EventFilterCreateHandler eventFilterCreate;
- EventFilterApplyHandler eventFilterApply;
- EventFilterDestroyHandler eventFilterDestroy;
-
- ServiceInitHandler serviceInit;
- ServiceExecuteHandler serviceExecute;
- ServiceCancelHandler serviceCancel;
- ServiceInvokeMethodHandler serviceInvokeMethod;
-
- ClusterNodeFilterApplyHandler clusterNodeFilterApply;
-
- NodeInfoHandler nodeInfo;
-
- OnStartHandler onStart;
- OnStopHandler onStop;
- ErrorHandler error;
-
- ExtensionCallbackInLongOutLongHandler extensionCallbackInLongOutLong;
- ExtensionCallbackInLongLongOutLongHandler extensionCallbackInLongLongOutLong;
- };
-
- /**
- * JNI Java members.
- */
- struct JniJavaMembers {
- jclass c_Class;
- jmethodID m_Class_getName;
-
- jclass c_Throwable;
- jmethodID m_Throwable_getMessage;
- jmethodID m_Throwable_printStackTrace;
-
- /**
- * Constructor.
- */
- void Initialize(JNIEnv* env);
-
- /**
- * Destroy members releasing all allocated classes.
- */
- void Destroy(JNIEnv* env);
-
- /**
- * Write error information.
- */
- bool WriteErrorInfo(JNIEnv* env, char** errClsName, int* errClsNameLen, char** errMsg, int* errMsgLen);
- };
-
- /**
- * JNI members.
- */
- struct JniMembers {
- jclass c_PlatformAbstractQryCursor;
- jmethodID m_PlatformAbstractQryCursor_iter;
- jmethodID m_PlatformAbstractQryCursor_iterHasNext;
- jmethodID m_PlatformAbstractQryCursor_close;
-
- jclass c_PlatformAffinity;
- jmethodID m_PlatformAffinity_partitions;
-
- jclass c_PlatformCache;
- jmethodID m_PlatformCache_withSkipStore;
- jmethodID m_PlatformCache_withNoRetries;
- jmethodID m_PlatformCache_withExpiryPolicy;
- jmethodID m_PlatformCache_withAsync;
- jmethodID m_PlatformCache_withKeepPortable;
- jmethodID m_PlatformCache_clear;
- jmethodID m_PlatformCache_removeAll;
- jmethodID m_PlatformCache_iterator;
- jmethodID m_PlatformCache_localIterator;
- jmethodID m_PlatformCache_enterLock;
- jmethodID m_PlatformCache_exitLock;
- jmethodID m_PlatformCache_tryEnterLock;
- jmethodID m_PlatformCache_closeLock;
- jmethodID m_PlatformCache_rebalance;
- jmethodID m_PlatformCache_size;
-
- jclass c_PlatformCacheStoreCallback;
- jmethodID m_PlatformCacheStoreCallback_invoke;
-
- jclass c_IgniteException;
-
- jclass c_PlatformClusterGroup;
- jmethodID m_PlatformClusterGroup_forOthers;
- jmethodID m_PlatformClusterGroup_forRemotes;
- jmethodID m_PlatformClusterGroup_forDaemons;
- jmethodID m_PlatformClusterGroup_forRandom;
- jmethodID m_PlatformClusterGroup_forOldest;
- jmethodID m_PlatformClusterGroup_forYoungest;
- jmethodID m_PlatformClusterGroup_resetMetrics;
-
- jclass c_PlatformCompute;
- jmethodID m_PlatformCompute_withNoFailover;
- jmethodID m_PlatformCompute_withTimeout;
- jmethodID m_PlatformCompute_executeNative;
-
- jclass c_PlatformContinuousQuery;
- jmethodID m_PlatformContinuousQuery_close;
- jmethodID m_PlatformContinuousQuery_getInitialQueryCursor;
-
- jclass c_PlatformDataStreamer;
- jmethodID m_PlatformDataStreamer_listenTopology;
- jmethodID m_PlatformDataStreamer_getAllowOverwrite;
- jmethodID m_PlatformDataStreamer_setAllowOverwrite;
- jmethodID m_PlatformDataStreamer_getSkipStore;
- jmethodID m_PlatformDataStreamer_setSkipStore;
- jmethodID m_PlatformDataStreamer_getPerNodeBufSize;
- jmethodID m_PlatformDataStreamer_setPerNodeBufSize;
- jmethodID m_PlatformDataStreamer_getPerNodeParallelOps;
- jmethodID m_PlatformDataStreamer_setPerNodeParallelOps;
-
- jclass c_PlatformEvents;
- jmethodID m_PlatformEvents_withAsync;
- jmethodID m_PlatformEvents_stopLocalListen;
- jmethodID m_PlatformEvents_localListen;
- jmethodID m_PlatformEvents_isEnabled;
-
- jclass c_PlatformServices;
- jmethodID m_PlatformServices_withAsync;
- jmethodID m_PlatformServices_withServerKeepPortable;
- jmethodID m_PlatformServices_cancel;
- jmethodID m_PlatformServices_cancelAll;
- jmethodID m_PlatformServices_serviceProxy;
-
- jclass c_PlatformIgnition;
- jmethodID m_PlatformIgnition_start;
- jmethodID m_PlatformIgnition_instance;
- jmethodID m_PlatformIgnition_environmentPointer;
- jmethodID m_PlatformIgnition_stop;
- jmethodID m_PlatformIgnition_stopAll;
-
- jclass c_PlatformMessaging;
- jmethodID m_PlatformMessaging_withAsync;
-
- jclass c_PlatformProcessor;
- jmethodID m_PlatformProcessor_releaseStart;
- jmethodID m_PlatformProcessor_cache;
- jmethodID m_PlatformProcessor_createCache;
- jmethodID m_PlatformProcessor_getOrCreateCache;
- jmethodID m_PlatformProcessor_affinity;
- jmethodID m_PlatformProcessor_dataStreamer;
- jmethodID m_PlatformProcessor_transactions;
- jmethodID m_PlatformProcessor_projection;
- jmethodID m_PlatformProcessor_compute;
- jmethodID m_PlatformProcessor_message;
- jmethodID m_PlatformProcessor_events;
- jmethodID m_PlatformProcessor_services;
- jmethodID m_PlatformProcessor_extensions;
-
- jclass c_PlatformTarget;
- jmethodID m_PlatformTarget_inStreamOutLong;
- jmethodID m_PlatformTarget_inStreamOutObject;
- jmethodID m_PlatformTarget_outLong;
- jmethodID m_PlatformTarget_outStream;
- jmethodID m_PlatformTarget_outObject;
- jmethodID m_PlatformTarget_inStreamOutStream;
- jmethodID m_PlatformTarget_inObjectStreamOutStream;
- jmethodID m_PlatformTarget_listenFuture;
- jmethodID m_PlatformTarget_listenFutureForOperation;
-
- jclass c_PlatformTransactions;
- jmethodID m_PlatformTransactions_txStart;
- jmethodID m_PlatformTransactions_txCommit;
- jmethodID m_PlatformTransactions_txCommitAsync;
- jmethodID m_PlatformTransactions_txRollback;
- jmethodID m_PlatformTransactions_txRollbackAsync;
- jmethodID m_PlatformTransactions_txState;
- jmethodID m_PlatformTransactions_txSetRollbackOnly;
- jmethodID m_PlatformTransactions_txClose;
- jmethodID m_PlatformTransactions_resetMetrics;
-
- jclass c_PlatformUtils;
- jmethodID m_PlatformUtils_reallocate;
- jmethodID m_PlatformUtils_errData;
-
- /**
- * Constructor.
- */
- void Initialize(JNIEnv* env);
-
- /**
- * Destroy members releasing all allocated classes.
- */
- void Destroy(JNIEnv* env);
- };
-
- /**
- * JNI JVM wrapper.
- */
- class IGNITE_IMPORT_EXPORT JniJvm {
- public:
- /**
- * Default constructor for uninitialized JVM.
- */
- JniJvm();
-
- /**
- * Constructor.
- *
- * @param jvm JVM.
- * @param javaMembers Java members.
- * @param members Members.
- */
- JniJvm(JavaVM* jvm, JniJavaMembers javaMembers, JniMembers members);
-
- /**
- * Get JVM.
- *
- * @param JVM.
- */
- JavaVM* GetJvm();
-
- /**
- * Get Java members.
- *
- * @param Java members.
- */
- JniJavaMembers& GetJavaMembers();
-
- /**
- * Get members.
- *
- * @param Members.
- */
- JniMembers& GetMembers();
- private:
- /** JVM. */
- JavaVM* jvm;
-
- /** Java members. */
- JniJavaMembers javaMembers;
-
- /** Members. */
- JniMembers members;
- };
-
- /**
- * JNI error information.
- */
- struct IGNITE_IMPORT_EXPORT JniErrorInfo
- {
- int code;
- char* errCls;
- char* errMsg;
-
- /**
- * Default constructor. Creates empty error info.
- */
- JniErrorInfo();
-
- /**
- * Constructor.
- *
- * @param code Code.
- * @param errCls Error class.
- * @param errMsg Error message.
- */
- JniErrorInfo(int code, const char* errCls, const char* errMsg);
-
- /**
- * Copy constructor.
- *
- * @param other Other instance.
- */
- JniErrorInfo(const JniErrorInfo& other);
-
- /**
- * Assignment operator overload.
- *
- * @param other Other instance.
- * @return This instance.
- */
- JniErrorInfo& operator=(const JniErrorInfo& other);
-
- /**
- * Destructor.
- */
- ~JniErrorInfo();
- };
-
- /**
- * Unmanaged context.
- */
- class IGNITE_IMPORT_EXPORT JniContext {
- public:
- static JniContext* Create(char** opts, int optsLen, JniHandlers hnds);
- static JniContext* Create(char** opts, int optsLen, JniHandlers hnds, JniErrorInfo* errInfo);
- static int Reallocate(long long memPtr, int cap);
- static void Detach();
- static void Release(jobject obj);
-
- jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr);
- jobject IgnitionStart(char* cfgPath, char* name, int factoryId, long long dataPtr, JniErrorInfo* errInfo);
- jobject IgnitionInstance(char* name);
- jobject IgnitionInstance(char* name, JniErrorInfo* errInfo);
- long long IgnitionEnvironmentPointer(char* name);
- long long IgnitionEnvironmentPointer(char* name, JniErrorInfo* errInfo);
- bool IgnitionStop(char* name, bool cancel);
- bool IgnitionStop(char* name, bool cancel, JniErrorInfo* errInfo);
- void IgnitionStopAll(bool cancel);
- void IgnitionStopAll(bool cancel, JniErrorInfo* errInfo);
-
- void ProcessorReleaseStart(jobject obj);
- jobject ProcessorProjection(jobject obj);
- jobject ProcessorCache(jobject obj, const char* name);
- jobject ProcessorCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorCreateCache(jobject obj, const char* name);
- jobject ProcessorCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorGetOrCreateCache(jobject obj, const char* name);
- jobject ProcessorGetOrCreateCache(jobject obj, const char* name, JniErrorInfo* errInfo);
- jobject ProcessorAffinity(jobject obj, const char* name);
- jobject ProcessorDataStreamer(jobject obj, const char* name, bool keepPortable);
- jobject ProcessorTransactions(jobject obj);
- jobject ProcessorCompute(jobject obj, jobject prj);
- jobject ProcessorMessage(jobject obj, jobject prj);
- jobject ProcessorEvents(jobject obj, jobject prj);
- jobject ProcessorServices(jobject obj, jobject prj);
- jobject ProcessorExtensions(jobject obj);
-
- long long TargetInStreamOutLong(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
- void TargetInStreamOutStream(jobject obj, int opType, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
- jobject TargetInStreamOutObject(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
- void TargetInObjectStreamOutStream(jobject obj, int opType, void* arg, long long inMemPtr, long long outMemPtr, JniErrorInfo* errInfo = NULL);
- long long TargetOutLong(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
- void TargetOutStream(jobject obj, int opType, long long memPtr, JniErrorInfo* errInfo = NULL);
- jobject TargetOutObject(jobject obj, int opType, JniErrorInfo* errInfo = NULL);
- void TargetListenFuture(jobject obj, long long futId, int typ);
- void TargetListenFutureForOperation(jobject obj, long long futId, int typ, int opId);
-
- int AffinityPartitions(jobject obj);
-
- jobject CacheWithSkipStore(jobject obj);
- jobject CacheWithNoRetries(jobject obj);
- jobject CacheWithExpiryPolicy(jobject obj, long long create, long long update, long long access);
- jobject CacheWithAsync(jobject obj);
- jobject CacheWithKeepPortable(jobject obj);
- void CacheClear(jobject obj, JniErrorInfo* errInfo = NULL);
- void CacheRemoveAll(jobject obj, JniErrorInfo* errInfo = NULL);
- jobject CacheOutOpQueryCursor(jobject obj, int type, long long memPtr, JniErrorInfo* errInfo = NULL);
- jobject CacheOutOpContinuousQuery(jobject obj, int type, long long memPtr);
- jobject CacheIterator(jobject obj);
- jobject CacheLocalIterator(jobject obj, int peekModes);
- void CacheEnterLock(jobject obj, long long id);
- void CacheExitLock(jobject obj, long long id);
- bool CacheTryEnterLock(jobject obj, long long id, long long timeout);
- void CacheCloseLock(jobject obj, long long id);
- void CacheRebalance(jobject obj, long long futId);
- int CacheSize(jobject obj, int peekModes, bool loc, JniErrorInfo* errInfo = NULL);
-
- void CacheStoreCallbackInvoke(jobject obj, long long memPtr);
-
- void ComputeWithNoFailover(jobject obj);
- void ComputeWithTimeout(jobject obj, long long timeout);
- void ComputeExecuteNative(jobject obj, long long taskPtr, long long topVer);
-
- void ContinuousQueryClose(jobject obj);
- void* ContinuousQueryGetInitialQueryCursor(jobject obj);
-
- void DataStreamerListenTopology(jobject obj, long long ptr);
- bool DataStreamerAllowOverwriteGet(jobject obj);
- void DataStreamerAllowOverwriteSet(jobject obj, bool val);
- bool DataStreamerSkipStoreGet(jobject obj);
- void DataStreamerSkipStoreSet(jobject obj, bool val);
- int DataStreamerPerNodeBufferSizeGet(jobject obj);
- void DataStreamerPerNodeBufferSizeSet(jobject obj, int val);
- int DataStreamerPerNodeParallelOperationsGet(jobject obj);
- void DataStreamerPerNodeParallelOperationsSet(jobject obj, int val);
-
- jobject MessagingWithAsync(jobject obj);
-
- jobject ProjectionForOthers(jobject obj, jobject prj);
- jobject ProjectionForRemotes(jobject obj);
- jobject ProjectionForDaemons(jobject obj);
- jobject ProjectionForRandom(jobject obj);
- jobject ProjectionForOldest(jobject obj);
- jobject ProjectionForYoungest(jobject obj);
- void ProjectionResetMetrics(jobject obj);
- jobject ProjectionOutOpRet(jobject obj, int type, long long memPtr);
-
- void QueryCursorIterator(jobject obj, JniErrorInfo* errInfo = NULL);
- bool QueryCursorIteratorHasNext(jobject obj, JniErrorInfo* errInfo = NULL);
- void QueryCursorClose(jobject obj, JniErrorInfo* errInfo = NULL);
-
- long long TransactionsStart(jobject obj, int concurrency, int isolation, long long timeout, int txSize);
- int TransactionsCommit(jobject obj, long long id);
- void TransactionsCommitAsync(jobject obj, long long id, long long futId);
- int TransactionsRollback(jobject obj, long long id);
- void TransactionsRollbackAsync(jobject obj, long long id, long long futId);
- int TransactionsClose(jobject obj, long long id);
- int TransactionsState(jobject obj, long long id);
- bool TransactionsSetRollbackOnly(jobject obj, long long id);
- void TransactionsResetMetrics(jobject obj);
-
- jobject EventsWithAsync(jobject obj);
- bool EventsStopLocalListen(jobject obj, long long hnd);
- void EventsLocalListen(jobject obj, long long hnd, int type);
- bool EventsIsEnabled(jobject obj, int type);
-
- jobject ServicesWithAsync(jobject obj);
- jobject ServicesWithServerKeepPortable(jobject obj);
- void ServicesCancel(jobject obj, char* name);
- void ServicesCancelAll(jobject obj);
- void* ServicesGetServiceProxy(jobject obj, char* name, bool sticky);
-
- jobject Acquire(jobject obj);
-
- void DestroyJvm();
- void ThrowToJava(char* errMsg);
- private:
- JniJvm* jvm;
- JniHandlers hnds;
-
- JniContext(JniJvm* jvm, JniHandlers hnds);
-
- JNIEnv* Attach();
- void ExceptionCheck(JNIEnv* env);
- void ExceptionCheck(JNIEnv* env, JniErrorInfo* errInfo);
- jobject LocalToGlobal(JNIEnv* env, jobject obj);
- jobject ProcessorCache0(jobject proc, const char* name, jmethodID mthd, JniErrorInfo* errInfo);
- };
-
- JNIEXPORT jlong JNICALL JniCacheStoreCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniCacheStoreInvoke(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr, jlong memPtr, jobject cb);
- JNIEXPORT void JNICALL JniCacheStoreDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr);
- JNIEXPORT jlong JNICALL JniCacheStoreSessionCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong storePtr);
-
- JNIEXPORT jlong JNICALL JniCacheEntryFilterCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniCacheEntryFilterApply(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniCacheEntryFilterDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong objPtr);
-
- JNIEXPORT void JNICALL JniCacheInvoke(JNIEnv *env, jclass cls, jlong envPtr, jlong inMemPtr, jlong outMemPtr);
-
- JNIEXPORT void JNICALL JniComputeTaskMap(JNIEnv *env, jclass cls, jlong envPtr, jlong taskPtr, jlong inMemPtr, jlong outMemPtr);
- JNIEXPORT jint JNICALL JniComputeTaskJobResult(JNIEnv *env, jclass cls, jlong envPtr, jlong taskPtr, jlong jobPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniComputeTaskReduce(JNIEnv *env, jclass cls, jlong envPtr, jlong taskPtr);
- JNIEXPORT void JNICALL JniComputeTaskComplete(JNIEnv *env, jclass cls, jlong envPtr, jlong taskPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniComputeJobSerialize(JNIEnv *env, jclass cls, jlong envPtr, jlong jobPtr, jlong memPtr);
- JNIEXPORT jlong JNICALL JniComputeJobCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniComputeJobExecute(JNIEnv *env, jclass cls, jlong envPtr, jlong jobPtr, jint cancel, jlong memPtr);
- JNIEXPORT void JNICALL JniComputeJobCancel(JNIEnv *env, jclass cls, jlong envPtr, jlong jobPtr);
- JNIEXPORT void JNICALL JniComputeJobDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong jobPtr);
-
- JNIEXPORT void JNICALL JniContinuousQueryListenerApply(JNIEnv *env, jclass cls, jlong envPtr, jlong cbPtr, jlong memPtr);
- JNIEXPORT jlong JNICALL JniContinuousQueryFilterCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniContinuousQueryFilterApply(JNIEnv *env, jclass cls, jlong envPtr, jlong filterPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniContinuousQueryFilterRelease(JNIEnv *env, jclass cls, jlong envPtr, jlong filterPtr);
-
- JNIEXPORT void JNICALL JniDataStreamerTopologyUpdate(JNIEnv *env, jclass cls, jlong envPtr, jlong ldrPtr, jlong topVer, jint topSize);
- JNIEXPORT void JNICALL JniDataStreamerStreamReceiverInvoke(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jobject cache, jlong memPtr, jboolean keepPortable);
-
- JNIEXPORT void JNICALL JniFutureByteResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jint res);
- JNIEXPORT void JNICALL JniFutureBoolResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jint res);
- JNIEXPORT void JNICALL JniFutureShortResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jint res);
- JNIEXPORT void JNICALL JniFutureCharResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jint res);
- JNIEXPORT void JNICALL JniFutureIntResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jint res);
- JNIEXPORT void JNICALL JniFutureFloatResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jfloat res);
- JNIEXPORT void JNICALL JniFutureLongResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jlong res);
- JNIEXPORT void JNICALL JniFutureDoubleResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jdouble res);
- JNIEXPORT void JNICALL JniFutureObjectResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniFutureNullResult(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr);
- JNIEXPORT void JNICALL JniFutureError(JNIEnv *env, jclass cls, jlong envPtr, jlong futPtr, jlong memPtr);
-
- JNIEXPORT void JNICALL JniLifecycleEvent(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jint evt);
-
- JNIEXPORT void JNICALL JniMemoryReallocate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr, jint cap);
-
- JNIEXPORT jlong JNICALL JniMessagingFilterCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniMessagingFilterApply(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr);
- JNIEXPORT void JNICALL JniMessagingFilterDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr);
-
- JNIEXPORT jlong JNICALL JniEventFilterCreate(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT jint JNICALL JniEventFilterApply(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr, jlong memPtr);
- JNIEXPORT void JNICALL JniEventFilterDestroy(JNIEnv *env, jclass cls, jlong envPtr, jlong ptr);
-
- JNIEXPORT jlong JNICALL JniServiceInit(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniServiceExecute(JNIEnv *env, jclass cls, jlong envPtr, jlong svcPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniServiceCancel(JNIEnv *env, jclass cls, jlong envPtr, jlong svcPtr, jlong memPtr);
- JNIEXPORT void JNICALL JniServiceInvokeMethod(JNIEnv *env, jclass cls, jlong envPtr, jlong svcPtr, jlong inMemPtr, jlong outMemPtr);
- JNIEXPORT jint JNICALL JniClusterNodeFilterApply(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
-
- JNIEXPORT jlong JNICALL JniNodeInfo(JNIEnv *env, jclass cls, jlong envPtr, jlong memPtr);
-
- JNIEXPORT void JNICALL JniOnStart(JNIEnv *env, jclass cls, jlong envPtr, jobject proc, jlong memPtr);
- JNIEXPORT void JNICALL JniOnStop(JNIEnv *env, jclass cls, jlong envPtr);
-
- JNIEXPORT jlong JNICALL JniExtensionCallbackInLongOutLong(JNIEnv *env, jclass cls, jlong envPtr, jint typ, jlong arg1);
- JNIEXPORT jlong JNICALL JniExtensionCallbackInLongLongOutLong(JNIEnv *env, jclass cls, jlong envPtr, jint typ, jlong arg1, jlong arg2);
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/linux/include/Makefile.am
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/linux/include/Makefile.am b/modules/platform/src/main/cpp/common/os/linux/include/Makefile.am
deleted file mode 100644
index 68e45e6..0000000
--- a/modules/platform/src/main/cpp/common/os/linux/include/Makefile.am
+++ /dev/null
@@ -1,21 +0,0 @@
-##
-## 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.
-##
-
-ACLOCAL_AMFLAGS = "-Im4"
-
-nobase_include_HEADERS = ignite/common/common.h \
- ignite/common/concurrent_os.h
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/common.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/common.h b/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/common.h
deleted file mode 100644
index 6577ad8..0000000
--- a/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/common.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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_COMMON_OS
-#define _IGNITE_COMMON_OS
-
-#ifndef __has_attribute
- #define __has_attribute(x) 0
-#endif
-
-#if (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4) && (__GNUC_MINOR__ > 2))) || __has_attribute(visibility)
- #define IGNITE_EXPORT __attribute__((visibility("default")))
- #define IGNITE_IMPORT __attribute__((visibility("default")))
-#else
- #define IGNITE_EXPORT
- #define IGNITE_IMPORT
-#endif
-
-#define IGNITE_CALL
-
-#ifdef IGNITE_IMPL
- #define IGNITE_IMPORT_EXPORT IGNITE_EXPORT
-#else
- #define IGNITE_IMPORT_EXPORT IGNITE_IMPORT
-#endif
-
-/**
- * Common construction to disable copy constructor and assignment for class.
- */
-#define IGNITE_NO_COPY_ASSIGNMENT(cls) \
- cls(const cls& src); \
- cls& operator= (const cls& other);
-
-namespace ignite
-{
- namespace common
- {
- /**
- * Helper class to manage attached threads.
- */
- class AttachHelper
- {
- public:
- /**
- * Destructor.
- */
- ~AttachHelper();
-
- /**
- * Callback invoked on successful thread attach ot JVM.
- */
- static void OnThreadAttach();
- private:
- /**
- * Helper method to allocate attach key.
- */
- static void AllocateAttachKey();
-
- /**
- * Attach key destructor.
- */
- static void DestroyAttachKey(void* key);
- };
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/concurrent_os.h
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/concurrent_os.h b/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/concurrent_os.h
deleted file mode 100644
index 63798b1..0000000
--- a/modules/platform/src/main/cpp/common/os/linux/include/ignite/common/concurrent_os.h
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * 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_COMMON_CONCURRENT_OS
-#define _IGNITE_COMMON_CONCURRENT_OS
-
-#include <map>
-#include <stdint.h>
-#include <pthread.h>
-
-#include "ignite/common/common.h"
-
-namespace ignite
-{
- namespace common
- {
- namespace concurrent
- {
- /**
- * Static class to manage memory visibility semantics.
- */
- class IGNITE_IMPORT_EXPORT Memory {
- public:
- /**
- * Full fence.
- */
- static void Fence();
- };
-
- /**
- * Critical section.
- */
- class IGNITE_IMPORT_EXPORT CriticalSection {
- public:
- /**
- * Constructor.
- */
- CriticalSection();
-
- /**
- * Destructor.
- */
- ~CriticalSection();
-
- /**
- * Enter critical section.
- */
- void Enter();
-
- /**
- * Leave critical section.
- */
- void Leave();
- private:
- pthread_mutex_t mux;
-
- IGNITE_NO_COPY_ASSIGNMENT(CriticalSection)
- };
-
- /**
- * Special latch with count = 1.
- */
- class IGNITE_IMPORT_EXPORT SingleLatch
- {
- public:
- /**
- * Constructor.
- */
- SingleLatch();
-
- /**
- * Destructor.
- */
- ~SingleLatch();
-
- /**
- * Perform the countdown.
- */
- void CountDown();
-
- /**
- * Await the countdown.
- */
- void Await();
- private:
- /** Mutex. */
- pthread_mutex_t mux;
-
- /** Condition. */
- pthread_cond_t cond;
-
- /** Ready flag. */
- bool ready;
-
- IGNITE_NO_COPY_ASSIGNMENT(SingleLatch)
- };
-
- /**
- * Primitives for atomic access.
- */
- class IGNITE_IMPORT_EXPORT Atomics
- {
- public:
- /**
- * Update the 32-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return True if update occurred as a result of this call, false otherwise.
- */
- static bool CompareAndSet32(int32_t* ptr, int32_t expVal, int32_t newVal);
-
- /**
- * Update the 32-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return Value which were observed during CAS attempt.
- */
- static int32_t CompareAndSet32Val(int32_t* ptr, int32_t expVal, int32_t newVal);
-
- /**
- * Increment 32-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after increment.
- */
- static int32_t IncrementAndGet32(int32_t* ptr);
-
- /**
- * Decrement 32-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after decrement.
- */
- static int32_t DecrementAndGet32(int32_t* ptr);
-
- /**
- * Update the 64-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return True if update occurred as a result of this call, false otherwise.
- */
- static bool CompareAndSet64(int64_t* ptr, int64_t expVal, int64_t newVal);
-
- /**
- * Update the 64-bit integer value if it is equal to expected value.
- *
- * @param ptr Pointer.
- * @param expVal Expected value.
- * @param newVal New value.
- * @return Value which were observed during CAS attempt.
- */
- static int64_t CompareAndSet64Val(int64_t* ptr, int64_t expVal, int64_t newVal);
-
- /**
- * Increment 64-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after increment.
- */
- static int64_t IncrementAndGet64(int64_t* ptr);
-
- /**
- * Decrement 64-bit integer and return new value.
- *
- * @param ptr Pointer.
- * @return Value after decrement.
- */
- static int64_t DecrementAndGet64(int64_t* ptr);
- };
-
- /**
- * Thread-local entry.
- */
- class IGNITE_IMPORT_EXPORT ThreadLocalEntry
- {
- public:
- /**
- * Virtual destructor to allow for correct typed entries cleanup.
- */
- virtual ~ThreadLocalEntry()
- {
- // No-op.
- }
- };
-
- /**
- * Typed thread-local entry.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT ThreadLocalTypedEntry : public ThreadLocalEntry
- {
- public:
- /**
- * Constructor.
- *
- * @param val Value.
- */
- ThreadLocalTypedEntry(T val) : val(val)
- {
- // No-op.
- }
-
- ~ThreadLocalTypedEntry()
- {
- // No-op.
- }
-
- /**
- * Get value.
- *
- * @return Value.
- */
- T Get()
- {
- return val;
- }
- private:
- /** Value. */
- T val;
- };
-
- /**
- * Thread-local abstraction.
- */
- class IGNITE_IMPORT_EXPORT ThreadLocal
- {
- public:
- /**
- * Get next available index to be used in thread-local storage.
- *
- * @return Index.
- */
- static int32_t NextIndex();
-
- /**
- * Get value by index.
- *
- * @param idx Index.
- * @return Value associated with the index or NULL.
- */
- template<typename T>
- static T Get(int32_t idx)
- {
- void* linuxVal = Get0();
-
- if (linuxVal)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(linuxVal);
-
- ThreadLocalTypedEntry<T>* entry = static_cast<ThreadLocalTypedEntry<T>*>((*map)[idx]);
-
- if (entry)
- return entry->Get();
- }
-
- return T();
- }
-
- /**
- * Set value at the given index.
- *
- * @param idx Index.
- * @param val Value to be associated with the index.
- */
- template<typename T>
- static void Set(int32_t idx, const T& val)
- {
- void* linuxVal = Get0();
-
- if (linuxVal)
- {
- std::map<int32_t, ThreadLocalEntry*>* map =
- static_cast<std::map<int32_t, ThreadLocalEntry*>*>(linuxVal);
-
- ThreadLocalEntry* appVal = (*map)[idx];
-
- if (appVal)
- delete appVal;
-
- (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
- }
- else
- {
- std::map<int32_t, ThreadLocalEntry*>* map = new std::map<int32_t, ThreadLocalEntry*>();
-
- Set0(map);
-
- (*map)[idx] = new ThreadLocalTypedEntry<T>(val);
- }
- }
-
- /**
- * Remove value at the given index.
- *
- * @param idx Index.
- */
- static void Remove(int32_t idx);
-
- /**
- * Internal thread-local map clear routine.
- *
- * @param mapPtr Pointer to map.
- */
- static void Clear0(void* mapPtr);
-
- private:
- /**
- * Internal get routine.
- *
- * @param Associated value.
- */
- static void* Get0();
-
- /**
- * Internal set routine.
- *
- * @param ptr Pointer.
- */
- static void Set0(void* ptr);
- };
-
- /**
- * Thread-local instance. Simplifies API avoiding direct index allocations.
- */
- template<typename T>
- class IGNITE_IMPORT_EXPORT ThreadLocalInstance
- {
- public:
- /**
- * Constructor.
- */
- ThreadLocalInstance() : idx(ThreadLocal::NextIndex())
- {
- // No-op.
- }
-
- /**
- * Get value.
- *
- * @return Value.
- */
- T Get()
- {
- return ThreadLocal::Get<T>(idx);
- }
-
- /**
- * Set instance.
- *
- * @param val Value.
- */
- void Set(const T& val)
- {
- ThreadLocal::Set<T>(idx, val);
- }
-
- /**
- * Remove instance.
- */
- void Remove()
- {
- ThreadLocal::Remove(idx);
- }
-
- private:
- /** Index. */
- int32_t idx;
- };
- }
- }
-}
-
-#endif
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/cpp/common/os/linux/src/common.cpp
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/cpp/common/os/linux/src/common.cpp b/modules/platform/src/main/cpp/common/os/linux/src/common.cpp
deleted file mode 100644
index c0cccdc..0000000
--- a/modules/platform/src/main/cpp/common/os/linux/src/common.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * 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.
- */
-#include <pthread.h>
-
-#include "ignite/common/common.h"
-#include "ignite/common/java.h"
-
-using namespace ignite::common::java;
-
-namespace ignite
-{
- namespace common
- {
- /** Key indicating that the thread is attached. */
- static pthread_key_t attachKey;
-
- /** Helper to ensure that attach key is allocated only once. */
- static pthread_once_t attachKeyInit = PTHREAD_ONCE_INIT;
-
- AttachHelper::~AttachHelper()
- {
- JniContext::Detach();
- }
-
- void AttachHelper::OnThreadAttach()
- {
- pthread_once(&attachKeyInit, AllocateAttachKey);
-
- void* val = pthread_getspecific(attachKey);
-
- if (!val)
- pthread_setspecific(attachKey, new AttachHelper());
- }
-
- void AttachHelper::AllocateAttachKey()
- {
- pthread_key_create(&attachKey, DestroyAttachKey);
- }
-
- void AttachHelper::DestroyAttachKey(void* key)
- {
- delete reinterpret_cast<AttachHelper*>(key);
- }
- }
-}
[35/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheAffinity.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheAffinity.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheAffinity.cs
deleted file mode 100644
index 64f34d7..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheAffinity.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
-
- /// <summary>
- /// Provides affinity information to detect which node is primary and which nodes are
- /// backups for a partitioned cache. You can get an instance of this interface by calling
- /// <see cref="IIgnite.GetAffinity"/> method.
- /// <para />
- /// Mapping of a key to a node is a three-step operation. First step will get an affinity key for
- /// given key using <c>CacheAffinityKeyMapper</c>. If mapper is not specified, the original key
- /// will be used. Second step will map affinity key to partition using
- /// <c>CacheAffinityFunction.partition(Object)</c> method. Third step will map obtained partition
- /// to nodes for current grid topology version.
- /// <para />
- /// Interface provides various <c>mapKeysToNodes(...)</c> methods which provide node affinity mapping
- /// for given keys. All <c>mapKeysToNodes(...)</c> methods are not transactional and will not enlist
- /// keys into ongoing transaction.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface ICacheAffinity
- {
- /// <summary>
- /// Gets number of partitions in cache according to configured affinity function.
- /// </summary>
- /// <returns>Number of cache partitions.</returns>
- int Partitions { get; }
-
- /// <summary>
- /// Gets partition id for the given key.
- /// </summary>
- /// <param name="key">Key to get partition id for.</param>
- /// <returns>Partition id.</returns>
- int GetPartition<TK>(TK key);
-
- /// <summary>
- /// Returns 'true' if given node is the primary node for given key.
- /// </summary>
- /// <param name="n">Node.</param>
- /// <param name="key">Key.</param>
- /// <returns>'True' if given node is the primary node for given key.</returns>
- bool IsPrimary<TK>(IClusterNode n, TK key);
-
- /// <summary>
- /// Returns 'true' if given node is the backup node for given key.
- /// </summary>
- /// <param name="n">Node.</param>
- /// <param name="key">Key.</param>
- /// <returns>'True' if given node is the backup node for given key.</returns>
- bool IsBackup<TK>(IClusterNode n, TK key);
-
- /// <summary>
- /// Returns 'true' if given node is either primary or backup node for given key.
- /// </summary>
- /// <param name="n">Node.</param>
- /// <param name="key">Key.</param>
- /// <returns>'True' if given node is either primary or backup node for given key.</returns>
- bool IsPrimaryOrBackup<TK>(IClusterNode n, TK key);
-
- /// <summary>
- /// Gets partition ids for which nodes of the given projection has primary
- /// ownership.
- /// </summary>
- /// <param name="n">Node.</param>
- /// <returns>Partition ids for which given projection has primary ownership.</returns>
- int[] GetPrimaryPartitions(IClusterNode n);
-
- /// <summary>
- /// Gets partition ids for which nodes of the given projection has backup
- /// ownership.
- /// </summary>
- /// <param name="n">Node.</param>
- /// <returns>Partition ids for which given projection has backup ownership.</returns>
- int[] GetBackupPartitions(IClusterNode n);
-
- /// <summary>
- /// Gets partition ids for which nodes of the given projection has ownership
- /// (either primary or backup).
- /// </summary>
- /// <param name="n">Node.</param>
- /// <returns>Partition ids for which given projection has ownership.</returns>
- int[] GetAllPartitions(IClusterNode n);
-
- /// <summary>
- /// Maps passed in key to a key which will be used for node affinity.
- /// </summary>
- /// <param name="key">Key to map.</param>
- /// <returns>Key to be used for node-to-affinity mapping (may be the same key as passed in).</returns>
- TR GetAffinityKey<TK, TR>(TK key);
-
- /// <summary>
- /// This method provides ability to detect which keys are mapped to which nodes.
- /// Use it to determine which nodes are storing which keys prior to sending
- /// jobs that access these keys.
- /// </summary>
- /// <param name="keys">Keys to map to nodes.</param>
- /// <returns>Map of nodes to keys or empty map if there are no alive nodes for this cache.</returns>
- IDictionary<IClusterNode, IList<TK>> MapKeysToNodes<TK>(IList<TK> keys);
-
- /// <summary>
- /// This method provides ability to detect to which primary node the given key
- /// is mapped. Use it to determine which nodes are storing which keys prior to sending
- /// jobs that access these keys.
- /// </summary>
- /// <param name="key">Keys to map to a node.</param>
- /// <returns>Primary node for the key or null if there are no alive nodes for this cache.</returns>
- IClusterNode MapKeyToNode<TK>(TK key);
-
- /// <summary>
- /// Gets primary and backup nodes for the key. Note that primary node is always
- /// first in the returned collection.
- /// </summary>
- /// <param name="key"></param>
- /// <returns></returns>
- IList<IClusterNode> MapKeyToPrimaryAndBackups<TK>(TK key);
-
- /// <summary>
- /// Gets primary node for the given partition.
- /// </summary>
- /// <param name="part">Partition id.</param>
- /// <returns>Primary node for the given partition.</returns>
- IClusterNode MapPartitionToNode(int part);
-
- /// <summary>
- /// Gets primary nodes for the given partitions.
- /// </summary>
- /// <param name="parts">Partition ids.</param>
- /// <returns>Mapping of given partitions to their primary nodes.</returns>
- IDictionary<int, IClusterNode> MapPartitionsToNodes(IList<int> parts);
-
- /// <summary>
- /// Gets primary and backup nodes for partition. Note that primary node is always
- /// first in the returned collection.
- /// </summary>
- /// <param name="part">Partition to get affinity nodes for.</param>
- /// <returns>Collection of primary and backup nodes for partition with primary node always first</returns>
- IList<IClusterNode> MapPartitionToPrimaryAndBackups(int part);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntry.cs
deleted file mode 100644
index 49ebfec..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntry.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// Cache entry interface.
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- public interface ICacheEntry<out TK, out TV>
- {
- /// <summary>
- /// Gets the key.
- /// </summary>
- TK Key { get; }
-
- /// <summary>
- /// Gets the value.
- /// </summary>
- TV Value { get; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryFilter.cs
deleted file mode 100644
index 9c7ee88..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryFilter.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// Cache entry predicate.
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- public interface ICacheEntryFilter<in TK, in TV>
- {
- /// <summary>
- /// Returns a value indicating whether provided cache entry satisfies this predicate.
- /// </summary>
- /// <param name="entry">Cache entry.</param>
- /// <returns>Value indicating whether provided cache entry satisfies this predicate.</returns>
- bool Invoke(ICacheEntry<TK, TV> entry);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessor.cs
deleted file mode 100644
index c8614c0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessor.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// An invocable function that allows applications to perform compound operations
- /// on a cache entry atomically, according the defined consistency of a cache.
- /// <para />
- /// Any cache entry mutations will not take effect until after
- /// the <see cref="Process" /> method has completedS execution.
- /// <para />
- /// If an exception is thrown by an entry processor, a Caching Implementation
- /// must wrap any exception thrown wrapped in an <see cref="CacheEntryProcessorException" />
- /// If this occurs no mutations will be made to the cache entry.
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- /// <typeparam name="TA">The type of the processor argument.</typeparam>
- /// <typeparam name="TR">The type of the processor result.</typeparam>
- public interface ICacheEntryProcessor<in TK, TV, in TA, out TR>
- {
- /// <summary>
- /// Process an entry.
- /// </summary>
- /// <param name="entry">The entry to process.</param>
- /// <param name="arg">The argument.</param>
- /// <returns>Processing result.</returns>
- TR Process(IMutableCacheEntry<TK, TV> entry, TA arg);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessorResult.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessorResult.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessorResult.cs
deleted file mode 100644
index 2d0f709..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheEntryProcessorResult.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// Represents a result of processing <see cref="ICacheEntry{K, V}"/>
- /// by <see cref="ICacheEntryProcessor{K, V, A, R}"/>.
- /// </summary>
- /// <typeparam name="T">Processor result type.</typeparam>
- public interface ICacheEntryProcessorResult<out T>
- {
- /// <summary>
- /// Gets the result of processing an entry.
- /// <para />
- /// If an exception was thrown during the processing of an entry,
- /// either by the <see cref="ICacheEntryProcessor{K, V, A, R}"/> itself
- /// or by the Caching implementation, the exceptions will be wrapped and re-thrown as a
- /// <see cref="CacheEntryProcessorException"/> when calling this property.
- /// </summary>
- /// <value>
- /// The result.
- /// </value>
- T Result { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheLock.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheLock.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheLock.cs
deleted file mode 100644
index a930961..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheLock.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- using System;
- using System.Threading;
-
- /// <summary>
- /// Cache locking interface.
- /// <para/>
- /// All members are thread-safe and may be used concurrently from multiple threads.
- /// </summary>
- public interface ICacheLock : IDisposable
- {
- /// <summary>
- /// Acquires an exclusive lock.
- /// </summary>
- void Enter();
-
- /// <summary>
- /// Acquires an exclusive lock only if it is free at the time of invocation.
- /// </summary>
- /// <returns>True if the current thread acquires the lock; otherwise, false.</returns>
- bool TryEnter();
-
- /// <summary>
- /// Attempts, for the specified amount of time, to acquire an exclusive lock.
- /// </summary>
- /// <param name="timeout">
- /// A <see cref="TimeSpan" /> representing the amount of time to wait for the lock.
- /// A value of –1 millisecond specifies an infinite wait.
- /// </param>
- /// <returns>True if the current thread acquires the lock; otherwise, false.</returns>
- bool TryEnter(TimeSpan timeout);
-
- /// <summary>
- /// Releases an exclusive lock on the specified object.
- /// <see cref="IDisposable.Dispose"/> does not call this method and will throw
- /// <see cref="SynchronizationLockException"/> if this lock is acquired.
- /// </summary>
- void Exit();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs
deleted file mode 100644
index 3405625..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/ICacheMetrics.cs
+++ /dev/null
@@ -1,486 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// Cache metrics used to obtain statistics on cache itself.
- /// </summary>
- public interface ICacheMetrics
- {
- /// <summary>
- /// The number of get requests that were satisfied by the cache.
- /// </summary>
- /// <returns>
- /// The number of hits
- /// </returns>
- long CacheHits { get; }
-
- /// <summary>
- /// This is a measure of cache efficiency.
- /// </summary>
- /// <returns>
- /// The percentage of successful hits, as a decimal e.g 75.
- /// </returns>
- float CacheHitPercentage { get; }
-
- /// <summary>
- /// A miss is a get request that is not satisfied.
- /// </summary>
- /// <returns>
- /// The number of misses
- /// </returns>
- long CacheMisses { get; }
-
- /// <summary>
- /// Returns the percentage of cache accesses that did not find a requested entry in the cache.
- /// </summary>
- /// <returns>
- /// The percentage of accesses that failed to find anything.
- /// </returns>
- float CacheMissPercentage { get; }
-
- /// <summary>
- /// The total number of requests to the cache. This will be equal to the sum of the hits and misses.
- /// </summary>
- /// <returns>
- /// The number of gets.
- /// </returns>
- long CacheGets { get; }
-
- /// <summary>
- /// The total number of puts to the cache.
- /// </summary>
- /// <returns>
- /// The number of puts.
- /// </returns>
- long CachePuts { get; }
-
- /// <summary>
- /// The total number of removals from the cache. This does not include evictions, where the cache itself
- /// initiates the removal to make space.
- /// </summary>
- /// <returns>
- /// The number of removals.
- /// </returns>
- long CacheRemovals { get; }
-
- /// <summary>
- /// The total number of evictions from the cache. An eviction is a removal initiated by the cache itself
- /// to free up space. An eviction is not treated as a removal and does not appear in the removal counts.
- /// </summary>
- /// <returns>
- /// The number of evictions.
- /// </returns>
- long CacheEvictions { get; }
-
- /// <summary>
- /// The mean time to execute gets.
- /// </summary>
- /// <returns>
- /// The time in �s.
- /// </returns>
- float AverageGetTime { get; }
-
- /// <summary>
- /// The mean time to execute puts.
- /// </summary>
- /// <returns>
- /// The time in �s.
- /// </returns>
- float AveragePutTime { get; }
-
- /// <summary>
- /// The mean time to execute removes.
- /// </summary>
- /// <returns>
- /// The time in �s.
- /// </returns>
- float AverageRemoveTime { get; }
-
- /// <summary>
- /// The mean time to execute tx commit.
- /// </summary>
- /// <returns>
- /// The time in �s.
- /// </returns>
- float AverageTxCommitTime { get; }
-
- /// <summary>
- /// The mean time to execute tx rollbacks.
- /// </summary>
- /// <returns>
- /// Number of transaction rollbacks.
- /// </returns>
- float AverageTxRollbackTime { get; }
-
- /// <summary>
- /// Gets total number of transaction commits.
- /// </summary>
- /// <returns>
- /// Number of transaction commits.
- /// </returns>
- long CacheTxCommits { get; }
-
- /// <summary>
- /// Gets total number of transaction rollbacks.
- /// </summary>
- /// <returns>
- /// Number of transaction rollbacks.
- /// </returns>
- long CacheTxRollbacks { get; }
-
- /// <summary>
- /// Gets cache name.
- /// </summary>
- /// <returns>
- /// Cache name.
- /// </returns>
- string CacheName { get; }
-
- /// <summary>
- /// Gets number of entries that was swapped to disk.
- /// </summary>
- /// <returns>
- /// Number of entries that was swapped to disk.
- /// </returns>
- long OverflowSize { get; }
-
- /// <summary>
- /// Gets number of entries stored in off-heap memory.
- /// </summary>
- /// <returns>
- /// Number of entries stored in off-heap memory.
- /// </returns>
- long OffHeapEntriesCount { get; }
-
- /// <summary>
- /// Gets memory size allocated in off-heap.
- /// </summary>
- /// <returns>
- /// Memory size allocated in off-heap.
- /// </returns>
- long OffHeapAllocatedSize { get; }
-
- /// <summary>
- /// Gets number of non-null values in the cache.
- /// </summary>
- /// <returns>
- /// Number of non-null values in the cache.
- /// </returns>
- int Size { get; }
-
- /// <summary>
- /// Gets number of keys in the cache, possibly with null values.
- /// </summary>
- /// <returns>
- /// Number of keys in the cache.
- /// </returns>
- int KeySize { get; }
-
- /// <summary>
- /// Returns true if this cache is empty.
- /// </summary>
- /// <returns>
- /// True if this cache is empty.
- /// </returns>
- bool IsEmpty { get; }
-
- /// <summary>
- /// Gets current size of evict queue used to batch up evictions.
- /// </summary>
- /// <returns>
- /// Current size of evict queue.
- /// </returns>
- int DhtEvictQueueCurrentSize { get; }
-
- /// <summary>
- /// Gets transaction per-thread map size.
- /// </summary>
- /// <returns>
- /// Thread map size.
- /// </returns>
- int TxThreadMapSize { get; }
-
- /// <summary>
- /// Gets transaction per-Xid map size.
- /// </summary>
- /// <returns>
- /// Transaction per-Xid map size.
- /// </returns>
- int TxXidMapSize { get; }
-
- /// <summary>
- /// Gets committed transaction queue size.
- /// </summary>
- /// <returns>
- /// Committed transaction queue size.
- /// </returns>
- int TxCommitQueueSize { get; }
-
- /// <summary>
- /// Gets prepared transaction queue size.
- /// </summary>
- /// <returns>
- /// Prepared transaction queue size.
- /// </returns>
- int TxPrepareQueueSize { get; }
-
- /// <summary>
- /// Gets start version counts map size.
- /// </summary>
- /// <returns>
- /// Start version counts map size.
- /// </returns>
- int TxStartVersionCountsSize { get; }
-
- /// <summary>
- /// Gets number of cached committed transaction IDs.
- /// </summary>
- /// <returns>
- /// Number of cached committed transaction IDs.
- /// </returns>
- int TxCommittedVersionsSize { get; }
-
- /// <summary>
- /// Gets number of cached rolled back transaction IDs.
- /// </summary>
- /// <returns>
- /// Number of cached rolled back transaction IDs.
- /// </returns>
- int TxRolledbackVersionsSize { get; }
-
- /// <summary>
- /// Gets transaction DHT per-thread map size.
- /// </summary>
- /// <returns>
- /// DHT thread map size.
- /// </returns>
- int TxDhtThreadMapSize { get; }
-
- /// <summary>
- /// Gets transaction DHT per-Xid map size.
- /// </summary>
- /// <returns>
- /// Transaction DHT per-Xid map size.
- /// </returns>
- int TxDhtXidMapSize { get; }
-
- /// <summary>
- /// Gets committed DHT transaction queue size.
- /// </summary>
- /// <returns>
- /// Committed DHT transaction queue size.
- /// </returns>
- int TxDhtCommitQueueSize { get; }
-
- /// <summary>
- /// Gets prepared DHT transaction queue size.
- /// </summary>
- /// <returns>
- /// Prepared DHT transaction queue size.
- /// </returns>
- int TxDhtPrepareQueueSize { get; }
-
- /// <summary>
- /// Gets DHT start version counts map size.
- /// </summary>
- /// <returns>
- /// DHT start version counts map size.
- /// </returns>
- int TxDhtStartVersionCountsSize { get; }
-
- /// <summary>
- /// Gets number of cached committed DHT transaction IDs.
- /// </summary>
- /// <returns>
- /// Number of cached committed DHT transaction IDs.
- /// </returns>
- int TxDhtCommittedVersionsSize { get; }
-
- /// <summary>
- /// Gets number of cached rolled back DHT transaction IDs.
- /// </summary>
- /// <returns>
- /// Number of cached rolled back DHT transaction IDs.
- /// </returns>
- int TxDhtRolledbackVersionsSize { get; }
-
- /// <summary>
- /// Returns true if write-behind is enabled.
- /// </summary>
- /// <returns>
- /// True if write-behind is enabled.
- /// </returns>
- bool IsWriteBehindEnabled { get; }
-
- /// <summary>
- /// Gets the maximum size of the write-behind buffer. When the count of unique keys in write buffer exceeds
- /// this value, the buffer is scheduled for write to the underlying store.
- /// <para />
- /// If this value is 0, then flush is performed only on time-elapsing basis.
- /// </summary>
- /// <returns>
- /// Buffer size that triggers flush procedure.
- /// </returns>
- int WriteBehindFlushSize { get; }
-
- /// <summary>
- /// Gets the number of flush threads that will perform store update operations.
- /// </summary>
- /// <returns>
- /// Count of worker threads.
- /// </returns>
- int WriteBehindFlushThreadCount { get; }
-
- /// <summary>
- /// Gets the cache flush frequency. All pending operations on the underlying store will be performed
- /// within time interval not less then this value.
- /// <para /> If this value is 0, then flush is performed only when buffer size exceeds flush size.
- /// </summary>
- /// <returns>
- /// Flush frequency in milliseconds.
- /// </returns>
- long WriteBehindFlushFrequency { get; }
-
- /// <summary>
- /// Gets the maximum count of similar (put or remove) operations that can be grouped to a single batch.
- /// </summary>
- /// <returns>
- /// Maximum size of batch.
- /// </returns>
- int WriteBehindStoreBatchSize { get; }
-
- /// <summary>
- /// Gets count of write buffer overflow events since initialization.
- /// Each overflow event causes the ongoing flush operation to be performed synchronously.
- /// </summary>
- /// <returns>
- /// Count of cache overflow events since start.
- /// </returns>
- int WriteBehindTotalCriticalOverflowCount { get; }
-
- /// <summary>
- /// Gets count of write buffer overflow events in progress at the moment.
- /// Each overflow event causes the ongoing flush operation to be performed synchronously.
- /// </summary>
- /// <returns>
- /// Count of cache overflow events since start.
- /// </returns>
- int WriteBehindCriticalOverflowCount { get; }
-
- /// <summary>
- /// Gets count of cache entries that are in a store-retry state.
- /// An entry is assigned a store-retry state when underlying store failed due some reason
- /// and cache has enough space to retain this entry till the next try.
- /// </summary>
- /// <returns>
- /// Count of entries in store-retry state.
- /// </returns>
- int WriteBehindErrorRetryCount { get; }
-
- /// <summary>
- /// Gets count of entries that were processed by the write-behind store
- /// and have not been flushed to the underlying store yet.
- /// </summary>
- /// <returns>
- /// Total count of entries in cache store internal buffer.
- /// </returns>
- int WriteBehindBufferSize { get; }
-
- /// <summary>
- /// Determines the required type of keys for this cache, if any.
- /// </summary>
- /// <returns>
- /// The fully qualified class name of the key type, or "java.lang.Object" if the type is undefined.
- /// </returns>
- string KeyType { get; }
-
- /// <summary>
- /// Determines the required type of values for this cache, if any.
- /// </summary>
- /// <returns>
- /// The fully qualified class name of the value type, or "java.lang.Object" if the type is undefined.
- /// </returns>
- string ValueType { get; }
-
- /// <summary>
- /// Whether storeByValue true or storeByReference false. When true, both keys and values are stored by value.
- /// <para />
- /// When false, both keys and values are stored by reference. Caches stored by reference are capable of
- /// mutation by any threads holding the reference.
- /// The effects are:
- /// - if the key is mutated, then the key may not be retrievable or removable
- /// - if the value is mutated, then all threads in the JVM can potentially observe those mutations, subject
- /// to the normal Java Memory Model rules.
- /// Storage by reference only applies to the local heap.
- /// If an entry is moved off heap it will need to be transformed into a representation.
- /// Any mutations that occur after transformation may not be reflected in the cache.
- /// <para />
- /// When a cache is storeByValue, any mutation to the key or value does not affect the key of value
- /// stored in the cache.
- /// <para />
- /// The default value is true.
- /// </summary>
- /// <returns>
- /// True if the cache is store by value
- /// </returns>
- bool IsStoreByValue { get; }
-
- /// <summary>
- /// Checks whether statistics collection is enabled in this cache.
- /// <para />
- /// The default value is false.
- /// </summary>
- /// <returns>
- /// True if statistics collection is enabled
- /// </returns>
- bool IsStatisticsEnabled { get; }
-
- /// <summary>
- /// Checks whether management is enabled on this cache.
- /// <para />
- /// The default value is false.
- /// </summary>
- /// <returns>
- /// True if management is enabled
- /// </returns>
- bool IsManagementEnabled { get; }
-
- /// <summary>
- /// Determines if a cache should operate in read-through mode.
- /// <para />
- /// The default value is false
- /// </summary>
- /// <returns>
- /// True when a cache is in "read-through" mode.
- /// </returns>
- bool IsReadThrough { get; }
-
- /// <summary>
- /// Determines if a cache should operate in "write-through" mode.
- /// <para />
- /// Will appropriately cause the configured CacheWriter to be invoked.
- /// <para />
- /// The default value is false
- /// </summary>
- /// <returns>
- /// True when a cache is in "write-through" mode.
- /// </returns>
- bool IsWriteThrough { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/IMutableCacheEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/IMutableCacheEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/IMutableCacheEntry.cs
deleted file mode 100644
index ae71be6..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/IMutableCacheEntry.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache
-{
- /// <summary>
- /// Mutable representation of <see cref="ICacheEntry{K, V}"/>
- /// </summary>
- /// <typeparam name="TK">Key type.</typeparam>
- /// <typeparam name="TV">Value type.</typeparam>
- public interface IMutableCacheEntry<out TK, TV> : ICacheEntry<TK, TV>
- {
- /// <summary>
- /// Gets a value indicating whether cache entry exists in cache.
- /// </summary>
- bool Exists { get; }
-
- /// <summary>
- /// Removes the entry from the Cache.
- /// </summary>
- void Remove();
-
- /// <summary>
- /// Gets, sets or replaces the value associated with the key.
- /// <para />
- /// If <see cref="Exists"/> is false and setter is called then a mapping is added to the cache
- /// visible once the EntryProcessor completes.
- /// <para />
- /// After setter invocation <see cref="Exists"/> will return true.
- /// </summary>
- new TV Value { get; set; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
deleted file mode 100644
index 8f297a2..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/ContinuousQuery.cs
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query.Continuous
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Cache.Event;
-
- /// <summary>
- /// API for configuring continuous cache queries.
- /// <para />
- /// Continuous queries allow to register a remote and a listener for cache update events.
- /// If an update event passes the filter, it will be sent to the node that executed the
- /// query and listener will be notified on that node.
- /// <para />
- /// Continuous query can either be executed on the whole topology or only on local node.
- /// <para />
- /// In case query is distributed and a new node joins, it will get the filter for the query
- /// during discovery process before it actually joins topology, so no updates will be missed.
- /// <para />
- /// To execute the query use method
- /// <see cref="ICache{K,V}.QueryContinuous(ContinuousQuery{K,V})"/>.
- /// </summary>
- public class ContinuousQuery<TK, TV>
- {
- /// <summary>
- /// Default buffer size.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
- public const int DfltBufSize = 1;
-
- /// <summary>
- /// Default time interval.
- /// </summary>
- [SuppressMessage("ReSharper", "StaticMemberInGenericType")]
- [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
- public static readonly TimeSpan DfltTimeInterval = new TimeSpan(0);
-
- /// <summary>
- /// Default auto-unsubscribe flag value.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")]
- public const bool DfltAutoUnsubscribe = true;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="lsnr">Listener.</param>
- public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr) : this(lsnr, false)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="lsnr">Listener.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, bool loc) : this(lsnr, null, loc)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="lsnr">Listener.</param>
- /// <param name="filter">Filter.</param>
- public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, ICacheEntryEventFilter<TK, TV> filter)
- : this(lsnr, filter, false)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="lsnr">Listener.</param>
- /// <param name="filter">Filter.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- public ContinuousQuery(ICacheEntryEventListener<TK, TV> lsnr, ICacheEntryEventFilter<TK, TV> filter, bool loc)
- {
- Listener = lsnr;
- Filter = filter;
- Local = loc;
-
- BufferSize = DfltBufSize;
- TimeInterval = DfltTimeInterval;
- AutoUnsubscribe = DfltAutoUnsubscribe;
- }
-
- /// <summary>
- /// Cache entry event listener. Invoked on the node where continuous query execution
- /// has been started.
- /// </summary>
- public ICacheEntryEventListener<TK, TV> Listener { get; set; }
-
- /// <summary>
- /// Optional cache entry filter. Invoked on a node where cache event occurred. If filter
- /// returns <c>false</c>, then cache entry event will not be sent to a node where
- /// continuous query has been started.
- /// <para />
- /// Must be either portable or serializable in case query is not local.
- /// </summary>
- public ICacheEntryEventFilter<TK, TV> Filter { get; set; }
-
- /// <summary>
- /// Buffer size. When a cache update happens, entry is first put into a buffer.
- /// Entries from buffer will be sent to the master node only if the buffer is
- /// full or time provided via <see cref="TimeInterval"/> is exceeded.
- /// <para />
- /// Defaults to <see cref="DfltBufSize"/>
- /// </summary>
- public int BufferSize { get; set; }
-
- /// <summary>
- /// Time interval. When a cache update happens, entry is first put into a buffer.
- /// Entries from buffer will be sent to the master node only if the buffer is full
- /// (its size can be provided via <see cref="BufferSize"/> property) or time provided
- /// via this method is exceeded.
- /// <para />
- /// Defaults to <c>0</c> which means that time check is disabled and entries will be
- /// sent only when buffer is full.
- /// </summary>
- public TimeSpan TimeInterval { get; set; }
-
- /// <summary>
- /// Automatic unsubscribe flag. This flag indicates that query filters on remote nodes
- /// should be automatically unregistered if master node (node that initiated the query)
- /// leaves topology. If this flag is <c>false</c>, filters will be unregistered only
- /// when the query is cancelled from master node, and won't ever be unregistered if
- /// master node leaves grid.
- /// <para />
- /// Defaults to <c>true</c>.
- /// </summary>
- public bool AutoUnsubscribe { get; set; }
-
- /// <summary>
- /// Local flag. When set query will be executed only on local node, so only local
- /// entries will be returned as query result.
- /// <para />
- /// Defaults to <c>false</c>.
- /// </summary>
- public bool Local { get; set; }
-
- /// <summary>
- /// Validate continuous query state.
- /// </summary>
- internal void Validate()
- {
- if (Listener == null)
- throw new ArgumentException("Listener cannot be null.");
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/IContinuousQueryHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/IContinuousQueryHandle.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/IContinuousQueryHandle.cs
deleted file mode 100644
index 03f8e05..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/Continuous/IContinuousQueryHandle.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query.Continuous
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// Represents a continuous query handle.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1040:AvoidEmptyInterfaces")]
- public interface IContinuousQueryHandle : IDisposable
- {
- // No-op.
- }
-
- /// <summary>
- /// Represents a continuous query handle.
- /// </summary>
- /// <typeparam name="T">Type of the initial query cursor.</typeparam>
- public interface IContinuousQueryHandle<T> : IContinuousQueryHandle
- {
- /// <summary>
- /// Gets the cursor for initial query.
- /// Can be called only once, throws exception on consequent calls.
- /// </summary>
- /// <returns>Initial query cursor.</returns>
- IQueryCursor<T> GetInitialQueryCursor();
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/IQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/IQueryCursor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/IQueryCursor.cs
deleted file mode 100644
index 9745765..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/IQueryCursor.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using System;
- using System.Collections.Generic;
-
- /// <summary>
- /// Query result cursor. Can be processed either in iterative mode, or by taking
- /// all entries using <see cref="IQueryCursor{T}.GetAll()"/> method.
- /// <para />
- /// Note that you get enumerator or call <code>GetAll()</code> method only once during
- /// cursor lifetime. Any further attempts to get enumerator or all entries will result
- /// in exception.
- /// </summary>
- public interface IQueryCursor<T> : IEnumerable<T>, IDisposable
- {
- /// <summary>
- /// Gets all query results. Use this method when you know in advance that query
- /// result is relatively small and will not cause memory utilization issues.
- /// </summary>
- /// <returns>List containing all query results.</returns>
- IList<T> GetAll();
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
deleted file mode 100644
index 3cb9e58..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/QueryBase.cs
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Portable;
-
- /// <summary>
- /// Base class for all Ignite cache entry queries.
- /// </summary>
- public abstract class QueryBase
- {
- /** Default page size. */
- public const int DfltPageSize = 1024;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="QueryBase"/> class.
- /// </summary>
- protected internal QueryBase()
- {
- PageSize = DfltPageSize;
- }
-
- /// <summary>
- /// Local flag. When set query will be executed only on local node, so only local
- /// entries will be returned as query result.
- /// <para />
- /// Defaults to <c>false</c>.
- /// </summary>
- public bool Local { get; set; }
-
- /// <summary>
- /// Optional page size. If set to <code>0</code>, then <code>CacheQueryConfiguration.pageSize</code> is used.
- /// </summary>
- public int PageSize { get; set; }
-
- /// <summary>
- /// Writes this instance to a stream created with a specified delegate.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- internal abstract void Write(PortableWriterImpl writer, bool keepPortable);
-
- /// <summary>
- /// Gets the interop opcode.
- /// </summary>
- internal abstract CacheOp OpId { get; }
-
- /// <summary>
- /// Write query arguments.
- /// </summary>
- /// <param name="writer">Writer.</param>
- /// <param name="args">Arguments.</param>
- internal static void WriteQueryArgs(PortableWriterImpl writer, object[] args)
- {
- if (args == null)
- writer.WriteInt(0);
- else
- {
- writer.WriteInt(args.Length);
-
- foreach (var arg in args)
- writer.WriteObject(arg);
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
deleted file mode 100644
index 44f8486..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/ScanQuery.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Portable;
-
- /// <summary>
- /// Scan query over cache entries. Will accept all the entries if no predicate was set.
- /// </summary>
- public class ScanQuery<TK, TV> : QueryBase
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ScanQuery{K, V}"/> class.
- /// </summary>
- /// <param name="filter">The filter.</param>
- public ScanQuery(ICacheEntryFilter<TK, TV> filter = null)
- {
- Filter = filter;
- }
-
- /// <summary>
- /// Gets or sets the predicate.
- /// </summary>
- public ICacheEntryFilter<TK, TV> Filter { get; set; }
-
- /// <summary>
- /// Gets or sets partition number over which this query should iterate. If null, query will iterate
- /// over all partitions in the cache. Must be in the range [0, N) where N is partition number in the cache.
- /// </summary>
- public int? Partition { get; set; }
-
- /** <inheritDoc /> */
- internal override void Write(PortableWriterImpl writer, bool keepPortable)
- {
- writer.WriteBoolean(Local);
- writer.WriteInt(PageSize);
-
- writer.WriteBoolean(Partition.HasValue);
-
- if (Partition.HasValue)
- writer.WriteInt(Partition.Value);
-
- if (Filter == null)
- writer.WriteObject<CacheEntryFilterHolder>(null);
- else
- {
- var holder = new CacheEntryFilterHolder(Filter, (key, val) => Filter.Invoke(
- new CacheEntry<TK, TV>((TK) key, (TV) val)), writer.Marshaller, keepPortable);
-
- writer.WriteObject(holder);
- writer.WriteLong(holder.Handle);
- }
- }
-
- /** <inheritDoc /> */
- internal override CacheOp OpId
- {
- get { return CacheOp.QryScan; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
deleted file mode 100644
index c0d58ca..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlFieldsQuery.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using System.Diagnostics.CodeAnalysis;
-
- /// <summary>
- /// SQL fields query.
- /// </summary>
- public class SqlFieldsQuery
- {
- /** Default page size. */
- public const int DfltPageSize = 1024;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="sql">SQL.</param>
- /// <param name="args">Arguments.</param>
- public SqlFieldsQuery(string sql, params object[] args) : this(sql, false, args)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor,
- /// </summary>
- /// <param name="sql">SQL.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- /// <param name="args">Arguments.</param>
- public SqlFieldsQuery(string sql, bool loc, params object[] args)
- {
- Sql = sql;
- Local = loc;
- Arguments = args;
-
- PageSize = DfltPageSize;
- }
-
- /// <summary>
- /// SQL.
- /// </summary>
- public string Sql { get; set; }
-
- /// <summary>
- /// Arguments.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
- public object[] Arguments { get; set; }
-
- /// <summary>
- /// Local flag. When set query will be executed only on local node, so only local
- /// entries will be returned as query result.
- /// <para />
- /// Defaults to <c>false</c>.
- /// </summary>
- public bool Local { get; set; }
-
- /// <summary>
- /// Optional page size.
- /// <para />
- /// Defautls to <see cref="DfltPageSize"/>.
- /// </summary>
- public int PageSize { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
deleted file mode 100644
index 303048b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/SqlQuery.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using System;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Portable;
-
- /// <summary>
- /// SQL Query.
- /// </summary>
- public class SqlQuery : QueryBase
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="sql">SQL.</param>
- /// <param name="args">Arguments.</param>
- public SqlQuery(Type typ, string sql, params object[] args) : this(typ, sql, false, args)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="sql">SQL.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- /// <param name="args">Arguments.</param>
- public SqlQuery(Type typ, string sql, bool loc, params object[] args) : this(typ.Name, sql, loc, args)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="sql">SQL.</param>
- /// <param name="args">Arguments.</param>
- public SqlQuery(string typ, string sql, params object[] args) : this(typ, sql, false, args)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="sql">SQL.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- /// <param name="args">Arguments.</param>
- public SqlQuery(string typ, string sql, bool loc, params object[] args)
- {
- Type = typ;
- Sql = sql;
- Local = loc;
- Arguments = args;
- }
-
- /// <summary>
- /// Type.
- /// </summary>
- public string Type { get; set; }
-
- /// <summary>
- /// SQL.
- /// </summary>
- public string Sql { get; set; }
-
- /// <summary>
- /// Arguments.
- /// </summary>
- [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
- public object[] Arguments { get; set; }
-
- /** <inheritDoc /> */
- internal override void Write(PortableWriterImpl writer, bool keepPortable)
- {
- if (string.IsNullOrEmpty(Sql))
- throw new ArgumentException("Sql cannot be null or empty");
-
- if (string.IsNullOrEmpty(Type))
- throw new ArgumentException("Type cannot be null or empty");
-
- // 2. Prepare.
- writer.WriteBoolean(Local);
- writer.WriteString(Sql);
- writer.WriteString(Type);
- writer.WriteInt(PageSize);
-
- WriteQueryArgs(writer, Arguments);
- }
-
- /** <inheritDoc /> */
- internal override CacheOp OpId
- {
- get { return CacheOp.QrySql; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
deleted file mode 100644
index 835271b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Query/TextQuery.cs
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Query
-{
- using System;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Portable;
-
- /// <summary>
- /// Text query.
- /// </summary>
- public class TextQuery : QueryBase
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="txt">Text.</param>
- public TextQuery(Type typ, string txt) : this(typ, txt, false)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="txt">Text.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- public TextQuery(Type typ, string txt, bool loc) : this(typ.Name, txt, loc)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="txt">Text.</param>
- public TextQuery(string typ, string txt) : this(typ, txt, false)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="typ">Type.</param>
- /// <param name="txt">Text.</param>
- /// <param name="loc">Whether query should be executed locally.</param>
- public TextQuery(string typ, string txt, bool loc)
- {
- Type = typ;
- Text = txt;
- Local = loc;
- }
-
- /// <summary>
- /// Type.
- /// </summary>
- public string Type { get; set; }
-
- /// <summary>
- /// Text.
- /// </summary>
- public string Text { get; set; }
-
- /** <inheritDoc /> */
- internal override void Write(PortableWriterImpl writer, bool keepPortable)
- {
- if (string.IsNullOrEmpty(Text))
- throw new ArgumentException("Text cannot be null or empty");
-
- if (string.IsNullOrEmpty(Type))
- throw new ArgumentException("Type cannot be null or empty");
-
- writer.WriteBoolean(Local);
- writer.WriteString(Text);
- writer.WriteString(Type);
- writer.WriteInt(PageSize);
- }
-
- /** <inheritDoc /> */
- internal override CacheOp OpId
- {
- get { return CacheOp.QryTxt; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
deleted file mode 100644
index cf4a77d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheParallelLoadStoreAdapter.cs
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Store
-{
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
-
- /// <summary>
- /// Cache storage adapter with parallel loading in LoadAll method.
- /// </summary>
- /// <remarks>
- /// LoadCache calls GetInputData() and iterates over it in parallel.
- /// GetInputData().GetEnumerator() result will be disposed if it implements IDisposable.
- /// Any additional post-LoadCache steps can be performed by overriding LoadCache method.
- /// </remarks>
- public abstract class CacheParallelLoadStoreAdapter : ICacheStore
- {
- /// <summary>
- /// Default number of working threads (equal to the number of available processors).
- /// </summary>
- public static readonly int DefaultThreadsCount = Environment.ProcessorCount;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- protected CacheParallelLoadStoreAdapter()
- {
- MaxDegreeOfParallelism = DefaultThreadsCount;
- }
-
- /// <summary>
- /// Loads all values from underlying persistent storage. Note that keys are
- /// not passed, so it is up to implementation to figure out what to load.
- /// This method is called whenever <see cref="ICache{K,V}.LocalLoadCache" />
- /// method is invoked which is usually to preload the cache from persistent storage.
- /// <para />
- /// This method is optional, and cache implementation
- /// does not depend on this method to do anything.
- /// <para />
- /// For every loaded value method provided action should be called.
- /// The action will then make sure that the loaded value is stored in cache.
- /// </summary>
- /// <param name="act">Action for loaded values.</param>
- /// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache" /> method.</param>
- /// <exception cref="CacheStoreException" />
- public virtual void LoadCache(Action<object, object> act, params object[] args)
- {
- if (MaxDegreeOfParallelism == 0 || MaxDegreeOfParallelism < -1)
- throw new ArgumentOutOfRangeException("MaxDegreeOfParallelism must be either positive or -1: " +
- MaxDegreeOfParallelism);
-
- var options = new ParallelOptions {MaxDegreeOfParallelism = MaxDegreeOfParallelism};
-
- Parallel.ForEach(GetInputData().OfType<object>(), options, item =>
- {
- var cacheEntry = Parse(item, args);
-
- if (cacheEntry != null)
- act(cacheEntry.Value.Key, cacheEntry.Value.Value);
- });
- }
-
- /// <summary>
- /// Gets the input data sequence to be used in LoadCache.
- /// </summary>
- protected abstract IEnumerable GetInputData();
-
- /// <summary>
- /// This method should transform raw data records from GetInputData
- /// into valid key-value pairs to be stored into cache.
- /// </summary>
- protected abstract KeyValuePair<object, object>? Parse(object inputRecord, params object[] args);
-
- /// <summary>
- /// Gets or sets the maximum degree of parallelism to use in LoadCache.
- /// Must be either positive or -1 for unlimited amount of threads.
- /// <para />
- /// Defaults to <see cref="DefaultThreadsCount"/>.
- /// </summary>
- public int MaxDegreeOfParallelism { get; set; }
-
- /// <summary>
- /// Loads an object. Application developers should implement this method to customize the loading
- /// of a value for a cache entry.
- /// This method is called by a cache when a requested entry is not in the cache.
- /// If the object can't be loaded <code>null</code> should be returned.
- /// </summary>
- /// <param name="key">The key identifying the object being loaded.</param>
- /// <returns>
- /// The value for the entry that is to be stored in the cache
- /// or <code>null</code> if the object can't be loaded
- /// </returns>
- public virtual object Load(object key)
- {
- return null;
- }
-
- /// <summary>
- /// Loads multiple objects. Application developers should implement this method to customize
- /// the loading of cache entries. This method is called when the requested object is not in the cache.
- /// If an object can't be loaded, it is not returned in the resulting map.
- /// </summary>
- /// <param name="keys">Keys identifying the values to be loaded.</param>
- /// <returns>
- /// A map of key, values to be stored in the cache.
- /// </returns>
- public virtual IDictionary LoadAll(ICollection keys)
- {
- return null;
- }
-
- /// <summary>
- /// Write the specified value under the specified key to the external resource.
- /// <para />
- /// This method is intended to support both key/value creation and value update.
- /// </summary>
- /// <param name="key">Key to write.</param>
- /// <param name="val">Value to write.</param>
- public virtual void Write(object key, object val)
- {
- // No-op.
- }
-
- /// <summary>
- /// Write the specified entries to the external resource.
- /// This method is intended to support both insert and update.
- /// <para />
- /// The order that individual writes occur is undefined.
- /// <para />
- /// If this operation fails (by throwing an exception) after a partial success,
- /// the writer must remove any successfully written entries from the entries collection
- /// so that the caching implementation knows what succeeded and can mutate the cache.
- /// </summary>
- /// <param name="entries">a mutable collection to write. Upon invocation, it contains the entries
- /// to write for write-through. Upon return the collection must only contain entries
- /// that were not successfully written. (see partial success above).</param>
- public virtual void WriteAll(IDictionary entries)
- {
- // No-op.
- }
-
- /// <summary>
- /// Delete the cache entry from the external resource.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method is invoked even if no mapping for the key exists.
- /// </summary>
- /// <param name="key">The key that is used for the delete operation.</param>
- public virtual void Delete(object key)
- {
- // No-op.
- }
-
- /// <summary>
- /// Remove data and keys from the external resource for the given collection of keys, if present.
- /// <para />
- /// The order that individual deletes occur is undefined.
- /// <para />
- /// If this operation fails (by throwing an exception) after a partial success,
- /// the writer must remove any successfully written entries from the entries collection
- /// so that the caching implementation knows what succeeded and can mutate the cache.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method may include keys even if there is no mapping for that key,
- /// in which case the data represented by that key should be removed from the underlying resource.
- /// </summary>
- /// <param name="keys">a mutable collection of keys for entries to delete. Upon invocation,
- /// it contains the keys to delete for write-through. Upon return the collection must only contain
- /// the keys that were not successfully deleted.</param>
- public virtual void DeleteAll(ICollection keys)
- {
- // No-op.
- }
-
- /// <summary>
- /// Tells store to commit or rollback a transaction depending on the value of the
- /// <c>commit</c> parameter.
- /// </summary>
- /// <param name="commit"><c>True</c> if transaction should commit, <c>false</c> for rollback.</param>
- public virtual void SessionEnd(bool commit)
- {
- // No-op.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
deleted file mode 100644
index 1930d0c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Cache/Store/CacheStoreAdapter.cs
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Cache.Store
-{
- using System;
- using System.Collections;
- using System.Linq;
-
- /// <summary>
- /// Cache storage convenience adapter. It provides default implementation for
- /// bulk operations, such as <code>LoadAll</code>, <code>PutAll</code> and
- /// <code>RemoveAll</code> by sequentially calling corresponding <code>Load</code>,
- /// <code>Put</code> and <code>Remove</code> operations. Use this adapter whenever
- /// such behaviour is acceptable. However in many cases it maybe more preferable
- /// to take advantage of database batch update functionality, and therefore default
- /// adapter implementation may not be the best option.
- /// <para/>
- /// Note that <code>LoadCache</code> method has empty implementation because it is
- /// essentially up to the user to invoke it with specific arguments.
- /// </summary>
- public abstract class CacheStoreAdapter : ICacheStore
- {
- /// <summary>
- /// Loads all values from underlying persistent storage. Note that keys are
- /// not passed, so it is up to implementation to figure out what to load.
- /// This method is called whenever <see cref="ICache{K,V}.LocalLoadCache" />
- /// method is invoked which is usually to preload the cache from persistent storage.
- /// <para />
- /// This method is optional, and cache implementation
- /// does not depend on this method to do anything.
- /// <para />
- /// For every loaded value method provided action should be called.
- /// The action will then make sure that the loaded value is stored in cache.
- /// </summary>
- /// <param name="act">Action for loaded values.</param>
- /// <param name="args">Optional arguemnts passed to <see cref="ICache{K,V}.LocalLoadCache" /> method.</param>
- public virtual void LoadCache(Action<object, object> act, params object[] args)
- {
- // No-op.
- }
-
- /// <summary>
- /// Loads multiple objects. Application developers should implement this method to customize
- /// the loading of cache entries. This method is called when the requested object is not in the cache.
- /// If an object can't be loaded, it is not returned in the resulting map.
- /// </summary>
- /// <param name="keys">Keys identifying the values to be loaded.</param>
- /// <returns>
- /// A map of key, values to be stored in the cache.
- /// </returns>
- public virtual IDictionary LoadAll(ICollection keys)
- {
- return keys.OfType<object>().ToDictionary(key => key, Load);
- }
-
- /// <summary>
- /// Writes all.
- /// </summary>
- /// <param name="entries">The map.</param>
- public virtual void WriteAll(IDictionary entries)
- {
- foreach (DictionaryEntry entry in entries)
- Write(entry.Key, entry.Value);
- }
-
- /// <summary>
- /// Remove data and keys from the external resource for the given collection of keys, if present.
- /// <para />
- /// The order that individual deletes occur is undefined.
- /// <para />
- /// If this operation fails (by throwing an exception) after a partial success,
- /// the writer must remove any successfully written entries from the entries collection
- /// so that the caching implementation knows what succeeded and can mutate the cache.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method may include keys even if there is no mapping for that key,
- /// in which case the data represented by that key should be removed from the underlying resource.
- /// </summary>
- /// <param name="keys">a mutable collection of keys for entries to delete. Upon invocation,
- /// it contains the keys to delete for write-through. Upon return the collection must only contain
- /// the keys that were not successfully deleted.</param>
- public virtual void DeleteAll(ICollection keys)
- {
- foreach (object key in keys)
- Delete(key);
- }
-
- /// <summary>
- /// Tells store to commit or rollback a transaction depending on the value of the
- /// <c>commit</c> parameter.
- /// </summary>
- /// <param name="commit"><c>True</c> if transaction should commit, <c>false</c> for rollback.</param>
- public virtual void SessionEnd(bool commit)
- {
- // No-op.
- }
-
- /// <summary>
- /// Loads an object. Application developers should implement this method to customize the loading
- /// of a value for a cache entry.
- /// This method is called by a cache when a requested entry is not in the cache.
- /// If the object can't be loaded <code>null</code> should be returned.
- /// </summary>
- /// <param name="key">The key identifying the object being loaded.</param>
- /// <returns>
- /// The value for the entry that is to be stored in the cache
- /// or <code>null</code> if the object can't be loaded
- /// </returns>
- public abstract object Load(object key);
-
- /// <summary>
- /// Write the specified value under the specified key to the external resource.
- /// <para />
- /// This method is intended to support both key/value creation and value update.
- /// </summary>
- /// <param name="key">Key to write.</param>
- /// <param name="val">Value to write.</param>
- public abstract void Write(object key, object val);
-
- /// <summary>
- /// Delete the cache entry from the external resource.
- /// <para />
- /// Expiry of a cache entry is not a delete hence will not cause this method to be invoked.
- /// <para />
- /// This method is invoked even if no mapping for the key exists.
- /// </summary>
- /// <param name="key">The key that is used for the delete operation.</param>
- public abstract void Delete(object key);
- }
-}
[29/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
deleted file mode 100644
index 5738ed9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilter.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
-{
- using Apache.Ignite.Core.Cache.Event;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using CQU = ContinuousQueryUtils;
-
- /// <summary>
- /// Continuous query filter interface. Required to hide generic nature of underliyng real filter.
- /// </summary>
- internal interface IContinuousQueryFilter
- {
- /// <summary>
- /// Evaluate filter.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Result.</returns>
- bool Evaluate(IPortableStream stream);
-
- /// <summary>
- /// Inject grid.
- /// </summary>
- /// <param name="grid"></param>
- void Inject(Ignite grid);
-
- /// <summary>
- /// Allocate handle for the filter.
- /// </summary>
- /// <returns></returns>
- long Allocate();
-
- /// <summary>
- /// Release filter.
- /// </summary>
- void Release();
- }
-
- /// <summary>
- /// Continuous query filter generic implementation.
- /// </summary>
- internal class ContinuousQueryFilter<TK, TV> : IContinuousQueryFilter
- {
- /** Actual filter. */
- private readonly ICacheEntryEventFilter<TK, TV> _filter;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Ignite hosting the filter. */
- private volatile Ignite _ignite;
-
- /** GC handle. */
- private long? _hnd;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="filter">Actual filter.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- public ContinuousQueryFilter(ICacheEntryEventFilter<TK, TV> filter, bool keepPortable)
- {
- _filter = filter;
- _keepPortable = keepPortable;
- }
-
- /** <inheritDoc /> */
- public bool Evaluate(IPortableStream stream)
- {
- ICacheEntryEvent<TK, TV> evt = CQU.ReadEvent<TK, TV>(stream, _ignite.Marshaller, _keepPortable);
-
- return _filter.Evaluate(evt);
- }
-
- /** <inheritDoc /> */
- public void Inject(Ignite grid)
- {
- _ignite = grid;
-
- ResourceProcessor.Inject(_filter, grid);
- }
-
- /** <inheritDoc /> */
- public long Allocate()
- {
- lock (this)
- {
- if (!_hnd.HasValue)
- _hnd = _ignite.HandleRegistry.Allocate(this);
-
- return _hnd.Value;
- }
- }
-
- /** <inheritDoc /> */
- public void Release()
- {
- lock (this)
- {
- if (_hnd.HasValue)
- {
- _ignite.HandleRegistry.Release(_hnd.Value);
-
- _hnd = null;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
deleted file mode 100644
index 65da674..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryFilterHolder.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
-{
- using System;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Continuous query remote filter holder. Wraps real filter into portable object,
- /// so that it can be passed over wire to another node.
- /// </summary>
- public class ContinuousQueryFilterHolder : IPortableWriteAware
- {
- /** Key type. */
- private readonly Type _keyTyp;
-
- /** Value type. */
- private readonly Type _valTyp;
-
- /** Filter object. */
- private readonly object _filter;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="keyTyp">Key type.</param>
- /// <param name="valTyp">Value type.</param>
- /// <param name="filter">Filter.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- public ContinuousQueryFilterHolder(Type keyTyp, Type valTyp, object filter, bool keepPortable)
- {
- _keyTyp = keyTyp;
- _valTyp = valTyp;
- _filter = filter;
- _keepPortable = keepPortable;
- }
-
- /// <summary>
- /// Key type.
- /// </summary>
- internal Type KeyType
- {
- get { return _keyTyp; }
- }
-
- /// <summary>
- /// Value type.
- /// </summary>
- internal Type ValueType
- {
- get { return _valTyp; }
- }
-
- /// <summary>
- /// Filter.
- /// </summary>
- internal object Filter
- {
- get { return _filter; }
- }
-
- /// <summary>
- /// Keep portable flag.
- /// </summary>
- internal bool KeepPortable
- {
- get { return _keepPortable; }
- }
-
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- public void WritePortable(IPortableWriter writer)
- {
- PortableWriterImpl rawWriter = (PortableWriterImpl) writer.RawWriter();
-
- PortableUtils.WritePortableOrSerializable(rawWriter, _keyTyp);
- PortableUtils.WritePortableOrSerializable(rawWriter, _valTyp);
- PortableUtils.WritePortableOrSerializable(rawWriter, _filter);
-
- rawWriter.WriteBoolean(_keepPortable);
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ContinuousQueryFilterHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ContinuousQueryFilterHolder(IPortableReader reader)
- {
- PortableReaderImpl rawReader = (PortableReaderImpl) reader.RawReader();
-
- _keyTyp = PortableUtils.ReadPortableOrSerializable<Type>(rawReader);
- _valTyp = PortableUtils.ReadPortableOrSerializable<Type>(rawReader);
- _filter = PortableUtils.ReadPortableOrSerializable<object>(rawReader);
- _keepPortable = rawReader.ReadBoolean();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
deleted file mode 100644
index d8d014b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryHandleImpl.cs
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Event;
- using Apache.Ignite.Core.Cache.Query;
- using Apache.Ignite.Core.Cache.Query.Continuous;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
- using CQU = ContinuousQueryUtils;
-
- /// <summary>
- /// Continuous query handle interface.
- /// </summary>
- internal interface IContinuousQueryHandleImpl : IDisposable
- {
- /// <summary>
- /// Process callback.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Result.</returns>
- void Apply(IPortableStream stream);
- }
-
- /// <summary>
- /// Continuous query handle.
- /// </summary>
- internal class ContinuousQueryHandleImpl<TK, TV> : IContinuousQueryHandleImpl, IContinuousQueryFilter,
- IContinuousQueryHandle<ICacheEntry<TK, TV>>
- {
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Keep portable flag. */
- private readonly bool _keepPortable;
-
- /** Real listener. */
- private readonly ICacheEntryEventListener<TK, TV> _lsnr;
-
- /** Real filter. */
- private readonly ICacheEntryEventFilter<TK, TV> _filter;
-
- /** GC handle. */
- private long _hnd;
-
- /** Native query. */
- private volatile IUnmanagedTarget _nativeQry;
-
- /** Initial query cursor. */
- private volatile IQueryCursor<ICacheEntry<TK, TV>> _initialQueryCursor;
-
- /** Disposed flag. */
- private bool _disposed;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="qry">Query.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- public ContinuousQueryHandleImpl(ContinuousQuery<TK, TV> qry, PortableMarshaller marsh, bool keepPortable)
- {
- _marsh = marsh;
- _keepPortable = keepPortable;
-
- _lsnr = qry.Listener;
- _filter = qry.Filter;
- }
-
- /// <summary>
- /// Start execution.
- /// </summary>
- /// <param name="grid">Ignite instance.</param>
- /// <param name="writer">Writer.</param>
- /// <param name="cb">Callback invoked when all necessary data is written to stream.</param>
- /// <param name="qry">Query.</param>
- public void Start(Ignite grid, PortableWriterImpl writer, Func<IUnmanagedTarget> cb,
- ContinuousQuery<TK, TV> qry)
- {
- // 1. Inject resources.
- ResourceProcessor.Inject(_lsnr, grid);
- ResourceProcessor.Inject(_filter, grid);
-
- // 2. Allocate handle.
- _hnd = grid.HandleRegistry.Allocate(this);
-
- // 3. Write data to stream.
- writer.WriteLong(_hnd);
- writer.WriteBoolean(qry.Local);
- writer.WriteBoolean(_filter != null);
-
- ContinuousQueryFilterHolder filterHolder = _filter == null || qry.Local ? null :
- new ContinuousQueryFilterHolder(typeof (TK), typeof (TV), _filter, _keepPortable);
-
- writer.WriteObject(filterHolder);
-
- writer.WriteInt(qry.BufferSize);
- writer.WriteLong((long)qry.TimeInterval.TotalMilliseconds);
- writer.WriteBoolean(qry.AutoUnsubscribe);
-
- // 4. Call Java.
- _nativeQry = cb();
-
- // 5. Initial query.
- var nativeInitialQryCur = UU.ContinuousQueryGetInitialQueryCursor(_nativeQry);
- _initialQueryCursor = nativeInitialQryCur == null
- ? null
- : new QueryCursor<TK, TV>(nativeInitialQryCur, _marsh, _keepPortable);
- }
-
- /** <inheritdoc /> */
- public void Apply(IPortableStream stream)
- {
- ICacheEntryEvent<TK, TV>[] evts = CQU.ReadEvents<TK, TV>(stream, _marsh, _keepPortable);
-
- _lsnr.OnEvent(evts);
- }
-
- /** <inheritdoc /> */
- public bool Evaluate(IPortableStream stream)
- {
- Debug.Assert(_filter != null, "Evaluate should not be called if filter is not set.");
-
- ICacheEntryEvent<TK, TV> evt = CQU.ReadEvent<TK, TV>(stream, _marsh, _keepPortable);
-
- return _filter.Evaluate(evt);
- }
-
- /** <inheritdoc /> */
- public void Inject(Ignite grid)
- {
- throw new NotSupportedException("Should not be called.");
- }
-
- /** <inheritdoc /> */
- public long Allocate()
- {
- throw new NotSupportedException("Should not be called.");
- }
-
- /** <inheritdoc /> */
- public void Release()
- {
- _marsh.Ignite.HandleRegistry.Release(_hnd);
- }
-
- /** <inheritdoc /> */
- public IQueryCursor<ICacheEntry<TK, TV>> GetInitialQueryCursor()
- {
- lock (this)
- {
- if (_disposed)
- throw new ObjectDisposedException("Continuous query handle has been disposed.");
-
- var cur = _initialQueryCursor;
-
- if (cur == null)
- throw new InvalidOperationException("GetInitialQueryCursor() can be called only once.");
-
- _initialQueryCursor = null;
-
- return cur;
- }
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- lock (this)
- {
- if (_disposed)
- return;
-
- Debug.Assert(_nativeQry != null);
-
- try
- {
- UU.ContinuousQueryClose(_nativeQry);
- }
- finally
- {
- _nativeQry.Dispose();
-
- _disposed = true;
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
deleted file mode 100644
index 86c8300..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/Continuous/ContinuousQueryUtils.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query.Continuous
-{
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using Apache.Ignite.Core.Cache.Event;
- using Apache.Ignite.Core.Impl.Cache.Event;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Utility methods for continuous queries.
- /// </summary>
- static class ContinuousQueryUtils
- {
- /// <summary>
- /// Read single event.
- /// </summary>
- /// <param name="stream">Stream to read data from.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- /// <returns>Event.</returns>
- public static ICacheEntryEvent<TK, TV> ReadEvent<TK, TV>(IPortableStream stream,
- PortableMarshaller marsh, bool keepPortable)
- {
- var reader = marsh.StartUnmarshal(stream, keepPortable);
-
- return ReadEvent0<TK, TV>(reader);
- }
-
- /// <summary>
- /// Read multiple events.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="keepPortable">Keep portable flag.</param>
- /// <returns>Events.</returns>
- [SuppressMessage("ReSharper", "PossibleNullReferenceException")]
- public static ICacheEntryEvent<TK, TV>[] ReadEvents<TK, TV>(IPortableStream stream,
- PortableMarshaller marsh, bool keepPortable)
- {
- var reader = marsh.StartUnmarshal(stream, keepPortable);
-
- int cnt = reader.ReadInt();
-
- ICacheEntryEvent<TK, TV>[] evts = new ICacheEntryEvent<TK, TV>[cnt];
-
- for (int i = 0; i < cnt; i++)
- evts[i] = ReadEvent0<TK, TV>(reader);
-
- return evts;
- }
-
- /// <summary>
- /// Read event.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>Event.</returns>
- private static ICacheEntryEvent<TK, TV> ReadEvent0<TK, TV>(PortableReaderImpl reader)
- {
- reader.DetachNext();
- TK key = reader.ReadObject<TK>();
-
- reader.DetachNext();
- TV oldVal = reader.ReadObject<TV>();
-
- reader.DetachNext();
- TV val = reader.ReadObject<TV>();
-
- return CreateEvent(key, oldVal, val);
- }
-
- /// <summary>
- /// Create event.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="oldVal">Old value.</param>
- /// <param name="val">Value.</param>
- /// <returns>Event.</returns>
- public static ICacheEntryEvent<TK, TV> CreateEvent<TK, TV>(TK key, TV oldVal, TV val)
- {
- if (oldVal == null)
- {
- Debug.Assert(val != null);
-
- return new CacheEntryCreateEvent<TK, TV>(key, val);
- }
-
- if (val == null)
- {
- Debug.Assert(oldVal != null);
-
- return new CacheEntryRemoveEvent<TK, TV>(key, oldVal);
- }
-
- return new CacheEntryUpdateEvent<TK, TV>(key, oldVal, val);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
deleted file mode 100644
index f38346c..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/FieldsQueryCursor.cs
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query
-{
- using System.Collections;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
-
- /// <summary>
- /// Cursor for entry-based queries.
- /// </summary>
- internal class FieldsQueryCursor : AbstractQueryCursor<IList>
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaler.</param>
- /// <param name="keepPortable">Keep poratble flag.</param>
- public FieldsQueryCursor(IUnmanagedTarget target, PortableMarshaller marsh, bool keepPortable)
- : base(target, marsh, keepPortable)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- protected override IList Read(PortableReaderImpl reader)
- {
- int cnt = reader.ReadInt();
-
- var res = new ArrayList(cnt);
-
- for (int i = 0; i < cnt; i++)
- res.Add(reader.ReadObject<object>());
-
- return res;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursor.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursor.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursor.cs
deleted file mode 100644
index 0b113f5..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Query/QueryCursor.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Query
-{
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
-
- /// <summary>
- /// Cursor for entry-based queries.
- /// </summary>
- internal class QueryCursor<TK, TV> : AbstractQueryCursor<ICacheEntry<TK, TV>>
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaler.</param>
- /// <param name="keepPortable">Keep poratble flag.</param>
- public QueryCursor(IUnmanagedTarget target, PortableMarshaller marsh,
- bool keepPortable) : base(target, marsh, keepPortable)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- protected override ICacheEntry<TK, TV> Read(PortableReaderImpl reader)
- {
- TK key = reader.ReadObject<TK>();
- TV val = reader.ReadObject<TV>();
-
- return new CacheEntry<TK, TV>(key, val);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
deleted file mode 100644
index 3fbc705..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStore.cs
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Store
-{
- using System.Collections;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Resource;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Interop cache store.
- /// </summary>
- internal class CacheStore
- {
- /** */
- private const byte OpLoadCache = 0;
-
- /** */
- private const byte OpLoad = 1;
-
- /** */
- private const byte OpLoadAll = 2;
-
- /** */
- private const byte OpPut = 3;
-
- /** */
- private const byte OpPutAll = 4;
-
- /** */
- private const byte OpRmv = 5;
-
- /** */
- private const byte OpRmvAll = 6;
-
- /** */
- private const byte OpSesEnd = 7;
-
- /** */
- private readonly bool _convertPortable;
-
- /** Store. */
- private readonly ICacheStore _store;
-
- /** Session. */
- private readonly CacheStoreSessionProxy _sesProxy;
-
- /** */
- private readonly long _handle;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="CacheStore" /> class.
- /// </summary>
- /// <param name="store">Store.</param>
- /// <param name="convertPortable">Whether to convert portable objects.</param>
- /// <param name="registry">The handle registry.</param>
- private CacheStore(ICacheStore store, bool convertPortable, HandleRegistry registry)
- {
- Debug.Assert(store != null);
-
- _store = store;
- _convertPortable = convertPortable;
-
- _sesProxy = new CacheStoreSessionProxy();
-
- ResourceProcessor.InjectStoreSession(store, _sesProxy);
-
- _handle = registry.AllocateCritical(this);
- }
-
- /// <summary>
- /// Creates interop cache store from a stream.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="registry">The handle registry.</param>
- /// <returns>
- /// Interop cache store.
- /// </returns>
- internal static CacheStore CreateInstance(long memPtr, HandleRegistry registry)
- {
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var reader = PortableUtils.Marshaller.StartUnmarshal(stream, PortableMode.KeepPortable);
-
- var assemblyName = reader.ReadString();
- var className = reader.ReadString();
- var convertPortable = reader.ReadBoolean();
- var propertyMap = reader.ReadGenericDictionary<string, object>();
-
- var store = (ICacheStore) IgniteUtils.CreateInstance(assemblyName, className);
-
- IgniteUtils.SetProperties(store, propertyMap);
-
- return new CacheStore(store, convertPortable, registry);
- }
- }
-
- /// <summary>
- /// Gets the handle.
- /// </summary>
- public long Handle
- {
- get { return _handle; }
- }
-
- /// <summary>
- /// Initializes this instance with a grid.
- /// </summary>
- /// <param name="grid">Grid.</param>
- public void Init(Ignite grid)
- {
- ResourceProcessor.Inject(_store, grid);
- }
-
- /// <summary>
- /// Invokes a store operation.
- /// </summary>
- /// <param name="input">Input stream.</param>
- /// <param name="cb">Callback.</param>
- /// <param name="grid">Grid.</param>
- /// <returns>Invocation result.</returns>
- /// <exception cref="IgniteException">Invalid operation type: + opType</exception>
- public int Invoke(IPortableStream input, IUnmanagedTarget cb, Ignite grid)
- {
- IPortableReader reader = grid.Marshaller.StartUnmarshal(input,
- _convertPortable ? PortableMode.Deserialize : PortableMode.ForcePortable);
-
- IPortableRawReader rawReader = reader.RawReader();
-
- int opType = rawReader.ReadByte();
-
- // Setup cache sessoin for this invocation.
- long sesId = rawReader.ReadLong();
-
- CacheStoreSession ses = grid.HandleRegistry.Get<CacheStoreSession>(sesId, true);
-
- ses.CacheName = rawReader.ReadString();
-
- _sesProxy.SetSession(ses);
-
- try
- {
- // Perform operation.
- switch (opType)
- {
- case OpLoadCache:
- _store.LoadCache((k, v) => WriteObjects(cb, grid, k, v), rawReader.ReadObjectArray<object>());
-
- break;
-
- case OpLoad:
- object val = _store.Load(rawReader.ReadObject<object>());
-
- if (val != null)
- WriteObjects(cb, grid, val);
-
- break;
-
- case OpLoadAll:
- var keys = rawReader.ReadCollection();
-
- var result = _store.LoadAll(keys);
-
- foreach (DictionaryEntry entry in result)
- WriteObjects(cb, grid, entry.Key, entry.Value);
-
- break;
-
- case OpPut:
- _store.Write(rawReader.ReadObject<object>(), rawReader.ReadObject<object>());
-
- break;
-
- case OpPutAll:
- _store.WriteAll(rawReader.ReadDictionary());
-
- break;
-
- case OpRmv:
- _store.Delete(rawReader.ReadObject<object>());
-
- break;
-
- case OpRmvAll:
- _store.DeleteAll(rawReader.ReadCollection());
-
- break;
-
- case OpSesEnd:
- grid.HandleRegistry.Release(sesId);
-
- _store.SessionEnd(rawReader.ReadBoolean());
-
- break;
-
- default:
- throw new IgniteException("Invalid operation type: " + opType);
- }
-
- return 0;
- }
- finally
- {
- _sesProxy.ClearSession();
- }
- }
-
- /// <summary>
- /// Writes objects to the marshaller.
- /// </summary>
- /// <param name="cb">Optional callback.</param>
- /// <param name="grid">Grid.</param>
- /// <param name="objects">Objects.</param>
- private static void WriteObjects(IUnmanagedTarget cb, Ignite grid, params object[] objects)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- PortableWriterImpl writer = grid.Marshaller.StartMarshal(stream);
-
- try
- {
- foreach (var obj in objects)
- {
- writer.DetachNext();
- writer.WriteObject(obj);
- }
- }
- finally
- {
- grid.Marshaller.FinishMarshal(writer);
- }
-
- if (cb != null)
- {
- stream.SynchronizeOutput();
-
- UnmanagedUtils.CacheStoreCallbackInvoke(cb, stream.MemoryPointer);
- }
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSession.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSession.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSession.cs
deleted file mode 100644
index f771fe8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSession.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Store
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache.Store;
-
- /// <summary>
- /// Store session implementation.
- /// </summary>
- internal class CacheStoreSession : ICacheStoreSession
- {
- /** Properties. */
- private IDictionary<object, object> _props;
-
- /** <inheritdoc /> */
-
- public string CacheName
- {
- get; internal set;
- }
-
- /** <inheritdoc /> */
- public IDictionary<object, object> Properties
- {
- get { return _props ?? (_props = new Dictionary<object, object>(2)); }
- }
-
- /// <summary>
- /// Clear session state.
- /// </summary>
- public void Clear()
- {
- if (_props != null)
- _props.Clear();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSessionProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSessionProxy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSessionProxy.cs
deleted file mode 100644
index 3dd7354..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cache/Store/CacheStoreSessionProxy.cs
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cache.Store
-{
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Cache.Store;
-
- /// <summary>
- /// Store session proxy.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class CacheStoreSessionProxy : ICacheStoreSession
- {
- /** Session. */
- private readonly ThreadLocal<CacheStoreSession> _target = new ThreadLocal<CacheStoreSession>();
-
- /** <inheritdoc /> */
- public string CacheName
- {
- get { return _target.Value.CacheName; }
- }
-
- /** <inheritdoc /> */
- public IDictionary<object, object> Properties
- {
- get { return _target.Value.Properties; }
- }
-
- /// <summary>
- /// Set thread-bound session.
- /// </summary>
- /// <param name="ses">Session.</param>
- internal void SetSession(CacheStoreSession ses)
- {
- _target.Value = ses;
- }
-
- /// <summary>
- /// Clear thread-bound session.
- /// </summary>
- internal void ClearSession()
- {
- _target.Value = null;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
deleted file mode 100644
index 382ab1e..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterGroupImpl.cs
+++ /dev/null
@@ -1,577 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cluster
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Threading;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Compute;
- using Apache.Ignite.Core.Impl.Events;
- using Apache.Ignite.Core.Impl.Messaging;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.Metadata;
- using Apache.Ignite.Core.Impl.Services;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Ignite projection implementation.
- /// </summary>
- internal class ClusterGroupImpl : PlatformTarget, IClusterGroupEx
- {
- /** Attribute: platform. */
- private const string AttrPlatform = "org.apache.ignite.platform";
-
- /** Platform. */
- private const string Platform = "dotnet";
-
- /** Initial topver; invalid from Java perspective, so update will be triggered when this value is met. */
- private const int TopVerInit = 0;
-
- /** */
- private const int OpAllMetadata = 1;
-
- /** */
- private const int OpForAttribute = 2;
-
- /** */
- private const int OpForCache = 3;
-
- /** */
- private const int OpForClient = 4;
-
- /** */
- private const int OpForData = 5;
-
- /** */
- private const int OpForHost = 6;
-
- /** */
- private const int OpForNodeIds = 7;
-
- /** */
- private const int OpMetadata = 8;
-
- /** */
- private const int OpMetrics = 9;
-
- /** */
- private const int OpMetricsFiltered = 10;
-
- /** */
- private const int OpNodeMetrics = 11;
-
- /** */
- private const int OpNodes = 12;
-
- /** */
- private const int OpPingNode = 13;
-
- /** */
- private const int OpTopology = 14;
-
- /** Initial Ignite instance. */
- private readonly Ignite _ignite;
-
- /** Predicate. */
- private readonly Func<IClusterNode, bool> _pred;
-
- /** Topology version. */
- [SuppressMessage("Microsoft.Performance", "CA1805:DoNotInitializeUnnecessarily")]
- private long _topVer = TopVerInit;
-
- /** Nodes for the given topology version. */
- private volatile IList<IClusterNode> _nodes;
-
- /** Processor. */
- private readonly IUnmanagedTarget _proc;
-
- /** Compute. */
- private readonly Lazy<Compute> _comp;
-
- /** Messaging. */
- private readonly Lazy<Messaging> _msg;
-
- /** Events. */
- private readonly Lazy<Events> _events;
-
- /** Services. */
- private readonly Lazy<IServices> _services;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="proc">Processor.</param>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="ignite">Grid.</param>
- /// <param name="pred">Predicate.</param>
- public ClusterGroupImpl(IUnmanagedTarget proc, IUnmanagedTarget target, PortableMarshaller marsh,
- Ignite ignite, Func<IClusterNode, bool> pred)
- : base(target, marsh)
- {
- _proc = proc;
- _ignite = ignite;
- _pred = pred;
-
- _comp = new Lazy<Compute>(() =>
- new Compute(new ComputeImpl(UU.ProcessorCompute(proc, target), marsh, this, false)));
-
- _msg = new Lazy<Messaging>(() => new Messaging(UU.ProcessorMessage(proc, target), marsh, this));
-
- _events = new Lazy<Events>(() => new Events(UU.ProcessorEvents(proc, target), marsh, this));
-
- _services = new Lazy<IServices>(() =>
- new Services(UU.ProcessorServices(proc, target), marsh, this, false, false));
- }
-
- /** <inheritDoc /> */
- public IIgnite Ignite
- {
- get { return _ignite; }
- }
-
- /** <inheritDoc /> */
- public ICompute GetCompute()
- {
- return _comp.Value;
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes)
- {
- IgniteArgumentCheck.NotNull(nodes, "nodes");
-
- return ForNodeIds0(nodes, node => node.Id);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForNodes(params IClusterNode[] nodes)
- {
- IgniteArgumentCheck.NotNull(nodes, "nodes");
-
- return ForNodeIds0(nodes, node => node.Id);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForNodeIds(IEnumerable<Guid> ids)
- {
- IgniteArgumentCheck.NotNull(ids, "ids");
-
- return ForNodeIds0(ids, null);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForNodeIds(params Guid[] ids)
- {
- IgniteArgumentCheck.NotNull(ids, "ids");
-
- return ForNodeIds0(ids, null);
- }
-
- /// <summary>
- /// Internal routine to get projection for specific node IDs.
- /// </summary>
- /// <param name="items">Items.</param>
- /// <param name="func">Function to transform item to Guid (optional).</param>
- /// <returns></returns>
- private IClusterGroup ForNodeIds0<T>(IEnumerable<T> items, Func<T, Guid> func)
- {
- Debug.Assert(items != null);
-
- IUnmanagedTarget prj = DoProjetionOutOp(OpForNodeIds, writer =>
- {
- WriteEnumerable(writer, items, func);
- });
-
- return GetClusterGroup(prj);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForPredicate(Func<IClusterNode, bool> p)
- {
- var newPred = _pred == null ? p : node => _pred(node) && p(node);
-
- return new ClusterGroupImpl(_proc, Target, Marshaller, _ignite, newPred);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForAttribute(string name, string val)
- {
- IgniteArgumentCheck.NotNull(name, "name");
-
- IUnmanagedTarget prj = DoProjetionOutOp(OpForAttribute, writer =>
- {
- writer.WriteString(name);
- writer.WriteString(val);
- });
-
- return GetClusterGroup(prj);
- }
-
- /// <summary>
- /// Creates projection with a specified op.
- /// </summary>
- /// <param name="name">Cache name to include into projection.</param>
- /// <param name="op">Operation id.</param>
- /// <returns>
- /// Projection over nodes that have specified cache running.
- /// </returns>
- private IClusterGroup ForCacheNodes(string name, int op)
- {
- IUnmanagedTarget prj = DoProjetionOutOp(op, writer =>
- {
- writer.WriteString(name);
- });
-
- return GetClusterGroup(prj);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForCacheNodes(string name)
- {
- return ForCacheNodes(name, OpForCache);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForDataNodes(string name)
- {
- return ForCacheNodes(name, OpForData);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForClientNodes(string name)
- {
- return ForCacheNodes(name, OpForClient);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForRemotes()
- {
- return GetClusterGroup(UU.ProjectionForRemotes(Target));
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForHost(IClusterNode node)
- {
- IgniteArgumentCheck.NotNull(node, "node");
-
- IUnmanagedTarget prj = DoProjetionOutOp(OpForHost, writer =>
- {
- writer.WriteGuid(node.Id);
- });
-
- return GetClusterGroup(prj);
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForRandom()
- {
- return GetClusterGroup(UU.ProjectionForRandom(Target));
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForOldest()
- {
- return GetClusterGroup(UU.ProjectionForOldest(Target));
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForYoungest()
- {
- return GetClusterGroup(UU.ProjectionForYoungest(Target));
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ForDotNet()
- {
- return ForAttribute(AttrPlatform, Platform);
- }
-
- /** <inheritDoc /> */
- public ICollection<IClusterNode> GetNodes()
- {
- return RefreshNodes();
- }
-
- /** <inheritDoc /> */
- public IClusterNode GetNode(Guid id)
- {
- return GetNodes().FirstOrDefault(node => node.Id == id);
- }
-
- /** <inheritDoc /> */
- public IClusterNode GetNode()
- {
- return GetNodes().FirstOrDefault();
- }
-
- /** <inheritDoc /> */
- public IClusterMetrics GetMetrics()
- {
- if (_pred == null)
- {
- return DoInOp(OpMetrics, stream =>
- {
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
- });
- }
- return DoOutInOp(OpMetricsFiltered, writer =>
- {
- WriteEnumerable(writer, GetNodes().Select(node => node.Id));
- }, stream =>
- {
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
- });
- }
-
- /** <inheritDoc /> */
- public IMessaging GetMessaging()
- {
- return _msg.Value;
- }
-
- /** <inheritDoc /> */
- public IEvents GetEvents()
- {
- return _events.Value;
- }
-
- /** <inheritDoc /> */
- public IServices GetServices()
- {
- return _services.Value;
- }
-
- /// <summary>
- /// Pings a remote node.
- /// </summary>
- /// <param name="nodeId">ID of a node to ping.</param>
- /// <returns>True if node for a given ID is alive, false otherwise.</returns>
- internal bool PingNode(Guid nodeId)
- {
- return DoOutOp(OpPingNode, nodeId) == True;
- }
-
- /// <summary>
- /// Predicate (if any).
- /// </summary>
- public Func<IClusterNode, bool> Predicate
- {
- get { return _pred; }
- }
-
- /// <summary>
- /// Refresh cluster node metrics.
- /// </summary>
- /// <param name="nodeId">Node</param>
- /// <param name="lastUpdateTime"></param>
- /// <returns></returns>
- internal ClusterMetricsImpl RefreshClusterNodeMetrics(Guid nodeId, long lastUpdateTime)
- {
- return DoOutInOp(OpNodeMetrics, writer =>
- {
- writer.WriteGuid(nodeId);
- writer.WriteLong(lastUpdateTime);
- }, stream =>
- {
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- return reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
- }
- );
- }
-
- /// <summary>
- /// Gets a topology by version. Returns null if topology history storage doesn't contain
- /// specified topology version (history currently keeps the last 1000 snapshots).
- /// </summary>
- /// <param name="version">Topology version.</param>
- /// <returns>Collection of Ignite nodes which represented by specified topology version,
- /// if it is present in history storage, {@code null} otherwise.</returns>
- /// <exception cref="IgniteException">If underlying SPI implementation does not support
- /// topology history. Currently only {@link org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi}
- /// supports topology history.</exception>
- internal ICollection<IClusterNode> Topology(long version)
- {
- return DoOutInOp(OpTopology, writer => writer.WriteLong(version),
- input => IgniteUtils.ReadNodes(Marshaller.StartUnmarshal(input)));
- }
-
- /// <summary>
- /// Topology version.
- /// </summary>
- internal long TopologyVersion
- {
- get
- {
- RefreshNodes();
-
- return Interlocked.Read(ref _topVer);
- }
- }
-
- /// <summary>
- /// Update topology.
- /// </summary>
- /// <param name="newTopVer">New topology version.</param>
- /// <param name="newNodes">New nodes.</param>
- internal void UpdateTopology(long newTopVer, List<IClusterNode> newNodes)
- {
- lock (this)
- {
- // If another thread already advanced topology version further, we still
- // can safely return currently received nodes, but we will not assign them.
- if (_topVer < newTopVer)
- {
- Interlocked.Exchange(ref _topVer, newTopVer);
-
- _nodes = newNodes.AsReadOnly();
- }
- }
- }
-
- /// <summary>
- /// Get current nodes without refreshing the topology.
- /// </summary>
- /// <returns>Current nodes.</returns>
- internal IList<IClusterNode> NodesNoRefresh()
- {
- return _nodes;
- }
-
- /// <summary>
- /// Creates new Cluster Group from given native projection.
- /// </summary>
- /// <param name="prj">Native projection.</param>
- /// <returns>New cluster group.</returns>
- private IClusterGroup GetClusterGroup(IUnmanagedTarget prj)
- {
- return new ClusterGroupImpl(_proc, prj, Marshaller, _ignite, _pred);
- }
-
- /// <summary>
- /// Refresh projection nodes.
- /// </summary>
- /// <returns>Nodes.</returns>
- private IList<IClusterNode> RefreshNodes()
- {
- long oldTopVer = Interlocked.Read(ref _topVer);
-
- List<IClusterNode> newNodes = null;
-
- DoOutInOp(OpNodes, writer =>
- {
- writer.WriteLong(oldTopVer);
- }, input =>
- {
- PortableReaderImpl reader = Marshaller.StartUnmarshal(input);
-
- if (reader.ReadBoolean())
- {
- // Topology has been updated.
- long newTopVer = reader.ReadLong();
-
- newNodes = IgniteUtils.ReadNodes(reader, _pred);
-
- UpdateTopology(newTopVer, newNodes);
- }
- });
-
- if (newNodes != null)
- return newNodes;
-
- // No topology changes.
- Debug.Assert(_nodes != null, "At least one topology update should have occurred.");
-
- return _nodes;
- }
-
- /// <summary>
- /// Perform synchronous out operation returning value.
- /// </summary>
- /// <param name="type">Operation type.</param>
- /// <param name="action">Action.</param>
- /// <returns>Native projection.</returns>
- private IUnmanagedTarget DoProjetionOutOp(int type, Action<PortableWriterImpl> action)
- {
- using (var stream = IgniteManager.Memory.Allocate().Stream())
- {
- var writer = Marshaller.StartMarshal(stream);
-
- action(writer);
-
- FinishMarshal(writer);
-
- return UU.ProjectionOutOpRet(Target, type, stream.SynchronizeOutput());
- }
- }
-
- /** <inheritDoc /> */
- public IPortableMetadata Metadata(int typeId)
- {
- return DoOutInOp<IPortableMetadata>(OpMetadata,
- writer =>
- {
- writer.WriteInt(typeId);
- },
- stream =>
- {
- PortableReaderImpl reader = Marshaller.StartUnmarshal(stream, false);
-
- return reader.ReadBoolean() ? new PortableMetadataImpl(reader) : null;
- }
- );
- }
-
- /// <summary>
- /// Gets metadata for all known types.
- /// </summary>
- public List<IPortableMetadata> Metadata()
- {
- return DoInOp(OpAllMetadata, s =>
- {
- var reader = Marshaller.StartUnmarshal(s);
-
- var size = reader.ReadInt();
-
- var res = new List<IPortableMetadata>(size);
-
- for (var i = 0; i < size; i++)
- res.Add(reader.ReadBoolean() ? new PortableMetadataImpl(reader) : null);
-
- return res;
- });
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs
deleted file mode 100644
index 664a1f1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterMetricsImpl.cs
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cluster
-{
- using System;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Cluster metrics implementation.
- /// </summary>
- internal class ClusterMetricsImpl : IClusterMetrics
- {
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterMetricsImpl"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ClusterMetricsImpl(IPortableRawReader reader)
- {
- LastUpdateTimeRaw = reader.ReadLong();
-
- DateTime? lastUpdateTime0 = reader.ReadDate();
-
- LastUpdateTime = lastUpdateTime0 ?? default(DateTime);
- MaximumActiveJobs = reader.ReadInt();
- CurrentActiveJobs = reader.ReadInt();
- AverageActiveJobs = reader.ReadFloat();
- MaximumWaitingJobs = reader.ReadInt();
-
- CurrentWaitingJobs = reader.ReadInt();
- AverageWaitingJobs = reader.ReadFloat();
- MaximumRejectedJobs = reader.ReadInt();
- CurrentRejectedJobs = reader.ReadInt();
- AverageRejectedJobs = reader.ReadFloat();
-
- TotalRejectedJobs = reader.ReadInt();
- MaximumCancelledJobs = reader.ReadInt();
- CurrentCancelledJobs = reader.ReadInt();
- AverageCancelledJobs = reader.ReadFloat();
- TotalCancelledJobs = reader.ReadInt();
-
- TotalExecutedJobs = reader.ReadInt();
- MaximumJobWaitTime = reader.ReadLong();
- CurrentJobWaitTime = reader.ReadLong();
- AverageJobWaitTime = reader.ReadDouble();
- MaximumJobExecuteTime = reader.ReadLong();
-
- CurrentJobExecuteTime = reader.ReadLong();
- AverageJobExecuteTime = reader.ReadDouble();
- TotalExecutedTasks = reader.ReadInt();
- TotalIdleTime = reader.ReadLong();
- CurrentIdleTime = reader.ReadLong();
-
- TotalCpus = reader.ReadInt();
- CurrentCpuLoad = reader.ReadDouble();
- AverageCpuLoad = reader.ReadDouble();
- CurrentGcCpuLoad = reader.ReadDouble();
- HeapMemoryInitialized = reader.ReadLong();
-
- HeapMemoryUsed = reader.ReadLong();
- HeapMemoryCommitted = reader.ReadLong();
- HeapMemoryMaximum = reader.ReadLong();
- HeapMemoryTotal = reader.ReadLong();
- NonHeapMemoryInitialized = reader.ReadLong();
-
- NonHeapMemoryUsed = reader.ReadLong();
- NonHeapMemoryCommitted = reader.ReadLong();
- NonHeapMemoryMaximum = reader.ReadLong();
- NonHeapMemoryTotal = reader.ReadLong();
- UpTime = reader.ReadLong();
-
- DateTime? startTime0 = reader.ReadDate();
-
- StartTime = startTime0 ?? default(DateTime);
-
- DateTime? nodeStartTime0 = reader.ReadDate();
-
- NodeStartTime = nodeStartTime0 ?? default(DateTime);
-
- CurrentThreadCount = reader.ReadInt();
- MaximumThreadCount = reader.ReadInt();
- TotalStartedThreadCount = reader.ReadLong();
- CurrentDaemonThreadCount = reader.ReadInt();
- LastDataVersion = reader.ReadLong();
-
- SentMessagesCount = reader.ReadInt();
- SentBytesCount = reader.ReadLong();
- ReceivedMessagesCount = reader.ReadInt();
- ReceivedBytesCount = reader.ReadLong();
- OutboundMessagesQueueSize = reader.ReadInt();
-
- TotalNodes = reader.ReadInt();
- }
-
- /// <summary>
- /// Last update time in raw format.
- /// </summary>
- internal long LastUpdateTimeRaw { get; set; }
-
- /** <inheritDoc /> */
- public DateTime LastUpdateTime { get; private set; }
-
- /** <inheritDoc /> */
- public int MaximumActiveJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentActiveJobs { get; private set; }
-
- /** <inheritDoc /> */
- public float AverageActiveJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int MaximumWaitingJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentWaitingJobs { get; private set; }
-
- /** <inheritDoc /> */
- public float AverageWaitingJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int MaximumRejectedJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentRejectedJobs { get; private set; }
-
- /** <inheritDoc /> */
- public float AverageRejectedJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int TotalRejectedJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int MaximumCancelledJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentCancelledJobs { get; private set; }
-
- /** <inheritDoc /> */
- public float AverageCancelledJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int TotalCancelledJobs { get; private set; }
-
- /** <inheritDoc /> */
- public int TotalExecutedJobs { get; private set; }
-
- /** <inheritDoc /> */
- public long MaximumJobWaitTime { get; private set; }
-
- /** <inheritDoc /> */
- public long CurrentJobWaitTime { get; private set; }
-
- /** <inheritDoc /> */
- public double AverageJobWaitTime { get; private set; }
-
- /** <inheritDoc /> */
- public long MaximumJobExecuteTime { get; private set; }
-
- /** <inheritDoc /> */
- public long CurrentJobExecuteTime { get; private set; }
-
- /** <inheritDoc /> */
- public double AverageJobExecuteTime { get; private set; }
-
- /** <inheritDoc /> */
- public int TotalExecutedTasks { get; private set; }
-
- /** <inheritDoc /> */
- public long TotalBusyTime
- {
- get { return UpTime - TotalIdleTime; }
- }
-
- /** <inheritDoc /> */
- public long TotalIdleTime { get; private set; }
-
- /** <inheritDoc /> */
- public long CurrentIdleTime { get; private set; }
-
- /** <inheritDoc /> */
- public float BusyTimePercentage
- {
- get { return 1 - IdleTimePercentage; }
- }
-
- /** <inheritDoc /> */
- public float IdleTimePercentage
- {
- get { return TotalIdleTime / (float) UpTime; }
- }
-
- /** <inheritDoc /> */
- public int TotalCpus { get; private set; }
-
- /** <inheritDoc /> */
- public double CurrentCpuLoad { get; private set; }
-
- /** <inheritDoc /> */
- public double AverageCpuLoad { get; private set; }
-
- /** <inheritDoc /> */
- public double CurrentGcCpuLoad { get; private set; }
-
- /** <inheritDoc /> */
- public long HeapMemoryInitialized { get; private set; }
-
- /** <inheritDoc /> */
- public long HeapMemoryUsed { get; private set; }
-
- /** <inheritDoc /> */
- public long HeapMemoryCommitted { get; private set; }
-
- /** <inheritDoc /> */
- public long HeapMemoryMaximum { get; private set; }
-
- /** <inheritDoc /> */
- public long HeapMemoryTotal { get; private set; }
-
- /** <inheritDoc /> */
- public long NonHeapMemoryInitialized { get; private set; }
-
- /** <inheritDoc /> */
- public long NonHeapMemoryUsed { get; private set; }
-
- /** <inheritDoc /> */
- public long NonHeapMemoryCommitted { get; private set; }
-
- /** <inheritDoc /> */
- public long NonHeapMemoryMaximum { get; private set; }
-
- /** <inheritDoc /> */
- public long NonHeapMemoryTotal { get; private set; }
-
- /** <inheritDoc /> */
- public long UpTime { get; private set; }
-
- /** <inheritDoc /> */
- public DateTime StartTime { get; private set; }
-
- /** <inheritDoc /> */
- public DateTime NodeStartTime { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentThreadCount { get; private set; }
-
- /** <inheritDoc /> */
- public int MaximumThreadCount { get; private set; }
-
- /** <inheritDoc /> */
- public long TotalStartedThreadCount { get; private set; }
-
- /** <inheritDoc /> */
- public int CurrentDaemonThreadCount { get; private set; }
-
- /** <inheritDoc /> */
- public long LastDataVersion { get; private set; }
-
- /** <inheritDoc /> */
- public int SentMessagesCount { get; private set; }
-
- /** <inheritDoc /> */
- public long SentBytesCount { get; private set; }
-
- /** <inheritDoc /> */
- public int ReceivedMessagesCount { get; private set; }
-
- /** <inheritDoc /> */
- public long ReceivedBytesCount { get; private set; }
-
- /** <inheritDoc /> */
- public int OutboundMessagesQueueSize { get; private set; }
-
- /** <inheritDoc /> */
- public int TotalNodes { get; private set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs
deleted file mode 100644
index da49feb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/ClusterNodeImpl.cs
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cluster
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Impl.Collections;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Cluster node implementation.
- /// </summary>
- internal class ClusterNodeImpl : IClusterNode
- {
- /** Node ID. */
- private readonly Guid _id;
-
- /** Attributes. */
- private readonly IDictionary<string, object> _attrs;
-
- /** Addresses. */
- private readonly ICollection<string> _addrs;
-
- /** Hosts. */
- private readonly ICollection<string> _hosts;
-
- /** Order. */
- private readonly long _order;
-
- /** Local flag. */
- private readonly bool _local;
-
- /** Daemon flag. */
- private readonly bool _daemon;
-
- /** Metrics. */
- private volatile ClusterMetricsImpl _metrics;
-
- /** Ignite reference. */
- private WeakReference _igniteRef;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ClusterNodeImpl"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public ClusterNodeImpl(IPortableRawReader reader)
- {
- _id = reader.ReadGuid() ?? default(Guid);
-
- _attrs = reader.ReadGenericDictionary<string, object>().AsReadOnly();
- _addrs = reader.ReadGenericCollection<string>().AsReadOnly();
- _hosts = reader.ReadGenericCollection<string>().AsReadOnly();
- _order = reader.ReadLong();
- _local = reader.ReadBoolean();
- _daemon = reader.ReadBoolean();
-
- _metrics = reader.ReadBoolean() ? new ClusterMetricsImpl(reader) : null;
- }
-
- /** <inheritDoc /> */
- public Guid Id
- {
- get { return _id; }
- }
-
- /** <inheritDoc /> */
- public T GetAttribute<T>(string name)
- {
- IgniteArgumentCheck.NotNull(name, "name");
-
- return (T)_attrs[name];
- }
-
- /** <inheritDoc /> */
- public bool TryGetAttribute<T>(string name, out T attr)
- {
- IgniteArgumentCheck.NotNull(name, "name");
-
- object val;
-
- if (_attrs.TryGetValue(name, out val))
- {
- attr = (T)val;
-
- return true;
- }
- attr = default(T);
-
- return false;
- }
-
- /** <inheritDoc /> */
- public IDictionary<string, object> GetAttributes()
- {
- return _attrs;
- }
-
- /** <inheritDoc /> */
- public ICollection<string> Addresses
- {
- get
- {
- return _addrs;
- }
- }
-
- /** <inheritDoc /> */
- public ICollection<string> HostNames
- {
- get
- {
- return _hosts;
- }
- }
-
- /** <inheritDoc /> */
- public long Order
- {
- get
- {
- return _order;
- }
- }
-
- /** <inheritDoc /> */
- public bool IsLocal
- {
- get
- {
- return _local;
- }
- }
-
- /** <inheritDoc /> */
- public bool IsDaemon
- {
- get
- {
- return _daemon;
- }
- }
-
- /** <inheritDoc /> */
- public IClusterMetrics GetMetrics()
- {
- var ignite = (Ignite)_igniteRef.Target;
-
- if (ignite == null)
- return _metrics;
-
- ClusterMetricsImpl oldMetrics = _metrics;
-
- long lastUpdateTime = oldMetrics.LastUpdateTimeRaw;
-
- ClusterMetricsImpl newMetrics = ignite.ClusterGroup.RefreshClusterNodeMetrics(_id, lastUpdateTime);
-
- if (newMetrics != null)
- {
- lock (this)
- {
- if (_metrics.LastUpdateTime < newMetrics.LastUpdateTime)
- _metrics = newMetrics;
- }
-
- return newMetrics;
- }
-
- return oldMetrics;
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- return "GridNode [id=" + Id + ']';
- }
-
- /** <inheritDoc /> */
- public override bool Equals(object obj)
- {
- ClusterNodeImpl node = obj as ClusterNodeImpl;
-
- if (node != null)
- return _id.Equals(node._id);
-
- return false;
- }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- // ReSharper disable once NonReadonlyMemberInGetHashCode
- return _id.GetHashCode();
- }
-
- /// <summary>
- /// Initializes this instance with a grid.
- /// </summary>
- /// <param name="grid">The grid.</param>
- internal void Init(Ignite grid)
- {
- _igniteRef = new WeakReference(grid);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/IClusterGroupEx.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/IClusterGroupEx.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/IClusterGroupEx.cs
deleted file mode 100644
index 554eb0a..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Cluster/IClusterGroupEx.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Cluster
-{
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- ///
- /// </summary>
- internal interface IClusterGroupEx : IClusterGroup
- {
- /// <summary>
- /// Gets protable metadata for type.
- /// </summary>
- /// <param name="typeId">Type ID.</param>
- /// <returns>Metadata.</returns>
- IPortableMetadata Metadata(int typeId);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/CollectionExtensions.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/CollectionExtensions.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/CollectionExtensions.cs
deleted file mode 100644
index 57295cb..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/CollectionExtensions.cs
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Collections
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Collection extension methods.
- /// </summary>
- public static class CollectionExtensions
- {
- /// <summary>
- /// Returns a read-only System.Collections.Generic.IDictionary{K, V} wrapper for the current collection.
- /// </summary>
- public static IDictionary<TKey, TValue> AsReadOnly<TKey, TValue>(this IDictionary<TKey, TValue> dict)
- {
- return new ReadOnlyDictionary<TKey, TValue>(dict);
- }
-
- /// <summary>
- /// Returns a read-only System.Collections.Generic.ICollection{K, V} wrapper for the current collection.
- /// </summary>
- public static ICollection<T> AsReadOnly<T>(this ICollection<T> col)
- {
- var list = col as List<T>;
-
- return list != null ? (ICollection<T>) list.AsReadOnly() : new ReadOnlyCollection<T>(col);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
deleted file mode 100644
index bd7e895..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Collections/MultiValueDictionary.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Collections
-{
- using System.Collections.Generic;
-
- /// <summary>
- /// Multiple-values-per-key dictionary.
- /// </summary>
- public class MultiValueDictionary<TKey, TValue>
- {
- /** Inner dictionary */
- private readonly Dictionary<TKey, object> _dict = new Dictionary<TKey, object>();
-
- /// <summary>
- /// Adds a value.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- public void Add(TKey key, TValue val)
- {
- object val0;
-
- if (_dict.TryGetValue(key, out val0))
- {
- var list = val0 as List<TValue>;
-
- if (list != null)
- list.Add(val);
- else
- _dict[key] = new List<TValue> {(TValue) val0, val};
- }
- else
- _dict[key] = val;
- }
-
- /// <summary>
- /// Tries the get a value. In case of multiple values for a key, returns the last one.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- /// <returns>True if value has been found for specified key; otherwise false.</returns>
- public bool TryGetValue(TKey key, out TValue val)
- {
- object val0;
-
- if (!_dict.TryGetValue(key, out val0))
- {
- val = default(TValue);
- return false;
- }
-
- var list = val0 as List<TValue>;
-
- if (list != null)
- val = list[list.Count - 1];
- else
- val = (TValue) val0;
-
- return true;
- }
-
- /// <summary>
- /// Removes the specified value for the specified key.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- public void Remove(TKey key, TValue val)
- {
- object val0;
-
- if (!_dict.TryGetValue(key, out val0))
- return;
-
- var list = val0 as List<TValue>;
-
- if (list != null)
- {
- list.Remove(val);
-
- if (list.Count == 0)
- _dict.Remove(key);
- }
- else if (Equals(val0, val))
- _dict.Remove(key);
- }
-
- /// <summary>
- /// Removes the last value for the specified key and returns it.
- /// </summary>
- /// <param name="key">The key.</param>
- /// <param name="val">The value.</param>
- /// <returns>True if value has been found for specified key; otherwise false.</returns>
- public bool TryRemove(TKey key, out TValue val)
- {
- object val0;
-
- if (!_dict.TryGetValue(key, out val0))
- {
- val = default(TValue);
-
- return false;
- }
-
- var list = val0 as List<TValue>;
-
- if (list != null)
- {
- var index = list.Count - 1;
-
- val = list[index];
-
- list.RemoveAt(index);
-
- if (list.Count == 0)
- _dict.Remove(key);
-
- return true;
- }
-
- val = (TValue) val0;
-
- _dict.Remove(key);
-
- return true;
- }
- }
-}
\ No newline at end of file
[26/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
deleted file mode 100644
index dfe0d18..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Compute/ComputeTaskHolder.cs
+++ /dev/null
@@ -1,484 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Compute.Closure;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Resource;
-
- /// <summary>
- /// Compute task holder interface used to avoid generics.
- /// </summary>
- internal interface IComputeTaskHolder
- {
- /// <summary>
- /// Perform map step.
- /// </summary>
- /// <param name="inStream">Stream with IN data (topology info).</param>
- /// <param name="outStream">Stream for OUT data (map result).</param>
- /// <returns>Map with produced jobs.</returns>
- void Map(PlatformMemoryStream inStream, PlatformMemoryStream outStream);
-
- /// <summary>
- /// Process local job result.
- /// </summary>
- /// <param name="jobId">Job pointer.</param>
- /// <returns>Policy.</returns>
- int JobResultLocal(ComputeJobHolder jobId);
-
- /// <summary>
- /// Process remote job result.
- /// </summary>
- /// <param name="jobId">Job pointer.</param>
- /// <param name="stream">Stream.</param>
- /// <returns>Policy.</returns>
- int JobResultRemote(ComputeJobHolder jobId, PlatformMemoryStream stream);
-
- /// <summary>
- /// Perform task reduce.
- /// </summary>
- void Reduce();
-
- /// <summary>
- /// Complete task.
- /// </summary>
- /// <param name="taskHandle">Task handle.</param>
- void Complete(long taskHandle);
-
- /// <summary>
- /// Complete task with error.
- /// </summary>
- /// <param name="taskHandle">Task handle.</param>
- /// <param name="stream">Stream with serialized exception.</param>
- void CompleteWithError(long taskHandle, PlatformMemoryStream stream);
- }
-
- /// <summary>
- /// Compute task holder.
- /// </summary>
- internal class ComputeTaskHolder<TA, T, TR> : IComputeTaskHolder
- {
- /** Empty results. */
- private static readonly IList<IComputeJobResult<T>> EmptyRes =
- new ReadOnlyCollection<IComputeJobResult<T>>(new List<IComputeJobResult<T>>());
-
- /** Compute instance. */
- private readonly ComputeImpl _compute;
-
- /** Actual task. */
- private readonly IComputeTask<TA, T, TR> _task;
-
- /** Task argument. */
- private readonly TA _arg;
-
- /** Results cache flag. */
- private readonly bool _resCache;
-
- /** Task future. */
- private readonly Future<TR> _fut = new Future<TR>();
-
- /** Jobs whose results are cached. */
- private ISet<object> _resJobs;
-
- /** Cached results. */
- private IList<IComputeJobResult<T>> _ress;
-
- /** Handles for jobs which are not serialized right away. */
- private volatile List<long> _jobHandles;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="grid">Grid.</param>
- /// <param name="compute">Compute.</param>
- /// <param name="task">Task.</param>
- /// <param name="arg">Argument.</param>
- public ComputeTaskHolder(Ignite grid, ComputeImpl compute, IComputeTask<TA, T, TR> task, TA arg)
- {
- _compute = compute;
- _arg = arg;
- _task = task;
-
- ResourceTypeDescriptor resDesc = ResourceProcessor.Descriptor(task.GetType());
-
- IComputeResourceInjector injector = task as IComputeResourceInjector;
-
- if (injector != null)
- injector.Inject(grid);
- else
- resDesc.InjectIgnite(task, grid);
-
- _resCache = !resDesc.TaskNoResultCache;
- }
-
- /** <inheritDoc /> */
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User code can throw any exception")]
- public void Map(PlatformMemoryStream inStream, PlatformMemoryStream outStream)
- {
- IList<IClusterNode> subgrid;
-
- ClusterGroupImpl prj = (ClusterGroupImpl)_compute.ClusterGroup;
-
- var ignite = (Ignite) prj.Ignite;
-
- // 1. Unmarshal topology info if topology changed.
- var reader = prj.Marshaller.StartUnmarshal(inStream);
-
- if (reader.ReadBoolean())
- {
- long topVer = reader.ReadLong();
-
- List<IClusterNode> nodes = new List<IClusterNode>(reader.ReadInt());
-
- int nodesCnt = reader.ReadInt();
-
- subgrid = new List<IClusterNode>(nodesCnt);
-
- for (int i = 0; i < nodesCnt; i++)
- {
- IClusterNode node = ignite.GetNode(reader.ReadGuid());
-
- nodes.Add(node);
-
- if (reader.ReadBoolean())
- subgrid.Add(node);
- }
-
- // Update parent projection to help other task callers avoid this overhead.
- // Note that there is a chance that topology changed even further and this update fails.
- // It means that some of subgrid nodes could have left the Grid. This is not critical
- // for us, because Java will handle it gracefully.
- prj.UpdateTopology(topVer, nodes);
- }
- else
- {
- IList<IClusterNode> nodes = prj.NodesNoRefresh();
-
- Debug.Assert(nodes != null, "At least one topology update should have occurred.");
-
- subgrid = IgniteUtils.Shuffle(nodes);
- }
-
- // 2. Perform map.
- IDictionary<IComputeJob<T>, IClusterNode> map;
- Exception err;
-
- try
- {
- map = _task.Map(subgrid, _arg);
-
- err = null;
- }
- catch (Exception e)
- {
- map = null;
-
- err = e;
-
- // Java can receive another exception in case of marshalling failure but it is not important.
- Finish(default(TR), e);
- }
-
- // 3. Write map result to the output stream.
- PortableWriterImpl writer = prj.Marshaller.StartMarshal(outStream);
-
- try
- {
- if (err == null)
- {
- writer.WriteBoolean(true); // Success flag.
-
- if (map == null)
- writer.WriteBoolean(false); // Map produced no result.
- else
- {
- writer.WriteBoolean(true); // Map produced result.
- writer.WriteInt(map.Count); // Amount of mapped jobs.
-
- var jobHandles = new List<long>(map.Count);
-
- foreach (KeyValuePair<IComputeJob<T>, IClusterNode> mapEntry in map)
- {
- var job = new ComputeJobHolder(_compute.ClusterGroup.Ignite as Ignite, mapEntry.Key.ToNonGeneric());
-
- IClusterNode node = mapEntry.Value;
-
- var jobHandle = ignite.HandleRegistry.Allocate(job);
-
- jobHandles.Add(jobHandle);
-
- writer.WriteLong(jobHandle);
-
- if (node.IsLocal)
- writer.WriteBoolean(false); // Job is not serialized.
- else
- {
- writer.WriteBoolean(true); // Job is serialized.
- writer.WriteObject(job);
- }
-
- writer.WriteGuid(node.Id);
- }
-
- _jobHandles = jobHandles;
- }
- }
- else
- {
- writer.WriteBoolean(false); // Map failed.
-
- // Write error as string because it is not important for Java, we need only to print
- // a message in the log.
- writer.WriteString("Map step failed [errType=" + err.GetType().Name +
- ", errMsg=" + err.Message + ']');
- }
- }
- catch (Exception e)
- {
- // Something went wrong during marshaling.
- Finish(default(TR), e);
-
- outStream.Reset();
-
- writer.WriteBoolean(false); // Map failed.
- writer.WriteString(e.Message); // Write error message.
- }
- finally
- {
- prj.Marshaller.FinishMarshal(writer);
- }
- }
-
- /** <inheritDoc /> */
- public int JobResultLocal(ComputeJobHolder job)
- {
- return (int)JobResult0(job.JobResult);
- }
-
- /** <inheritDoc /> */
- [SuppressMessage("ReSharper", "PossibleInvalidOperationException")]
- public int JobResultRemote(ComputeJobHolder job, PlatformMemoryStream stream)
- {
- // 1. Unmarshal result.
- PortableReaderImpl reader = _compute.Marshaller.StartUnmarshal(stream);
-
- Guid nodeId = reader.ReadGuid().Value;
- bool cancelled = reader.ReadBoolean();
-
- try
- {
- object err;
-
- var data = PortableUtils.ReadWrappedInvocationResult(reader, out err);
-
- // 2. Process the result.
- return (int) JobResult0(new ComputeJobResultImpl(data, (Exception) err, job.Job, nodeId, cancelled));
- }
- catch (Exception e)
- {
- Finish(default(TR), e);
-
- if (!(e is IgniteException))
- throw new IgniteException("Failed to process job result: " + e.Message, e);
-
- throw;
- }
- }
-
- /** <inheritDoc /> */
- public void Reduce()
- {
- try
- {
- TR taskRes = _task.Reduce(_resCache ? _ress : EmptyRes);
-
- Finish(taskRes, null);
- }
- catch (Exception e)
- {
- Finish(default(TR), e);
-
- if (!(e is IgniteException))
- throw new IgniteException("Failed to reduce task: " + e.Message, e);
-
- throw;
- }
- }
-
- /** <inheritDoc /> */
- public void Complete(long taskHandle)
- {
- Clean(taskHandle);
- }
-
- /// <summary>
- /// Complete task with error.
- /// </summary>
- /// <param name="taskHandle">Task handle.</param>
- /// <param name="e">Error.</param>
- public void CompleteWithError(long taskHandle, Exception e)
- {
- Finish(default(TR), e);
-
- Clean(taskHandle);
- }
-
- /** <inheritDoc /> */
- [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes",
- Justification = "User object deserialization can throw any exception")]
- public void CompleteWithError(long taskHandle, PlatformMemoryStream stream)
- {
- PortableReaderImpl reader = _compute.Marshaller.StartUnmarshal(stream);
-
- Exception err;
-
- try
- {
- if (reader.ReadBoolean())
- {
- PortableResultWrapper res = reader.ReadObject<PortableUserObject>()
- .Deserialize<PortableResultWrapper>();
-
- err = (Exception) res.Result;
- }
- else
- err = ExceptionUtils.GetException(reader.ReadString(), reader.ReadString());
- }
- catch (Exception e)
- {
- err = new IgniteException("Task completed with error, but it cannot be unmarshalled: " + e.Message, e);
- }
-
- CompleteWithError(taskHandle, err);
- }
-
- /// <summary>
- /// Task completion future.
- /// </summary>
- internal IFuture<TR> Future
- {
- get { return _fut; }
- }
-
- /// <summary>
- /// Manually set job handles. Used by closures because they have separate flow for map step.
- /// </summary>
- /// <param name="jobHandles">Job handles.</param>
- internal void JobHandles(List<long> jobHandles)
- {
- _jobHandles = jobHandles;
- }
-
- /// <summary>
- /// Process job result.
- /// </summary>
- /// <param name="res">Result.</param>
- private ComputeJobResultPolicy JobResult0(IComputeJobResult<object> res)
- {
- try
- {
- IList<IComputeJobResult<T>> ress0;
-
- // 1. Prepare old results.
- if (_resCache)
- {
- if (_resJobs == null)
- {
- _resJobs = new HashSet<object>();
-
- _ress = new List<IComputeJobResult<T>>();
- }
-
- ress0 = _ress;
- }
- else
- ress0 = EmptyRes;
-
- // 2. Invoke user code.
- var policy = _task.Result(new ComputeJobResultGenericWrapper<T>(res), ress0);
-
- // 3. Add result to the list only in case of success.
- if (_resCache)
- {
- var job = res.Job().Unwrap();
-
- if (!_resJobs.Add(job))
- {
- // Duplicate result => find and replace it with the new one.
- var oldRes = _ress.Single(item => item.Job() == job);
-
- _ress.Remove(oldRes);
- }
-
- _ress.Add(new ComputeJobResultGenericWrapper<T>(res));
- }
-
- return policy;
- }
- catch (Exception e)
- {
- Finish(default(TR), e);
-
- if (!(e is IgniteException))
- throw new IgniteException("Failed to process job result: " + e.Message, e);
-
- throw;
- }
- }
-
- /// <summary>
- /// Finish task.
- /// </summary>
- /// <param name="res">Result.</param>
- /// <param name="err">Error.</param>
- private void Finish(TR res, Exception err)
- {
- _fut.OnDone(res, err);
- }
-
- /// <summary>
- /// Clean-up task resources.
- /// </summary>
- /// <param name="taskHandle"></param>
- private void Clean(long taskHandle)
- {
- var handles = _jobHandles;
-
- var handleRegistry = _compute.Marshaller.Ignite.HandleRegistry;
-
- if (handles != null)
- foreach (var handle in handles)
- handleRegistry.Release(handle, true);
-
- handleRegistry.Release(taskHandle, true);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
deleted file mode 100644
index cbd26dd..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerBatch.cs
+++ /dev/null
@@ -1,269 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Datastream
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
-
- /// <summary>
- /// Data streamer batch.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class DataStreamerBatch<TK, TV>
- {
- /** Queue. */
- private readonly ConcurrentQueue<object> _queue = new ConcurrentQueue<object>();
-
- /** Lock for concurrency. */
- private readonly ReaderWriterLockSlim _rwLock = new ReaderWriterLockSlim();
-
- /** Previous batch. */
- private volatile DataStreamerBatch<TK, TV> _prev;
-
- /** Current queue size.*/
- private volatile int _size;
-
- /** Send guard. */
- private bool _sndGuard;
-
- /** */
- private readonly Future<object> _fut = new Future<object>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public DataStreamerBatch() : this(null)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="prev">Previous batch.</param>
- public DataStreamerBatch(DataStreamerBatch<TK, TV> prev)
- {
- _prev = prev;
-
- if (prev != null)
- Thread.MemoryBarrier(); // Prevent "prev" field escape.
-
- _fut.Listen(() => ParentsCompleted());
- }
-
- /// <summary>
- /// Gets the future.
- /// </summary>
- public IFuture Future
- {
- get { return _fut; }
- }
-
- /// <summary>
- /// Add object to the batch.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <param name="cnt">Items count.</param>
- /// <returns>Positive value in case batch is active, -1 in case no more additions are allowed.</returns>
- public int Add(object val, int cnt)
- {
- // If we cannot enter read-lock immediately, then send is scheduled and batch is definetely blocked.
- if (!_rwLock.TryEnterReadLock(0))
- return -1;
-
- try
- {
- // 1. Ensure additions are possible
- if (_sndGuard)
- return -1;
-
- // 2. Add data and increase size.
- _queue.Enqueue(val);
-
-#pragma warning disable 0420
- int newSize = Interlocked.Add(ref _size, cnt);
-#pragma warning restore 0420
-
- return newSize;
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
- }
-
- /// <summary>
- /// Internal send routine.
- /// </summary>
- /// <param name="ldr">streamer.</param>
- /// <param name="plc">Policy.</param>
- public void Send(DataStreamerImpl<TK, TV> ldr, int plc)
- {
- // 1. Delegate to the previous batch first.
- DataStreamerBatch<TK, TV> prev0 = _prev;
-
- if (prev0 != null)
- prev0.Send(ldr, DataStreamerImpl<TK, TV>.PlcContinue);
-
- // 2. Set guard.
- _rwLock.EnterWriteLock();
-
- try
- {
- if (_sndGuard)
- return;
- else
- _sndGuard = true;
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
-
- var handleRegistry = ldr.Marshaller.Ignite.HandleRegistry;
-
- long futHnd = 0;
-
- // 3. Actual send.
- ldr.Update(writer =>
- {
- writer.WriteInt(plc);
-
- if (plc != DataStreamerImpl<TK, TV>.PlcCancelClose)
- {
- futHnd = handleRegistry.Allocate(_fut);
-
- try
- {
- writer.WriteLong(futHnd);
-
- WriteTo(writer);
- }
- catch (Exception)
- {
- handleRegistry.Release(futHnd);
-
- throw;
- }
- }
- });
-
- if (plc == DataStreamerImpl<TK, TV>.PlcCancelClose || _size == 0)
- {
- _fut.OnNullResult();
-
- handleRegistry.Release(futHnd);
- }
- }
-
-
- /// <summary>
- /// Await completion of current and all previous loads.
- /// </summary>
- public void AwaitCompletion()
- {
- DataStreamerBatch<TK, TV> curBatch = this;
-
- while (curBatch != null)
- {
- try
- {
- curBatch._fut.Get();
- }
- catch (Exception)
- {
- // Ignore.
- }
-
- curBatch = curBatch._prev;
- }
- }
-
- /// <summary>
- /// Write batch content.
- /// </summary>
- /// <param name="writer">Portable writer.</param>
- private void WriteTo(PortableWriterImpl writer)
- {
- writer.WriteInt(_size);
-
- object val;
-
- while (_queue.TryDequeue(out val))
- {
- // 1. Is it a collection?
- ICollection<KeyValuePair<TK, TV>> entries = val as ICollection<KeyValuePair<TK, TV>>;
-
- if (entries != null)
- {
- foreach (KeyValuePair<TK, TV> item in entries)
- {
- writer.Write(item.Key);
- writer.Write(item.Value);
- }
-
- continue;
- }
-
- // 2. Is it a single entry?
- DataStreamerEntry<TK, TV> entry = val as DataStreamerEntry<TK, TV>;
-
- if (entry != null) {
- writer.Write(entry.Key);
- writer.Write(entry.Value);
-
- continue;
- }
-
- // 3. Is it remove merker?
- DataStreamerRemoveEntry<TK> rmvEntry = val as DataStreamerRemoveEntry<TK>;
-
- if (rmvEntry != null)
- {
- writer.Write(rmvEntry.Key);
- writer.Write<object>(null);
- }
- }
- }
-
- /// <summary>
- /// Checck whether all previous batches are completed.
- /// </summary>
- /// <returns></returns>
- private bool ParentsCompleted()
- {
- DataStreamerBatch<TK, TV> prev0 = _prev;
-
- if (prev0 != null)
- {
- if (prev0.ParentsCompleted())
- _prev = null;
- else
- return false;
- }
-
- return _fut.IsDone;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerEntry.cs
deleted file mode 100644
index 41ee176..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerEntry.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Datastream
-{
- /// <summary>
- /// Data streamer entry.
- /// </summary>
- internal class DataStreamerEntry<TK, TV>
- {
- /** Key. */
- private readonly TK _key;
-
- /** Value. */
- private readonly TV _val;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="key">Key.</param>
- /// <param name="val">Value.</param>
- public DataStreamerEntry(TK key, TV val)
- {
- _key = key;
- _val = val;
- }
-
- /// <summary>
- /// Key.
- /// </summary>
- public TK Key
- {
- get
- {
- return _key;
- }
- }
-
- /// <summary>
- /// Value.
- /// </summary>
- public TV Value
- {
- get
- {
- return _val;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
deleted file mode 100644
index bf11397..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerImpl.cs
+++ /dev/null
@@ -1,832 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Datastream
-{
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Data streamer internal interface to get rid of generics.
- /// </summary>
- internal interface IDataStreamer
- {
- /// <summary>
- /// Callback invoked on topology size change.
- /// </summary>
- /// <param name="topVer">New topology version.</param>
- /// <param name="topSize">New topology size.</param>
- void TopologyChange(long topVer, int topSize);
- }
-
- /// <summary>
- /// Data streamer implementation.
- /// </summary>
- internal class DataStreamerImpl<TK, TV> : PlatformDisposableTarget, IDataStreamer, IDataStreamer<TK, TV>
- {
-
-#pragma warning disable 0420
-
- /** Policy: continue. */
- internal const int PlcContinue = 0;
-
- /** Policy: close. */
- internal const int PlcClose = 1;
-
- /** Policy: cancel and close. */
- internal const int PlcCancelClose = 2;
-
- /** Policy: flush. */
- internal const int PlcFlush = 3;
-
- /** Operation: update. */
- private const int OpUpdate = 1;
-
- /** Operation: set receiver. */
- private const int OpReceiver = 2;
-
- /** Cache name. */
- private readonly string _cacheName;
-
- /** Lock. */
- private readonly ReaderWriterLockSlim _rwLock = new ReaderWriterLockSlim();
-
- /** Closed event. */
- private readonly ManualResetEventSlim _closedEvt = new ManualResetEventSlim(false);
-
- /** Close future. */
- private readonly Future<object> _closeFut = new Future<object>();
-
- /** GC handle to this streamer. */
- private readonly long _hnd;
-
- /** Topology version. */
- private long _topVer;
-
- /** Topology size. */
- private int _topSize;
-
- /** Buffer send size. */
- private volatile int _bufSndSize;
-
- /** Current data streamer batch. */
- private volatile DataStreamerBatch<TK, TV> _batch;
-
- /** Flusher. */
- private readonly Flusher<TK, TV> _flusher;
-
- /** Receiver. */
- private volatile IStreamReceiver<TK, TV> _rcv;
-
- /** Receiver handle. */
- private long _rcvHnd;
-
- /** Receiver portable mode. */
- private readonly bool _keepPortable;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="cacheName">Cache name.</param>
- /// <param name="keepPortable">Portable flag.</param>
- public DataStreamerImpl(IUnmanagedTarget target, PortableMarshaller marsh, string cacheName, bool keepPortable)
- : base(target, marsh)
- {
- _cacheName = cacheName;
- _keepPortable = keepPortable;
-
- // Create empty batch.
- _batch = new DataStreamerBatch<TK, TV>();
-
- // Allocate GC handle so that this data streamer could be easily dereferenced from native code.
- WeakReference thisRef = new WeakReference(this);
-
- _hnd = marsh.Ignite.HandleRegistry.Allocate(thisRef);
-
- // Start topology listening. This call will ensure that buffer size member is updated.
- UU.DataStreamerListenTopology(target, _hnd);
-
- // Membar to ensure fields initialization before leaving constructor.
- Thread.MemoryBarrier();
-
- // Start flusher after everything else is initialized.
- _flusher = new Flusher<TK, TV>(thisRef);
-
- _flusher.RunThread();
- }
-
- /** <inheritDoc /> */
- public string CacheName
- {
- get { return _cacheName; }
- }
-
- /** <inheritDoc /> */
- public bool AllowOverwrite
- {
- get
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- return UU.DataStreamerAllowOverwriteGet(Target);
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
- }
- set
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- UU.DataStreamerAllowOverwriteSet(Target, value);
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
- }
- }
-
- /** <inheritDoc /> */
- public bool SkipStore
- {
- get
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- return UU.DataStreamerSkipStoreGet(Target);
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
- }
- set
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- UU.DataStreamerSkipStoreSet(Target, value);
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
- }
- }
-
- /** <inheritDoc /> */
- public int PerNodeBufferSize
- {
- get
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- return UU.DataStreamerPerNodeBufferSizeGet(Target);
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
- }
- set
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- UU.DataStreamerPerNodeBufferSizeSet(Target, value);
-
- _bufSndSize = _topSize * value;
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
- }
- }
-
- /** <inheritDoc /> */
- public int PerNodeParallelOperations
- {
- get
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- return UU.DataStreamerPerNodeParallelOperationsGet(Target);
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
-
- }
- set
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- UU.DataStreamerPerNodeParallelOperationsSet(Target, value);
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
-
- }
- }
-
- /** <inheritDoc /> */
- public long AutoFlushFrequency
- {
- get
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- return _flusher.Frequency;
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
-
- }
- set
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- _flusher.Frequency = value;
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
- }
- }
-
- /** <inheritDoc /> */
- public IFuture Future
- {
- get
- {
- ThrowIfDisposed();
-
- return _closeFut;
- }
- }
-
- /** <inheritDoc /> */
- public IStreamReceiver<TK, TV> Receiver
- {
- get
- {
- ThrowIfDisposed();
-
- return _rcv;
- }
- set
- {
- IgniteArgumentCheck.NotNull(value, "value");
-
- var handleRegistry = Marshaller.Ignite.HandleRegistry;
-
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- if (_rcv == value)
- return;
-
- var rcvHolder = new StreamReceiverHolder(value,
- (rec, grid, cache, stream, keepPortable) =>
- StreamReceiverHolder.InvokeReceiver((IStreamReceiver<TK, TV>) rec, grid, cache, stream,
- keepPortable));
-
- var rcvHnd0 = handleRegistry.Allocate(rcvHolder);
-
- try
- {
- DoOutOp(OpReceiver, w =>
- {
- w.WriteLong(rcvHnd0);
-
- w.WriteObject(rcvHolder);
- });
- }
- catch (Exception)
- {
- handleRegistry.Release(rcvHnd0);
- throw;
- }
-
- if (_rcv != null)
- handleRegistry.Release(_rcvHnd);
-
- _rcv = value;
- _rcvHnd = rcvHnd0;
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
- }
- }
-
- /** <inheritDoc /> */
- public IFuture AddData(TK key, TV val)
- {
- ThrowIfDisposed();
-
- IgniteArgumentCheck.NotNull(key, "key");
-
- return Add0(new DataStreamerEntry<TK, TV>(key, val), 1);
- }
-
- /** <inheritDoc /> */
- public IFuture AddData(KeyValuePair<TK, TV> pair)
- {
- ThrowIfDisposed();
-
- return Add0(new DataStreamerEntry<TK, TV>(pair.Key, pair.Value), 1);
- }
-
- /** <inheritDoc /> */
- public IFuture AddData(ICollection<KeyValuePair<TK, TV>> entries)
- {
- ThrowIfDisposed();
-
- IgniteArgumentCheck.NotNull(entries, "entries");
-
- return Add0(entries, entries.Count);
- }
-
- /** <inheritDoc /> */
- public IFuture RemoveData(TK key)
- {
- ThrowIfDisposed();
-
- IgniteArgumentCheck.NotNull(key, "key");
-
- return Add0(new DataStreamerRemoveEntry<TK>(key), 1);
- }
-
- /** <inheritDoc /> */
- public void TryFlush()
- {
- ThrowIfDisposed();
-
- DataStreamerBatch<TK, TV> batch0 = _batch;
-
- if (batch0 != null)
- Flush0(batch0, false, PlcFlush);
- }
-
- /** <inheritDoc /> */
- public void Flush()
- {
- ThrowIfDisposed();
-
- DataStreamerBatch<TK, TV> batch0 = _batch;
-
- if (batch0 != null)
- Flush0(batch0, true, PlcFlush);
- else
- {
- // Batch is null, i.e. data streamer is closing. Wait for close to complete.
- _closedEvt.Wait();
- }
- }
-
- /** <inheritDoc /> */
- public void Close(bool cancel)
- {
- _flusher.Stop();
-
- while (true)
- {
- DataStreamerBatch<TK, TV> batch0 = _batch;
-
- if (batch0 == null)
- {
- // Wait for concurrent close to finish.
- _closedEvt.Wait();
-
- return;
- }
-
- if (Flush0(batch0, true, cancel ? PlcCancelClose : PlcClose))
- {
- _closeFut.OnDone(null, null);
-
- _rwLock.EnterWriteLock();
-
- try
- {
- base.Dispose(true);
-
- if (_rcv != null)
- Marshaller.Ignite.HandleRegistry.Release(_rcvHnd);
-
- _closedEvt.Set();
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
-
- Marshaller.Ignite.HandleRegistry.Release(_hnd);
-
- break;
- }
- }
- }
-
- /** <inheritDoc /> */
- public IDataStreamer<TK1, TV1> WithKeepPortable<TK1, TV1>()
- {
- if (_keepPortable)
- {
- var result = this as IDataStreamer<TK1, TV1>;
-
- if (result == null)
- throw new InvalidOperationException(
- "Can't change type of portable streamer. WithKeepPortable has been called on an instance of " +
- "portable streamer with incompatible generic arguments.");
-
- return result;
- }
-
- return new DataStreamerImpl<TK1, TV1>(UU.ProcessorDataStreamer(Marshaller.Ignite.InteropProcessor,
- _cacheName, true), Marshaller, _cacheName, true);
- }
-
- /** <inheritDoc /> */
- protected override void Dispose(bool disposing)
- {
- if (disposing)
- Close(false); // Normal dispose: do not cancel
- else
- {
- // Finalizer: just close Java streamer
- try
- {
- if (_batch != null)
- _batch.Send(this, PlcCancelClose);
- }
- catch (Exception)
- {
- // Finalizers should never throw
- }
-
- Marshaller.Ignite.HandleRegistry.Release(_hnd, true);
- Marshaller.Ignite.HandleRegistry.Release(_rcvHnd, true);
-
- base.Dispose(false);
- }
- }
-
- /** <inheritDoc /> */
- ~DataStreamerImpl()
- {
- Dispose(false);
- }
-
- /** <inheritDoc /> */
- public void TopologyChange(long topVer, int topSize)
- {
- _rwLock.EnterWriteLock();
-
- try
- {
- ThrowIfDisposed();
-
- if (_topVer < topVer)
- {
- _topVer = topVer;
- _topSize = topSize;
-
- _bufSndSize = topSize * UU.DataStreamerPerNodeBufferSizeGet(Target);
- }
- }
- finally
- {
- _rwLock.ExitWriteLock();
- }
-
- }
-
- /// <summary>
- /// Internal add/remove routine.
- /// </summary>
- /// <param name="val">Value.</param>
- /// <param name="cnt">Items count.</param>
- /// <returns>Future.</returns>
- private IFuture Add0(object val, int cnt)
- {
- int bufSndSize0 = _bufSndSize;
-
- while (true)
- {
- var batch0 = _batch;
-
- if (batch0 == null)
- throw new InvalidOperationException("Data streamer is stopped.");
-
- int size = batch0.Add(val, cnt);
-
- if (size == -1)
- {
- // Batch is blocked, perform CAS.
- Interlocked.CompareExchange(ref _batch,
- new DataStreamerBatch<TK, TV>(batch0), batch0);
-
- continue;
- }
- if (size >= bufSndSize0)
- // Batch is too big, schedule flush.
- Flush0(batch0, false, PlcContinue);
-
- return batch0.Future;
- }
- }
-
- /// <summary>
- /// Internal flush routine.
- /// </summary>
- /// <param name="curBatch"></param>
- /// <param name="wait">Whether to wait for flush to complete.</param>
- /// <param name="plc">Whether this is the last batch.</param>
- /// <returns>Whether this call was able to CAS previous batch</returns>
- private bool Flush0(DataStreamerBatch<TK, TV> curBatch, bool wait, int plc)
- {
- // 1. Try setting new current batch to help further adders.
- bool res = Interlocked.CompareExchange(ref _batch,
- (plc == PlcContinue || plc == PlcFlush) ?
- new DataStreamerBatch<TK, TV>(curBatch) : null, curBatch) == curBatch;
-
- // 2. Perform actual send.
- curBatch.Send(this, plc);
-
- if (wait)
- // 3. Wait for all futures to finish.
- curBatch.AwaitCompletion();
-
- return res;
- }
-
- /// <summary>
- /// Start write.
- /// </summary>
- /// <returns>Writer.</returns>
- internal void Update(Action<PortableWriterImpl> action)
- {
- _rwLock.EnterReadLock();
-
- try
- {
- ThrowIfDisposed();
-
- DoOutOp(OpUpdate, action);
- }
- finally
- {
- _rwLock.ExitReadLock();
- }
- }
-
- /// <summary>
- /// Flusher.
- /// </summary>
- private class Flusher<TK1, TV1>
- {
- /** State: running. */
- private const int StateRunning = 0;
-
- /** State: stopping. */
- private const int StateStopping = 1;
-
- /** State: stopped. */
- private const int StateStopped = 2;
-
- /** Data streamer. */
- private readonly WeakReference _ldrRef;
-
- /** Finish flag. */
- private int _state;
-
- /** Flush frequency. */
- private long _freq;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ldrRef">Data streamer weak reference..</param>
- public Flusher(WeakReference ldrRef)
- {
- _ldrRef = ldrRef;
-
- lock (this)
- {
- _state = StateRunning;
- }
- }
-
- /// <summary>
- /// Main flusher routine.
- /// </summary>
- private void Run()
- {
- bool force = false;
- long curFreq = 0;
-
- try
- {
- while (true)
- {
- if (curFreq > 0 || force)
- {
- var ldr = _ldrRef.Target as DataStreamerImpl<TK1, TV1>;
-
- if (ldr == null)
- return;
-
- ldr.TryFlush();
-
- force = false;
- }
-
- lock (this)
- {
- // Stop immediately.
- if (_state == StateStopping)
- return;
-
- if (curFreq == _freq)
- {
- // Frequency is unchanged
- if (curFreq == 0)
- // Just wait for a second and re-try.
- Monitor.Wait(this, 1000);
- else
- {
- // Calculate remaining time.
- DateTime now = DateTime.Now;
-
- long ticks;
-
- try
- {
- ticks = now.AddMilliseconds(curFreq).Ticks - now.Ticks;
-
- if (ticks > int.MaxValue)
- ticks = int.MaxValue;
- }
- catch (ArgumentOutOfRangeException)
- {
- // Handle possible overflow.
- ticks = int.MaxValue;
- }
-
- Monitor.Wait(this, TimeSpan.FromTicks(ticks));
- }
- }
- else
- {
- if (curFreq != 0)
- force = true;
-
- curFreq = _freq;
- }
- }
- }
- }
- finally
- {
- // Let streamer know about stop.
- lock (this)
- {
- _state = StateStopped;
-
- Monitor.PulseAll(this);
- }
- }
- }
-
- /// <summary>
- /// Frequency.
- /// </summary>
- public long Frequency
- {
- get
- {
- return Interlocked.Read(ref _freq);
- }
-
- set
- {
- lock (this)
- {
- if (_freq != value)
- {
- _freq = value;
-
- Monitor.PulseAll(this);
- }
- }
- }
- }
-
- /// <summary>
- /// Stop flusher.
- /// </summary>
- public void Stop()
- {
- lock (this)
- {
- if (_state == StateRunning)
- {
- _state = StateStopping;
-
- Monitor.PulseAll(this);
- }
-
- while (_state != StateStopped)
- Monitor.Wait(this);
- }
- }
-
- /// <summary>
- /// Runs the flusher thread.
- /// </summary>
- public void RunThread()
- {
- new Thread(Run).Start();
- }
- }
-
-#pragma warning restore 0420
-
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerRemoveEntry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerRemoveEntry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerRemoveEntry.cs
deleted file mode 100644
index 7e65934..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/DataStreamerRemoveEntry.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Datastream
-{
- /// <summary>
- /// Remove marker.
- /// </summary>
- internal class DataStreamerRemoveEntry<TK>
- {
- /** Key to remove. */
- private readonly TK _key;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="key">Key.</param>
- public DataStreamerRemoveEntry(TK key)
- {
- _key = key;
- }
-
- /// <summary>
- /// Key.
- /// </summary>
- public TK Key
- {
- get
- {
- return _key;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
deleted file mode 100644
index 5a7c104..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Datastream/StreamReceiverHolder.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Datastream
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
-
- /// <summary>
- /// Portable wrapper for <see cref="IStreamReceiver{TK,TV}"/>.
- /// </summary>
- internal class StreamReceiverHolder : IPortableWriteAware
- {
- /** */
- private const byte RcvNormal = 0;
-
- /** */
- public const byte RcvTransformer = 1;
-
- /** Generic receiver. */
- private readonly object _rcv;
-
- /** Invoker delegate. */
- private readonly Action<object, Ignite, IUnmanagedTarget, IPortableStream, bool> _invoke;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StreamReceiverHolder"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public StreamReceiverHolder(PortableReaderImpl reader)
- {
- var rcvType = reader.ReadByte();
-
- _rcv = PortableUtils.ReadPortableOrSerializable<object>(reader);
-
- Debug.Assert(_rcv != null);
-
- var type = _rcv.GetType();
-
- if (rcvType == RcvTransformer)
- {
- // rcv is a user ICacheEntryProcessor<K, V, A, R>, construct StreamTransformer from it.
- // (we can't marshal StreamTransformer directly, because it is generic,
- // and we do not know type arguments that user will have)
- _rcv = DelegateTypeDescriptor.GetStreamTransformerCtor(type)(_rcv);
- }
-
- _invoke = DelegateTypeDescriptor.GetStreamReceiver(_rcv.GetType());
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="StreamReceiverHolder"/> class.
- /// </summary>
- /// <param name="rcv">Receiver.</param>
- /// <param name="invoke">Invoke delegate.</param>
- public StreamReceiverHolder(object rcv,
- Action<object, Ignite, IUnmanagedTarget, IPortableStream, bool> invoke)
- {
- Debug.Assert(rcv != null);
- Debug.Assert(invoke != null);
-
- _rcv = rcv;
- _invoke = invoke;
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var w = writer.RawWriter();
-
- var writeAware = _rcv as IPortableWriteAware;
-
- if (writeAware != null)
- writeAware.WritePortable(writer);
- else
- {
- w.WriteByte(RcvNormal);
- PortableUtils.WritePortableOrSerializable((PortableWriterImpl) writer, _rcv);
- }
- }
-
- /// <summary>
- /// Updates cache with batch of entries.
- /// </summary>
- /// <param name="grid">The grid.</param>
- /// <param name="cache">Cache.</param>
- /// <param name="stream">Stream.</param>
- /// <param name="keepPortable">Portable flag.</param>
- public void Receive(Ignite grid, IUnmanagedTarget cache, IPortableStream stream, bool keepPortable)
- {
- Debug.Assert(grid != null);
- Debug.Assert(cache != null);
- Debug.Assert(stream != null);
-
- _invoke(_rcv, grid, cache, stream, keepPortable);
- }
-
- /// <summary>
- /// Invokes the receiver.
- /// </summary>
- /// <param name="receiver">Receiver.</param>
- /// <param name="grid">Grid.</param>
- /// <param name="cache">Cache.</param>
- /// <param name="stream">Stream.</param>
- /// <param name="keepPortable">Portable flag.</param>
- public static void InvokeReceiver<TK, TV>(IStreamReceiver<TK, TV> receiver, Ignite grid, IUnmanagedTarget cache,
- IPortableStream stream, bool keepPortable)
- {
- var reader = grid.Marshaller.StartUnmarshal(stream, keepPortable);
-
- var size = reader.ReadInt();
-
- var entries = new List<ICacheEntry<TK, TV>>(size);
-
- for (var i = 0; i < size; i++)
- entries.Add(new CacheEntry<TK, TV>(reader.ReadObject<TK>(), reader.ReadObject<TV>()));
-
- receiver.Receive(grid.Cache<TK, TV>(cache, keepPortable), entries);
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
deleted file mode 100644
index 3972bb0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/Events.cs
+++ /dev/null
@@ -1,498 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Events
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Portable;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Ignite events.
- /// </summary>
- internal class Events : PlatformTarget, IEvents
- {
- /// <summary>
- /// Opcodes.
- /// </summary>
- protected enum Op
- {
- RemoteQuery = 1,
- RemoteListen = 2,
- StopRemoteListen = 3,
- WaitForLocal = 4,
- LocalQuery = 5,
- RecordLocal = 6,
- EnableLocal = 8,
- DisableLocal = 9,
- GetEnabledEvents = 10
- }
-
- /** Map from user func to local wrapper, needed for invoke/unsubscribe. */
- private readonly Dictionary<object, Dictionary<int, LocalHandledEventFilter>> _localFilters
- = new Dictionary<object, Dictionary<int, LocalHandledEventFilter>>();
-
- /** Grid. */
- protected readonly Ignite Ignite;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Events"/> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="clusterGroup">Cluster group.</param>
- public Events(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup clusterGroup)
- : base(target, marsh)
- {
- Debug.Assert(clusterGroup != null);
-
- ClusterGroup = clusterGroup;
-
- Ignite = (Ignite) clusterGroup.Ignite;
- }
-
- /** <inheritDoc /> */
- public virtual IEvents WithAsync()
- {
- return new EventsAsync(UU.EventsWithAsync(Target), Marshaller, ClusterGroup);
- }
-
- /** <inheritDoc /> */
- public virtual bool IsAsync
- {
- get { return false; }
- }
-
- /** <inheritDoc /> */
- public virtual IFuture GetFuture()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public virtual IFuture<TResult> GetFuture<TResult>()
- {
- throw IgniteUtils.GetAsyncModeDisabledException();
- }
-
- /** <inheritDoc /> */
- public IClusterGroup ClusterGroup { get; private set; }
-
- /** <inheritDoc /> */
- public virtual List<T> RemoteQuery<T>(IEventFilter<T> filter, TimeSpan? timeout = null, params int[] types)
- where T : IEvent
- {
- IgniteArgumentCheck.NotNull(filter, "filter");
-
- return DoOutInOp((int) Op.RemoteQuery,
- writer =>
- {
- writer.Write(new PortableOrSerializableObjectHolder(filter));
-
- writer.WriteLong((long) (timeout == null ? 0 : timeout.Value.TotalMilliseconds));
-
- WriteEventTypes(types, writer);
- },
- reader => ReadEvents<T>(reader));
- }
-
- /** <inheritDoc /> */
- public virtual Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true,
- IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types)
- where T : IEvent
- {
- IgniteArgumentCheck.Ensure(bufSize > 0, "bufSize", "should be > 0");
- IgniteArgumentCheck.Ensure(interval == null || interval.Value.TotalMilliseconds > 0, "interval", "should be null or >= 0");
-
- return DoOutInOp((int) Op.RemoteListen,
- writer =>
- {
- writer.WriteInt(bufSize);
- writer.WriteLong((long) (interval == null ? 0 : interval.Value.TotalMilliseconds));
- writer.WriteBoolean(autoUnsubscribe);
-
- writer.WriteBoolean(localListener != null);
-
- if (localListener != null)
- {
- var listener = new RemoteListenEventFilter(Ignite, (id, e) => localListener.Invoke(id, (T) e));
- writer.WriteLong(Ignite.HandleRegistry.Allocate(listener));
- }
-
- writer.WriteBoolean(remoteFilter != null);
-
- if (remoteFilter != null)
- writer.Write(new PortableOrSerializableObjectHolder(remoteFilter));
-
- WriteEventTypes(types, writer);
- },
- reader => Marshaller.StartUnmarshal(reader).ReadGuid() ?? Guid.Empty);
- }
-
- /** <inheritDoc /> */
- public virtual void StopRemoteListen(Guid opId)
- {
- DoOutOp((int) Op.StopRemoteListen, writer =>
- {
- Marshaller.StartMarshal(writer).WriteGuid(opId);
- });
- }
-
- /** <inheritDoc /> */
- public IEvent WaitForLocal(params int[] types)
- {
- return WaitForLocal<IEvent>(null, types);
- }
-
- /** <inheritDoc /> */
- public virtual T WaitForLocal<T>(IEventFilter<T> filter, params int[] types) where T : IEvent
- {
- long hnd = 0;
-
- try
- {
- return WaitForLocal0(filter, ref hnd, types);
- }
- finally
- {
- if (filter != null)
- Ignite.HandleRegistry.Release(hnd);
- }
- }
-
- /** <inheritDoc /> */
- public List<IEvent> LocalQuery(params int[] types)
- {
- return DoOutInOp((int) Op.LocalQuery,
- writer => WriteEventTypes(types, writer),
- reader => ReadEvents<IEvent>(reader));
- }
-
- /** <inheritDoc /> */
- public void RecordLocal(IEvent evt)
- {
- throw new NotImplementedException("GG-10244");
- }
-
- /** <inheritDoc /> */
- public void LocalListen<T>(IEventFilter<T> listener, params int[] types) where T : IEvent
- {
- IgniteArgumentCheck.NotNull(listener, "listener");
- IgniteArgumentCheck.NotNullOrEmpty(types, "types");
-
- foreach (var type in types)
- LocalListen(listener, type);
- }
-
- /** <inheritDoc /> */
- public bool StopLocalListen<T>(IEventFilter<T> listener, params int[] types) where T : IEvent
- {
- lock (_localFilters)
- {
- Dictionary<int, LocalHandledEventFilter> filters;
-
- if (!_localFilters.TryGetValue(listener, out filters))
- return false;
-
- var success = false;
-
- // Should do this inside lock to avoid race with subscription
- // ToArray is required because we are going to modify underlying dictionary during enumeration
- foreach (var filter in GetLocalFilters(listener, types).ToArray())
- success |= UU.EventsStopLocalListen(Target, filter.Handle);
-
- return success;
- }
- }
-
- /** <inheritDoc /> */
- public void EnableLocal(params int[] types)
- {
- IgniteArgumentCheck.NotNullOrEmpty(types, "types");
-
- DoOutOp((int)Op.EnableLocal, writer => WriteEventTypes(types, writer));
- }
-
- /** <inheritDoc /> */
- public void DisableLocal(params int[] types)
- {
- IgniteArgumentCheck.NotNullOrEmpty(types, "types");
-
- DoOutOp((int)Op.DisableLocal, writer => WriteEventTypes(types, writer));
- }
-
- /** <inheritDoc /> */
- public int[] GetEnabledEvents()
- {
- return DoInOp((int)Op.GetEnabledEvents, reader => ReadEventTypes(reader));
- }
-
- /** <inheritDoc /> */
- public bool IsEnabled(int type)
- {
- return UU.EventsIsEnabled(Target, type);
- }
-
- /// <summary>
- /// Waits for the specified events.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="filter">Optional filtering predicate. Event wait will end as soon as it returns false.</param>
- /// <param name="handle">The filter handle, if applicable.</param>
- /// <param name="types">Types of the events to wait for.
- /// If not provided, all events will be passed to the filter.</param>
- /// <returns>Ignite event.</returns>
- protected T WaitForLocal0<T>(IEventFilter<T> filter, ref long handle, params int[] types) where T : IEvent
- {
- if (filter != null)
- handle = Ignite.HandleRegistry.Allocate(new LocalEventFilter
- {
- InvokeFunc = stream => InvokeLocalFilter(stream, filter)
- });
-
- var hnd = handle;
-
- return DoOutInOp((int)Op.WaitForLocal,
- writer =>
- {
- if (filter != null)
- {
- writer.WriteBoolean(true);
- writer.WriteLong(hnd);
- }
- else
- writer.WriteBoolean(false);
-
- WriteEventTypes(types, writer);
- },
- reader => EventReader.Read<T>(Marshaller.StartUnmarshal(reader)));
- }
-
- /// <summary>
- /// Reads events from a portable stream.
- /// </summary>
- /// <typeparam name="T">Event type.</typeparam>
- /// <param name="reader">Reader.</param>
- /// <returns>Resulting list or null.</returns>
- private List<T> ReadEvents<T>(IPortableStream reader) where T : IEvent
- {
- return ReadEvents<T>(Marshaller.StartUnmarshal(reader));
- }
-
- /// <summary>
- /// Reads events from a portable reader.
- /// </summary>
- /// <typeparam name="T">Event type.</typeparam>
- /// <param name="portableReader">Reader.</param>
- /// <returns>Resulting list or null.</returns>
- protected static List<T> ReadEvents<T>(PortableReaderImpl portableReader) where T : IEvent
- {
- var count = portableReader.RawReader().ReadInt();
-
- if (count == -1)
- return null;
-
- var result = new List<T>(count);
-
- for (var i = 0; i < count; i++)
- result.Add(EventReader.Read<T>(portableReader));
-
- return result;
- }
-
- /// <summary>
- /// Gets local filters by user listener and event type.
- /// </summary>
- /// <param name="listener">Listener.</param>
- /// <param name="types">Types.</param>
- /// <returns>Collection of local listener wrappers.</returns>
- [SuppressMessage("ReSharper", "InconsistentlySynchronizedField",
- Justification = "This private method should be always called within a lock on localFilters")]
- private IEnumerable<LocalHandledEventFilter> GetLocalFilters(object listener, int[] types)
- {
- Dictionary<int, LocalHandledEventFilter> filters;
-
- if (!_localFilters.TryGetValue(listener, out filters))
- return Enumerable.Empty<LocalHandledEventFilter>();
-
- if (types.Length == 0)
- return filters.Values;
-
- return types.Select(type =>
- {
- LocalHandledEventFilter filter;
-
- return filters.TryGetValue(type, out filter) ? filter : null;
- }).Where(x => x != null);
- }
-
- /// <summary>
- /// Adds an event listener for local events.
- /// </summary>
- /// <typeparam name="T">Type of events.</typeparam>
- /// <param name="listener">Predicate that is called on each received event.</param>
- /// <param name="type">Event type for which this listener will be notified</param>
- private void LocalListen<T>(IEventFilter<T> listener, int type) where T : IEvent
- {
- lock (_localFilters)
- {
- Dictionary<int, LocalHandledEventFilter> filters;
-
- if (!_localFilters.TryGetValue(listener, out filters))
- {
- filters = new Dictionary<int, LocalHandledEventFilter>();
-
- _localFilters[listener] = filters;
- }
-
- LocalHandledEventFilter localFilter;
-
- if (!filters.TryGetValue(type, out localFilter))
- {
- localFilter = CreateLocalFilter(listener, type);
-
- filters[type] = localFilter;
- }
-
- UU.EventsLocalListen(Target, localFilter.Handle, type);
- }
- }
-
- /// <summary>
- /// Creates a user filter wrapper.
- /// </summary>
- /// <typeparam name="T">Event object type.</typeparam>
- /// <param name="listener">Listener.</param>
- /// <param name="type">Event type.</param>
- /// <returns>Created wrapper.</returns>
- private LocalHandledEventFilter CreateLocalFilter<T>(IEventFilter<T> listener, int type) where T : IEvent
- {
- var result = new LocalHandledEventFilter(
- stream => InvokeLocalFilter(stream, listener),
- unused =>
- {
- lock (_localFilters)
- {
- Dictionary<int, LocalHandledEventFilter> filters;
-
- if (_localFilters.TryGetValue(listener, out filters))
- {
- filters.Remove(type);
-
- if (filters.Count == 0)
- _localFilters.Remove(listener);
- }
- }
- });
-
- result.Handle = Ignite.HandleRegistry.Allocate(result);
-
- return result;
- }
-
- /// <summary>
- /// Invokes local filter using data from specified stream.
- /// </summary>
- /// <typeparam name="T">Event object type.</typeparam>
- /// <param name="stream">The stream.</param>
- /// <param name="listener">The listener.</param>
- /// <returns>Filter invocation result.</returns>
- private bool InvokeLocalFilter<T>(IPortableStream stream, IEventFilter<T> listener) where T : IEvent
- {
- var evt = EventReader.Read<T>(Marshaller.StartUnmarshal(stream));
-
- // No guid in local mode
- return listener.Invoke(Guid.Empty, evt);
- }
-
- /// <summary>
- /// Writes the event types.
- /// </summary>
- /// <param name="types">Types.</param>
- /// <param name="writer">Writer.</param>
- private static void WriteEventTypes(int[] types, IPortableRawWriter writer)
- {
- if (types.Length == 0)
- types = null; // empty array means no type filtering
-
- writer.WriteIntArray(types);
- }
-
- /// <summary>
- /// Writes the event types.
- /// </summary>
- /// <param name="reader">Reader.</param>
- private int[] ReadEventTypes(IPortableStream reader)
- {
- return Marshaller.StartUnmarshal(reader).ReadIntArray();
- }
-
- /// <summary>
- /// Local user filter wrapper.
- /// </summary>
- private class LocalEventFilter : IInteropCallback
- {
- /** */
- public Func<IPortableStream, bool> InvokeFunc;
-
- /** <inheritdoc /> */
- public int Invoke(IPortableStream stream)
- {
- return InvokeFunc(stream) ? 1 : 0;
- }
- }
-
- /// <summary>
- /// Local user filter wrapper with handle.
- /// </summary>
- private class LocalHandledEventFilter : Handle<Func<IPortableStream, bool>>, IInteropCallback
- {
- /** */
- public long Handle;
-
- /** <inheritdoc /> */
- public int Invoke(IPortableStream stream)
- {
- return Target(stream) ? 1 : 0;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LocalHandledEventFilter"/> class.
- /// </summary>
- /// <param name="invokeFunc">The invoke function.</param>
- /// <param name="releaseAction">The release action.</param>
- public LocalHandledEventFilter(
- Func<IPortableStream, bool> invokeFunc, Action<Func<IPortableStream, bool>> releaseAction)
- : base(invokeFunc, releaseAction)
- {
- // No-op.
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs
deleted file mode 100644
index 632d8b8..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/EventsAsync.cs
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Events
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Threading;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Async Ignite events.
- /// </summary>
- [SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
- internal class EventsAsync : Events
- {
- /** */
- private readonly ThreadLocal<int> _lastAsyncOp = new ThreadLocal<int>(() => OpNone);
-
- /** */
- private readonly ThreadLocal<IFuture> _curFut = new ThreadLocal<IFuture>();
-
- /// <summary>
- /// Initializes a new instance of the <see cref="Events"/> class.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="clusterGroup">Cluster group.</param>
- public EventsAsync(IUnmanagedTarget target, PortableMarshaller marsh, IClusterGroup clusterGroup)
- : base(target, marsh, clusterGroup)
- {
- // No-op.
- }
-
- /** <inheritdoc /> */
- public override List<T> RemoteQuery<T>(IEventFilter<T> filter, TimeSpan? timeout = null, params int[] types)
- {
- _lastAsyncOp.Value = (int) Op.RemoteQuery;
-
- var result = base.RemoteQuery(filter, timeout, types);
-
- // Result is a List<T> so we can't create proper converter later in GetFuture call from user.
- // ReSharper disable once RedundantTypeArgumentsOfMethod (otherwise won't compile in VS2010 / TC)
- _curFut.Value = GetFuture<List<T>>((futId, futTyp) => UU.TargetListenFutureForOperation(Target, futId, futTyp,
- (int) Op.RemoteQuery), convertFunc: ReadEvents<T>);
-
- return result;
- }
-
- /** <inheritdoc /> */
- public override Guid RemoteListen<T>(int bufSize = 1, TimeSpan? interval = null, bool autoUnsubscribe = true,
- IEventFilter<T> localListener = null, IEventFilter<T> remoteFilter = null, params int[] types)
- {
- _lastAsyncOp.Value = (int) Op.RemoteListen;
- _curFut.Value = null;
-
- return base.RemoteListen(bufSize, interval, autoUnsubscribe, localListener, remoteFilter, types);
- }
-
- /** <inheritdoc /> */
- public override void StopRemoteListen(Guid opId)
- {
- _lastAsyncOp.Value = (int) Op.StopRemoteListen;
- _curFut.Value = null;
-
- base.StopRemoteListen(opId);
- }
-
- /** <inheritdoc /> */
- public override T WaitForLocal<T>(IEventFilter<T> filter, params int[] types)
- {
- _lastAsyncOp.Value = (int) Op.WaitForLocal;
-
- long hnd = 0;
-
- try
- {
- var result = WaitForLocal0(filter, ref hnd, types);
-
- if (filter != null)
- {
- // Dispose handle as soon as future ends.
- var fut = GetFuture<T>();
-
- _curFut.Value = fut;
-
- fut.Listen(() => Ignite.HandleRegistry.Release(hnd));
- }
- else
- _curFut.Value = null;
-
- return result;
- }
- catch (Exception)
- {
- Ignite.HandleRegistry.Release(hnd);
- throw;
- }
- }
-
- /** <inheritdoc /> */
- public override IEvents WithAsync()
- {
- return this;
- }
-
- /** <inheritdoc /> */
- public override bool IsAsync
- {
- get { return true; }
- }
-
- /** <inheritdoc /> */
- public override IFuture GetFuture()
- {
- return GetFuture<object>();
- }
-
- /** <inheritdoc /> */
- public override IFuture<T> GetFuture<T>()
- {
- if (_curFut.Value != null)
- {
- var fut = _curFut.Value;
- _curFut.Value = null;
- return (IFuture<T>) fut;
- }
-
- Func<PortableReaderImpl, T> converter = null;
-
- if (_lastAsyncOp.Value == (int) Op.WaitForLocal)
- converter = reader => (T) EventReader.Read<IEvent>(reader);
-
- return GetFuture((futId, futTyp) => UU.TargetListenFutureForOperation(Target, futId, futTyp, _lastAsyncOp.Value),
- convertFunc: converter);
- }
- }
-}
\ No newline at end of file
[11/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs
deleted file mode 100644
index f5c0acf..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Config/IConfigurator.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Config
-{
- using Apache.Ignite.Core;
-
- /// <summary>
- /// Configurator which is capable of setting configuration properties taken from somewhere.
- /// </summary>
- internal interface IConfigurator<in T>
- {
- /// <summary>
- /// Set configuration.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <param name="src">Source.</param>
- void Configure(IgniteConfiguration cfg, T src);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs b/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs
deleted file mode 100644
index 122994f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/IgniteRunner.cs
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite
-{
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using System.Linq;
- using System.ServiceProcess;
- using Apache.Ignite.Config;
- using Apache.Ignite.Core;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Service;
-
- /// <summary>
- /// Runner class.
- /// </summary>
- public class IgniteRunner
- {
- /** Help commands. */
- private static readonly IList<string> Help = new List<string> { "/help", "-help", "--help" };
-
- /** Argument meaning that this is service call. */
- internal static readonly string Svc = "/service";
-
- /** Service install command. */
- internal static readonly string SvcInstall = "/install";
-
- /** Service uninstall command. */
- internal static readonly string SvcUninstall = "/uninstall";
-
- /// <summary>
- /// Application entry point.
- /// </summary>
- internal static void Main(string[] args)
- {
- IgniteConfiguration cfg;
-
- bool svc = false;
- bool install = false;
-
- try
- {
- // Check for special cases.
- if (args.Length > 0)
- {
- string first = args[0].ToLower();
-
- if (Help.Contains(first))
- {
- PrintHelp();
-
- return;
- }
-
- if (Svc.Equals(first))
- {
- args = RemoveFirstArg(args);
-
- svc = true;
- }
-
- else if (SvcInstall.Equals(first))
- {
- args = RemoveFirstArg(args);
-
- install = true;
- }
- else if (SvcUninstall.Equals(first))
- {
- IgniteService.Uninstall();
-
- return;
- }
- }
-
- if (!svc)
- {
- // Pick application configuration.
- cfg = new IgniteConfiguration();
-
- new AppSettingsConfigurator().Configure(cfg, ConfigurationManager.AppSettings);
-
- // Pick command line arguments.
- new ArgsConfigurator().Configure(cfg, args);
-
- if (install)
- IgniteService.DoInstall(cfg);
- else
- {
- Ignition.Start(cfg);
-
- IgniteManager.DestroyJvm();
- }
-
- return;
- }
- }
- catch (Exception e)
- {
- Console.WriteLine("ERROR: " + e.Message);
-
- Environment.Exit(-1);
- }
-
- // If we are here, then this is a service call.
- cfg = new IgniteConfiguration();
-
- // Use only arguments, not app.config.
- new ArgsConfigurator().Configure(cfg, args);
-
- ServiceBase.Run(new IgniteService(cfg));
- }
-
- /// <summary>
- /// Prints help.
- /// </summary>
- private static void PrintHelp()
- {
- Console.WriteLine("Usage: Apache.Ignite.exe [/install] [/uninstall] [-options]");
- Console.WriteLine("");
- Console.WriteLine("\t/install [-options] installs Ignite Windows service with provided options");
- Console.WriteLine("\t/uninstall uninstalls Ignite Windows service");
- Console.WriteLine("");
- Console.WriteLine("Options:");
- Console.WriteLine("\t-IgniteHome path to Ignite installation directory (if not provided IGNITE_HOME environment variable is used)");
- Console.WriteLine("\t-springConfigUrl path to spring configuration file (if not provided \"config/default-config.xml\" is used)");
- Console.WriteLine("\t-jvmDllPath path to JVM library jvm.dll (if not provided JAVA_HOME environment variable is used)");
- Console.WriteLine("\t-jvmClasspath classpath passed to JVM (enlist additional jar files here)");
- Console.WriteLine("\t-suppressWarnings wether to print warnings");
- Console.WriteLine("\t-J<javaOption> JVM options passed to created JVM");
- Console.WriteLine("\t-assembly=userLib.dll additional .Net assemblies");
- Console.WriteLine("\t-jvmInitialMemoryMB Initial Java heap size, in megabytes. Maps to -Xms Java parameter. Defaults to 512.");
- Console.WriteLine("\t-jvmMaxMemoryMB Maximum Java heap size, in megabytes. Maps to -Xmx Java parameter. Defaults to 1024.");
- Console.WriteLine("");
- Console.WriteLine("Examples:");
- Console.WriteLine("\tApache.Ignite.exe -J-Xms1024m -J-Xmx1024m -springConfigUrl=C:/woer/gg-test/my-test-gg-confignative.xml");
- Console.WriteLine("\tApache.Ignite.exe -IgniteHome=c:/apache-ignite -jvmClasspath=libs/myLib1.jar;libs/myLib2.jar");
- Console.WriteLine("\tApache.Ignite.exe -assembly=c:/myProject/libs/lib1.dll -assembly=c:/myProject/libs/lib2.dll");
- Console.WriteLine("\tApache.Ignite.exe -jvmInitialMemoryMB=1024 -jvmMaxMemoryMB=4096");
- Console.WriteLine("");
- Console.WriteLine("Note:");
- Console.WriteLine("Command line settings have priority over Apache.Ignite.exe.config settings. JVM options and assemblies are concatenated; data from config file comes first, then data from command line.");
- }
-
- /// <summary>
- /// Remove the first argument.
- /// </summary>
- /// <param name="args">Arguments.</param>
- /// <returns>New arguments.</returns>
- private static string[] RemoveFirstArg(string[] args)
- {
- return args.Skip(1).ToArray();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
deleted file mode 100644
index 03f7fb9..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-[assembly: AssemblyTitle("Apache.Ignite")]
-[assembly: AssemblyDescription("Apache Ignite .NET Executable")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("Apache Software Foundation")]
-[assembly: AssemblyProduct("Apache Ignite")]
-[assembly: AssemblyCopyright("Copyright © 2015")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-[assembly: ComVisible(false)]
-
-[assembly: Guid("0f9702ec-da7d-4ce5-b4b7-73310c885355")]
-
-[assembly: AssemblyVersion("1.5.0")]
-[assembly: AssemblyFileVersion("1.5.0")]
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs
deleted file mode 100644
index a818171..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Service/IgniteService.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Service
-{
- using System;
- using System.ComponentModel;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.ServiceProcess;
- using System.Text;
- using Apache.Ignite.Config;
- using Apache.Ignite.Core;
- using Apache.Ignite.Core.Common;
-
- /// <summary>
- /// Ignite windows service.
- /// </summary>
- internal class IgniteService : ServiceBase
- {
- /** Service name. */
- internal static readonly string SvcName = "Apache Ignite";
-
- /** Service display name. */
- internal static readonly string SvcDisplayName = "Apache Ignite .NET " +
- Assembly.GetExecutingAssembly().GetName().Version.ToString(4);
-
- /** Service description. */
- internal static readonly string SvcDesc = "Apache Ignite .Net Service.";
-
- /** Current executable name. */
- internal static readonly string ExeName =
- new FileInfo(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath).FullName;
-
- /** Current executable fully qualified name. */
- internal static readonly string FullExeName = Path.GetFileName(FullExeName);
-
- /** Ignite configuration to start with. */
- private readonly IgniteConfiguration _cfg;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public IgniteService(IgniteConfiguration cfg)
- {
- AutoLog = true;
- CanStop = true;
- ServiceName = SvcName;
-
- _cfg = cfg;
- }
-
- /** <inheritDoc /> */
- protected override void OnStart(string[] args)
- {
- Ignition.Start(_cfg);
- }
-
- /** <inheritDoc /> */
- protected override void OnStop()
- {
- Ignition.StopAll(true);
- }
-
- /// <summary>
- /// Install service programmatically.
- /// </summary>
- /// <param name="cfg">Ignite configuration.</param>
- internal static void DoInstall(IgniteConfiguration cfg)
- {
- // 1. Check if already defined.
- if (ServiceController.GetServices().Any(svc => SvcName.Equals(svc.ServiceName)))
- {
- throw new IgniteException("Ignite service is already installed (uninstall it using \"" +
- ExeName + " " + IgniteRunner.SvcUninstall + "\" first)");
- }
-
- // 2. Create startup arguments.
- var args = ArgsConfigurator.ToArgs(cfg);
-
- if (args.Length > 0)
- {
- Console.WriteLine("Installing \"" + SvcName + "\" service with the following startup " +
- "arguments:");
-
- foreach (var arg in args)
- Console.WriteLine("\t" + arg);
- }
- else
- Console.WriteLine("Installing \"" + SvcName + "\" service ...");
-
- // 3. Actual installation.
- Install0(args);
-
- Console.WriteLine("\"" + SvcName + "\" service installed successfully.");
- }
-
- /// <summary>
- /// Uninstall service programmatically.
- /// </summary>
- internal static void Uninstall()
- {
- var svc = ServiceController.GetServices().FirstOrDefault(x => SvcName == x.ServiceName);
-
- if (svc == null)
- {
- Console.WriteLine("\"" + SvcName + "\" service is not installed.");
- }
- else if (svc.Status != ServiceControllerStatus.Stopped)
- {
- throw new IgniteException("Ignite service is running, please stop it first.");
- }
- else
- {
- Console.WriteLine("Uninstalling \"" + SvcName + "\" service ...");
-
- Uninstall0();
-
- Console.WriteLine("\"" + SvcName + "\" service uninstalled successfully.");
- }
- }
-
- /// <summary>
- /// Native service installation.
- /// </summary>
- /// <param name="args">Arguments.</param>
- private static void Install0(string[] args)
- {
- // 1. Prepare arguments.
- var binPath = new StringBuilder(FullExeName).Append(" ").Append(IgniteRunner.Svc);
-
- foreach (var arg in args)
- binPath.Append(" ").Append(arg);
-
- // 2. Get SC manager.
- var scMgr = OpenServiceControlManager();
-
- // 3. Create service.
- var svc = NativeMethods.CreateService(
- scMgr,
- SvcName,
- SvcDisplayName,
- 983551, // Access constant.
- 0x10, // Service type SERVICE_WIN32_OWN_PROCESS.
- 0x2, // Start type SERVICE_AUTO_START.
- 0x2, // Error control SERVICE_ERROR_SEVERE.
- binPath.ToString(),
- null,
- IntPtr.Zero,
- null,
- null, // Use priviliged LocalSystem account.
- null
- );
-
- if (svc == IntPtr.Zero)
- throw new IgniteException("Failed to create the service.", new Win32Exception());
-
- // 4. Set description.
- var desc = new ServiceDescription {desc = Marshal.StringToHGlobalUni(SvcDesc)};
-
-
- try
- {
- if (!NativeMethods.ChangeServiceConfig2(svc, 1u, ref desc))
- throw new IgniteException("Failed to set service description.", new Win32Exception());
- }
- finally
- {
- Marshal.FreeHGlobal(desc.desc);
- }
- }
-
- /// <summary>
- /// Native service uninstallation.
- /// </summary>
- private static void Uninstall0()
- {
- var scMgr = OpenServiceControlManager();
-
- var svc = NativeMethods.OpenService(scMgr, SvcName, 65536);
-
- if (svc == IntPtr.Zero)
- throw new IgniteException("Failed to uninstall the service.", new Win32Exception());
-
- NativeMethods.DeleteService(svc);
- }
-
- /// <summary>
- /// Opens SC manager.
- /// </summary>
- /// <returns>SC manager pointer.</returns>
- private static IntPtr OpenServiceControlManager()
- {
- var ptr = NativeMethods.OpenSCManager(null, null, 983103);
-
- if (ptr == IntPtr.Zero)
- throw new IgniteException("Failed to initialize Service Control manager " +
- "(did you run the command as administrator?)", new Win32Exception());
-
- return ptr;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs
deleted file mode 100644
index 56ab15d..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Service/NativeMethods.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Service
-{
- using System;
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Native methods.
- /// </summary>
- internal class NativeMethods
- {
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern IntPtr OpenSCManager(string machineName, string dbName, int access);
-
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern IntPtr CreateService(
- IntPtr db,
- string svcName,
- string displayName,
- int access,
- int svcType,
- int startType,
- int errControl,
- string binPath,
- string loadOrderGrp,
- IntPtr pTagId,
- string dependencies,
- string servicesStartName,
- string pwd
- );
-
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern IntPtr OpenService(IntPtr db, string svcName, int access);
-
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern bool DeleteService(IntPtr svc);
-
- [DllImport("advapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
- public static extern bool ChangeServiceConfig2(IntPtr svc, uint infoLevel, ref ServiceDescription desc);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs b/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs
deleted file mode 100644
index a81a737..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite/Service/ServiceDescription.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Service
-{
- using System;
- using System.Runtime.InteropServices;
-
- /// <summary>
- /// Service description structure.
- /// </summary>
- [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
- public struct ServiceDescription
- {
- /** Pointer to description. */
- public IntPtr desc;
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite_x86.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite_x86.slnrel b/modules/platform/src/main/dotnet/Apache.Ignite_x86.slnrel
deleted file mode 100644
index a85e118..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite_x86.slnrel
+++ /dev/null
@@ -1,43 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core", "Apache.Ignite.Core\Apache.Ignite.Core.csproj", "{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\cpp\src\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite", "Apache.Ignite\Apache.Ignite.csproj", "{27F7F3C6-BDDE-43A9-B565-856F8395A04B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.ActiveCfg = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.Build.0 = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.ActiveCfg = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.Build.0 = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.ActiveCfg = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.Build.0 = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.ActiveCfg = Release|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.Build.0 = Release|x86
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.Build.0 = Release|Win32
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.ActiveCfg = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.Build.0 = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.ActiveCfg = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.Build.0 = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.ActiveCfg = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.Build.0 = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.ActiveCfg = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.sln
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.sln b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.sln
deleted file mode 100644
index c1337f3..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.sln
+++ /dev/null
@@ -1,72 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 2013
-VisualStudioVersion = 12.0.31101.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Core", "..\Apache.Ignite.Core\Apache.Ignite.Core.csproj", "{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "common", "..\..\cpp\common\project\vs\common.vcxproj", "{4F7E4917-4612-4B96-9838-025711ADE391}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Examples", "Apache.Ignite.Examples\Apache.Ignite.Examples.csproj", "{069FA680-3C4D-43A9-B84F-E67513B87827}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.ExamplesDll", "Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj", "{DFB08363-202E-412D-8812-349EF10A8702}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{F1491682-C798-4C23-8239-16C5BC2C5A02}"
- ProjectSection(SolutionItems) = preProject
- Config\example-cache-query.xml = Config\example-cache-query.xml
- Config\example-cache-store.xml = Config\example-cache-store.xml
- Config\example-cache.xml = Config\example-cache.xml
- Config\example-compute.xml = Config\example-compute.xml
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite", "..\Apache.Ignite\Apache.Ignite.csproj", "{27F7F3C6-BDDE-43A9-B565-856F8395A04B}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.ActiveCfg = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x64.Build.0 = Debug|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.ActiveCfg = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Debug|x86.Build.0 = Debug|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.ActiveCfg = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x64.Build.0 = Release|x64
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.ActiveCfg = Release|x86
- {4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}.Release|x86.Build.0 = Release|x86
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.ActiveCfg = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x64.Build.0 = Debug|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.ActiveCfg = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Debug|x86.Build.0 = Debug|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.ActiveCfg = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x64.Build.0 = Release|x64
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.ActiveCfg = Release|Win32
- {4F7E4917-4612-4B96-9838-025711ADE391}.Release|x86.Build.0 = Release|Win32
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.ActiveCfg = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.Build.0 = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.ActiveCfg = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.Build.0 = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.ActiveCfg = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.Build.0 = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.ActiveCfg = Release|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.Build.0 = Release|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x64.ActiveCfg = Debug|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x86.ActiveCfg = Debug|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x64.ActiveCfg = Release|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x86.ActiveCfg = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.ActiveCfg = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x64.Build.0 = Debug|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.ActiveCfg = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Debug|x86.Build.0 = Debug|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.ActiveCfg = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x64.Build.0 = Release|x64
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.ActiveCfg = Release|x86
- {27F7F3C6-BDDE-43A9-B565-856F8395A04B}.Release|x86.Build.0 = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.slnrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.slnrel b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.slnrel
deleted file mode 100644
index d898abc..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples.slnrel
+++ /dev/null
@@ -1,38 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.Examples", "Apache.Ignite.Examples\Apache.Ignite.Examples.csproj", "{069FA680-3C4D-43A9-B84F-E67513B87827}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Ignite.ExamplesDll", "Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj", "{DFB08363-202E-412D-8812-349EF10A8702}"
-EndProject
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Config", "Config", "{F1491682-C798-4C23-8239-16C5BC2C5A02}"
- ProjectSection(SolutionItems) = preProject
- Config\example-cache-query.xml = Config\example-cache-query.xml
- Config\example-cache-store.xml = Config\example-cache-store.xml
- Config\example-cache.xml = Config\example-cache.xml
- Config\example-compute.xml = Config\example-compute.xml
- EndProjectSection
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.ActiveCfg = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x64.Build.0 = Debug|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.ActiveCfg = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Debug|x86.Build.0 = Debug|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.ActiveCfg = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x64.Build.0 = Release|x64
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.ActiveCfg = Release|x86
- {069FA680-3C4D-43A9-B84F-E67513B87827}.Release|x86.Build.0 = Release|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x64.ActiveCfg = Debug|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Debug|x86.ActiveCfg = Debug|x86
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x64.ActiveCfg = Release|x64
- {DFB08363-202E-412D-8812-349EF10A8702}.Release|x86.ActiveCfg = Release|x86
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
deleted file mode 100644
index 8ee90d9..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csproj
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{069FA680-3C4D-43A9-B84F-E67513B87827}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.Examples</RootNamespace>
- <AssemblyName>Apache.Ignite.Examples</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject>Apache.Ignite.Examples.Compute.TaskExample</StartupObject>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\x86\Release\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Compute\ClosureExample.cs" />
- <Compile Include="Compute\TaskExample.cs" />
- <Compile Include="Datagrid\ContinuousQueryExample.cs" />
- <Compile Include="Datagrid\CrossPlatformExample.cs" />
- <Compile Include="Datagrid\DataStreamerExample.cs" />
- <Compile Include="Datagrid\PutGetExample.cs" />
- <Compile Include="Datagrid\QueryExample.cs" />
- <Compile Include="Datagrid\StoreExample.cs" />
- <Compile Include="Datagrid\TransactionExample.cs" />
- <Compile Include="Events\EventsExample.cs" />
- <Compile Include="Messaging\MessagingExample.cs" />
- <Compile Include="Misc\LifecycleExample.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Services\IMapService.cs" />
- <Compile Include="Services\ServicesExample.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\Apache.Ignite.Core\Apache.Ignite.Core.csproj">
- <Project>{4CD2F726-7E2B-46C4-A5BA-057BB82EECB6}</Project>
- <Name>Apache.Ignite.Core</Name>
- </ProjectReference>
- <ProjectReference Include="..\Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj">
- <Project>{dfb08363-202e-412d-8812-349ef10a8702}</Project>
- <Name>Apache.Ignite.ExamplesDll</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <ItemGroup />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csprojrel
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csprojrel b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csprojrel
deleted file mode 100644
index ff13ddc..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Apache.Ignite.Examples.csprojrel
+++ /dev/null
@@ -1,79 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProjectGuid>{069FA680-3C4D-43A9-B84F-E67513B87827}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Apache.Ignite.Examples</RootNamespace>
- <AssemblyName>Apache.Ignite.Examples</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Debug\</OutputPath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
- <PlatformTarget>x64</PlatformTarget>
- <OutputPath>bin\x64\Release\</OutputPath>
- </PropertyGroup>
- <PropertyGroup>
- <StartupObject>Apache.Ignite.Examples.Compute.TaskExample</StartupObject>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
- <DebugSymbols>true</DebugSymbols>
- <OutputPath>bin\x86\Debug\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
- <OutputPath>bin\x86\Release\</OutputPath>
- <PlatformTarget>x86</PlatformTarget>
- <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Apache.Ignite.Core">
- <HintPath>..\..\Apache.Ignite\bin\$(Platform)\$(Configuration)\Apache.Ignite.Core.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Compute\ClosureExample.cs" />
- <Compile Include="Compute\TaskExample.cs" />
- <Compile Include="Datagrid\ContinuousQueryExample.cs" />
- <Compile Include="Datagrid\CrossPlatformExample.cs" />
- <Compile Include="Datagrid\DataStreamerExample.cs" />
- <Compile Include="Datagrid\PutGetExample.cs" />
- <Compile Include="Datagrid\QueryExample.cs" />
- <Compile Include="Datagrid\StoreExample.cs" />
- <Compile Include="Datagrid\TransactionExample.cs" />
- <Compile Include="Events\EventsExample.cs" />
- <Compile Include="Messaging\MessagingExample.cs" />
- <Compile Include="Misc\LifecycleExample.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- <Compile Include="Services\IMapService.cs" />
- <Compile Include="Services\ServicesExample.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\Apache.Ignite.ExamplesDll\Apache.Ignite.ExamplesDll.csproj">
- <Project>{dfb08363-202e-412d-8812-349ef10a8702}</Project>
- <Name>Apache.Ignite.ExamplesDll</Name>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <None Include="App.config" />
- </ItemGroup>
- <ItemGroup />
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
- Other similar extension points exist, see Microsoft.Common.targets.
- <Target Name="BeforeBuild">
- </Target>
- <Target Name="AfterBuild">
- </Target>
- -->
-</Project>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/App.config
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/App.config b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/App.config
deleted file mode 100644
index 8e69aeb..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/App.config
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-
-<!--
- 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.
--->
-
-<configuration>
- <runtime>
- <gcServer enabled="true" />
- </runtime>
-</configuration>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/ClosureExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/ClosureExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/ClosureExample.cs
deleted file mode 100644
index 7d0128d..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/ClosureExample.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using Apache.Ignite.Core;
-using Apache.Ignite.ExamplesDll.Compute;
-
-namespace Apache.Ignite.Examples.Compute
-{
- /// <summary>
- /// Example demonstrating closure execution.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class ClosureExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Closure execution example started.");
-
- // Split the string by spaces to count letters in each word in parallel.
- ICollection<string> words = "Count characters using closure".Split().ToList();
-
- Console.WriteLine();
- Console.WriteLine(">>> Calculating character count with manual reducing:");
-
- var res = ignite.GetCompute().Apply(new CharacterCountClosure(), words);
-
- int totalLen = res.Sum();
-
- Console.WriteLine(">>> Total character count: " + totalLen);
- Console.WriteLine();
- Console.WriteLine(">>> Calculating character count with reducer:");
-
- totalLen = ignite.GetCompute().Apply(new CharacterCountClosure(), words, new CharacterCountReducer());
-
- Console.WriteLine(">>> Total character count: " + totalLen);
- Console.WriteLine();
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/TaskExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/TaskExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/TaskExample.cs
deleted file mode 100644
index 47fee9e..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Compute/TaskExample.cs
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.ExamplesDll.Compute;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Compute
-{
- /// <summary>
- /// Example demonstrating task execution.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-compute.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class TaskExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-compute.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Task execution example started.");
-
- // Generate employees to calculate average salary for.
- ICollection<Employee> employees = Employees();
-
- Console.WriteLine();
- Console.WriteLine(">>> Calculating average salary for employees:");
-
- foreach (Employee employee in employees)
- Console.WriteLine(">>> " + employee);
-
- // Execute task and get average salary.
- var avgSalary = ignite.GetCompute().Execute(new AverageSalaryTask(), employees);
-
- Console.WriteLine();
- Console.WriteLine(">>> Average salary for all employees: " + avgSalary);
- Console.WriteLine();
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Generates collection of employees for example.
- /// </summary>
- /// <returns>Collection of employees.</returns>
- private static ICollection<Employee> Employees()
- {
- return new []
- {
- new Employee(
- "James Wilson",
- 12500,
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- new List<string> {"Human Resources", "Customer Service"}
- ),
- new Employee(
- "Daniel Adams",
- 11000,
- new Address("184 Fidler Drive, San Antonio, TX", 78205),
- new List<string> {"Development", "QA"}
- ),
- new Employee(
- "Cristian Moss",
- 12500,
- new Address("667 Jerry Dove Drive, Florence, SC", 29501),
- new List<string> {"Logistics"}
- ),
- new Employee(
- "Allison Mathis",
- 25300,
- new Address("2702 Freedom Lane, Hornitos, CA", 95325),
- new List<string> {"Development"}
- ),
- new Employee(
- "Breana Robbin",
- 6500,
- new Address("3960 Sundown Lane, Austin, TX", 78758),
- new List<string> {"Sales"}
- ),
- new Employee(
- "Philip Horsley",
- 19800,
- new Address("2803 Elsie Drive, Sioux Falls, SD", 57104),
- new List<string> {"Sales"}
- ),
- new Employee(
- "Brian Peters",
- 10600,
- new Address("1407 Pearlman Avenue, Boston, MA", 02110),
- new List<string> {"Development", "QA"}
- ),
- new Employee(
- "Jack Yang",
- 12900,
- new Address("4425 Parrish Avenue Smithsons Valley, TX", 78130),
- new List<string> {"Sales"}
- )
- };
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs
deleted file mode 100644
index c61b45d..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/ContinuousQueryExample.cs
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Threading;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Cache.Event;
-using Apache.Ignite.Core.Cache.Query.Continuous;
-using Apache.Ignite.ExamplesDll.Datagrid;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// This example demonstrates continuous query API.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class ContinuousQueryExample
- {
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"}
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cache continuous query example started.");
-
- var cache = ignite.GetOrCreateCache<int, string>("cache_continuous_query");
-
- // Clean up caches on all nodes before run.
- cache.Clear();
-
- const int keyCnt = 20;
-
- for (int i = 0; i < keyCnt; i++)
- cache.Put(i, i.ToString());
-
- var qry = new ContinuousQuery<int, string>(new Listener<string>(), new ContinuousQueryFilter(15));
-
-
- // Create new continuous query.
- using (cache.QueryContinuous(qry))
- {
- // Add a few more keys and watch more query notifications.
- for (var i = keyCnt; i < keyCnt + 5; i++)
- cache.Put(i, i.ToString());
-
- // Wait for a while while callback is notified about remaining puts.
- Thread.Sleep(2000);
- }
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Callback for continuous query example.
- /// </summary>
- private class Listener<T> : ICacheEntryEventListener<int, T>
- {
- public void OnEvent(IEnumerable<ICacheEntryEvent<int, T>> events)
- {
- foreach (var e in events)
- Console.WriteLine("Queried entry [key=" + e.Key + ", val=" + e.Value + ']');
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
deleted file mode 100644
index e23d615..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/CrossPlatformExample.cs
+++ /dev/null
@@ -1,208 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Portable;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// This example demonstrates use of portable objects between different platforms.
- /// <para/>
- /// This example must be run with standalone Java node. To achieve this start a node from %IGNITE_HOME%
- /// using "ignite.bat" with proper configuration:
- /// <example>'bin\ignite.bat examples\config\example-server.xml'</example>.
- /// <para />
- /// Once remote node is started, launch this example as follows:
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build);
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start application (F5 or Ctrl+F5).
- /// <para />
- /// To see how objects can be transferred between platforms, start cross-platform Java example
- /// without restarting remote node.
- /// </summary>
- public class CrossPlatformExample
- {
- /// <summary>Key for Java object.</summary>
- private const int KeyJava = 100;
-
- /// <summary>Key for .Net object.</summary>
- private const int KeyDotnet = 200;
-
- /// <summary>Key for C++ object.</summary>
- private const int KeyCpp = 300;
-
- /// <summary>Cache Name.</summary>
- private const string CacheName = "cacheCrossPlatform";
-
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cross-platform example started.");
-
- if (ignite.GetCluster().ForRemotes().GetNodes().Count == 0)
- {
- Console.WriteLine();
- Console.WriteLine(">>> This example requires remote nodes to be started.");
- Console.WriteLine(">>> Please start at least 1 remote node.");
- Console.WriteLine(">>> Refer to example's documentation for details on configuration.");
- Console.WriteLine();
- }
- else
- {
- var cache = ignite.GetOrCreateCache<int, Organization>(CacheName);
-
- // Create new Organization object to store in cache.
- Organization org = new Organization(
- "Apache",
- new Address("1065 East Hillsdale Blvd, Foster City, CA", 94404),
- OrganizationType.Private,
- DateTime.Now
- );
-
- // Put created data entry to cache.
- cache.Put(KeyDotnet, org);
-
- // Retrieve value stored by Java client.
- GetFromJava(ignite);
-
- // Retrieve value stored by C++ client.
- GetFromCpp(ignite);
-
- // Gets portable value from cache in portable format, without de-serializing it.
- GetDotNetPortableInstance(ignite);
-
- // Gets portable value form cache as a strongly-typed fully de-serialized instance.
- GetDotNetTypedInstance(ignite);
-
- Console.WriteLine();
- }
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Gets entry put by Java client. In order for entry to be in cache, Java client example
- /// must be run before this example.
- /// </summary>
- /// <param name="Ignite">Ignite instance.</param>
- private static void GetFromJava(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName)
- .WithKeepPortable<int, IPortableObject>().WithAsync();
-
- cache.Get(KeyJava);
-
- var orgPortable = cache.GetFuture<IPortableObject>().ToTask().Result;
-
- if (orgPortable == null)
- {
- Console.WriteLine(">>> Java client hasn't put entry to cache. Run Java example before this example " +
- "to see the output.");
- }
- else
- {
- Console.WriteLine(">>> Entry from Java client:");
- Console.WriteLine(">>> Portable: " + orgPortable);
- Console.WriteLine(">>> Deserialized: " + orgPortable.Deserialize<Organization>());
- }
- }
-
- /// <summary>
- /// Gets entry put by C++ client. In order for entry to be in cache, C++ client example
- /// must be run before this example.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetFromCpp(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName)
- .WithKeepPortable<int, IPortableObject>().WithAsync();
-
- cache.Get(KeyCpp);
-
- var orgPortable = cache.GetFuture<IPortableObject>().Get();
-
- Console.WriteLine();
-
- if (orgPortable == null)
- {
- Console.WriteLine(">>> CPP client hasn't put entry to cache. Run CPP example before this example " +
- "to see the output.");
- }
- else
- {
- Console.WriteLine(">>> Entry from CPP client:");
- Console.WriteLine(">>> Portable: " + orgPortable);
- Console.WriteLine(">>> Deserialized: " + orgPortable.Deserialize<Organization>());
- }
- }
-
- /// <summary>
- /// Gets portable value from cache in portable format, without de-serializing it.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetDotNetPortableInstance(IIgnite ignite)
- {
- // Apply "KeepPortable" flag on data projection.
- var cache = ignite.GetOrCreateCache<int, IPortableObject>(CacheName)
- .WithKeepPortable<int, IPortableObject>();
-
- var org = cache.Get(KeyDotnet);
-
- string name = org.GetField<string>("name");
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization name from portable field: " + name);
- }
-
- /// <summary>
- /// Gets portable value form cache as a strongly-typed fully de-serialized instance.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void GetDotNetTypedInstance(IIgnite ignite)
- {
- var cache = ignite.GetOrCreateCache<int, Organization>(CacheName);
-
- // Get recently created employee as a strongly-typed fully de-serialized instance.
- Organization emp = cache.Get(KeyDotnet);
-
- string name = emp.Name;
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization name from deserialized Organization instance: " + name);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs
deleted file mode 100644
index ee9e200..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/DataStreamerExample.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Datastream;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// Demonstrates how cache can be populated with data utilizing <see cref="IDataStreamer{TK,TV}"/>.
- /// Data streamer is a lot more efficient to use than standard cache put operation
- /// as it properly buffers cache requests together and properly manages load on remote nodes.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class DataStreamerExample
- {
- /// <summary>Number of entries to load.</summary>
- private const int EntryCount = 500000;
-
- /// <summary>Cache name.</summary>
- private const string CacheName = "cache_data_streamer";
-
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> {"-Xms512m", "-Xmx1024m"}
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cache data streamer example started.");
-
- // Clean up caches on all nodes before run.
- ignite.GetOrCreateCache<int, Account>(CacheName).Clear();
-
- Stopwatch timer = new Stopwatch();
-
- timer.Start();
-
- using (var ldr = ignite.GetDataStreamer<int, Account>(CacheName))
- {
- ldr.PerNodeBufferSize = 1024;
-
- for (int i = 0; i < EntryCount; i++)
- {
- ldr.AddData(i, new Account(i, i));
-
- // Print out progress while loading cache.
- if (i > 0 && i % 10000 == 0)
- Console.WriteLine("Loaded " + i + " accounts.");
- }
- }
-
- timer.Stop();
-
- long dur = timer.ElapsedMilliseconds;
-
- Console.WriteLine(">>> Loaded " + EntryCount + " accounts in " + dur + "ms.");
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs b/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs
deleted file mode 100644
index c1146f1..0000000
--- a/modules/platform/src/main/dotnet/Examples/Apache.Ignite.Examples/Datagrid/PutGetExample.cs
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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.
- */
-
-using System;
-using System.Collections.Generic;
-using Apache.Ignite.Core;
-using Apache.Ignite.Core.Portable;
-using Apache.Ignite.ExamplesDll.Portable;
-
-namespace Apache.Ignite.Examples.Datagrid
-{
- /// <summary>
- /// This example demonstrates several put-get operations on Ignite cache
- /// with portable values. Note that portable object can be retrieved in
- /// fully-deserialized form or in portable object format using special
- /// cache projection.
- /// <para />
- /// 1) Build the project Apache.Ignite.ExamplesDll (select it -> right-click -> Build).
- /// Apache.Ignite.ExamplesDll.dll must appear in %IGNITE_HOME%/platforms/dotnet/Examples/Apache.Ignite.ExamplesDll/bin/${Platform]/${Configuration} folder.
- /// 2) Set this class as startup object (Apache.Ignite.Examples project -> right-click -> Properties ->
- /// Application -> Startup object);
- /// 3) Start example (F5 or Ctrl+F5).
- /// <para />
- /// This example can be run with standalone Apache Ignite .Net node:
- /// 1) Run %IGNITE_HOME%/platforms/dotnet/Apache.Ignite/bin/${Platform]/${Configuration}/Apache.Ignite.exe:
- /// Apache.Ignite.exe -IgniteHome="%IGNITE_HOME%" -springConfigUrl=platforms\dotnet\examples\config\example-cache.xml -assembly=[path_to_Apache.Ignite.ExamplesDll.dll]
- /// 2) Start example.
- /// </summary>
- public class PutGetExample
- {
- /// <summary>Cache name.</summary>
- private const string CacheName = "cache_put_get";
-
- /// <summary>
- /// Runs the example.
- /// </summary>
- [STAThread]
- public static void Main()
- {
- var cfg = new IgniteConfiguration
- {
- SpringConfigUrl = @"platforms\dotnet\examples\config\example-cache.xml",
- JvmOptions = new List<string> { "-Xms512m", "-Xmx1024m" }
- };
-
- using (var ignite = Ignition.Start(cfg))
- {
- Console.WriteLine();
- Console.WriteLine(">>> Cache put-get example started.");
-
- // Clean up caches on all nodes before run.
- ignite.GetOrCreateCache<object, object>(CacheName).Clear();
-
- PutGet(ignite);
- PutGetPortable(ignite);
- PutAllGetAll(ignite);
- PutAllGetAllPortable(ignite);
-
- Console.WriteLine();
- }
-
- Console.WriteLine();
- Console.WriteLine(">>> Example finished, press any key to exit ...");
- Console.ReadKey();
- }
-
- /// <summary>
- /// Execute individual Put and Get.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void PutGet(IIgnite ignite)
- {
- var cache = ignite.GetCache<int, Organization>(CacheName);
-
- // Create new Organization to store in cache.
- Organization org = new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.Private,
- DateTime.Now
- );
-
- // Put created data entry to cache.
- cache.Put(1, org);
-
- // Get recently created employee as a strongly-typed fully de-serialized instance.
- Organization orgFromCache = cache.Get(1);
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization instance from cache: " + orgFromCache);
- }
-
- /// <summary>
- /// Execute individual Put and Get, getting value in portable format, without de-serializing it.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void PutGetPortable(IIgnite ignite)
- {
- var cache = ignite.GetCache<int, Organization>(CacheName);
-
- // Create new Organization to store in cache.
- Organization org = new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.Private,
- DateTime.Now
- );
-
- // Put created data entry to cache.
- cache.Put(1, org);
-
- // Create projection that will get values as portable objects.
- var portableCache = cache.WithKeepPortable<int, IPortableObject>();
-
- // Get recently created organization as a portable object.
- var portableOrg = portableCache.Get(1);
-
- // Get organization's name from portable object (note that object doesn't need to be fully deserialized).
- string name = portableOrg.GetField<string>("name");
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization name from portable object: " + name);
- }
-
- /// <summary>
- /// Execute bulk Put and Get operations.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void PutAllGetAll(IIgnite ignite)
- {
- var cache = ignite.GetCache<int, Organization>(CacheName);
-
- // Create new Organizations to store in cache.
- Organization org1 = new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.Private,
- DateTime.Now
- );
-
- Organization org2 = new Organization(
- "Red Cross",
- new Address("184 Fidler Drive, San Antonio, TX", 78205),
- OrganizationType.NonProfit,
- DateTime.Now
- );
-
- var map = new Dictionary<int, Organization> { { 1, org1 }, { 2, org2 } };
-
- // Put created data entries to cache.
- cache.PutAll(map);
-
- // Get recently created organizations as a strongly-typed fully de-serialized instances.
- IDictionary<int, Organization> mapFromCache = cache.GetAll(new List<int> { 1, 2 });
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization instances from cache:");
-
- foreach (Organization org in mapFromCache.Values)
- Console.WriteLine(">>> " + org);
- }
-
- /// <summary>
- /// Execute bulk Put and Get operations getting values in portable format, without de-serializing it.
- /// </summary>
- /// <param name="ignite">Ignite instance.</param>
- private static void PutAllGetAllPortable(IIgnite ignite)
- {
- var cache = ignite.GetCache<int, Organization>(CacheName);
-
- // Create new Organizations to store in cache.
- Organization org1 = new Organization(
- "Microsoft",
- new Address("1096 Eddy Street, San Francisco, CA", 94109),
- OrganizationType.Private,
- DateTime.Now
- );
-
- Organization org2 = new Organization(
- "Red Cross",
- new Address("184 Fidler Drive, San Antonio, TX", 78205),
- OrganizationType.NonProfit,
- DateTime.Now
- );
-
- var map = new Dictionary<int, Organization> { { 1, org1 }, { 2, org2 } };
-
- // Put created data entries to cache.
- cache.PutAll(map);
-
- // Create projection that will get values as portable objects.
- var portableCache = cache.WithKeepPortable<int, IPortableObject>();
-
- // Get recently created organizations as portable objects.
- IDictionary<int, IPortableObject> portableMap =
- portableCache.GetAll(new List<int> { 1, 2 });
-
- Console.WriteLine();
- Console.WriteLine(">>> Retrieved organization names from portable objects:");
-
- foreach (IPortableObject poratbleOrg in portableMap.Values)
- Console.WriteLine(">>> " + poratbleOrg.GetField<string>("name"));
- }
- }
-}
[04/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
deleted file mode 100644
index e46ec64..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/FailoverTaskSelfTest.cs
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Test for task and job adapter.
- /// </summary>
- public class FailoverTaskSelfTest : AbstractTaskTest
- {
- /** */
- static volatile string _gridName;
-
- /** */
- static volatile int _cnt;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public FailoverTaskSelfTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected FailoverTaskSelfTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test for GridComputeJobFailoverException.
- /// </summary>
- [Test]
- public void TestClosureFailoverException()
- {
- for (int i = 0; i < 20; i++)
- {
- int res = Grid1.GetCompute().Call(new TestClosure());
-
- Assert.AreEqual(2, res);
-
- Cleanup();
- }
- }
-
- /// <summary>
- /// Test for GridComputeJobFailoverException with serializable job.
- /// </summary>
- [Test]
- public void TestTaskAdapterFailoverExceptionSerializable()
- {
- TestTaskAdapterFailoverException(true);
- }
-
- /// <summary>
- /// Test for GridComputeJobFailoverException with portable job.
- /// </summary>
- [Test]
- public void TestTaskAdapterFailoverExceptionPortable()
- {
- TestTaskAdapterFailoverException(false);
- }
-
- /// <summary>
- /// Test for GridComputeJobFailoverException.
- /// </summary>
- private void TestTaskAdapterFailoverException(bool serializable)
- {
- int res = Grid1.GetCompute().Execute(new TestTask(),
- new Tuple<bool, bool>(serializable, true));
-
- Assert.AreEqual(2, res);
-
- Cleanup();
-
- res = Grid1.GetCompute().Execute(new TestTask(),
- new Tuple<bool, bool>(serializable, false));
-
- Assert.AreEqual(2, res);
- }
-
- /// <summary>
- /// Cleanup.
- /// </summary>
- [TearDown]
- public void Cleanup()
- {
- _cnt = 0;
-
- _gridName = null;
- }
-
- /** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(TestPortableJob)));
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- public class TestTask : ComputeTaskAdapter<Tuple<bool, bool>, int, int>
- {
- /** <inheritDoc /> */
- override public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, Tuple<bool, bool> arg)
- {
- Assert.AreEqual(3, subgrid.Count);
-
- Tuple<bool, bool> t = arg;
-
- bool serializable = t.Item1;
- bool local = t.Item2;
-
- IDictionary<IComputeJob<int>, IClusterNode> jobs = new Dictionary<IComputeJob<int>, IClusterNode>();
-
- IComputeJob<int> job;
-
- if (serializable)
- job = new TestSerializableJob();
- else
- job = new TestPortableJob();
-
- foreach (IClusterNode node in subgrid) {
- bool add = local ? node.IsLocal : !node.IsLocal;
-
- if (add)
- {
- jobs.Add(job, node);
-
- break;
- }
- }
-
- Assert.AreEqual(1, jobs.Count);
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- override public int Reduce(IList<IComputeJobResult<int>> results)
- {
- Assert.AreEqual(1, results.Count);
-
- return results[0].Data();
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- class TestClosure : IComputeFunc<int>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- public int Invoke()
- {
- return FailoverJob(_grid);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- class TestSerializableJob : IComputeJob<int>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- public int Execute()
- {
- return FailoverJob(_grid);
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class TestPortableJob : IComputeJob<int>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- public int Execute()
- {
- return FailoverJob(_grid);
- }
-
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- /// Throws GridComputeJobFailoverException on first call.
- /// </summary>
- private static int FailoverJob(IIgnite grid)
- {
- Assert.NotNull(grid);
-
- _cnt++;
-
- if (_gridName == null)
- {
- _gridName = grid.Name;
-
- throw new ComputeJobFailoverException("Test error.");
- }
- Assert.AreNotEqual(_gridName, grid.Name);
-
- return _cnt;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
deleted file mode 100644
index 4ce917b..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedPortableClosureTaskTest.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute.Forked
-{
- /// <summary>
- /// Forked closure execution tests for portable objects.
- /// </summary>
- public class ForkedPortableClosureTaskTest : PortableClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ForkedPortableClosureTaskTest() : base(true) { }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
deleted file mode 100644
index 84c1ba2..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedResourceTaskTest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute.Forked
-{
- using NUnit.Framework;
-
- /// <summary>
- /// Forked resource task test.
- /// </summary>
- [Ignore("IGNITE-1381")]
- public class ForkedResourceTaskTest : ResourceTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ForkedResourceTaskTest() : base(true) { }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
deleted file mode 100644
index 0324125..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedSerializableClosureTaskTest.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute.Forked
-{
- using NUnit.Framework;
-
- /// <summary>
- /// Forked closure execution tests for serializable objects.
- /// </summary>
- [Ignore("IGNITE-1381")]
- public class ForkedSerializableClosureTaskTest : SerializableClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ForkedSerializableClosureTaskTest() : base(true) { }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs
deleted file mode 100644
index a4cf182..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/Forked/ForkedTaskAdapterTest.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute.Forked
-{
- /// <summary>
- /// Forked task adapter test.
- /// </summary>
- public class ForkedTaskAdapterTest : TaskAdapterTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ForkedTaskAdapterTest() : base(true) { }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
deleted file mode 100644
index 62f860d..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/IgniteExceptionTaskSelfTest.cs
+++ /dev/null
@@ -1,753 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for exception handling on various task execution stages.
- /// </summary>
- public class IgniteExceptionTaskSelfTest : AbstractTaskTest
- {
- /** Error mode. */
- public static ErrorMode Mode;
-
- /** Observed job errors. */
- public static readonly ICollection<Exception> JobErrs = new List<Exception>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public IgniteExceptionTaskSelfTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected IgniteExceptionTaskSelfTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test error occurred during map step.
- /// </summary>
- [Test]
- public void TestMapError()
- {
- Mode = ErrorMode.MapErr;
-
- GoodException e = ExecuteWithError() as GoodException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.MapErr, e.Mode);
- }
-
- /// <summary>
- /// Test not-marshalable error occurred during map step.
- /// </summary>
- [Test]
- public void TestMapNotMarshalableError()
- {
- Mode = ErrorMode.MapErrNotMarshalable;
-
- BadException e = ExecuteWithError() as BadException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.MapErrNotMarshalable, e.Mode);
- }
-
- /// <summary>
- /// Test task behavior when job produced by mapper is not marshalable.
- /// </summary>
- [Test]
- public void TestMapNotMarshalableJob()
- {
- Mode = ErrorMode.MapJobNotMarshalable;
-
- SerializationException e = ExecuteWithError() as SerializationException;
-
- Assert.IsNotNull(e);
- }
-
- /// <summary>
- /// Test local job error.
- /// </summary>
- [Test]
- public void TestLocalJobError()
- {
- Mode = ErrorMode.LocJobErr;
-
- int res = Execute();
-
- Assert.AreEqual(2, res);
-
- Assert.AreEqual(1, JobErrs.Count);
- Assert.IsNotNull(JobErrs.First() as GoodException);
- Assert.AreEqual(ErrorMode.LocJobErr, ((GoodException) JobErrs.First()).Mode);
- }
-
- /// <summary>
- /// Test local not-marshalable job error.
- /// </summary>
- [Test]
- public void TestLocalJobErrorNotMarshalable()
- {
- Mode = ErrorMode.LocJobErrNotMarshalable;
-
- int res = Execute();
-
- Assert.AreEqual(2, res);
-
- Assert.AreEqual(1, JobErrs.Count);
- Assert.IsNotNull(JobErrs.First() as BadException); // Local job exception is not marshalled.
- }
-
- /// <summary>
- /// Test local not-marshalable job result.
- /// </summary>
- [Test]
- public void TestLocalJobResultNotMarshalable()
- {
- Mode = ErrorMode.LocJobResNotMarshalable;
-
- int res = Execute();
-
- Assert.AreEqual(3, res); // Local job result is not marshalled.
-
- Assert.AreEqual(0, JobErrs.Count);
- }
-
- /// <summary>
- /// Test remote job error.
- /// </summary>
- [Test]
- public void TestRemoteJobError()
- {
- Mode = ErrorMode.RmtJobErr;
-
- int res = Execute();
-
- Assert.AreEqual(1, res);
-
- Assert.AreEqual(2, JobErrs.Count);
-
- Assert.IsNotNull(JobErrs.ElementAt(0) as GoodException);
- Assert.IsNotNull(JobErrs.ElementAt(1) as GoodException);
-
- Assert.AreEqual(ErrorMode.RmtJobErr, ((GoodException) JobErrs.ElementAt(0)).Mode);
- Assert.AreEqual(ErrorMode.RmtJobErr, ((GoodException) JobErrs.ElementAt(1)).Mode);
- }
-
- /// <summary>
- /// Test remote not-marshalable job error.
- /// </summary>
- [Test]
- public void TestRemoteJobErrorNotMarshalable()
- {
- Mode = ErrorMode.RmtJobErrNotMarshalable;
-
- int res = Execute();
-
- Assert.AreEqual(1, res);
-
- Assert.AreEqual(2, JobErrs.Count);
-
- Assert.IsNotNull(JobErrs.ElementAt(0) as IgniteException);
- Assert.IsNotNull(JobErrs.ElementAt(1) as IgniteException);
- }
-
- /// <summary>
- /// Test local not-marshalable job result.
- /// </summary>
- [Test]
- public void TestRemoteJobResultNotMarshalable()
- {
- Mode = ErrorMode.RmtJobResNotMarshalable;
-
- int res = Execute();
-
- Assert.AreEqual(1, res);
-
- Assert.AreEqual(2, JobErrs.Count);
-
- Assert.IsNotNull(JobErrs.ElementAt(0) as IgniteException);
- Assert.IsNotNull(JobErrs.ElementAt(1) as IgniteException);
- }
-
- /// <summary>
- /// Test local result error.
- /// </summary>
- [Test]
- public void TestLocalResultError()
- {
- Mode = ErrorMode.LocResErr;
-
- GoodException e = ExecuteWithError() as GoodException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.LocResErr, e.Mode);
- }
-
- /// <summary>
- /// Test local result not-marshalable error.
- /// </summary>
- [Test]
- public void TestLocalResultErrorNotMarshalable()
- {
- Mode = ErrorMode.LocResErrNotMarshalable;
-
- BadException e = ExecuteWithError() as BadException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.LocResErrNotMarshalable, e.Mode);
- }
-
- /// <summary>
- /// Test remote result error.
- /// </summary>
- [Test]
- public void TestRemoteResultError()
- {
- Mode = ErrorMode.RmtResErr;
-
- GoodException e = ExecuteWithError() as GoodException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.RmtResErr, e.Mode);
- }
-
- /// <summary>
- /// Test remote result not-marshalable error.
- /// </summary>
- [Test]
- public void TestRemoteResultErrorNotMarshalable()
- {
- Mode = ErrorMode.RmtResErrNotMarshalable;
-
- BadException e = ExecuteWithError() as BadException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.RmtResErrNotMarshalable, e.Mode);
- }
-
- /// <summary>
- /// Test reduce with error.
- /// </summary>
- [Test]
- public void TestReduceError()
- {
- Mode = ErrorMode.ReduceErr;
-
- GoodException e = ExecuteWithError() as GoodException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.ReduceErr, e.Mode);
- }
-
- /// <summary>
- /// Test reduce with not-marshalable error.
- /// </summary>
- [Test]
- public void TestReduceErrorNotMarshalable()
- {
- Mode = ErrorMode.ReduceErrNotMarshalable;
-
- BadException e = ExecuteWithError() as BadException;
-
- Assert.IsNotNull(e);
-
- Assert.AreEqual(ErrorMode.ReduceErrNotMarshalable, e.Mode);
- }
-
- /// <summary>
- /// Test reduce with not-marshalable result.
- /// </summary>
- [Test]
- public void TestReduceResultNotMarshalable()
- {
- Mode = ErrorMode.ReduceResNotMarshalable;
-
- int res = Execute();
-
- Assert.AreEqual(3, res);
- }
-
- /// <summary>
- /// Execute task successfully.
- /// </summary>
- /// <returns>Task result.</returns>
- private int Execute()
- {
- JobErrs.Clear();
-
- object res = Grid1.GetCompute().Execute(new Task());
-
- return res is GoodTaskResult ? ((GoodTaskResult)res).Res : ((BadTaskResult)res).Res;
- }
-
- /// <summary>
- /// Execute task with error.
- /// </summary>
- /// <returns>Task</returns>
- private Exception ExecuteWithError()
- {
- JobErrs.Clear();
-
- Exception err = null;
-
- try
- {
- Grid1.GetCompute().Execute(new Task());
-
- Assert.Fail();
- }
- catch (Exception e)
- {
- err = e;
- }
-
- return err;
- }
-
- /// <summary>
- /// Error modes.
- /// </summary>
- public enum ErrorMode
- {
- /** Error during map step. */
- MapErr,
-
- /** Error during map step which is not marshalable. */
- MapErrNotMarshalable,
-
- /** Job created by mapper is not marshalable. */
- MapJobNotMarshalable,
-
- /** Error occurred in local job. */
- LocJobErr,
-
- /** Error occurred in local job and is not marshalable. */
- LocJobErrNotMarshalable,
-
- /** Local job result is not marshalable. */
- LocJobResNotMarshalable,
-
- /** Error occurred in remote job. */
- RmtJobErr,
-
- /** Error occurred in remote job and is not marshalable. */
- RmtJobErrNotMarshalable,
-
- /** Remote job result is not marshalable. */
- RmtJobResNotMarshalable,
-
- /** Error occurred during local result processing. */
- LocResErr,
-
- /** Error occurred during local result processing and is not marshalable. */
- LocResErrNotMarshalable,
-
- /** Error occurred during remote result processing. */
- RmtResErr,
-
- /** Error occurred during remote result processing and is not marshalable. */
- RmtResErrNotMarshalable,
-
- /** Error during reduce step. */
- ReduceErr,
-
- /** Error during reduce step and is not marshalable. */
- ReduceErrNotMarshalable,
-
- /** Reduce result is not marshalable. */
- ReduceResNotMarshalable
- }
-
- /// <summary>
- /// Task.
- /// </summary>
- public class Task : IComputeTask<object, object>
- {
- /** Grid. */
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** Result. */
- private int _res;
-
- /** <inheritDoc /> */
- public IDictionary<IComputeJob<object>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
- {
- switch (Mode)
- {
- case ErrorMode.MapErr:
- throw new GoodException(ErrorMode.MapErr);
-
- case ErrorMode.MapErrNotMarshalable:
- throw new BadException(ErrorMode.MapErrNotMarshalable);
-
- case ErrorMode.MapJobNotMarshalable:
- {
- var badJobs = new Dictionary<IComputeJob<object>, IClusterNode>();
-
- foreach (IClusterNode node in subgrid)
- badJobs.Add(new BadJob(), node);
-
- return badJobs;
- }
- }
-
- // Map completes sucessfully and we spread jobs to all nodes.
- var jobs = new Dictionary<IComputeJob<object>, IClusterNode>();
-
- foreach (IClusterNode node in subgrid)
- jobs.Add(new GoodJob(!_grid.GetCluster().GetLocalNode().Id.Equals(node.Id)), node);
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- public ComputeJobResultPolicy Result(IComputeJobResult<object> res, IList<IComputeJobResult<object>> rcvd)
- {
- if (res.Exception() != null)
- JobErrs.Add(res.Exception());
- else
- {
- object res0 = res.Data();
-
- bool rmt = res0 is GoodJobResult ? ((GoodJobResult)res0).Rmt : ((BadJobResult)res0).Rmt;
-
- if (rmt)
- {
- switch (Mode)
- {
- case ErrorMode.RmtResErr:
- throw new GoodException(ErrorMode.RmtResErr);
-
- case ErrorMode.RmtResErrNotMarshalable:
- throw new BadException(ErrorMode.RmtResErrNotMarshalable);
- }
- }
- else
- {
- switch (Mode)
- {
- case ErrorMode.LocResErr:
- throw new GoodException(ErrorMode.LocResErr);
-
- case ErrorMode.LocResErrNotMarshalable:
- throw new BadException(ErrorMode.LocResErrNotMarshalable);
- }
- }
-
- _res += 1;
- }
-
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public object Reduce(IList<IComputeJobResult<object>> results)
- {
- switch (Mode)
- {
- case ErrorMode.ReduceErr:
- throw new GoodException(ErrorMode.ReduceErr);
-
- case ErrorMode.ReduceErrNotMarshalable:
- throw new BadException(ErrorMode.ReduceErrNotMarshalable);
-
- case ErrorMode.ReduceResNotMarshalable:
- return new BadTaskResult(_res);
- }
-
- return new GoodTaskResult(_res);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- public class GoodJob : IComputeJob<object>
- {
- /** Whether the job is remote. */
- private bool _rmt;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="rmt"></param>
- public GoodJob(bool rmt)
- {
- _rmt = rmt;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public GoodJob(SerializationInfo info, StreamingContext context)
- {
- _rmt = info.GetBoolean("rmt");
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("rmt", _rmt);
- }
-
- /** <inheritDoc /> */
- public object Execute()
- {
- if (_rmt)
- {
- switch (Mode)
- {
- case ErrorMode.RmtJobErr:
- throw new GoodException(ErrorMode.RmtJobErr);
-
- case ErrorMode.RmtJobErrNotMarshalable:
- throw new BadException(ErrorMode.RmtJobErr);
-
- case ErrorMode.RmtJobResNotMarshalable:
- return new BadJobResult(_rmt);
- }
- }
- else
- {
- switch (Mode)
- {
- case ErrorMode.LocJobErr:
- throw new GoodException(ErrorMode.LocJobErr);
-
- case ErrorMode.LocJobErrNotMarshalable:
- throw new BadException(ErrorMode.LocJobErr);
-
- case ErrorMode.LocJobResNotMarshalable:
- return new BadJobResult(_rmt);
- }
- }
-
- return new GoodJobResult(_rmt);
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BadJob : IComputeJob<object>
- {
- [InstanceResource]
-
- /** <inheritDoc /> */
- public object Execute()
- {
- throw new NotImplementedException();
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- public class GoodJobResult
- {
- /** */
- public bool Rmt;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="rmt"></param>
- public GoodJobResult(bool rmt)
- {
- Rmt = rmt;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public GoodJobResult(SerializationInfo info, StreamingContext context)
- {
- Rmt = info.GetBoolean("rmt");
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("rmt", Rmt);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BadJobResult
- {
- /** */
- public bool Rmt;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="rmt"></param>
- public BadJobResult(bool rmt)
- {
- Rmt = rmt;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- public class GoodTaskResult
- {
- /** */
- public int Res;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="res"></param>
- public GoodTaskResult(int res)
- {
- Res = res;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public GoodTaskResult(SerializationInfo info, StreamingContext context)
- {
- Res = info.GetInt32("res");
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("res", Res);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- public class BadTaskResult
- {
- /** */
- public int Res;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="res"></param>
- public BadTaskResult(int res)
- {
- Res = res;
- }
- }
-
- /// <summary>
- /// Marshalable exception.
- /// </summary>
- [Serializable]
- public class GoodException : Exception
- {
- /** */
- public ErrorMode Mode;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="mode"></param>
- public GoodException(ErrorMode mode)
- {
- Mode = mode;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public GoodException(SerializationInfo info, StreamingContext context)
- {
- Mode = (ErrorMode)info.GetInt32("mode");
- }
-
- /** <inheritDoc /> */
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("mode", (int)Mode);
-
- base.GetObjectData(info, context);
- }
- }
-
- /// <summary>
- /// Not marshalable exception.
- /// </summary>
- public class BadException : Exception
- {
- /** */
- public ErrorMode Mode;
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="mode"></param>
- public BadException(ErrorMode mode)
- {
- Mode = mode;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
deleted file mode 100644
index 3ca933e..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableClosureTaskTest.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Portable;
- using NUnit.Framework;
-
- /// <summary>
- /// Closure execution tests for portable objects.
- /// </summary>
- public class PortableClosureTaskTest : ClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableClosureTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected PortableClosureTaskTest(bool fork) : base(fork) { }
-
- /** <inheritDoc /> */
- protected override void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableOutFunc)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableFunc)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableResult)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableException)));
- }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object> OutFunc(bool err)
- {
- return new PortableOutFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object, object> Func(bool err)
- {
- return new PortableFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override void CheckResult(object res)
- {
- Assert.IsTrue(res != null);
-
- PortableResult res0 = res as PortableResult;
-
- Assert.IsTrue(res0 != null);
- Assert.AreEqual(1, res0.Res);
- }
-
- /** <inheritDoc /> */
- protected override void CheckError(Exception err)
- {
- Assert.IsTrue(err != null);
-
- PortableException err0 = err as PortableException;
-
- Assert.IsTrue(err0 != null);
- Assert.AreEqual(ErrMsg, err0.Msg);
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableOutFunc : IComputeFunc<object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public PortableOutFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public PortableOutFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke()
- {
- if (_err)
- throw new PortableException(ErrMsg);
- return new PortableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableFunc : IComputeFunc<object, object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public PortableFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public PortableFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke(object arg)
- {
- if (_err)
- throw new PortableException(ErrMsg);
- return new PortableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableException : Exception, IPortableMarshalAware
- {
- /** */
- public string Msg;
-
- /// <summary>
- ///
- /// </summary>
- public PortableException()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="msg"></param>
- public PortableException(string msg) : this()
- {
- Msg = msg;
- }
-
- /** <inheritDoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- writer.RawWriter().WriteString(Msg);
- }
-
- /** <inheritDoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- Msg = reader.RawReader().ReadString();
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- private class PortableResult
- {
- /** */
- public int Res;
-
- /// <summary>
- ///
- /// </summary>
- public PortableResult()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="res"></param>
- public PortableResult(int res)
- {
- Res = res;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
deleted file mode 100644
index 736aa61..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/PortableTaskTest.cs
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Task test result.
- /// </summary>
- public class PortableTaskTest : AbstractTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public PortableTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected PortableTaskTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test for task result.
- /// </summary>
- [Test]
- public void TestPortableObjectInTask()
- {
- IPortableObject taskArg = ToPortable(Grid1, new PortableTaskArgument(100));
-
- TestTask task = new TestTask(Grid1, taskArg);
-
- IPortableObject res = Grid1.GetCompute().Execute(task, taskArg);
-
- Assert.NotNull(res);
-
- Assert.AreEqual(400, res.GetField<int>("val"));
-
- PortableTaskResult resObj = res.Deserialize<PortableTaskResult>();
-
- Assert.AreEqual(400, resObj.Val);
- }
-
- private static IPortableObject ToPortable(IIgnite grid, object obj)
- {
- var cache = grid.GetCache<object, object>(Cache1Name).WithKeepPortable<object, object>();
-
- cache.Put(1, obj);
-
- return (IPortableObject) cache.Get(1);
- }
-
- /** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableJobArgument)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableJobResult)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableTaskArgument)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableTaskResult)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableJob)));
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- public class TestTask : ComputeTaskAdapter<IPortableObject, IPortableObject, IPortableObject>
- {
- /** */
- private readonly IIgnite _grid;
-
- private readonly IPortableObject _taskArgField;
-
- public TestTask(IIgnite grid, IPortableObject taskArgField)
- {
- _grid = grid;
- _taskArgField = taskArgField;
- }
-
- /** <inheritDoc /> */
- override public IDictionary<IComputeJob<IPortableObject>, IClusterNode> Map(IList<IClusterNode> subgrid, IPortableObject arg)
- {
- Assert.AreEqual(3, subgrid.Count);
- Assert.NotNull(_grid);
-
- IPortableObject taskArg = arg;
-
- CheckTaskArgument(taskArg);
-
- CheckTaskArgument(_taskArgField);
-
- IDictionary<IComputeJob<IPortableObject>, IClusterNode> jobs = new Dictionary<IComputeJob<IPortableObject>, IClusterNode>();
-
-
- foreach (IClusterNode node in subgrid)
- {
- if (!Grid3Name.Equals(node.GetAttribute<string>("org.apache.ignite.ignite.name"))) // Grid3 does not have cache.
- {
- PortableJob job = new PortableJob();
-
- job.Arg = ToPortable(_grid, new PortableJobArgument(200));
-
- jobs.Add(job, node);
- }
- }
-
- Assert.AreEqual(2, jobs.Count);
-
- return jobs;
- }
-
- private void CheckTaskArgument(IPortableObject taskArg)
- {
- Assert.IsNotNull(taskArg);
-
- Assert.AreEqual(100, taskArg.GetField<int>("val"));
-
- PortableTaskArgument taskArgObj = taskArg.Deserialize<PortableTaskArgument>();
-
- Assert.AreEqual(100, taskArgObj.Val);
- }
-
- /** <inheritDoc /> */
- override public IPortableObject Reduce(IList<IComputeJobResult<IPortableObject>> results)
- {
- Assert.NotNull(_grid);
-
- Assert.AreEqual(2, results.Count);
-
- foreach (IComputeJobResult<IPortableObject> res in results)
- {
- IPortableObject jobRes = res.Data();
-
- Assert.NotNull(jobRes);
-
- Assert.AreEqual(300, jobRes.GetField<int>("val"));
-
- PortableJobResult jobResObj = jobRes.Deserialize<PortableJobResult>();
-
- Assert.AreEqual(300, jobResObj.Val);
- }
-
- return ToPortable(_grid, new PortableTaskResult(400));
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJobArgument
- {
- /** */
- public int Val;
-
- public PortableJobArgument(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJobResult
- {
- /** */
- public int Val;
-
- public PortableJobResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableTaskArgument
- {
- /** */
- public int Val;
-
- public PortableTaskArgument(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableTaskResult
- {
- /** */
- public int Val;
-
- public PortableTaskResult(int val)
- {
- Val = val;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class PortableJob : IComputeJob<IPortableObject>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** */
- public IPortableObject Arg;
-
- /** <inheritDoc /> */
- public IPortableObject Execute()
- {
- Assert.IsNotNull(Arg);
-
- Assert.AreEqual(200, Arg.GetField<int>("val"));
-
- PortableJobArgument argObj = Arg.Deserialize<PortableJobArgument>();
-
- Assert.AreEqual(200, argObj.Val);
-
- return ToPortable(_grid, new PortableJobResult(300));
- }
-
- public void Cancel()
- {
- // No-op.
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
deleted file mode 100644
index 55bb9d0..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/ResourceTaskTest.cs
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Test resource injections in tasks and jobs.
- /// </summary>
- public class ResourceTaskTest : AbstractTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public ResourceTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected ResourceTaskTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test Ignite injection into the task.
- /// </summary>
- [Test]
- public void TestTaskInjection()
- {
- int res = Grid1.GetCompute().Execute(new InjectionTask(), 0);
-
- Assert.AreEqual(Grid1.GetCluster().GetNodes().Count, res);
- }
-
- /// <summary>
- /// Test Ignite injection into the closure.
- /// </summary>
- [Test]
- public void TestClosureInjection()
- {
- var res = Grid1.GetCompute().Broadcast(new InjectionClosure(), 1);
-
- Assert.AreEqual(Grid1.GetCluster().GetNodes().Count, res.Sum());
- }
-
- /// <summary>
- /// Test Ignite injection into reducer.
- /// </summary>
- [Test]
- public void TestReducerInjection()
- {
- int res = Grid1.GetCompute().Apply(new InjectionClosure(), new List<int> { 1, 1, 1 }, new InjectionReducer());
-
- Assert.AreEqual(Grid1.GetCluster().GetNodes().Count, res);
- }
-
- /// <summary>
- /// Test no-result-cache attribute.
- /// </summary>
- [Test]
- public void TestNoResultCache()
- {
- int res = Grid1.GetCompute().Execute(new NoResultCacheTask(), 0);
-
- Assert.AreEqual(Grid1.GetCluster().GetNodes().Count, res);
- }
-
- /// <summary>
- /// Injection task.
- /// </summary>
- public class InjectionTask : Injectee, IComputeTask<object, int, int>
- {
- /** <inheritDoc /> */
- public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, object arg)
- {
- CheckInjection();
-
- return subgrid.ToDictionary(x => (IComputeJob<int>) new InjectionJob(), x => x);
- }
-
- /** <inheritDoc /> */
- public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd)
- {
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public int Reduce(IList<IComputeJobResult<int>> results)
- {
- return results.Sum(res => res.Data());
- }
- }
-
- /// <summary>
- /// Injection job.
- /// </summary>
- [Serializable]
- public class InjectionJob : Injectee, IComputeJob<int>
- {
- /// <summary>
- ///
- /// </summary>
- public InjectionJob()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public InjectionJob(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- public int Execute()
- {
- CheckInjection();
-
- return 1;
- }
-
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- /// Injection closure.
- /// </summary>
- [Serializable]
- public class InjectionClosure : IComputeFunc<int, int>
- {
- /** */
- [InstanceResource]
- private static IIgnite _staticGrid1;
-
- /** */
- [InstanceResource]
- public static IIgnite StaticGrid2;
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- public static IIgnite StaticPropGrid1
- {
- get { return _staticGrid1; }
- set { _staticGrid1 = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- private static IIgnite StaticPropGrid2
- {
- get { return StaticGrid2; }
- set { StaticGrid2 = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- public static void StaticMethod1(IIgnite grid)
- {
- _staticGrid1 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- private static void StaticMethod2(IIgnite grid)
- {
- StaticGrid2 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- public InjectionClosure()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public InjectionClosure(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
- /** */
- [InstanceResource]
- private readonly IIgnite _grid1 = null;
-
- /** */
- [InstanceResource]
- public IIgnite Grid2;
-
- /** */
- private IIgnite _mthdGrid1;
-
- /** */
- private IIgnite _mthdGrid2;
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- public IIgnite PropGrid1
- {
- get;
- set;
- }
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- private IIgnite PropGrid2
- {
- get;
- set;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- public void Method1(IIgnite grid)
- {
- _mthdGrid1 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- private void Method2(IIgnite grid)
- {
- _mthdGrid2 = grid;
- }
-
- /// <summary>
- /// Check Ignite injections.
- /// </summary>
- protected void CheckInjection()
- {
- Assert.IsTrue(_staticGrid1 == null);
- Assert.IsTrue(StaticGrid2 == null);
-
- Assert.IsTrue(_grid1 != null);
- Assert.IsTrue(Grid2 == _grid1);
-
- Assert.IsTrue(PropGrid1 == _grid1);
- Assert.IsTrue(PropGrid2 == _grid1);
-
- Assert.IsTrue(_mthdGrid1 == _grid1);
- Assert.IsTrue(_mthdGrid2 == _grid1);
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- public int Invoke(int arg)
- {
- CheckInjection();
-
- return arg;
- }
- }
-
- /// <summary>
- /// Injection reducer.
- /// </summary>
- public class InjectionReducer : Injectee, IComputeReducer<int, int>
- {
- /** Collected results. */
- private readonly ICollection<int> _ress = new List<int>();
-
- /** <inheritDoc /> */
- public bool Collect(int res)
- {
- CheckInjection();
-
- lock (_ress)
- {
- _ress.Add(res);
- }
-
- return true;
- }
-
- /** <inheritDoc /> */
- public int Reduce()
- {
- CheckInjection();
-
- lock (_ress)
- {
- return _ress.Sum();
- }
- }
- }
-
- /// <summary>
- /// Injectee.
- /// </summary>
- [Serializable]
- public class Injectee : ISerializable
- {
- /** */
- [InstanceResource]
- private static IIgnite _staticGrid1;
-
- /** */
- [InstanceResource]
- public static IIgnite StaticGrid2;
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- public static IIgnite StaticPropGrid1
- {
- get { return _staticGrid1; }
- set { _staticGrid1 = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- private static IIgnite StaticPropGrid2
- {
- get { return StaticGrid2; }
- set { StaticGrid2 = value; }
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- public static void StaticMethod1(IIgnite grid)
- {
- _staticGrid1 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- private static void StaticMethod2(IIgnite grid)
- {
- StaticGrid2 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- public Injectee()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public Injectee(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
- /** */
- [InstanceResource]
- private readonly IIgnite _grid1 = null;
-
- /** */
- [InstanceResource]
- public IIgnite Grid2;
-
- /** */
- private IIgnite _mthdGrid1;
-
- /** */
- private IIgnite _mthdGrid2;
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- public IIgnite PropGrid1
- {
- get;
- set;
- }
-
- /// <summary>
- ///
- /// </summary>
- [InstanceResource]
- private IIgnite PropGrid2
- {
- get;
- set;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- public void Method1(IIgnite grid)
- {
- _mthdGrid1 = grid;
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="grid"></param>
- [InstanceResource]
- private void Method2(IIgnite grid)
- {
- _mthdGrid2 = grid;
- }
-
- /// <summary>
- /// Check Ignite injections.
- /// </summary>
- protected void CheckInjection()
- {
- Assert.IsTrue(_staticGrid1 == null);
- Assert.IsTrue(StaticGrid2 == null);
-
- Assert.IsTrue(_grid1 != null);
- Assert.IsTrue(Grid2 == _grid1);
-
- Assert.IsTrue(PropGrid1 == _grid1);
- Assert.IsTrue(PropGrid2 == _grid1);
-
- Assert.IsTrue(_mthdGrid1 == _grid1);
- Assert.IsTrue(_mthdGrid2 == _grid1);
- }
-
- /** <inheritDoc /> */
- public void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [ComputeTaskNoResultCache]
- public class NoResultCacheTask : IComputeTask<int, int, int>
- {
- /** Sum. */
- private int _sum;
-
- /** <inheritDoc /> */
- public IDictionary<IComputeJob<int>, IClusterNode> Map(IList<IClusterNode> subgrid, int arg)
- {
- return subgrid.ToDictionary(x => (IComputeJob<int>) new NoResultCacheJob(), x => x);
- }
-
- /** <inheritDoc /> */
- public ComputeJobResultPolicy Result(IComputeJobResult<int> res, IList<IComputeJobResult<int>> rcvd)
- {
- Assert.IsTrue(rcvd != null);
- Assert.IsTrue(rcvd.Count == 0);
-
- _sum += res.Data();
-
- return ComputeJobResultPolicy.Wait;
- }
-
- /** <inheritDoc /> */
- public int Reduce(IList<IComputeJobResult<int>> results)
- {
- Assert.IsTrue(results != null);
- Assert.IsTrue(results.Count == 0);
-
- return _sum;
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- public class NoResultCacheJob : IComputeJob<int>
- {
- /// <summary>
- ///
- /// </summary>
- public NoResultCacheJob()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public NoResultCacheJob(SerializationInfo info, StreamingContext context)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- public int Execute()
- {
- return 1;
- }
-
- public void Cancel()
- {
- // No-op.
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
deleted file mode 100644
index ded56ed..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/SerializableClosureTaskTest.cs
+++ /dev/null
@@ -1,217 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Runtime.Serialization;
- using Apache.Ignite.Core.Compute;
- using NUnit.Framework;
-
- /// <summary>
- /// Closure execution tests for serializable objects.
- /// </summary>
- public class SerializableClosureTaskTest : ClosureTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public SerializableClosureTaskTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected SerializableClosureTaskTest(bool fork) : base(fork) { }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object> OutFunc(bool err)
- {
- return new SerializableOutFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override IComputeFunc<object, object> Func(bool err)
- {
- return new SerializableFunc(err);
- }
-
- /** <inheritDoc /> */
- protected override void CheckResult(object res)
- {
- Assert.IsTrue(res != null);
-
- SerializableResult res0 = res as SerializableResult;
-
- Assert.IsTrue(res0 != null);
- Assert.AreEqual(1, res0.Res);
- }
-
- /** <inheritDoc /> */
- protected override void CheckError(Exception err)
- {
- Assert.IsTrue(err != null);
-
- SerializableException err0 = err as SerializableException;
-
- Assert.IsTrue(err0 != null);
- Assert.AreEqual(ErrMsg, err0.Msg);
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- private class SerializableOutFunc : IComputeFunc<object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public SerializableOutFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public SerializableOutFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke()
- {
- if (_err)
- throw new SerializableException(ErrMsg);
- return new SerializableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- private class SerializableFunc : IComputeFunc<object, object>
- {
- /** Error. */
- private bool _err;
-
- /// <summary>
- ///
- /// </summary>
- public SerializableFunc()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="err"></param>
- public SerializableFunc(bool err)
- {
- _err = err;
- }
-
- /** <inheritDoc /> */
- public object Invoke(object arg)
- {
- Console.WriteLine("INVOKED!");
-
- if (_err)
- throw new SerializableException(ErrMsg);
- return new SerializableResult(1);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- private class SerializableException : Exception
- {
- /** */
- public string Msg;
-
- /// <summary>
- ///
- /// </summary>
- public SerializableException()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="msg"></param>
- public SerializableException(string msg) : this()
- {
- Msg = msg;
- }
- /// <summary>
- ///
- /// </summary>
- /// <param name="info"></param>
- /// <param name="context"></param>
- public SerializableException(SerializationInfo info, StreamingContext context) : base(info, context)
- {
- Msg = info.GetString("msg");
- }
-
- /** <inheritDoc /> */
- public override void GetObjectData(SerializationInfo info, StreamingContext context)
- {
- info.AddValue("msg", Msg);
-
- base.GetObjectData(info, context);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [Serializable]
- private class SerializableResult
- {
- public int Res;
-
- /// <summary>
- ///
- /// </summary>
- public SerializableResult()
- {
- // No-op.
- }
-
- /// <summary>
- ///
- /// </summary>
- /// <param name="res"></param>
- public SerializableResult(int res)
- {
- Res = res;
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
deleted file mode 100644
index f7fb422..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Compute/TaskAdapterTest.cs
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Compute
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Resource;
- using NUnit.Framework;
-
- /// <summary>
- /// Test for task and job adapter.
- /// </summary>
- public class TaskAdapterTest : AbstractTaskTest
- {
- /// <summary>
- /// Constructor.
- /// </summary>
- public TaskAdapterTest() : base(false) { }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fork">Fork flag.</param>
- protected TaskAdapterTest(bool fork) : base(fork) { }
-
- /// <summary>
- /// Test for task adapter.
- /// </summary>
- [Test]
- public void TestTaskAdapter()
- {
- Assert.AreEqual(3, Grid1.GetCluster().GetNodes().Count);
-
- HashSet<Guid> allNodes = new HashSet<Guid>();
-
- for (int i = 0; i < 20 && allNodes.Count < 3; i++)
- {
- HashSet<Guid> res = Grid1.GetCompute().Execute(new TestSplitTask(), 1);
-
- Assert.AreEqual(1, res.Count);
-
- allNodes.UnionWith(res);
- }
-
- Assert.AreEqual(3, allNodes.Count);
-
- HashSet<Guid> res2 = Grid1.GetCompute().Execute<int, Guid, HashSet<Guid>>(typeof(TestSplitTask), 3);
-
- Assert.IsTrue(res2.Count > 0);
-
- Grid1.GetCompute().Execute(new TestSplitTask(), 100);
-
- Assert.AreEqual(3, allNodes.Count);
- }
-
- /// <summary>
- /// Test for job adapter.
- /// </summary>
- [Test]
- public void TestSerializableJobAdapter()
- {
- for (int i = 0; i < 10; i++)
- {
- bool res = Grid1.GetCompute().Execute(new TestJobAdapterTask(), true);
-
- Assert.IsTrue(res);
- }
- }
-
- /// <summary>
- /// Test for job adapter.
- /// </summary>
- [Test]
- public void TestPortableJobAdapter()
- {
- for (int i = 0; i < 10; i++)
- {
- bool res = Grid1.GetCompute().Execute(new TestJobAdapterTask(), false);
-
- Assert.IsTrue(res);
- }
- }
-
- /** <inheritDoc /> */
- override protected void PortableTypeConfigurations(ICollection<PortableTypeConfiguration> portTypeCfgs)
- {
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableJob)));
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- public class TestSplitTask : ComputeTaskSplitAdapter<int, Guid, HashSet<Guid>>
- {
- /** <inheritDoc /> */
- override protected ICollection<IComputeJob<Guid>> Split(int gridSize, int arg)
- {
- Assert.AreEqual(3, gridSize);
-
- int jobsNum = arg;
-
- Assert.IsTrue(jobsNum > 0);
-
- var jobs = new List<IComputeJob<Guid>>(jobsNum);
-
- for (int i = 0; i < jobsNum; i++)
- jobs.Add(new NodeIdJob());
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- override public HashSet<Guid> Reduce(IList<IComputeJobResult<Guid>> results)
- {
- HashSet<Guid> nodes = new HashSet<Guid>();
-
- foreach (var res in results) {
- Guid id = res.Data();
-
- Assert.NotNull(id);
-
- nodes.Add(id);
- }
-
- return nodes;
- }
- }
-
- /// <summary>
- /// Test task.
- /// </summary>
- public class TestJobAdapterTask : ComputeTaskSplitAdapter<bool, bool, bool>
- {
- /** <inheritDoc /> */
- override protected ICollection<IComputeJob<bool>> Split(int gridSize, bool arg)
- {
- bool serializable = arg;
-
- ICollection<IComputeJob<bool>> jobs = new List<IComputeJob<bool>>(1);
-
- if (serializable)
- jobs.Add(new SerializableJob(100, "str"));
- else
- jobs.Add(new PortableJob(100, "str"));
-
- return jobs;
- }
-
- /** <inheritDoc /> */
- override public bool Reduce(IList<IComputeJobResult<bool>> results)
- {
- Assert.AreEqual(1, results.Count);
-
- Assert.IsTrue(results[0].Data());
-
- return true;
- }
- }
-
- /// <summary>
- /// Test job.
- /// </summary>
- [Serializable]
- public class NodeIdJob : IComputeJob<Guid>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- /** <inheritDoc /> */
- public Guid Execute()
- {
- Assert.NotNull(_grid);
-
- return _grid.GetCluster().GetLocalNode().Id;
- }
-
- /** <inheritDoc /> */
- public void Cancel()
- {
- // No-op.
- }
- }
-
- /// <summary>
- /// Test serializable job.
- /// </summary>
- [Serializable]
- public class SerializableJob : ComputeJobAdapter<bool>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- public SerializableJob(params object[] args) : base(args)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- override public bool Execute()
- {
- Assert.IsFalse(IsCancelled());
-
- Cancel();
-
- Assert.IsTrue(IsCancelled());
-
- Assert.NotNull(_grid);
-
- int arg1 = Argument<int>(0);
-
- Assert.AreEqual(100, arg1);
-
- string arg2 = Argument<string>(1);
-
- Assert.AreEqual("str", arg2);
-
- return true;
- }
- }
-
- /// <summary>
- /// Test portable job.
- /// </summary>
- public class PortableJob : ComputeJobAdapter<bool>
- {
- [InstanceResource]
- private IIgnite _grid = null;
-
- public PortableJob(params object[] args) : base(args)
- {
- // No-op.
- }
-
- /** <inheritDoc /> */
- override public bool Execute()
- {
- Assert.IsFalse(IsCancelled());
-
- Cancel();
-
- Assert.IsTrue(IsCancelled());
-
- Assert.NotNull(_grid);
-
- int arg1 = Argument<int>(0);
-
- Assert.AreEqual(100, arg1);
-
- string arg2 = Argument<string>(1);
-
- Assert.AreEqual("str", arg2);
-
- return true;
- }
- }
- }
-}
[25/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
deleted file mode 100644
index 8b44966..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Events/RemoteListenEventFilter.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Events
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Event filter/listener holder for RemoteListen.
- /// </summary>
- internal class RemoteListenEventFilter : IInteropCallback
- {
- /** */
- private readonly Ignite _ignite;
-
- /** */
- private readonly Func<Guid, IEvent, bool> _filter;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="RemoteListenEventFilter"/> class.
- /// </summary>
- /// <param name="ignite">The grid.</param>
- /// <param name="filter">The filter.</param>
- public RemoteListenEventFilter(Ignite ignite, Func<Guid, IEvent, bool> filter)
- {
- _ignite = ignite;
- _filter = filter;
- }
-
- /** <inheritdoc /> */
- public int Invoke(IPortableStream stream)
- {
- var reader = _ignite.Marshaller.StartUnmarshal(stream);
-
- var evt = EventReader.Read<IEvent>(reader);
-
- var nodeId = reader.ReadGuid() ?? Guid.Empty;
-
- return _filter(nodeId, evt) ? 1 : 0;
- }
-
- /// <summary>
- /// Creates an instance of this class from a stream.
- /// </summary>
- /// <param name="memPtr">Memory pointer.</param>
- /// <param name="grid">Grid</param>
- /// <returns>Deserialized instance of <see cref="RemoteListenEventFilter"/></returns>
- public static RemoteListenEventFilter CreateInstance(long memPtr, Ignite grid)
- {
- Debug.Assert(grid != null);
-
- using (var stream = IgniteManager.Memory.Get(memPtr).Stream())
- {
- var marsh = grid.Marshaller;
-
- var reader = marsh.StartUnmarshal(stream);
-
- var pred = reader.ReadObject<PortableOrSerializableObjectHolder>().Item;
-
- var func = DelegateTypeDescriptor.GetEventFilter(pred.GetType());
-
- return new RemoteListenEventFilter(grid, (id, evt) => func(pred, id, evt));
- }
- }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
deleted file mode 100644
index 066f345..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/ExceptionUtils.cs
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Runtime.InteropServices;
- using System.Security;
- using System.Threading;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Store;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Managed environment. Acts as a gateway for native code.
- /// </summary>
- [StructLayout(LayoutKind.Sequential)]
- internal static class ExceptionUtils
- {
- /** NoClassDefFoundError fully-qualified class name which is important during startup phase. */
- private const string ClsNoClsDefFoundErr = "java.lang.NoClassDefFoundError";
-
- /** NoSuchMethodError fully-qualified class name which is important during startup phase. */
- private const string ClsNoSuchMthdErr = "java.lang.NoSuchMethodError";
-
- /** InteropCachePartialUpdateException. */
- private const string ClsCachePartialUpdateErr = "org.apache.ignite.internal.processors.platform.cache.PlatformCachePartialUpdateException";
-
- /** Map with predefined exceptions. */
- private static readonly IDictionary<string, ExceptionFactoryDelegate> EXS = new Dictionary<string, ExceptionFactoryDelegate>();
-
- /** Exception factory delegate. */
- private delegate Exception ExceptionFactoryDelegate(string msg);
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- static ExceptionUtils()
- {
- // Common Java exceptions mapped to common .Net exceptions.
- EXS["java.lang.IllegalArgumentException"] = m => new ArgumentException(m);
- EXS["java.lang.IllegalStateException"] = m => new InvalidOperationException(m);
- EXS["java.lang.UnsupportedOperationException"] = m => new NotImplementedException(m);
- EXS["java.lang.InterruptedException"] = m => new ThreadInterruptedException(m);
-
- // Generic Ignite exceptions.
- EXS["org.apache.ignite.IgniteException"] = m => new IgniteException(m);
- EXS["org.apache.ignite.IgniteCheckedException"] = m => new IgniteException(m);
-
- // Cluster exceptions.
- EXS["org.apache.ignite.cluster.ClusterGroupEmptyException"] = m => new ClusterGroupEmptyException(m);
- EXS["org.apache.ignite.cluster.ClusterTopologyException"] = m => new ClusterTopologyException(m);
-
- // Compute exceptions.
- EXS["org.apache.ignite.compute.ComputeExecutionRejectedException"] = m => new ComputeExecutionRejectedException(m);
- EXS["org.apache.ignite.compute.ComputeJobFailoverException"] = m => new ComputeJobFailoverException(m);
- EXS["org.apache.ignite.compute.ComputeTaskCancelledException"] = m => new ComputeTaskCancelledException(m);
- EXS["org.apache.ignite.compute.ComputeTaskTimeoutException"] = m => new ComputeTaskTimeoutException(m);
- EXS["org.apache.ignite.compute.ComputeUserUndeclaredException"] = m => new ComputeUserUndeclaredException(m);
-
- // Cache exceptions.
- EXS["javax.cache.CacheException"] = m => new CacheException(m);
- EXS["javax.cache.integration.CacheLoaderException"] = m => new CacheStoreException(m);
- EXS["javax.cache.integration.CacheWriterException"] = m => new CacheStoreException(m);
- EXS["javax.cache.processor.EntryProcessorException"] = m => new CacheEntryProcessorException(m);
- EXS["org.apache.ignite.cache.CacheAtomicUpdateTimeoutException"] = m => new CacheAtomicUpdateTimeoutException(m);
-
- // Transaction exceptions.
- EXS["org.apache.ignite.transactions.TransactionOptimisticException"] = m => new TransactionOptimisticException(m);
- EXS["org.apache.ignite.transactions.TransactionTimeoutException"] = m => new TransactionTimeoutException(m);
- EXS["org.apache.ignite.transactions.TransactionRollbackException"] = m => new TransactionRollbackException(m);
- EXS["org.apache.ignite.transactions.TransactionHeuristicException"] = m => new TransactionHeuristicException(m);
-
- // Security exceptions.
- EXS["org.apache.ignite.IgniteAuthenticationException"] = m => new SecurityException(m);
- EXS["org.apache.ignite.plugin.security.GridSecurityException"] = m => new SecurityException(m);
- }
-
- /// <summary>
- /// Creates exception according to native code class and message.
- /// </summary>
- /// <param name="clsName">Exception class name.</param>
- /// <param name="msg">Exception message.</param>
- /// <param name="reader">Error data reader.</param>
- public static Exception GetException(string clsName, string msg, PortableReaderImpl reader = null)
- {
- ExceptionFactoryDelegate ctor;
-
- if (EXS.TryGetValue(clsName, out ctor))
- return ctor(msg);
-
- if (ClsNoClsDefFoundErr.Equals(clsName))
- return new IgniteException("Java class is not found (did you set IGNITE_HOME environment " +
- "variable?): " + msg);
-
- if (ClsNoSuchMthdErr.Equals(clsName))
- return new IgniteException("Java class method is not found (did you set IGNITE_HOME environment " +
- "variable?): " + msg);
-
- if (ClsCachePartialUpdateErr.Equals(clsName))
- return ProcessCachePartialUpdateException(msg, reader);
-
- return new IgniteException("Java exception occurred [class=" + clsName + ", message=" + msg + ']');
- }
-
- /// <summary>
- /// Process cache partial update exception.
- /// </summary>
- /// <param name="msg">Message.</param>
- /// <param name="reader">Reader.</param>
- /// <returns></returns>
- private static Exception ProcessCachePartialUpdateException(string msg, PortableReaderImpl reader)
- {
- if (reader == null)
- return new CachePartialUpdateException(msg, new IgniteException("Failed keys are not available."));
-
- bool dataExists = reader.ReadBoolean();
-
- Debug.Assert(dataExists);
-
- if (reader.ReadBoolean())
- {
- bool keepPortable = reader.ReadBoolean();
-
- PortableReaderImpl keysReader = reader.Marshaller.StartUnmarshal(reader.Stream, keepPortable);
-
- try
- {
- return new CachePartialUpdateException(msg, ReadNullableList(keysReader));
- }
- catch (Exception e)
- {
- // Failed to deserialize data.
- return new CachePartialUpdateException(msg, e);
- }
- }
-
- // Was not able to write keys.
- string innerErrCls = reader.ReadString();
- string innerErrMsg = reader.ReadString();
-
- Exception innerErr = GetException(innerErrCls, innerErrMsg);
-
- return new CachePartialUpdateException(msg, innerErr);
- }
-
- /// <summary>
- /// Create JVM initialization exception.
- /// </summary>
- /// <param name="clsName">Class name.</param>
- /// <param name="msg">Message.</param>
- /// <returns>Exception.</returns>
- public static Exception GetJvmInitializeException(string clsName, string msg)
- {
- if (clsName != null)
- return new IgniteException("Failed to initialize JVM.", GetException(clsName, msg));
-
- if (msg != null)
- return new IgniteException("Failed to initialize JVM: " + msg);
-
- return new IgniteException("Failed to initialize JVM.");
- }
-
- /// <summary>
- /// Reads nullable list.
- /// </summary>
- /// <param name="reader">Reader.</param>
- /// <returns>List.</returns>
- private static List<object> ReadNullableList(PortableReaderImpl reader)
- {
- if (!reader.ReadBoolean())
- return null;
-
- var size = reader.ReadInt();
-
- var list = new List<object>(size);
-
- for (int i = 0; i < size; i++)
- list.Add(reader.ReadObject<object>());
-
- return list;
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
deleted file mode 100644
index 0168963..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/Handle.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Handle
-{
- using System;
- using System.Threading;
-
- /// <summary>
- /// Wrapper over some resource ensuring it's release.
- /// </summary>
- public class Handle<T> : IHandle
- {
- /** Target.*/
- private readonly T _target;
-
- /** Release action. */
- private readonly Action<T> _releaseAction;
-
- /** Release flag. */
- private int _released;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="releaseAction">Release action.</param>
- public Handle(T target, Action<T> releaseAction)
- {
- _target = target;
- _releaseAction = releaseAction;
- }
-
- /// <summary>
- /// Target.
- /// </summary>
- public T Target
- {
- get { return _target; }
- }
-
- /** <inheritdoc /> */
- public void Release()
- {
- if (Interlocked.CompareExchange(ref _released, 1, 0) == 0)
- _releaseAction(_target);
- }
-
- /** <inheritdoc /> */
- public bool Released
- {
- get { return Thread.VolatileRead(ref _released) == 1; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
deleted file mode 100644
index 9c8178f..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/HandleRegistry.cs
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Handle
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading;
-
- /// <summary>
- /// Resource registry.
- /// </summary>
- public class HandleRegistry
- {
- /** Default critical resources capacity. */
- internal const int DfltFastCap = 1024;
-
- /** Array for fast-path. */
- private readonly object[] _fast;
-
- /** Dictionery for slow-path. */
- private readonly ConcurrentDictionary<long, object> _slow;
-
- /** Capacity of fast array. */
- private readonly int _fastCap;
-
- /** Counter for fast-path. */
- private int _fastCtr;
-
- /** Counter for slow-path. */
- private long _slowCtr;
-
- /** Close flag. */
- private int _closed;
-
- /// <summary>
- /// Constructor.
- /// </summary>
- public HandleRegistry() : this(DfltFastCap)
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="fastCap">Amount of critical resources this registry can allocate in "fast" mode.</param>
- public HandleRegistry(int fastCap)
- {
- _fastCap = fastCap;
- _fast = new object[fastCap];
-
- _slow = new ConcurrentDictionary<long, object>();
- _slowCtr = fastCap;
- }
-
- /// <summary>
- /// Allocate a handle for resource.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <returns>Pointer.</returns>
- public long Allocate(object target)
- {
- return Allocate0(target, false, false);
- }
-
- /// <summary>
- /// Allocate a handle in safe mode.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <returns>Pointer.</returns>
- public long AllocateSafe(object target)
- {
- return Allocate0(target, false, true);
- }
-
- /// <summary>
- /// Allocate a handle for critical resource.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <returns>Pointer.</returns>
- public long AllocateCritical(object target)
- {
- return Allocate0(target, true, false);
- }
-
- /// <summary>
- /// Allocate a handle for critical resource in safe mode.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <returns>Pointer.</returns>
- public long AllocateCriticalSafe(object target)
- {
- return Allocate0(target, true, true);
- }
-
- /// <summary>
- /// Internal allocation routine.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="critical">Critical flag.</param>
- /// <param name="safe">Safe flag.</param>
- /// <returns>Pointer.</returns>
- private long Allocate0(object target, bool critical, bool safe)
- {
- if (Closed)
- throw ClosedException();
-
- // Try allocating on critical path.
- if (critical)
- {
- if (_fastCtr < _fastCap) // Non-volatile read could yield in old value, but increment resolves this.
- {
- int fastIdx = Interlocked.Increment(ref _fastCtr);
-
- if (fastIdx < _fastCap)
- {
- Thread.VolatileWrite(ref _fast[fastIdx], target);
-
- if (safe && Closed)
- {
- Thread.VolatileWrite(ref _fast[fastIdx], null);
-
- Release0(target, true);
-
- throw ClosedException();
- }
-
- return fastIdx;
- }
- }
- }
-
- // Critical allocation failed, fallback to slow mode.
- long slowIdx = Interlocked.Increment(ref _slowCtr);
-
- _slow[slowIdx] = target;
-
- if (safe && Closed)
- {
- _slow[slowIdx] = null;
-
- Release0(target, true);
-
- throw ClosedException();
- }
-
- return slowIdx;
- }
-
-
- /// <summary>
- /// Release handle.
- /// </summary>
- /// <param name="id">Identifier.</param>
- /// <param name="quiet">Whether release must be quiet or not.</param>
- public void Release(long id, bool quiet = false)
- {
- if (id < _fastCap)
- {
- object target = Thread.VolatileRead(ref _fast[id]);
-
- if (target != null)
- {
- Thread.VolatileWrite(ref _fast[id], null);
-
- Release0(target, quiet);
- }
- }
- else
- {
- object target;
-
- if (_slow.TryRemove(id, out target))
- Release0(target, quiet);
- }
- }
-
- /// <summary>
- /// Internal release routine.
- /// </summary>
- /// <param name="target">Target.</param>
- /// <param name="quiet">Whether release must be quiet or not.</param>
- private static void Release0(object target, bool quiet)
- {
- IHandle target0 = target as IHandle;
-
- if (target0 != null)
- {
- if (quiet)
- {
- try
- {
- target0.Release();
- }
- catch (Exception)
- {
- // No-op.
- }
- }
- else
- target0.Release();
- }
- }
-
- /// <summary>
- /// Gets handle target.
- /// </summary>
- /// <param name="id">Identifier.</param>
- /// <returns>Target.</returns>
- public T Get<T>(long id)
- {
- return Get<T>(id, false);
- }
-
- /// <summary>
- /// Gets handle target.
- /// </summary>
- /// <param name="id">Identifier.</param>
- /// <param name="throwOnAbsent">Whether to throw an exception if resource is not found.</param>
- /// <returns>Target.</returns>
- public T Get<T>(long id, bool throwOnAbsent)
- {
- object target;
-
- if (id < _fastCap)
- {
- target = Thread.VolatileRead(ref _fast[id]);
-
- if (target != null)
- return (T)target;
- }
- else
- {
- if (_slow.TryGetValue(id, out target))
- return (T) target;
- }
-
- if (throwOnAbsent)
- throw new InvalidOperationException("Resource handle has been released (is Ignite stopping?).");
-
- return default(T);
- }
-
- /// <summary>
- /// Close the registry. All resources allocated at the moment of close are
- /// guaranteed to be released.
- /// </summary>
- public void Close()
- {
- if (Interlocked.CompareExchange(ref _closed, 1, 0) == 0)
- {
- // Cleanup on fast-path.
- for (int i = 0; i < _fastCap; i++)
- {
- object target = Thread.VolatileRead(ref _fast[i]);
-
- if (target != null)
- {
- Thread.VolatileWrite(ref _fast[i], null);
-
- Release0(target, true);
- }
- }
-
- // Cleanup on slow-path.
- foreach (var item in _slow)
- {
- object target = item.Value;
-
- if (target != null)
- Release0(target, true);
- }
-
- _slow.Clear();
- }
- }
-
- /// <summary>
- /// Closed flag.
- /// </summary>
- public bool Closed
- {
- get { return Thread.VolatileRead(ref _closed) == 1; }
- }
-
- /// <summary>
- /// Gets the current handle count.
- /// </summary>
- public int Count
- {
- get
- {
- Thread.MemoryBarrier();
-
- return _fast.Count(x => x != null) + _slow.Count;
- }
- }
-
- /// <summary>
- /// Gets a snapshot of currently referenced objects list.
- /// </summary>
- public List<KeyValuePair<long, object>> GetItems()
- {
- Thread.MemoryBarrier();
-
- return
- _fast.Select((x, i) => new KeyValuePair<long, object>(i, x))
- .Where(x => x.Value != null)
- .Concat(_slow)
- .ToList();
- }
-
- /// <summary>
- /// Create new exception for closed state.
- /// </summary>
- /// <returns>Exception.</returns>
- private static Exception ClosedException()
- {
- return new InvalidOperationException("Cannot allocate a resource handle because Ignite is stopping.");
- }
- }
-}
-
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
deleted file mode 100644
index d147f8b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Handle/IHandle.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.Handle
-{
- /// <summary>
- /// Wrapper over some resource ensuring it's release.
- /// </summary>
- public interface IHandle
- {
- /// <summary>
- /// Release the resource.
- /// </summary>
- void Release();
-
- /// <summary>
- /// Resource released flag.
- /// </summary>
- bool Released { get; }
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IInteropCallback.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IInteropCallback.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IInteropCallback.cs
deleted file mode 100644
index 91838d0..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IInteropCallback.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using Apache.Ignite.Core.Impl.Portable.IO;
-
- /// <summary>
- /// Interop callback.
- /// </summary>
- internal interface IInteropCallback
- {
- /// <summary>
- /// Invokes callback.
- /// </summary>
- /// <param name="stream">Stream.</param>
- /// <returns>Invocation result.</returns>
- int Invoke(IPortableStream stream);
- }
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Ignite.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
deleted file mode 100644
index 5f764c1..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/Ignite.cs
+++ /dev/null
@@ -1,511 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Concurrent;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.Linq;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Common;
- using Apache.Ignite.Core.Impl.Datastream;
- using Apache.Ignite.Core.Impl.Handle;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Impl.Transactions;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using Apache.Ignite.Core.Lifecycle;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
- using Apache.Ignite.Core.Transactions;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Native Ignite wrapper.
- /// </summary>
- internal class Ignite : IIgnite, IClusterGroupEx, ICluster
- {
- /** */
- private readonly IgniteConfiguration _cfg;
-
- /** Grid name. */
- private readonly string _name;
-
- /** Unmanaged node. */
- private readonly IUnmanagedTarget _proc;
-
- /** Marshaller. */
- private readonly PortableMarshaller _marsh;
-
- /** Initial projection. */
- private readonly ClusterGroupImpl _prj;
-
- /** Portables. */
- private readonly PortablesImpl _portables;
-
- /** Cached proxy. */
- private readonly IgniteProxy _proxy;
-
- /** Lifecycle beans. */
- private readonly IList<LifecycleBeanHolder> _lifecycleBeans;
-
- /** Local node. */
- private IClusterNode _locNode;
-
- /** Transactions facade. */
- private readonly Lazy<TransactionsImpl> _transactions;
-
- /** Callbacks */
- private readonly UnmanagedCallbacks _cbs;
-
- /** Node info cache. */
-
- private readonly ConcurrentDictionary<Guid, ClusterNodeImpl> _nodes =
- new ConcurrentDictionary<Guid, ClusterNodeImpl>();
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <param name="name">Grid name.</param>
- /// <param name="proc">Interop processor.</param>
- /// <param name="marsh">Marshaller.</param>
- /// <param name="lifecycleBeans">Lifecycle beans.</param>
- /// <param name="cbs">Callbacks.</param>
- public Ignite(IgniteConfiguration cfg, string name, IUnmanagedTarget proc, PortableMarshaller marsh,
- IList<LifecycleBeanHolder> lifecycleBeans, UnmanagedCallbacks cbs)
- {
- Debug.Assert(cfg != null);
- Debug.Assert(proc != null);
- Debug.Assert(marsh != null);
- Debug.Assert(lifecycleBeans != null);
- Debug.Assert(cbs != null);
-
- _cfg = cfg;
- _name = name;
- _proc = proc;
- _marsh = marsh;
- _lifecycleBeans = lifecycleBeans;
- _cbs = cbs;
-
- marsh.Ignite = this;
-
- _prj = new ClusterGroupImpl(proc, UU.ProcessorProjection(proc), marsh, this, null);
-
- _portables = new PortablesImpl(marsh);
-
- _proxy = new IgniteProxy(this);
-
- cbs.Initialize(this);
-
- // Grid is not completely started here, can't initialize interop transactions right away.
- _transactions = new Lazy<TransactionsImpl>(
- () => new TransactionsImpl(UU.ProcessorTransactions(proc), marsh, GetLocalNode().Id));
- }
-
- /// <summary>
- /// On-start routine.
- /// </summary>
- internal void OnStart()
- {
- foreach (var lifecycleBean in _lifecycleBeans)
- lifecycleBean.OnStart(this);
- }
-
- /// <summary>
- /// Gets Ignite proxy.
- /// </summary>
- /// <returns>Proxy.</returns>
- public IgniteProxy Proxy
- {
- get { return _proxy; }
- }
-
- /** <inheritdoc /> */
- public string Name
- {
- get { return _name; }
- }
-
- /** <inheritdoc /> */
-
- public ICluster GetCluster()
- {
- return this;
- }
-
- /** <inheritdoc /> */
- IIgnite IClusterGroup.Ignite
- {
- get { return this; }
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForLocal()
- {
- return _prj.ForNodes(GetLocalNode());
- }
-
- /** <inheritdoc /> */
- public ICompute GetCompute()
- {
- return _prj.GetCompute();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes)
- {
- return ((IClusterGroup) _prj).ForNodes(nodes);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodes(params IClusterNode[] nodes)
- {
- return _prj.ForNodes(nodes);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(IEnumerable<Guid> ids)
- {
- return ((IClusterGroup) _prj).ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(ICollection<Guid> ids)
- {
- return _prj.ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(params Guid[] ids)
- {
- return _prj.ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForPredicate(Func<IClusterNode, bool> p)
- {
- IgniteArgumentCheck.NotNull(p, "p");
-
- return _prj.ForPredicate(p);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForAttribute(string name, string val)
- {
- return _prj.ForAttribute(name, val);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForCacheNodes(string name)
- {
- return _prj.ForCacheNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForDataNodes(string name)
- {
- return _prj.ForDataNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForClientNodes(string name)
- {
- return _prj.ForClientNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForRemotes()
- {
- return _prj.ForRemotes();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForHost(IClusterNode node)
- {
- IgniteArgumentCheck.NotNull(node, "node");
-
- return _prj.ForHost(node);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForRandom()
- {
- return _prj.ForRandom();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForOldest()
- {
- return _prj.ForOldest();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForYoungest()
- {
- return _prj.ForYoungest();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForDotNet()
- {
- return _prj.ForDotNet();
- }
-
- /** <inheritdoc /> */
- public ICollection<IClusterNode> GetNodes()
- {
- return _prj.GetNodes();
- }
-
- /** <inheritdoc /> */
- public IClusterNode GetNode(Guid id)
- {
- return _prj.GetNode(id);
- }
-
- /** <inheritdoc /> */
- public IClusterNode GetNode()
- {
- return _prj.GetNode();
- }
-
- /** <inheritdoc /> */
- public IClusterMetrics GetMetrics()
- {
- return _prj.GetMetrics();
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- Ignition.Stop(Name, true);
- }
-
- /// <summary>
- /// Internal stop routine.
- /// </summary>
- /// <param name="cancel">Cancel flag.</param>
- internal unsafe void Stop(bool cancel)
- {
- UU.IgnitionStop(_proc.Context, Name, cancel);
-
- _cbs.Cleanup();
-
- foreach (var bean in _lifecycleBeans)
- bean.OnLifecycleEvent(LifecycleEventType.AfterNodeStop);
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> GetCache<TK, TV>(string name)
- {
- return Cache<TK, TV>(UU.ProcessorCache(_proc, name));
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> GetOrCreateCache<TK, TV>(string name)
- {
- return Cache<TK, TV>(UU.ProcessorGetOrCreateCache(_proc, name));
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> CreateCache<TK, TV>(string name)
- {
- return Cache<TK, TV>(UU.ProcessorCreateCache(_proc, name));
- }
-
- /// <summary>
- /// Gets cache from specified native cache object.
- /// </summary>
- /// <param name="nativeCache">Native cache.</param>
- /// <param name="keepPortable">Portable flag.</param>
- /// <returns>
- /// New instance of cache wrapping specified native cache.
- /// </returns>
- public ICache<TK, TV> Cache<TK, TV>(IUnmanagedTarget nativeCache, bool keepPortable = false)
- {
- var cacheImpl = new CacheImpl<TK, TV>(this, nativeCache, _marsh, false, keepPortable, false, false);
-
- return new CacheProxyImpl<TK, TV>(cacheImpl);
- }
-
- /** <inheritdoc /> */
- public IClusterNode GetLocalNode()
- {
- return _locNode ?? (_locNode = GetNodes().FirstOrDefault(x => x.IsLocal));
- }
-
- /** <inheritdoc /> */
- public bool PingNode(Guid nodeId)
- {
- return _prj.PingNode(nodeId);
- }
-
- /** <inheritdoc /> */
- public long TopologyVersion
- {
- get { return _prj.TopologyVersion; }
- }
-
- /** <inheritdoc /> */
- public ICollection<IClusterNode> GetTopology(long ver)
- {
- return _prj.Topology(ver);
- }
-
- /** <inheritdoc /> */
- public void ResetMetrics()
- {
- UU.ProjectionResetMetrics(_prj.Target);
- }
-
- /** <inheritdoc /> */
- public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)
- {
- return new DataStreamerImpl<TK, TV>(UU.ProcessorDataStreamer(_proc, cacheName, false),
- _marsh, cacheName, false);
- }
-
- /** <inheritdoc /> */
- public IPortables GetPortables()
- {
- return _portables;
- }
-
- /** <inheritdoc /> */
- public ICacheAffinity GetAffinity(string cacheName)
- {
- return new CacheAffinityImpl(UU.ProcessorAffinity(_proc, cacheName), _marsh, false, this);
- }
-
- /** <inheritdoc /> */
-
- public ITransactions GetTransactions()
- {
- return _transactions.Value;
- }
-
- /** <inheritdoc /> */
- public IMessaging GetMessaging()
- {
- return _prj.GetMessaging();
- }
-
- /** <inheritdoc /> */
- public IEvents GetEvents()
- {
- return _prj.GetEvents();
- }
-
- /** <inheritdoc /> */
- public IServices GetServices()
- {
- return _prj.GetServices();
- }
-
- /// <summary>
- /// Gets internal projection.
- /// </summary>
- /// <returns>Projection.</returns>
- internal ClusterGroupImpl ClusterGroup
- {
- get { return _prj; }
- }
-
- /// <summary>
- /// Marshaller.
- /// </summary>
- internal PortableMarshaller Marshaller
- {
- get { return _marsh; }
- }
-
- /// <summary>
- /// Configuration.
- /// </summary>
- internal IgniteConfiguration Configuration
- {
- get { return _cfg; }
- }
-
- /// <summary>
- /// Put metadata to Grid.
- /// </summary>
- /// <param name="metas">Metadata.</param>
- internal void PutMetadata(IDictionary<int, IPortableMetadata> metas)
- {
- _prj.PutMetadata(metas);
- }
-
- /** <inheritDoc /> */
- public IPortableMetadata Metadata(int typeId)
- {
- return _prj.Metadata(typeId);
- }
-
- /// <summary>
- /// Handle registry.
- /// </summary>
- public HandleRegistry HandleRegistry
- {
- get { return _cbs.HandleRegistry; }
- }
-
- /// <summary>
- /// Updates the node information from stream.
- /// </summary>
- /// <param name="memPtr">Stream ptr.</param>
- public void UpdateNodeInfo(long memPtr)
- {
- var stream = IgniteManager.Memory.Get(memPtr).Stream();
-
- IPortableRawReader reader = Marshaller.StartUnmarshal(stream, false);
-
- var node = new ClusterNodeImpl(reader);
-
- node.Init(this);
-
- _nodes[node.Id] = node;
- }
-
- /// <summary>
- /// Gets the node from cache.
- /// </summary>
- /// <param name="id">Node id.</param>
- /// <returns>Cached node.</returns>
- public ClusterNodeImpl GetNode(Guid? id)
- {
- return id == null ? null : _nodes[id.Value];
- }
-
- /// <summary>
- /// Gets the interop processor.
- /// </summary>
- internal IUnmanagedTarget InteropProcessor
- {
- get { return _proc; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteConfigurationEx.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteConfigurationEx.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteConfigurationEx.cs
deleted file mode 100644
index 358e805..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteConfigurationEx.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- /// <summary>
- /// Internal extensions for IgniteConfiguration.
- /// </summary>
- internal class IgniteConfigurationEx : IgniteConfiguration
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public IgniteConfigurationEx()
- {
- // No-op.
- }
-
- /// <summary>
- /// Copying constructor.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- public IgniteConfigurationEx(IgniteConfiguration cfg) : base(cfg)
- {
- // No-op.
- }
-
- /// <summary>
- /// Copying constructor.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- public IgniteConfigurationEx(IgniteConfigurationEx cfg)
- : this((IgniteConfiguration) cfg)
- {
- GridName = cfg.GridName;
- }
-
- /// <summary>
- /// Grid name which is used if not provided in configuration file.
- /// </summary>
- public string GridName { get; set; }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
deleted file mode 100644
index 8fd8825..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteManager.cs
+++ /dev/null
@@ -1,490 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using System.Runtime.InteropServices;
- using System.Text;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl.Memory;
- using Apache.Ignite.Core.Impl.Unmanaged;
- using UU = Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils;
-
- /// <summary>
- /// Native interface manager.
- /// </summary>
- internal static unsafe class IgniteManager
- {
- /** Environment variable: IGNITE_HOME. */
- internal const string EnvIgniteHome = "IGNITE_HOME";
-
- /** Environment variable: whether to set test classpath or not. */
- internal const string EnvIgniteNativeTestClasspath = "IGNITE_NATIVE_TEST_CLASSPATH";
-
- /** Classpath prefix. */
- private const string ClasspathPrefix = "-Djava.class.path=";
-
- /** Java Command line argument: Xms. Case sensitive. */
- private const string CmdJvmMinMemJava = "-Xms";
-
- /** Java Command line argument: Xmx. Case sensitive. */
- private const string CmdJvmMaxMemJava = "-Xmx";
-
- /** Monitor for DLL load synchronization. */
- private static readonly object SyncRoot = new object();
-
- /** First created context. */
- private static void* _ctx;
-
- /** Configuration used on JVM start. */
- private static JvmConfiguration _jvmCfg;
-
- /** Memory manager. */
- private static PlatformMemoryManager _mem;
-
- /// <summary>
- /// Static initializer.
- /// </summary>
- static IgniteManager()
- {
- // No-op.
- }
-
- /// <summary>
- /// Create JVM.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <param name="cbs">Callbacks.</param>
- /// <returns>Context.</returns>
- internal static void* GetContext(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
- {
- lock (SyncRoot)
- {
- // 1. Warn about possible configuration inconsistency.
- JvmConfiguration jvmCfg = JvmConfig(cfg);
-
- if (!cfg.SuppressWarnings && _jvmCfg != null)
- {
- if (!_jvmCfg.Equals(jvmCfg))
- {
- Console.WriteLine("Attempting to start Ignite node with different Java " +
- "configuration; current Java configuration will be ignored (consider " +
- "starting node in separate process) [oldConfig=" + _jvmCfg +
- ", newConfig=" + jvmCfg + ']');
- }
- }
-
- // 2. Create unmanaged pointer.
- void* ctx = CreateJvm(cfg, cbs);
-
- cbs.SetContext(ctx);
-
- // 3. If this is the first JVM created, preserve it.
- if (_ctx == null)
- {
- _ctx = ctx;
- _jvmCfg = jvmCfg;
- _mem = new PlatformMemoryManager(1024);
- }
-
- return ctx;
- }
- }
-
- /// <summary>
- /// Memory manager attached to currently running JVM.
- /// </summary>
- internal static PlatformMemoryManager Memory
- {
- get { return _mem; }
- }
-
- /// <summary>
- /// Destroy JVM.
- /// </summary>
- public static void DestroyJvm()
- {
- lock (SyncRoot)
- {
- if (_ctx != null)
- {
- UU.DestroyJvm(_ctx);
-
- _ctx = null;
- }
- }
- }
-
- /// <summary>
- /// Create JVM.
- /// </summary>
- /// <returns>JVM.</returns>
- private static void* CreateJvm(IgniteConfiguration cfg, UnmanagedCallbacks cbs)
- {
- var ggHome = GetIgniteHome(cfg);
-
- var cp = CreateClasspath(ggHome, cfg, false);
-
- var jvmOpts = GetMergedJvmOptions(cfg);
-
- var hasGgHome = !string.IsNullOrWhiteSpace(ggHome);
-
- var opts = new sbyte*[1 + jvmOpts.Count + (hasGgHome ? 1 : 0)];
-
- int idx = 0;
-
- opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cp);
-
- if (hasGgHome)
- opts[idx++] = IgniteUtils.StringToUtf8Unmanaged("-DIGNITE_HOME=" + ggHome);
-
- foreach (string cfgOpt in jvmOpts)
- opts[idx++] = IgniteUtils.StringToUtf8Unmanaged(cfgOpt);
-
- try
- {
- IntPtr mem = Marshal.AllocHGlobal(opts.Length * 8);
-
- fixed (sbyte** opts0 = opts)
- {
- PlatformMemoryUtils.CopyMemory(opts0, mem.ToPointer(), opts.Length * 8);
- }
-
- try
- {
- return UU.CreateContext(mem.ToPointer(), opts.Length, cbs.CallbacksPointer);
- }
- finally
- {
- Marshal.FreeHGlobal(mem);
- }
- }
- finally
- {
- foreach (sbyte* opt in opts)
- Marshal.FreeHGlobal((IntPtr)opt);
- }
- }
-
- /// <summary>
- /// Gets JvmOptions collection merged with individual properties (Min/Max mem, etc) according to priority.
- /// </summary>
- private static IList<string> GetMergedJvmOptions(IgniteConfiguration cfg)
- {
- var jvmOpts = cfg.JvmOptions == null ? new List<string>() : cfg.JvmOptions.ToList();
-
- // JvmInitialMemoryMB / JvmMaxMemoryMB have lower priority than CMD_JVM_OPT
- if (!jvmOpts.Any(opt => opt.StartsWith(CmdJvmMinMemJava, StringComparison.OrdinalIgnoreCase)))
- jvmOpts.Add(string.Format("{0}{1}m", CmdJvmMinMemJava, cfg.JvmInitialMemoryMb));
-
- if (!jvmOpts.Any(opt => opt.StartsWith(CmdJvmMaxMemJava, StringComparison.OrdinalIgnoreCase)))
- jvmOpts.Add(string.Format("{0}{1}m", CmdJvmMaxMemJava, cfg.JvmMaxMemoryMb));
-
- return jvmOpts;
- }
-
- /// <summary>
- /// Create JVM configuration value object.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <returns>JVM configuration.</returns>
- private static JvmConfiguration JvmConfig(IgniteConfiguration cfg)
- {
- return new JvmConfiguration
- {
- Home = cfg.IgniteHome,
- Dll = cfg.JvmDllPath,
- Classpath = cfg.JvmClasspath,
- Options = cfg.JvmOptions
- };
- }
-
- /// <summary>
- /// Append jars from the given path.
- /// </summary>
- /// <param name="path">Path.</param>
- /// <param name="cpStr">Classpath string builder.</param>
- private static void AppendJars(string path, StringBuilder cpStr)
- {
- if (Directory.Exists(path))
- {
- foreach (string jar in Directory.EnumerateFiles(path, "*.jar"))
- {
- cpStr.Append(jar);
- cpStr.Append(';');
- }
- }
- }
-
- /// <summary>
- /// Calculate Ignite home.
- /// </summary>
- /// <param name="cfg">Configuration.</param>
- /// <returns></returns>
- internal static string GetIgniteHome(IgniteConfiguration cfg)
- {
- var home = cfg == null ? null : cfg.IgniteHome;
-
- if (string.IsNullOrWhiteSpace(home))
- home = Environment.GetEnvironmentVariable(EnvIgniteHome);
- else if (!IsIgniteHome(new DirectoryInfo(home)))
- throw new IgniteException(string.Format("IgniteConfiguration.IgniteHome is not valid: '{0}'", home));
-
- if (string.IsNullOrWhiteSpace(home))
- home = ResolveIgniteHome();
- else if (!IsIgniteHome(new DirectoryInfo(home)))
- throw new IgniteException(string.Format("{0} is not valid: '{1}'", EnvIgniteHome, home));
-
- return home;
- }
-
- /// <summary>
- /// Automatically resolve Ignite home directory.
- /// </summary>
- /// <returns>Ignite home directory.</returns>
- private static string ResolveIgniteHome()
- {
- var probeDirs = new[]
- {
- Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
- Directory.GetCurrentDirectory()
- };
-
- foreach (var probeDir in probeDirs.Where(x => !string.IsNullOrEmpty(x)))
- {
- var dir = new DirectoryInfo(probeDir);
-
- while (dir != null)
- {
- if (IsIgniteHome(dir))
- return dir.FullName;
-
- dir = dir.Parent;
- }
- }
-
- return null;
- }
-
- /// <summary>
- /// Determines whether specified dir looks like a Ignite home.
- /// </summary>
- /// <param name="dir">Directory.</param>
- /// <returns>Value indicating whether specified dir looks like a Ignite home.</returns>
- private static bool IsIgniteHome(DirectoryInfo dir)
- {
- return dir.Exists && dir.EnumerateDirectories().Count(x => x.Name == "examples" || x.Name == "bin") == 2;
- }
-
- /// <summary>
- /// Creates classpath from the given configuration, or default classpath if given config is null.
- /// </summary>
- /// <param name="cfg">The configuration.</param>
- /// <param name="forceTestClasspath">Append test directories even if <see cref="EnvIgniteNativeTestClasspath" /> is not set.</param>
- /// <returns>
- /// Classpath string.
- /// </returns>
- internal static string CreateClasspath(IgniteConfiguration cfg = null, bool forceTestClasspath = false)
- {
- return CreateClasspath(GetIgniteHome(cfg), cfg, forceTestClasspath);
- }
-
- /// <summary>
- /// Creates classpath from the given configuration, or default classpath if given config is null.
- /// </summary>
- /// <param name="ggHome">The home dir.</param>
- /// <param name="cfg">The configuration.</param>
- /// <param name="forceTestClasspath">Append test directories even if
- /// <see cref="EnvIgniteNativeTestClasspath" /> is not set.</param>
- /// <returns>
- /// Classpath string.
- /// </returns>
- private static string CreateClasspath(string ggHome, IgniteConfiguration cfg, bool forceTestClasspath)
- {
- var cpStr = new StringBuilder();
-
- if (cfg != null && cfg.JvmClasspath != null)
- {
- cpStr.Append(cfg.JvmClasspath);
-
- if (!cfg.JvmClasspath.EndsWith(";"))
- cpStr.Append(';');
- }
-
- if (!string.IsNullOrWhiteSpace(ggHome))
- AppendHomeClasspath(ggHome, forceTestClasspath, cpStr);
-
- return ClasspathPrefix + cpStr;
- }
-
- /// <summary>
- /// Appends classpath from home directory, if it is defined.
- /// </summary>
- /// <param name="ggHome">The home dir.</param>
- /// <param name="forceTestClasspath">Append test directories even if
- /// <see cref="EnvIgniteNativeTestClasspath"/> is not set.</param>
- /// <param name="cpStr">The classpath string.</param>
- private static void AppendHomeClasspath(string ggHome, bool forceTestClasspath, StringBuilder cpStr)
- {
- // Append test directories (if needed) first, because otherwise build *.jar will be picked first.
- if (forceTestClasspath || "true".Equals(Environment.GetEnvironmentVariable(EnvIgniteNativeTestClasspath)))
- {
- AppendTestClasses(ggHome + "\\examples", cpStr);
- AppendTestClasses(ggHome + "\\modules", cpStr);
- }
-
- string ggLibs = ggHome + "\\libs";
-
- AppendJars(ggLibs, cpStr);
-
- if (Directory.Exists(ggLibs))
- {
- foreach (string dir in Directory.EnumerateDirectories(ggLibs))
- {
- if (!dir.EndsWith("optional"))
- AppendJars(dir, cpStr);
- }
- }
- }
-
- /// <summary>
- /// Append target (compile) directories to classpath (for testing purposes only).
- /// </summary>
- /// <param name="path">Path</param>
- /// <param name="cp">Classpath builder.</param>
- private static void AppendTestClasses(string path, StringBuilder cp)
- {
- if (Directory.Exists(path))
- {
- AppendTestClasses0(path, cp);
-
- foreach (string moduleDir in Directory.EnumerateDirectories(path))
- AppendTestClasses0(moduleDir, cp);
- }
- }
-
- /// <summary>
- /// Internal routine to append classes and jars from eploded directory.
- /// </summary>
- /// <param name="path">Path.</param>
- /// <param name="cp">Classpath builder.</param>
- private static void AppendTestClasses0(string path, StringBuilder cp)
- {
- if (path.EndsWith("rest-http", StringComparison.OrdinalIgnoreCase))
- return;
-
- if (Directory.Exists(path + "\\target\\classes"))
- cp.Append(path + "\\target\\classes;");
-
- if (Directory.Exists(path + "\\target\\test-classes"))
- cp.Append(path + "\\target\\test-classes;");
-
- if (Directory.Exists(path + "\\target\\libs"))
- AppendJars(path + "\\target\\libs", cp);
- }
-
- /// <summary>
- /// JVM configuration.
- /// </summary>
- private class JvmConfiguration
- {
- /// <summary>
- /// Gets or sets the home.
- /// </summary>
- public string Home { get; set; }
-
- /// <summary>
- /// Gets or sets the DLL.
- /// </summary>
- public string Dll { get; set; }
-
- /// <summary>
- /// Gets or sets the cp.
- /// </summary>
- public string Classpath { get; set; }
-
- /// <summary>
- /// Gets or sets the options.
- /// </summary>
- public ICollection<string> Options { get; set; }
-
- /** <inheritDoc /> */
- public override int GetHashCode()
- {
- return 0;
- }
-
- /** <inheritDoc /> */
- [SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
- public override bool Equals(object obj)
- {
- JvmConfiguration other = obj as JvmConfiguration;
-
- if (other == null)
- return false;
-
- if (!string.Equals(Home, other.Home, StringComparison.OrdinalIgnoreCase))
- return false;
-
- if (!string.Equals(Classpath, other.Classpath, StringComparison.OrdinalIgnoreCase))
- return false;
-
- if (!string.Equals(Dll, other.Dll, StringComparison.OrdinalIgnoreCase))
- return false;
-
- return (Options == null && other.Options == null) ||
- (Options != null && other.Options != null && Options.Count == other.Options.Count
- && !Options.Except(other.Options).Any());
- }
-
- /** <inheritDoc /> */
- public override string ToString()
- {
- var sb = new StringBuilder("[IgniteHome=" + Home + ", JvmDllPath=" + Dll);
-
- if (Options != null && Options.Count > 0)
- {
- sb.Append(", JvmOptions=[");
-
- bool first = true;
-
- foreach (string opt in Options)
- {
- if (first)
- first = false;
- else
- sb.Append(", ");
-
- sb.Append(opt);
- }
-
- sb.Append(']');
- }
-
- sb.Append(", Classpath=" + Classpath + ']');
-
- return sb.ToString();
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs b/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
deleted file mode 100644
index 2e01a5b..0000000
--- a/modules/platform/src/main/dotnet/Apache.Ignite.Core/Impl/IgniteProxy.cs
+++ /dev/null
@@ -1,333 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl
-{
- using System;
- using System.Collections.Generic;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Compute;
- using Apache.Ignite.Core.Datastream;
- using Apache.Ignite.Core.Events;
- using Apache.Ignite.Core.Impl.Cluster;
- using Apache.Ignite.Core.Impl.Portable;
- using Apache.Ignite.Core.Messaging;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Services;
- using Apache.Ignite.Core.Transactions;
-
- /// <summary>
- /// Grid proxy with fake serialization.
- /// </summary>
- [Serializable]
- internal class IgniteProxy : IIgnite, IClusterGroupEx, IPortableWriteAware, ICluster
- {
- /** */
- [NonSerialized]
- private readonly IIgnite _ignite;
-
- /// <summary>
- /// Default ctor for marshalling.
- /// </summary>
- public IgniteProxy()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="ignite">Grid.</param>
- public IgniteProxy(IIgnite ignite)
- {
- _ignite = ignite;
- }
-
- /** <inheritdoc /> */
- public string Name
- {
- get { return _ignite.Name; }
- }
-
- /** <inheritdoc /> */
-
- public ICluster GetCluster()
- {
- return this;
- }
-
- /** <inheritdoc /> */
- public IIgnite Ignite
- {
- get { return this; }
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForLocal()
- {
- return _ignite.GetCluster().ForLocal();
- }
-
- /** <inheritdoc /> */
- public ICompute GetCompute()
- {
- return _ignite.GetCompute();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodes(IEnumerable<IClusterNode> nodes)
- {
- return _ignite.GetCluster().ForNodes(nodes);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodes(params IClusterNode[] nodes)
- {
- return _ignite.GetCluster().ForNodes(nodes);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(IEnumerable<Guid> ids)
- {
- return _ignite.GetCluster().ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(ICollection<Guid> ids)
- {
- return _ignite.GetCluster().ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForNodeIds(params Guid[] ids)
- {
- return _ignite.GetCluster().ForNodeIds(ids);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForPredicate(Func<IClusterNode, bool> p)
- {
- return _ignite.GetCluster().ForPredicate(p);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForAttribute(string name, string val)
- {
- return _ignite.GetCluster().ForAttribute(name, val);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForCacheNodes(string name)
- {
- return _ignite.GetCluster().ForCacheNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForDataNodes(string name)
- {
- return _ignite.GetCluster().ForDataNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForClientNodes(string name)
- {
- return _ignite.GetCluster().ForClientNodes(name);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForRemotes()
- {
- return _ignite.GetCluster().ForRemotes();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForHost(IClusterNode node)
- {
- return _ignite.GetCluster().ForHost(node);
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForRandom()
- {
- return _ignite.GetCluster().ForRandom();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForOldest()
- {
- return _ignite.GetCluster().ForOldest();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForYoungest()
- {
- return _ignite.GetCluster().ForYoungest();
- }
-
- /** <inheritdoc /> */
- public IClusterGroup ForDotNet()
- {
- return _ignite.GetCluster().ForDotNet();
- }
-
- /** <inheritdoc /> */
- public ICollection<IClusterNode> GetNodes()
- {
- return _ignite.GetCluster().GetNodes();
- }
-
- /** <inheritdoc /> */
- public IClusterNode GetNode(Guid id)
- {
- return _ignite.GetCluster().GetNode(id);
- }
-
- /** <inheritdoc /> */
- public IClusterNode GetNode()
- {
- return _ignite.GetCluster().GetNode();
- }
-
- /** <inheritdoc /> */
- public IClusterMetrics GetMetrics()
- {
- return _ignite.GetCluster().GetMetrics();
- }
-
- /** <inheritdoc /> */
- public void Dispose()
- {
- _ignite.Dispose();
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> GetCache<TK, TV>(string name)
- {
- return _ignite.GetCache<TK, TV>(name);
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> GetOrCreateCache<TK, TV>(string name)
- {
- return _ignite.GetOrCreateCache<TK, TV>(name);
- }
-
- /** <inheritdoc /> */
- public ICache<TK, TV> CreateCache<TK, TV>(string name)
- {
- return _ignite.CreateCache<TK, TV>(name);
- }
-
- /** <inheritdoc /> */
-
- public IClusterNode GetLocalNode()
- {
- return _ignite.GetCluster().GetLocalNode();
- }
-
- /** <inheritdoc /> */
- public bool PingNode(Guid nodeId)
- {
- return _ignite.GetCluster().PingNode(nodeId);
- }
-
- /** <inheritdoc /> */
- public long TopologyVersion
- {
- get { return _ignite.GetCluster().TopologyVersion; }
- }
-
- /** <inheritdoc /> */
- public ICollection<IClusterNode> GetTopology(long ver)
- {
- return _ignite.GetCluster().GetTopology(ver);
- }
-
- /** <inheritdoc /> */
- public void ResetMetrics()
- {
- _ignite.GetCluster().ResetMetrics();
- }
-
- /** <inheritdoc /> */
- public IDataStreamer<TK, TV> GetDataStreamer<TK, TV>(string cacheName)
- {
- return _ignite.GetDataStreamer<TK, TV>(cacheName);
- }
-
- /** <inheritdoc /> */
- public IPortables GetPortables()
- {
- return _ignite.GetPortables();
- }
-
- /** <inheritdoc /> */
- public ICacheAffinity GetAffinity(string name)
- {
- return _ignite.GetAffinity(name);
- }
-
- /** <inheritdoc /> */
-
- public ITransactions GetTransactions()
- {
- return _ignite.GetTransactions();
- }
-
- /** <inheritdoc /> */
- public IMessaging GetMessaging()
- {
- return _ignite.GetMessaging();
- }
-
- /** <inheritdoc /> */
- public IEvents GetEvents()
- {
- return _ignite.GetEvents();
- }
-
- /** <inheritdoc /> */
- public IServices GetServices()
- {
- return _ignite.GetServices();
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- // No-op.
- }
-
- /// <summary>
- /// Target grid.
- /// </summary>
- internal IIgnite Target
- {
- get
- {
- return _ignite;
- }
- }
-
- /** <inheritdoc /> */
- public IPortableMetadata Metadata(int typeId)
- {
- return ((IClusterGroupEx)_ignite).Metadata(typeId);
- }
- }
-}
[08/51] [partial] ignite git commit: IGNITE-1513: Finalized build
procedure.
Posted by vo...@apache.org.
http://git-wip-us.apache.org/repos/asf/ignite/blob/f0bac562/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
----------------------------------------------------------------------
diff --git a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs b/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
deleted file mode 100644
index ae00c91..0000000
--- a/modules/platform/src/test/dotnet/Apache.Ignite.Core.Tests/Cache/CacheAbstractTest.cs
+++ /dev/null
@@ -1,3252 +0,0 @@
-/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.Cache
-{
- using System;
- using System.Collections.Generic;
- using System.Diagnostics.CodeAnalysis;
- using System.Linq;
- using System.Runtime.Serialization;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using Apache.Ignite.Core.Cache;
- using Apache.Ignite.Core.Cache.Expiry;
- using Apache.Ignite.Core.Cluster;
- using Apache.Ignite.Core.Common;
- using Apache.Ignite.Core.Impl;
- using Apache.Ignite.Core.Impl.Cache;
- using Apache.Ignite.Core.Portable;
- using Apache.Ignite.Core.Tests.Query;
- using Apache.Ignite.Core.Transactions;
- using NUnit.Framework;
-
- /// <summary>
- ///
- /// </summary>
- class CacheTestKey
- {
- /// <summary>
- /// Default constructor.
- /// </summary>
- public CacheTestKey()
- {
- // No-op.
- }
-
- /// <summary>
- /// Constructor.
- /// </summary>
- /// <param name="id">ID.</param>
- public CacheTestKey(int id)
- {
- Id = id;
- }
-
- /// <summary>
- /// ID.
- /// </summary>
- public int Id
- {
- get;
- set;
- }
-
- /** <inheritdoc /> */
- public override bool Equals(object obj)
- {
- CacheTestKey other = obj as CacheTestKey;
-
- return other != null && Id == other.Id;
- }
-
- /** <inheritdoc /> */
- public override int GetHashCode()
- {
- return Id;
- }
-
- /** <inheritdoc /> */
- public override string ToString()
- {
- return new StringBuilder()
- .Append(typeof(CacheTestKey).Name)
- .Append(" [id=").Append(Id)
- .Append(']').ToString();
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- class TestReferenceObject
- {
- public TestReferenceObject Obj;
-
- /// <summary>
- /// Default constructor.
- /// </summary>
- public TestReferenceObject()
- {
- // No-op.
- }
-
- public TestReferenceObject(TestReferenceObject obj)
- {
- Obj = obj;
- }
- }
-
- [Serializable]
- public class TestSerializableObject
- {
- public string Name { get; set; }
- public int Id { get; set; }
-
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
-
- var other = (TestSerializableObject) obj;
- return obj.GetType() == GetType() && (string.Equals(Name, other.Name) && Id == other.Id);
- }
-
- public override int GetHashCode()
- {
- unchecked
- {
- return ((Name != null ? Name.GetHashCode() : 0) * 397) ^ Id;
- }
- }
- }
-
- /// <summary>
- /// Cache entry processor that adds argument value to the entry value.
- /// </summary>
- [Serializable]
- public class AddArgCacheEntryProcessor : ICacheEntryProcessor<int, int, int, int>
- {
- // Expected exception text
- public const string ExceptionText = "Exception from AddArgCacheEntryProcessor.";
-
- // Error flag
- public bool ThrowErr { get; set; }
-
- // Error flag
- public bool ThrowErrPortable { get; set; }
-
- // Error flag
- public bool ThrowErrNonSerializable { get; set; }
-
- // Key value to throw error on
- public int ThrowOnKey { get; set; }
-
- // Remove flag
- public bool Remove { get; set; }
-
- // Exists flag
- public bool Exists { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="AddArgCacheEntryProcessor"/> class.
- /// </summary>
- public AddArgCacheEntryProcessor()
- {
- Exists = true;
- ThrowOnKey = -1;
- }
-
- /** <inheritdoc /> */
- int ICacheEntryProcessor<int, int, int, int>.Process(IMutableCacheEntry<int, int> entry, int arg)
- {
- if (ThrowOnKey < 0 || ThrowOnKey == entry.Key)
- {
- if (ThrowErr)
- throw new Exception(ExceptionText);
-
- if (ThrowErrPortable)
- throw new PortableTestException {Info = ExceptionText};
-
- if (ThrowErrNonSerializable)
- throw new NonSerializableException();
- }
-
- Assert.AreEqual(Exists, entry.Exists);
-
- if (Remove)
- entry.Remove();
- else
- entry.Value = entry.Value + arg;
-
- return entry.Value;
- }
-
- /** <inheritdoc /> */
- public int Process(IMutableCacheEntry<int, int> entry, int arg)
- {
- throw new Exception("Invalid method");
- }
- }
-
- /// <summary>
- /// Portable add processor.
- /// </summary>
- public class PortableAddArgCacheEntryProcessor : AddArgCacheEntryProcessor, IPortableMarshalAware
- {
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- var w = writer.RawWriter();
-
- w.WriteBoolean(ThrowErr);
- w.WriteBoolean(ThrowErrPortable);
- w.WriteBoolean(ThrowErrNonSerializable);
- w.WriteInt(ThrowOnKey);
- w.WriteBoolean(Remove);
- w.WriteBoolean(Exists);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- var r = reader.RawReader();
-
- ThrowErr = r.ReadBoolean();
- ThrowErrPortable = r.ReadBoolean();
- ThrowErrNonSerializable = r.ReadBoolean();
- ThrowOnKey = r.ReadInt();
- Remove = r.ReadBoolean();
- Exists = r.ReadBoolean();
- }
- }
-
- /// <summary>
- /// Non-serializable processor.
- /// </summary>
- public class NonSerializableCacheEntryProcessor : AddArgCacheEntryProcessor
- {
- // No-op.
- }
-
- /// <summary>
- /// Portable exception.
- /// </summary>
- public class PortableTestException : Exception, IPortableMarshalAware
- {
- /// <summary>
- /// Gets or sets exception info.
- /// </summary>
- public string Info { get; set; }
-
- /** <inheritdoc /> */
- public override string Message
- {
- get { return Info; }
- }
-
- /** <inheritdoc /> */
- public void WritePortable(IPortableWriter writer)
- {
- writer.RawWriter().WriteString(Info);
- }
-
- /** <inheritdoc /> */
- public void ReadPortable(IPortableReader reader)
- {
- Info = reader.RawReader().ReadString();
- }
- }
-
- /// <summary>
- /// Non-serializable exception.
- /// </summary>
- public class NonSerializableException : Exception
- {
- // No-op
- }
-
- /// <summary>
- ///
- /// </summary>
- [SuppressMessage("ReSharper", "UnusedVariable")]
- public abstract class CacheAbstractTest {
- /// <summary>
- ///
- /// </summary>
- [TestFixtureSetUp]
- public virtual void StartGrids() {
- TestUtils.KillProcesses();
-
- IgniteConfigurationEx cfg = new IgniteConfigurationEx();
-
- PortableConfiguration portCfg = new PortableConfiguration();
-
- ICollection<PortableTypeConfiguration> portTypeCfgs = new List<PortableTypeConfiguration>();
-
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortablePerson)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(CacheTestKey)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(TestReferenceObject)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableAddArgCacheEntryProcessor)));
- portTypeCfgs.Add(new PortableTypeConfiguration(typeof(PortableTestException)));
-
- portCfg.TypeConfigurations = portTypeCfgs;
-
- cfg.PortableConfiguration = portCfg;
- cfg.JvmClasspath = TestUtils.CreateTestClasspath();
- cfg.JvmOptions = TestUtils.TestJavaOptions();
- cfg.SpringConfigUrl = "config\\native-client-test-cache.xml";
-
- for (int i = 0; i < GridCount(); i++) {
- cfg.GridName = "grid-" + i;
-
- Ignition.Start(cfg);
- }
- }
-
- /// <summary>
- ///
- /// </summary>
- [TestFixtureTearDown]
- public virtual void StopGrids() {
- for (int i = 0; i < GridCount(); i++)
- Ignition.Stop("grid-" + i, true);
- }
-
- /// <summary>
- ///
- /// </summary>
- [SetUp]
- public virtual void BeforeTest()
- {
- Console.WriteLine("Test started: " + TestContext.CurrentContext.Test.Name);
- }
-
- /// <summary>
- ///
- /// </summary>
- [TearDown]
- public virtual void AfterTest() {
- for (int i = 0; i < GridCount(); i++)
- Cache(i).RemoveAll();
-
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- if (!cache.IsEmpty())
- {
- var entries = Enumerable.Range(0, 2000)
- .Select(x => new KeyValuePair<int, int>(x, cache.LocalPeek(x)))
- .Where(x => x.Value != 0)
- .Select(pair => pair.ToString() + GetKeyAffinity(cache, pair.Key))
- .Aggregate((acc, val) => string.Format("{0}, {1}", acc, val));
-
- Assert.Fail("Cache '{0}' is not empty in grid [{1}]: ({2})", CacheName(), i, entries);
- }
- }
-
- Console.WriteLine("Test finished: " + TestContext.CurrentContext.Test.Name);
- }
-
- public IIgnite GetIgnite(int idx)
- {
- return Ignition.GetIgnite("grid-" + idx);
- }
-
- public ICache<int, int> Cache(int idx) {
- return Cache<int, int>(idx);
- }
-
- public ICache<TK, TV> Cache<TK, TV>(int idx) {
- return GetIgnite(idx).GetCache<TK, TV>(CacheName());
- }
-
- public ICache<int, int> Cache()
- {
- return Cache<int, int>(0);
- }
-
- public ICache<TK, TV> Cache<TK, TV>()
- {
- return Cache<TK, TV>(0);
- }
-
- public ICacheAffinity Affinity()
- {
- return GetIgnite(0).GetAffinity(CacheName());
- }
-
- public ITransactions Transactions
- {
- get { return GetIgnite(0).GetTransactions(); }
- }
-
- [Test]
- public void TestCircularReference()
- {
- var cache = Cache().WithKeepPortable<int, object>();
-
- TestReferenceObject obj1 = new TestReferenceObject();
-
- obj1.Obj = new TestReferenceObject(obj1);
-
- cache.Put(1, obj1);
-
- var po = (IPortableObject) cache.Get(1);
-
- Assert.IsNotNull(po);
-
- TestReferenceObject objRef = po.Deserialize<TestReferenceObject>();
-
- Assert.IsNotNull(objRef);
- }
-
- [Test]
- public void TestName()
- {
- for (int i = 0; i < GridCount(); i++ )
- Assert.AreEqual(CacheName(), Cache(i).Name);
- }
-
- [Test]
- public void TestIsEmpty()
- {
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- Assert.IsTrue(cache.IsEmpty());
- }
-
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- cache.Put(PrimaryKeyForCache(cache), 1);
- }
-
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- Assert.IsFalse(cache.IsEmpty());
- }
- }
-
- [Test]
- public void TestContainsKey()
- {
- var cache = Cache();
-
- int key = PrimaryKeyForCache(cache);
-
- cache.Put(key, 1);
-
- Assert.IsTrue(cache.ContainsKey(key));
- Assert.IsFalse(cache.ContainsKey(-1));
- }
-
- [Test]
- public void TestContainsKeys()
- {
- var cache = Cache();
-
- var keys = PrimaryKeysForCache(cache, 5);
-
- Assert.IsFalse(cache.ContainsKeys(keys));
-
- cache.PutAll(keys.ToDictionary(k => k, k => k));
-
- Assert.IsTrue(cache.ContainsKeys(keys));
-
- Assert.IsFalse(cache.ContainsKeys(keys.Concat(new[] {int.MaxValue})));
- }
-
- [Test]
- public void TestPeek()
- {
- var cache = Cache();
-
- int key1 = PrimaryKeyForCache(cache);
-
- cache.Put(key1, 1);
-
- Assert.AreEqual(1, cache.LocalPeek(key1));
- Assert.AreEqual(0, cache.LocalPeek(-1));
-
- Assert.AreEqual(1, cache.LocalPeek(key1, CachePeekMode.All));
- Assert.AreEqual(0, cache.LocalPeek(-1, CachePeekMode.All));
- }
-
- [Test]
- public void TestGet()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(0, cache.Get(3));
- }
-
- [Test]
- public void TestGetAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(0, cache.Get(3));
- }
-
- [Test]
- public void TestGetAll()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
- cache.Put(4, 4);
- cache.Put(5, 5);
-
- IDictionary<int, int> map = cache.GetAll(new List<int> { 0, 1, 2, 5 });
-
- Assert.AreEqual(3, map.Count);
-
- Assert.AreEqual(1, map[1]);
- Assert.AreEqual(2, map[2]);
- }
-
- [Test]
- public void TestGetAllAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
-
- var map = cache.GetAll(new List<int> { 0, 1, 2 });
-
- Assert.AreEqual(2, map.Count);
-
- Assert.AreEqual(1, map[1]);
- Assert.AreEqual(2, map[2]);
- }
-
- [Test]
- public void TestGetAndPut()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.Get(1));
-
- int old = cache.GetAndPut(1, 1);
-
- Assert.AreEqual(0, old);
-
- Assert.AreEqual(1, cache.Get(1));
-
- old = cache.GetAndPut(1, 2);
-
- Assert.AreEqual(1, old);
-
- Assert.AreEqual(2, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndReplace()
- {
- var cache = Cache();
-
- cache.Put(1, 10);
-
- Assert.AreEqual(10, cache.GetAndReplace(1, 100));
-
- Assert.AreEqual(0, cache.GetAndReplace(2, 2));
-
- Assert.AreEqual(0, cache.Get(2));
-
- Assert.AreEqual(100, cache.Get(1));
-
- Assert.IsTrue(cache.Remove(1));
- }
-
- [Test]
- public void TestGetAndRemove()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(0, cache.GetAndRemove(0));
-
- Assert.AreEqual(1, cache.GetAndRemove(1));
-
- Assert.AreEqual(0, cache.GetAndRemove(1));
-
- Assert.AreEqual(0, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndPutAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.Get(1));
-
- int old = cache.GetAndPut(1, 1);
-
- Assert.AreEqual(0, old);
-
- Assert.AreEqual(1, cache.Get(1));
-
- old = cache.GetAndPut(1, 2);
-
- Assert.AreEqual(1, old);
-
- Assert.AreEqual(2, cache.Get(1));
- }
-
- [Test]
- public void TestPut()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestPutxAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestPutIfAbsent()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.Get(1));
-
- Assert.AreEqual(true, cache.PutIfAbsent(1, 1));
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(false, cache.PutIfAbsent(1, 2));
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndPutIfAbsent()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.Get(1));
-
- Assert.AreEqual(0, cache.GetAndPutIfAbsent(1, 1));
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(1, cache.GetAndPutIfAbsent(1, 2));
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndPutIfAbsentAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.Get(1));
-
- int old = cache.GetAndPutIfAbsent(1, 1);
-
- Assert.AreEqual(0, old);
-
- Assert.AreEqual(1, cache.Get(1));
-
- old = cache.GetAndPutIfAbsent(1, 2);
-
- Assert.AreEqual(1, old);
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestPutIfAbsentAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.Get(1));
-
- Assert.IsTrue(cache.PutIfAbsent(1, 1));
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsFalse(cache.PutIfAbsent(1, 2));
-
- Assert.AreEqual(1, cache.Get(1));
- }
-
- [Test]
- public void TestReplace()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.Get(1));
-
- bool success = cache.Replace(1, 1);
-
- Assert.AreEqual(false, success);
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- success = cache.Replace(1, 2);
-
- Assert.AreEqual(true, success);
-
- Assert.AreEqual(2, cache.Get(1));
-
- Assert.IsFalse(cache.Replace(1, -1, 3));
-
- Assert.AreEqual(2, cache.Get(1));
-
- Assert.IsTrue(cache.Replace(1, 2, 3));
-
- Assert.AreEqual(3, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndReplaceAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.Get(1));
-
- int old = cache.GetAndReplace(1, 1);
-
- Assert.AreEqual(0, old);
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- old = cache.GetAndReplace(1, 2);
-
- Assert.AreEqual(1, old);
-
- Assert.AreEqual(2, cache.Get(1));
-
- Assert.IsFalse(cache.Replace(1, -1, 3));
-
- Assert.AreEqual(2, cache.Get(1));
-
- Assert.IsTrue(cache.Replace(1, 2, 3));
-
- Assert.AreEqual(3, cache.Get(1));
- }
-
- [Test]
- public void TestReplacex()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.Get(1));
-
- Assert.IsFalse(cache.Replace(1, 1));
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsTrue(cache.Replace(1, 2));
-
- Assert.AreEqual(2, cache.Get(1));
- }
-
- [Test]
- public void TestReplaceAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.Get(1));
-
- Assert.IsFalse(cache.Replace(1, 1));
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsTrue(cache.Replace(1, 2));
-
- Assert.AreEqual(2, cache.Get(1));
- }
-
- [Test]
- public void TestPutAll()
- {
- var cache = Cache();
-
- cache.PutAll(new Dictionary<int, int> { { 1, 1 }, { 2, 2 }, { 3, 3 } });
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
- }
-
- [Test]
- public void TestPutAllAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.PutAll(new Dictionary<int, int> { { 1, 1 }, { 2, 2 }, { 3, 3 } });
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
- }
-
- /// <summary>
- /// Expiry policy tests.
- /// </summary>
- [Test]
- public void TestWithExpiryPolicy()
- {
- ICache<int, int> cache0 = Cache(0);
-
- int key0;
- int key1;
-
- if (LocalCache())
- {
- key0 = 0;
- key1 = 1;
- }
- else
- {
- key0 = PrimaryKeyForCache(cache0);
- key1 = PrimaryKeyForCache(Cache(1));
- }
-
- // Test unchanged expiration.
- ICache<int, int> cache = cache0.WithExpiryPolicy(new ExpiryPolicy(null, null, null));
-
- cache.Put(key0, key0);
- cache.Put(key1, key1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache.Put(key0, key0 + 1);
- cache.Put(key1, key1 + 1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache.Get(key0);
- cache.Get(key1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache0.RemoveAll(new List<int> { key0, key1 });
-
- // Test eternal expiration.
- cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.MaxValue, TimeSpan.MaxValue, TimeSpan.MaxValue));
-
- cache.Put(key0, key0);
- cache.Put(key1, key1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache.Put(key0, key0 + 1);
- cache.Put(key1, key1 + 1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache.Get(key0);
- cache.Get(key1);
- Thread.Sleep(200);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
-
- cache0.RemoveAll(new List<int> { key0, key1 });
-
- // Test zero expiration.
- cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.Zero, TimeSpan.Zero, TimeSpan.Zero));
-
- cache.Put(key0, key0);
- cache.Put(key1, key1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
- cache.Put(key0, key0 + 1);
- cache.Put(key1, key1 + 1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- cache.Get(key0);
- cache.Get(key1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.RemoveAll(new List<int> { key0, key1 });
-
- // Test negative expiration.
- cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(-100),
- TimeSpan.FromMilliseconds(-100), TimeSpan.FromMilliseconds(-100)));
-
- cache.Put(key0, key0);
- cache.Put(key1, key1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
- cache.Put(key0, key0 + 1);
- cache.Put(key1, key1 + 1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- cache.Get(key0);
- cache.Get(key1);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.RemoveAll(new List<int> { key0, key1 });
-
- // Test regular expiration.
- cache = cache0.WithExpiryPolicy(new ExpiryPolicy(TimeSpan.FromMilliseconds(100),
- TimeSpan.FromMilliseconds(100), TimeSpan.FromMilliseconds(100)));
-
- cache.Put(key0, key0);
- cache.Put(key1, key1);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
- Thread.Sleep(200);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- cache.Put(key0, key0 + 1);
- cache.Put(key1, key1 + 1);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
- Thread.Sleep(200);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
-
- cache0.Put(key0, key0);
- cache0.Put(key1, key1);
- cache.Get(key0);
- cache.Get(key1);
- Assert.IsTrue(cache0.ContainsKey(key0));
- Assert.IsTrue(cache0.ContainsKey(key1));
- Thread.Sleep(200);
- Assert.IsFalse(cache0.ContainsKey(key0));
- Assert.IsFalse(cache0.ContainsKey(key1));
- }
-
- [Test]
- public void TestEvict()
- {
- var cache = Cache();
-
- int key = PrimaryKeyForCache(cache);
-
- cache.Put(key, 1);
-
- Assert.AreEqual(1, PeekInt(cache, key));
-
- cache.LocalEvict(new[] {key});
-
- Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(0, PeekInt(cache, key));
-
- Assert.AreEqual(1, cache.Get(key));
-
- Assert.AreEqual(1, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(1, PeekInt(cache, key));
- }
-
- [Test]
- public void TestEvictAllKeys()
- {
- var cache = Cache();
-
- List<int> keys = PrimaryKeysForCache(cache, 3);
-
- cache.Put(keys[0], 1);
- cache.Put(keys[1], 2);
- cache.Put(keys[2], 3);
-
- Assert.AreEqual(1, PeekInt(cache, keys[0]));
- Assert.AreEqual(2, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
-
- cache.LocalEvict(new List<int> { -1, keys[0], keys[1] });
-
- Assert.AreEqual(1, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(0, PeekInt(cache, keys[0]));
- Assert.AreEqual(0, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
-
- Assert.AreEqual(1, cache.Get(keys[0]));
- Assert.AreEqual(2, cache.Get(keys[1]));
-
- Assert.AreEqual(3, cache.GetLocalSize());
-
- Assert.AreEqual(1, PeekInt(cache, keys[0]));
- Assert.AreEqual(2, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
- }
-
- [Test]
- public void TestClear()
- {
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- cache.Put(PrimaryKeyForCache(cache, 500), 1);
-
- Assert.IsFalse(cache.IsEmpty());
- }
-
- Cache().Clear();
-
- for (int i = 0; i < GridCount(); i++)
- Assert.IsTrue(Cache(i).IsEmpty());
- }
-
- [Test]
- public void TestClearKey()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 10);
-
- foreach (var key in keys)
- cache.Put(key, 3);
-
- var i = cache.GetSize();
-
- foreach (var key in keys)
- {
- cache.Clear(key);
-
- Assert.AreEqual(0, cache.Get(key));
-
- Assert.Less(cache.GetSize(), i);
-
- i = cache.GetSize();
- }
- }
-
- [Test]
- public void TestClearKeys()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 10);
-
- foreach (var key in keys)
- cache.Put(key, 3);
-
- cache.ClearAll(keys);
-
- foreach (var key in keys)
- Assert.AreEqual(0, cache.Get(key));
- }
-
- [Test]
- public void TestLocalClearKey()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 10);
-
- foreach (var key in keys)
- cache.Put(key, 3);
-
- var i = cache.GetSize();
-
- foreach (var key in keys)
- {
- cache.LocalClear(key);
-
- Assert.AreEqual(0, cache.LocalPeek(key));
-
- Assert.Less(cache.GetSize(), i);
-
- i = cache.GetSize();
- }
-
- cache.Clear();
- }
-
- [Test]
- public void TestLocalClearKeys()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 10);
-
- foreach (var key in keys)
- cache.Put(key, 3);
-
- cache.LocalClearAll(keys);
-
- foreach (var key in keys)
- Assert.AreEqual(0, cache.LocalPeek(key));
-
- cache.Clear();
- }
-
- [Test]
- public void TestRemove()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(true, cache.Remove(1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsFalse(cache.Remove(1, -1));
- Assert.IsTrue(cache.Remove(1, 1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
- }
-
- [Test]
- public void TestGetAndRemoveAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(1, cache.GetAndRemove(1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsFalse(cache.Remove(1, -1));
- Assert.IsTrue(cache.Remove(1, 1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
- }
-
- [Test]
- public void TestRemovex()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsFalse(cache.Remove(-1));
- Assert.IsTrue(cache.Remove(1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
- }
-
- [Test]
- public void TestRemoveAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- cache.Put(1, 1);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.IsFalse(cache.Remove(-1));
- Assert.IsTrue(cache.Remove(1));
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(1));
- }
-
- [Test]
- public void TestRemoveAll()
- {
- var cache = Cache();
-
- List<int> keys = PrimaryKeysForCache(cache, 2);
-
- cache.Put(keys[0], 1);
- cache.Put(keys[1], 2);
-
- Assert.AreEqual(1, cache.Get(keys[0]));
- Assert.AreEqual(2, cache.Get(keys[1]));
-
- cache.RemoveAll();
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(keys[0]));
- Assert.AreEqual(0, cache.Get(keys[1]));
- }
-
- [Test]
- public void TestRemoveAllAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- List<int> keys = PrimaryKeysForCache(cache, 2);
-
- cache.Put(keys[0], 1);
- cache.Put(keys[1], 2);
-
- Assert.AreEqual(1, cache.Get(keys[0]));
- Assert.AreEqual(2, cache.Get(keys[1]));
-
- cache.RemoveAll();
-
- Assert.AreEqual(0, cache.GetSize());
-
- Assert.AreEqual(0, cache.Get(keys[0]));
- Assert.AreEqual(0, cache.Get(keys[1]));
- }
-
- [Test]
- public void TestRemoveAllKeys()
- {
- var cache = Cache();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
-
- cache.RemoveAll(new List<int> { 0, 1, 2 });
-
- Assert.AreEqual(1, cache.GetSize(CachePeekMode.Primary));
-
- Assert.AreEqual(0, cache.Get(1));
- Assert.AreEqual(0, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
- }
-
- [Test]
- public void TestRemoveAllKeysAsync()
- {
- var cache = Cache().WithAsync().WrapAsync();
-
- Assert.AreEqual(0, cache.GetSize());
-
- cache.Put(1, 1);
- cache.Put(2, 2);
- cache.Put(3, 3);
-
- Assert.AreEqual(1, cache.Get(1));
- Assert.AreEqual(2, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
-
- cache.RemoveAll(new List<int> { 0, 1, 2 });
-
- Assert.AreEqual(1, cache.GetSize(CachePeekMode.Primary));
-
- Assert.AreEqual(0, cache.Get(1));
- Assert.AreEqual(0, cache.Get(2));
- Assert.AreEqual(3, cache.Get(3));
- }
-
- [Test]
- public void TestSizes()
- {
- for (int i = 0; i < GridCount(); i++)
- {
- var cache = Cache(i);
-
- List<int> keys = PrimaryKeysForCache(cache, 2);
-
- foreach (int key in keys)
- cache.Put(key, 1);
-
- Assert.IsTrue(cache.GetSize() >= 2);
- Assert.AreEqual(2, cache.GetLocalSize(CachePeekMode.Primary));
- }
-
- ICache<int, int> cache0 = Cache();
-
- Assert.AreEqual(GridCount() * 2, cache0.GetSize(CachePeekMode.Primary));
-
- if (!LocalCache() && !ReplicatedCache())
- {
- int nearKey = NearKeyForCache(cache0);
-
- cache0.Put(nearKey, 1);
-
- Assert.AreEqual(NearEnabled() ? 1 : 0, cache0.GetSize(CachePeekMode.Near));
- }
- }
-
- [Test]
- public void TestLocalSize()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 3);
-
- cache.Put(keys[0], 1);
- cache.Put(keys[1], 2);
-
- var localSize = cache.GetLocalSize();
-
- cache.LocalEvict(keys.Take(2).ToArray());
-
- Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Onheap));
- Assert.AreEqual(localSize, cache.GetLocalSize(CachePeekMode.All));
-
- cache.Put(keys[2], 3);
-
- Assert.AreEqual(localSize + 1, cache.GetLocalSize(CachePeekMode.All));
-
- cache.RemoveAll(keys.Take(2).ToArray());
- }
-
- /// <summary>
- /// Test enumerators.
- /// </summary>
- [Test]
- [SuppressMessage("ReSharper", "PossibleMultipleEnumeration")]
- public void TestEnumerators()
- {
- var cache = Cache();
- var keys = PrimaryKeysForCache(cache, 2);
-
- cache.Put(keys[0], keys[0] + 1);
- cache.Put(keys[1], keys[1] + 1);
-
- // Check distributed enumerator.
- IEnumerable<ICacheEntry<int, int>> e = cache;
-
- CheckEnumerator(e.GetEnumerator(), keys);
- CheckEnumerator(e.GetEnumerator(), keys);
-
- // Check local enumerator.
- e = cache.GetLocalEntries();
-
- CheckEnumerator(e.GetEnumerator(), keys);
- CheckEnumerator(e.GetEnumerator(), keys);
-
- // Evict and check peek modes.
- cache.LocalEvict(new List<int> { keys[0] } );
-
- e = cache.GetLocalEntries(CachePeekMode.Onheap);
- CheckEnumerator(e.GetEnumerator(), new List<int> { keys[1] });
- CheckEnumerator(e.GetEnumerator(), new List<int> { keys[1] });
-
- e = cache.GetLocalEntries(CachePeekMode.All);
- CheckEnumerator(e.GetEnumerator(), keys);
- CheckEnumerator(e.GetEnumerator(), keys);
-
- e = cache.GetLocalEntries(CachePeekMode.Onheap, CachePeekMode.Swap);
- CheckEnumerator(e.GetEnumerator(), keys);
- CheckEnumerator(e.GetEnumerator(), keys);
-
- cache.Remove(keys[0]);
- }
-
- /// <summary>
- /// Check enumerator content.
- /// </summary>
- /// <param name="e">Enumerator.</param>
- /// <param name="keys">Keys.</param>
- private static void CheckEnumerator(IEnumerator<ICacheEntry<int, int>> e, IList<int> keys)
- {
- CheckEnumerator0(e, keys);
-
- e.Reset();
-
- CheckEnumerator0(e, keys);
-
- e.Dispose();
-
- Assert.Throws<ObjectDisposedException>(() => { e.MoveNext(); });
- Assert.Throws<ObjectDisposedException>(() => { var entry = e.Current; });
- Assert.Throws<ObjectDisposedException>(e.Reset);
-
- e.Dispose();
- }
-
- /// <summary>
- /// Check enumerator content.
- /// </summary>
- /// <param name="e">Enumerator.</param>
- /// <param name="keys">Keys.</param>
- private static void CheckEnumerator0(IEnumerator<ICacheEntry<int, int>> e, IList<int> keys)
- {
- Assert.Throws<InvalidOperationException>(() => { var entry = e.Current; });
-
- int cnt = 0;
-
- while (e.MoveNext())
- {
- ICacheEntry<int, int> entry = e.Current;
-
- Assert.IsTrue(keys.Contains(entry.Key), "Unexpected entry: " + entry);
-
- Assert.AreEqual(entry.Key + 1, entry.Value);
-
- cnt++;
- }
-
- Assert.AreEqual(keys.Count, cnt);
-
- Assert.IsFalse(e.MoveNext());
-
- Assert.Throws<InvalidOperationException>(() => { var entry = e.Current; });
- }
-
- [Test]
- public void TestPromote()
- {
- var cache = Cache();
-
- int key = PrimaryKeyForCache(cache);
-
- cache.Put(key, 1);
-
- Assert.AreEqual(1, PeekInt(cache, key));
-
- cache.LocalEvict(new[] {key});
-
- Assert.AreEqual(0, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(0, PeekInt(cache, key));
-
- cache.LocalPromote(new[] { key });
-
- Assert.AreEqual(1, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(1, PeekInt(cache, key));
- }
-
- [Test]
- public void TestPromoteAll()
- {
- var cache = Cache();
-
- List<int> keys = PrimaryKeysForCache(cache, 3);
-
- cache.Put(keys[0], 1);
- cache.Put(keys[1], 2);
- cache.Put(keys[2], 3);
-
- Assert.AreEqual(1, PeekInt(cache, keys[0]));
- Assert.AreEqual(2, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
-
- cache.LocalEvict(new List<int> { -1, keys[0], keys[1] });
-
- Assert.AreEqual(1, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(0, PeekInt(cache, keys[0]));
- Assert.AreEqual(0, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
-
- cache.LocalPromote(new[] {keys[0], keys[1]});
-
- Assert.AreEqual(3, cache.GetLocalSize(CachePeekMode.Onheap));
-
- Assert.AreEqual(1, PeekInt(cache, keys[0]));
- Assert.AreEqual(2, PeekInt(cache, keys[1]));
- Assert.AreEqual(3, PeekInt(cache, keys[2]));
- }
-
- [Test]
- public void TestPutGetPortable()
- {
- var cache = Cache<int, PortablePerson>();
-
- PortablePerson obj1 = new PortablePerson("obj1", 1);
-
- cache.Put(1, obj1);
-
- obj1 = cache.Get(1);
-
- Assert.AreEqual("obj1", obj1.Name);
- Assert.AreEqual(1, obj1.Age);
- }
-
- [Test]
- public void TestPutGetPortableAsync()
- {
- var cache = Cache<int, PortablePerson>().WithAsync().WrapAsync();
-
- PortablePerson obj1 = new PortablePerson("obj1", 1);
-
- cache.Put(1, obj1);
-
- obj1 = cache.Get(1);
-
- Assert.AreEqual("obj1", obj1.Name);
- Assert.AreEqual(1, obj1.Age);
- }
-
- [Test]
- public void TestPutGetPortableKey()
- {
- var cache = Cache<CacheTestKey, string>();
-
- int cnt = 100;
-
- for (int i = 0; i < cnt; i++)
- cache.Put(new CacheTestKey(i), "val-" + i);
-
- for (int i = 0; i < cnt; i++)
- Assert.AreEqual("val-" + i, cache.Get(new CacheTestKey(i)));
- }
-
- [Test]
- public void TestGetAsync2()
- {
- var cache = Cache().WithAsync();
-
- for (int i = 0; i < 100; i++)
- {
- cache.Put(i, i);
-
- cache.GetFuture<object>().Get();
- }
-
- var futs = new List<IFuture<int>>();
-
- for (int i = 0; i < 1000; i++)
- {
- cache.Get(i % 100);
-
- futs.Add(cache.GetFuture<int>());
- }
-
- for (int i = 0; i < 1000; i++) {
- Assert.AreEqual(i % 100, futs[i].Get(), "Unexpected result: " + i);
-
- Assert.IsTrue(futs[i].IsDone);
- }
- }
-
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestGetAsyncMultithreaded()
- {
- var cache = Cache().WithAsync();
-
- for (int i = 0; i < 100; i++)
- {
- cache.Put(i, i);
-
- cache.GetFuture<object>().Get();
- }
-
- TestUtils.RunMultiThreaded(() =>
- {
- for (int i = 0; i < 100; i++)
- {
- var futs = new List<IFuture<int>>();
-
- for (int j = 0; j < 100; j++)
- {
- cache.Get(j);
-
- futs.Add(cache.GetFuture<int>());
- }
-
- for (int j = 0; j < 100; j++)
- Assert.AreEqual(j, futs[j].Get());
- }
- }, 10);
- }
-
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestPutxAsyncMultithreaded()
- {
- var cache = Cache().WithAsync();
-
- TestUtils.RunMultiThreaded(() =>
- {
- Random rnd = new Random();
-
- for (int i = 0; i < 50; i++)
- {
- var futs = new List<IFuture<object>>();
-
- for (int j = 0; j < 10; j++)
- {
- cache.Put(rnd.Next(1000), i);
-
- futs.Add(cache.GetFuture<object>());
- }
-
- foreach (var fut in futs)
- fut.Get();
- }
- }, 5);
- }
-
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestPutGetAsyncMultithreaded()
- {
- var cache = Cache<CacheTestKey, PortablePerson>().WithAsync();
-
- const int threads = 10;
- const int objPerThread = 1000;
-
- int cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- // ReSharper disable once AccessToModifiedClosure
- int threadIdx = Interlocked.Increment(ref cntr);
-
- var futs = new List<IFuture<object>>();
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
-
- futs.Add(cache.GetFuture<object>());
- }
-
- foreach (var fut in futs)
- {
- fut.Get();
-
- Assert.IsTrue(fut.IsDone);
- }
- }, threads);
-
- for (int i = 0; i < threads; i++)
- {
- int threadIdx = i + 1;
-
- for (int j = 0; j < objPerThread; j++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Get(new CacheTestKey(key));
- var p = cache.GetFuture<PortablePerson>().Get();
-
- Assert.IsNotNull(p);
- Assert.AreEqual(key, p.Age);
- Assert.AreEqual("Person-" + key, p.Name);
- }
- }
-
- cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- int threadIdx = Interlocked.Increment(ref cntr);
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
-
- cache.GetFuture<object>().Get();
- }
- }, threads);
-
- cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- int threadIdx = Interlocked.Increment(ref cntr);
-
- var futs = new List<IFuture<PortablePerson>>();
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Get(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<PortablePerson>());
- }
-
- for (int i = 0; i < objPerThread; i++)
- {
- var fut = futs[i];
-
- int key = threadIdx * objPerThread + i;
-
- var p = fut.Get();
-
- Assert.IsNotNull(p);
- Assert.AreEqual(key, p.Age);
- Assert.AreEqual("Person-" + key, p.Name);
- }
- }, threads);
- }
-
- //[Test]
- //[Category(TestUtils.CATEGORY_INTENSIVE)]
- public void TestAsyncMultithreadedKeepPortable()
- {
- var cache = Cache().WithAsync().WithKeepPortable<CacheTestKey, PortablePerson>();
- var portCache = Cache().WithAsync().WithKeepPortable<CacheTestKey, IPortableObject>();
-
- const int threads = 10;
- const int objPerThread = 1000;
-
- int cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- // ReSharper disable once AccessToModifiedClosure
- int threadIdx = Interlocked.Increment(ref cntr);
-
- var futs = new List<IFuture<object>>();
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Put(new CacheTestKey(key), new PortablePerson("Person-" + key, key));
-
- futs.Add(cache.GetFuture<object>());
- }
-
- foreach (var fut in futs)
- Assert.IsNull(fut.Get());
- }, threads);
-
- for (int i = 0; i < threads; i++)
- {
- int threadIdx = i + 1;
-
- for (int j = 0; j < objPerThread; j++)
- {
- int key = threadIdx * objPerThread + i;
-
- IPortableObject p = portCache.Get(new CacheTestKey(key));
-
- Assert.IsNotNull(p);
- Assert.AreEqual(key, p.GetField<int>("age"));
- Assert.AreEqual("Person-" + key, p.GetField<string>("name"));
- }
- }
-
- cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- int threadIdx = Interlocked.Increment(ref cntr);
-
- var futs = new List<IFuture<IPortableObject>>();
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- portCache.Get(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<IPortableObject>());
- }
-
- for (int i = 0; i < objPerThread; i++)
- {
- var fut = futs[i];
-
- int key = threadIdx * objPerThread + i;
-
- var p = fut.Get();
-
- Assert.IsNotNull(p);
- Assert.AreEqual(key, p.GetField<int>("age"));
- Assert.AreEqual("Person-" + key, p.GetField<string>("name"));
- }
- }, threads);
-
- cntr = 0;
-
- TestUtils.RunMultiThreaded(() =>
- {
- int threadIdx = Interlocked.Increment(ref cntr);
-
- var futs = new List<IFuture<bool>>();
-
- for (int i = 0; i < objPerThread; i++)
- {
- int key = threadIdx * objPerThread + i;
-
- cache.Remove(new CacheTestKey(key));
-
- futs.Add(cache.GetFuture<bool>());
- }
-
- for (int i = 0; i < objPerThread; i++)
- {
- var fut = futs[i];
-
- Assert.AreEqual(true, fut.Get());
- }
- }, threads);
- }
-
- [Test]
- [Ignore("IGNITE-835")]
- public void TestLock()
- {
- if (!LockingEnabled())
- return;
-
- var cache = Cache();
-
- const int key = 7;
-
- // Lock
- CheckLock(cache, key, () => cache.Lock(key));
-
- // LockAll
- CheckLock(cache, key, () => cache.LockAll(new[] { key, 2, 3, 4, 5 }));
- }
-
- /// <summary>
- /// Internal lock test routine.
- /// </summary>
- /// <param name="cache">Cache.</param>
- /// <param name="key">Key.</param>
- /// <param name="getLock">Function to get the lock.</param>
- private static void CheckLock(ICache<int, int> cache, int key, Func<ICacheLock> getLock)
- {
- var sharedLock = getLock();
-
- using (sharedLock)
- {
- Assert.Throws<InvalidOperationException>(() => sharedLock.Exit()); // can't exit if not entered
-
- sharedLock.Enter();
-
- try
- {
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
-
- sharedLock.Enter();
-
- try
- {
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
- }
- finally
- {
- sharedLock.Exit();
- }
-
- Assert.IsTrue(cache.IsLocalLocked(key, true));
- Assert.IsTrue(cache.IsLocalLocked(key, false));
-
- EnsureCannotLock(getLock, sharedLock);
-
- Assert.Throws<SynchronizationLockException>(() => sharedLock.Dispose()); // can't dispose while locked
- }
- finally
- {
- sharedLock.Exit();
- }
-
- Assert.IsFalse(cache.IsLocalLocked(key, true));
- Assert.IsFalse(cache.IsLocalLocked(key, false));
-
- var innerTask = new Task(() =>
- {
- Assert.IsTrue(sharedLock.TryEnter());
- sharedLock.Exit();
-
- using (var otherLock = getLock())
- {
- Assert.IsTrue(otherLock.TryEnter());
- otherLock.Exit();
- }
- });
-
- innerTask.Start();
- innerTask.Wait();
- }
-
- Assert.IsFalse(cache.IsLocalLocked(key, true));
- Assert.IsFalse(cache.IsLocalLocked(key, false));
-
- var outerTask = new Task(() =>
- {
- using (var otherLock = getLock())
- {
- Assert.IsTrue(otherLock.TryEnter());
- otherLock.Exit();
- }
- });
-
- outerTask.Start();
- outerTask.Wait();
-
- Assert.Throws<ObjectDisposedException>(() => sharedLock.Enter()); // Can't enter disposed lock
- }
-
- /// <summary>
- /// ENsure taht lock cannot be obtained by other threads.
- /// </summary>
- /// <param name="getLock">Get lock function.</param>
- /// <param name="sharedLock">Shared lock.</param>
- private static void EnsureCannotLock(Func<ICacheLock> getLock, ICacheLock sharedLock)
- {
- var task = new Task(() =>
- {
- Assert.IsFalse(sharedLock.TryEnter());
- Assert.IsFalse(sharedLock.TryEnter(TimeSpan.FromMilliseconds(100)));
-
- using (var otherLock = getLock())
- {
- Assert.IsFalse(otherLock.TryEnter());
- Assert.IsFalse(otherLock.TryEnter(TimeSpan.FromMilliseconds(100)));
- }
- });
-
- task.Start();
- task.Wait();
- }
-
- [Test]
- public void TestTxCommit()
- {
- TestTxCommit(false);
- }
-
- [Test]
- public void TestTxCommitAsync()
- {
- TestTxCommit(true);
- }
-
- private void TestTxCommit(bool async)
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try
- {
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- if (async)
- {
- var asyncTx = tx.WithAsync();
-
- asyncTx.Commit();
-
- var fut = asyncTx.GetFuture();
-
- fut.Get();
-
- Assert.IsTrue(fut.IsDone);
- Assert.AreEqual(fut.Get(), null);
- }
- else
- tx.Commit();
- }
- finally
- {
- tx.Dispose();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxRollback()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try {
- cache.Put(1, 10);
-
- cache.Put(2, 20);
- }
- finally {
- tx.Rollback();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- Assert.IsNull(Transactions.Tx);
- }
-
- [Test]
- public void TestTxClose()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = Transactions.TxStart();
-
- try
- {
- cache.Put(1, 10);
-
- cache.Put(2, 20);
- }
- finally
- {
- tx.Dispose();
- }
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxAllModes()
- {
- TestTxAllModes(false);
-
- TestTxAllModes(true);
-
- Console.WriteLine("Done");
- }
-
- protected void TestTxAllModes(bool withTimeout)
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- int cntr = 0;
-
- foreach (TransactionConcurrency concurrency in Enum.GetValues(typeof(TransactionConcurrency))) {
- foreach (TransactionIsolation isolation in Enum.GetValues(typeof(TransactionIsolation))) {
- Console.WriteLine("Test tx [concurrency=" + concurrency + ", isolation=" + isolation + "]");
-
- ITransaction tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- tx = withTimeout
- ? Transactions.TxStart(concurrency, isolation, TimeSpan.FromMilliseconds(1100), 10)
- : Transactions.TxStart(concurrency, isolation);
-
- Assert.AreEqual(concurrency, tx.Concurrency);
- Assert.AreEqual(isolation, tx.Isolation);
-
- if (withTimeout)
- Assert.AreEqual(1100, tx.Timeout.TotalMilliseconds);
-
- try {
- cache.Put(1, cntr);
-
- tx.Commit();
- }
- finally {
- tx.Dispose();
- }
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
-
- Assert.AreEqual(cntr, cache.Get(1));
-
- cntr++;
- }
- }
- }
-
- [Test]
- public void TestTxAttributes()
- {
- if (!TxEnabled())
- return;
-
- ITransaction tx = Transactions.TxStart(TransactionConcurrency.Optimistic,
- TransactionIsolation.RepeatableRead, TimeSpan.FromMilliseconds(2500), 100);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime.Ticks > 0);
- Assert.AreEqual(tx.NodeId, GetIgnite(0).GetCluster().GetLocalNode().Id);
-
- DateTime startTime1 = tx.StartTime;
-
- tx.Commit();
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionState.Committed, tx.State);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime1, tx.StartTime);
-
- Thread.Sleep(100);
-
- tx = Transactions.TxStart(TransactionConcurrency.Pessimistic, TransactionIsolation.ReadCommitted,
- TimeSpan.FromMilliseconds(3500), 200);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
- Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime.Ticks > 0);
- Assert.IsTrue(tx.StartTime > startTime1);
-
- DateTime startTime2 = tx.StartTime;
-
- tx.Rollback();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
- Assert.AreEqual(TransactionConcurrency.Pessimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.ReadCommitted, tx.Isolation);
- Assert.AreEqual(3500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime2, tx.StartTime);
-
- Thread.Sleep(100);
-
- tx = Transactions.TxStart(TransactionConcurrency.Optimistic, TransactionIsolation.RepeatableRead,
- TimeSpan.FromMilliseconds(2500), 100);
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(TransactionState.Active, tx.State);
- Assert.IsTrue(tx.StartTime > startTime2);
-
- DateTime startTime3 = tx.StartTime;
-
- tx.Commit();
-
- Assert.IsFalse(tx.IsRollbackOnly);
- Assert.AreEqual(TransactionState.Committed, tx.State);
- Assert.AreEqual(TransactionConcurrency.Optimistic, tx.Concurrency);
- Assert.AreEqual(TransactionIsolation.RepeatableRead, tx.Isolation);
- Assert.AreEqual(2500, tx.Timeout.TotalMilliseconds);
- Assert.AreEqual(startTime3, tx.StartTime);
- }
-
- [Test]
- public void TestTxRollbackOnly()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- cache.Put(1, 1);
-
- cache.Put(2, 2);
-
- ITransaction tx = Transactions.TxStart();
-
- cache.Put(1, 10);
-
- cache.Put(2, 20);
-
- Assert.IsFalse(tx.IsRollbackOnly);
-
- tx.SetRollbackonly();
-
- Assert.IsTrue(tx.IsRollbackOnly);
-
- Assert.AreEqual(TransactionState.MarkedRollback, tx.State);
-
- try
- {
- tx.Commit();
-
- Assert.Fail("Commit must fail.");
- }
- catch (IgniteException e)
- {
- Console.WriteLine("Expected exception: " + e);
- }
-
- tx.Dispose();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
-
- Assert.IsTrue(tx.IsRollbackOnly);
-
- Assert.AreEqual(1, cache.Get(1));
-
- Assert.AreEqual(2, cache.Get(2));
-
- tx = Transactions.Tx;
-
- Assert.IsNull(tx);
- }
-
- [Test]
- public void TestTxMetrics()
- {
- if (!TxEnabled())
- return;
-
- var cache = Cache();
-
- var startTime = DateTime.UtcNow.AddSeconds(-1);
-
- Transactions.ResetMetrics();
-
- var metrics = Transactions.GetMetrics();
-
- Assert.AreEqual(0, metrics.TxCommits);
- Assert.AreEqual(0, metrics.TxRollbacks);
-
- using (Transactions.TxStart())
- {
- cache.Put(1, 1);
- }
-
- using (var tx = Transactions.TxStart())
- {
- cache.Put(1, 1);
- tx.Commit();
- }
-
- metrics = Transactions.GetMetrics();
-
- Assert.AreEqual(1, metrics.TxCommits);
- Assert.AreEqual(1, metrics.TxRollbacks);
-
- Assert.LessOrEqual(startTime, metrics.CommitTime);
- Assert.LessOrEqual(startTime, metrics.RollbackTime);
-
- Assert.GreaterOrEqual(DateTime.UtcNow, metrics.CommitTime);
- Assert.GreaterOrEqual(DateTime.UtcNow, metrics.RollbackTime);
- }
-
- [Test]
- public void TestTxStateAndExceptions()
- {
- if (!TxEnabled())
- return;
-
- var tx = Transactions.TxStart();
-
- Assert.AreEqual(TransactionState.Active, tx.State);
-
- tx.Rollback();
-
- Assert.AreEqual(TransactionState.RolledBack, tx.State);
-
- try
- {
- tx.Commit();
- Assert.Fail();
- }
- catch (InvalidOperationException)
- {
- // Expected
- }
-
- tx = Transactions.TxStart().WithAsync();
-
- Assert.AreEqual(TransactionState.Active, tx.State);
-
- tx.Commit();
-
- tx.GetFuture().Get();
-
- Assert.AreEqual(TransactionState.Committed, tx.State);
-
- tx.Rollback(); // Illegal, but should not fail here; will fail in future
-
- try
- {
- tx.GetFuture<object>().Get();
- Assert.Fail();
- }
- catch (InvalidOperationException)
- {
- // Expected
- }
- }
-
- /// <summary>
- /// Test thraed-locals leak.
- /// </summary>
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestThreadLocalLeak()
- {
- var cache = Cache<string, string>();
-
- Exception err = null;
-
- const int threadCnt = 10;
-
- Thread[] threads = new Thread[threadCnt];
-
- ThreadStart[] threadStarts = new ThreadStart[threadCnt];
-
- for (int j = 0; j < threadCnt; j++)
- {
- string key = "key" + j;
-
- threadStarts[j] = () =>
- {
- try
- {
- cache.Put(key, key);
-
- Assert.AreEqual(key, cache.Get(key));
- }
- catch (Exception e)
- {
- Interlocked.CompareExchange(ref err, e, null);
-
- Assert.Fail("Unexpected error: " + e);
- }
- };
- }
-
- for (int i = 0; i < 100 && err == null; i++)
- {
- for (int j = 0 ; j < threadCnt; j++) {
- Thread t = new Thread(threadStarts[j]);
-
- threads[j] = t;
- }
-
- foreach (Thread t in threads)
- t.Start();
-
- foreach (Thread t in threads)
- t.Join();
-
- if (i % 500 == 0)
- {
- Console.WriteLine("Iteration: " + i);
-
- GC.Collect();
- }
- }
-
- Assert.IsNull(err);
- }
-
- /**
- * Test tries to provoke garbage collection for .Net future before it was completed to verify
- * futures pinning works.
- */
- [Test]
- [Category(TestUtils.CategoryIntensive)]
- public void TestFuturesGc()
- {
- var cache = Cache().WithAsync();
-
- cache.Put(1, 1);
-
- for (int i = 0; i < 10; i++)
- {
- TestUtils.RunMultiThreaded(() =>
- {
- for (int j = 0; j < 1000; j++)
- cache.Get(1);
- }, 5);
-
- GC.Collect();
-
- cache.Get(1);
- Assert.AreEqual(1, cache.GetFuture<int>().Get());
- }
-
- Thread.Sleep(2000);
- }
-
- [Test]
- public void TestPartitions()
- {
- ICacheAffinity aff = Affinity();
-
- for (int i = 0; i < 5; i++ )
- Assert.AreEqual(CachePartitions(), aff.Partitions);
- }
-
- [Test]
- public void TestKeyPartition()
- {
- ICacheAffinity aff = Affinity();
-
- {
- ISet<int> parts = new HashSet<int>();
-
- for (int i = 0; i < 1000; i++)
- parts.Add(aff.GetPartition(i));
-
- if (LocalCache())
- Assert.AreEqual(1, parts.Count);
- else
- Assert.IsTrue(parts.Count > 10);
- }
-
- {
- ISet<int> parts = new HashSet<int>();
-
- for (int i = 0; i < 1000; i++)
- parts.Add(aff.GetPartition("key" + i));
-
- if (LocalCache())
- Assert.AreEqual(1, parts.Count);
- else
- Assert.IsTrue(parts.Count > 10);
- }
- }
-
- [Test]
- public void TestIsPrimaryOrBackup()
- {
- ICacheAffinity aff = Affinity();
-
- ICollection<IClusterNode> nodes = GetIgnite(0).GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count > 0);
-
- IClusterNode node = nodes.First();
-
- {
- bool found = false;
-
- for (int i = 0; i < 1000; i++)
- {
- if (aff.IsPrimary(node, i))
- {
- Assert.IsTrue(aff.IsPrimaryOrBackup(node, i));
-
- found = true;
-
- if (nodes.Count > 1)
- Assert.IsFalse(aff.IsPrimary(nodes.Last(), i));
-
- break;
- }
- }
-
- Assert.IsTrue(found, "Failed to find primary key for node " + node);
- }
-
- if (nodes.Count > 1)
- {
- bool found = false;
-
- for (int i = 0; i < 1000; i++)
- {
- if (aff.IsBackup(node, i))
- {
- Assert.IsTrue(aff.IsPrimaryOrBackup(node, i));
-
- found = true;
-
- break;
- }
- }
-
- Assert.IsTrue(found, "Failed to find backup key for node " + node);
- }
- }
-
- [Test]
- public void TestNodePartitions()
- {
- ICacheAffinity aff = Affinity();
-
- ICollection<IClusterNode> nodes = GetIgnite(0).GetCluster().GetNodes();
-
- Assert.IsTrue(nodes.Count > 0);
-
- if (nodes.Count == 1)
- {
- IClusterNode node = nodes.First();
-
- int[] parts = aff.GetBackupPartitions(node);
-
- Assert.AreEqual(0, parts.Length);
-
- parts = aff.GetAllPartitions(node);
-
- Assert.AreEqual(CachePartitions(), parts.Length);
- }
- else
- {
- IList<int> allPrimaryParts = new List<int>();
- IList<int> allBackupParts = new List<int>();
- IList<int> allParts = new List<int>();
-
- foreach(IClusterNode node in nodes) {
- int[] parts = aff.GetPrimaryPartitions(node);
-
- foreach (int part in parts)
- allPrimaryParts.Add(part);
-
- parts = aff.GetBackupPartitions(node);
-
- foreach (int part in parts)
- allBackupParts.Add(part);
-
- parts = aff.GetAllPartitions(node);
-
- foreach (int part in parts)
- allParts.Add(part);
- }
-
- Assert.AreEqual(CachePartitions(), allPrimaryParts.Count);
- Assert.AreEqual(CachePartitions() * Backups(), allBackupParts.Count);
- Assert.AreEqual(CachePartitions() * (Backups() + 1), allParts.Count);
- }
- }
-
- [Test]
- public void TestAffinityKey()
- {
- ICacheAffinity aff = Affinity();
-
- Assert.AreEqual(10, aff.GetAffinityKey<int, int>(10));
-
- Assert.AreEqual("string", aff.GetAffinityKey<string, string>("string"));
- }
-
- [Test]
- public void TestMapToNode()
- {
- ICacheAffinity aff = Affinity();
-
- const int key = 1;
-
- IClusterNode node = aff.MapKeyToNode(key);
-
- Assert.IsNotNull(node);
-
- Assert.IsTrue(GetIgnite(0).GetCluster().GetNodes().Contains(node));
-
- Assert.IsTrue(aff.IsPrimary(node, key));
-
- Assert.IsTrue(aff.IsPrimaryOrBackup(node, key));
-
- Assert.IsFalse(aff.IsBackup(node, key));
-
- int part = aff.GetPartition(key);
-
- IClusterNode partNode = aff.MapPartitionToNode(part);
-
- Assert.AreEqual(node, partNode);
- }
-
- [Test]
- public void TestMapToPrimaryAndBackups()
- {
- ICacheAffinity aff = Affinity();
-
- const int key = 1;
-
- IList<IClusterNode> nodes = aff.MapKeyToPrimaryAndBackups(key);
-
- Assert.IsTrue(nodes.Count > 0);
-
- for (int i = 0; i < nodes.Count; i++)
- {
- if (i == 0)
- Assert.IsTrue(aff.IsPrimary(nodes[i], key));
- else
- Assert.IsTrue(aff.IsBackup(nodes[i], key));
- }
-
- int part = aff.GetPartition(key);
-
- IList<IClusterNode> partNodes = aff.MapPartitionToPrimaryAndBackups(part);
-
- Assert.AreEqual(nodes, partNodes);
- }
-
- [Test]
- public void TestMapKeysToNodes()
- {
- ICacheAffinity aff = Affinity();
-
- IList<int> keys = new List<int> {1, 2, 3};
-
- IDictionary<IClusterNode, IList<int>> map = aff.MapKeysToNodes(keys);
-
- Assert.IsTrue(map.Count > 0);
-
- foreach (int key in keys)
- {
- IClusterNode primary = aff.MapKeyToNode(key);
-
- Assert.IsTrue(map.ContainsKey(primary));
-
- IList<int> nodeKeys = map[primary];
-
- Assert.IsNotNull(nodeKeys);
-
- Assert.IsTrue(nodeKeys.Contains(key));
- }
- }
-
- [Test]
- public void TestMapPartitionsToNodes()
- {
- ICacheAffinity aff = Affinity();
-
- if (LocalCache())
- {
- IList<int> parts = new List<int> { 0 };
-
- IDictionary<int, IClusterNode> map = aff.MapPartitionsToNodes(parts);
-
- Assert.AreEqual(parts.Count, map.Count);
-
- Assert.AreEqual(GetIgnite(0).GetCluster().GetLocalNode(), map[0]);
- }
- else
- {
- IList<int> parts = new List<int> { 1, 2, 3 };
-
- IDictionary<int, IClusterNode> map = aff.MapPartitionsToNodes(parts);
-
- Assert.AreEqual(parts.Count, map.Count);
-
- foreach (int part in parts)
- {
- Assert.IsTrue(map.ContainsKey(part));
-
- IClusterNode primary = aff.MapPartitionToNode(part);
-
- Assert.AreEqual(primary, map[part], "Wrong node for partition: " + part);
- }
- }
- }
-
- [Test]
- public void TestKeepPortableFlag()
- {
- TestKeepPortableFlag(false);
- }
-
- [Test]
- public void TestKeepPortableFlagAsync()
- {
- TestKeepPortableFlag(true);
- }
-
- [Test]
- public void TestNearKeys()
- {
- if (!NearEnabled())
- return;
-
- const int count = 20;
-
- var cache = Cache();
- var aff = cache.Ignite.GetAffinity(cache.Name);
- var node = cache.Ignite.GetCluster().GetLocalNode();
-
- for (int i = 0; i < count; i++)
- cache.Put(i, -i - 1);
-
- var nearKeys = Enumerable.Range(0, count).Where(x => !aff.IsPrimaryOrBackup(node, x)).ToArray();
-
- var nearKeysString = nearKeys.Select(x => x.ToString()).Aggregate((x, y) => x + ", " + y);
-
- Console.WriteLine("Near keys: " + nearKeysString);
-
- foreach (var nearKey in nearKeys.Take(3))
- Assert.AreNotEqual(0, cache.Get(nearKey));
- }
-
- [Test]
- public void TestSerializable()
- {
- var cache = Cache<int, TestSerializableObject>();
-
- var obj = new TestSerializableObject {Name = "Vasya", Id = 128};
-
- cache.Put(1, obj);
-
- var resultObj = cache.Get(1);
-
- Assert.AreEqual(obj, resultObj);
- }
-
- [Test]
- public void TestInvoke()
- {
- TestInvoke(false);
- }
-
- [Test]
- public void TestInvokeAsync()
- {
- TestInvoke(true);
- }
-
- private void TestInvoke(bool async)
- {
- TestInvoke<AddArgCacheEntryProcessor>(async);
- TestInvoke<PortableAddArgCacheEntryProcessor>(async);
-
- try
- {
- TestInvoke<NonSerializableCacheEntryProcessor>(async);
- Assert.Fail();
- }
- catch (SerializationException)
- {
- // Expected
- }
- }
-
- private void TestInvoke<T>(bool async) where T: AddArgCacheEntryProcessor, new()
- {
- var cache = async ? Cache().WithAsync().WrapAsync() : Cache();
-
- cache.Clear();
-
- const int key = 1;
- const int value = 3;
- const int arg = 5;
-
- cache.Put(key, value);
-
- // Existing entry
- Assert.AreEqual(value + arg, cache.Invoke(key, new T(), arg));
- Assert.AreEqual(value + arg, cache.Get(key));
-
- // Non-existing entry
- Assert.AreEqual(arg, cache.Invoke(10, new T {Exists = false}, arg));
- Assert.AreEqual(arg, cache.Get(10));
-
- // Remove entry
- Assert.AreEqual(0, cache.Invoke(key, new T {Remove = true}, arg));
- Assert.AreEqual(0, cache.Get(key));
-
- // Test exceptions
- AssertThrowsCacheEntryProcessorException(() => cache.Invoke(key, new T {ThrowErr = true}, arg));
- AssertThrowsCacheEntryProcessorException(
- () => cache.Invoke(key, new T {ThrowErrPortable = true}, arg));
- AssertThrowsCacheEntryProcessorException(
- () => cache.Invoke(key, new T { ThrowErrNonSerializable = true }, arg), "SerializationException");
- }
-
- private static void AssertThrowsCacheEntryProcessorException(Action action, string containsText = null)
- {
- try
- {
- action();
-
- Assert.Fail();
- }
- catch (Exception ex)
- {
- Assert.IsInstanceOf<CacheEntryProcessorException>(ex);
-
- if (string.IsNullOrEmpty(containsText))
- Assert.AreEqual(ex.InnerException.Message, AddArgCacheEntryProcessor.ExceptionText);
- else
- Assert.IsTrue(ex.ToString().Contains(containsText));
- }
- }
-
- [Test]
- public void TestInvokeAll()
- {
- TestInvokeAll(false);
- }
-
- [Test]
- public void TestInvokeAllAsync()
- {
- TestInvokeAll(true);
- }
-
- private void TestInvokeAll(bool async)
- {
- for (var i = 1; i < 10; i++)
- {
- TestInvokeAll<AddArgCacheEntryProcessor>(async, i);
- TestInvokeAll<PortableAddArgCacheEntryProcessor>(async, i);
-
- try
- {
- TestInvokeAll<NonSerializableCacheEntryProcessor>(async, i);
- Assert.Fail();
- }
- catch (SerializationException)
- {
- // Expected
- }
- }
- }
-
- public void TestInvokeAll<T>(bool async, int entryCount) where T : AddArgCacheEntryProcessor, new()
- {
- var cache = async ? Cache().WithAsync().WrapAsync() : Cache();
-
- var entries = Enumerable.Range(1, entryCount).ToDictionary(x => x, x => x + 1);
-
- cache.PutAll(entries);
-
- const int arg = 5;
-
- // Existing entries
- var res = cache.InvokeAll(entries.Keys, new T(), arg);
-
- var results = res.OrderBy(x => x.Key).Select(x => x.Value.Result);
- var expectedResults = entries.OrderBy(x => x.Key).Select(x => x.Value + arg);
-
- Assert.IsTrue(results.SequenceEqual(expectedResults));
-
- var resultEntries = cache.GetAll(entries.Keys);
-
- Assert.IsTrue(resultEntries.All(x => x.Value == x.Key + 1 + arg));
-
- // Remove entries
- res = cache.InvokeAll(entries.Keys, new T {Remove = true}, arg);
-
- Assert.IsTrue(res.All(x => x.Value.Result == 0));
- Assert.AreEqual(0, cache.GetAll(entries.Keys).Count);
-
- // Non-existing entries
- res = cache.InvokeAll(entries.Keys, new T {Exists = false}, arg);
-
- Assert.IsTrue(res.All(x => x.Value.Result == arg));
- Assert.IsTrue(cache.GetAll(entries.Keys).All(x => x.Value == arg));
-
- // Test exceptions
- var errKey = entries.Keys.Reverse().Take(5).Last();
-
- TestInvokeAllException(cache, entries, new T { ThrowErr = true, ThrowOnKey = errKey }, arg, errKey);
- TestInvokeAllException(cache, entries, new T { ThrowErrPortable = true, ThrowOnKey = errKey },
- arg, errKey);
- TestInvokeAllException(cache, entries, new T { ThrowErrNonSerializable = true, ThrowOnKey = errKey },
- arg, errKey, "SerializationException");
-
- }
-
- private static void TestInvokeAllException<T>(ICache<int, int> cache, Dictionary<int, int> entries,
- T processor, int arg, int errKey, string exceptionText = null) where T : AddArgCacheEntryProcessor
- {
- var res = cache.InvokeAll(entries.Keys, processor, arg);
-
- foreach (var procRes in res)
- {
- if (procRes.Key == errKey)
- // ReSharper disable once AccessToForEachVariableInClosure
- AssertThrowsCacheEntryProcessorException(() => { var x = procRes.Value.Result; }, exceptionText);
- else
- Assert.Greater(procRes.Value.Result, 0);
- }
- }
-
- /// <summary>
- /// Test skip-store semantics.
- /// </summary>
- [Test]
- public void TestSkipStore()
- {
- CacheProxyImpl<int, int> cache = (CacheProxyImpl<int, int>)Cache();
-
- Assert.IsFalse(cache.SkipStore);
-
- // Ensure correct flag set.
- CacheProxyImpl<int, int> cacheSkipStore1 = (CacheProxyImpl<int, int>)cache.WithSkipStore();
-
- Assert.AreNotSame(cache, cacheSkipStore1);
- Assert.IsFalse(cache.SkipStore);
- Assert.IsTrue(cacheSkipStore1.SkipStore);
-
- // Ensure that the same instance is returned if flag is already set.
- CacheProxyImpl<int, int> cacheSkipStore2 = (CacheProxyImpl<int, int>)cacheSkipStore1.WithSkipStore();
-
- Assert.IsTrue(cacheSkipStore2.SkipStore);
- Assert.AreSame(cacheSkipStore1, cacheSkipStore2);
-
- // Ensure other flags are preserved.
- Assert.IsTrue(((CacheProxyImpl<int, int>)cache.WithKeepPortable<int, int>().WithSkipStore()).IsKeepPortable);
- Assert.IsTrue(cache.WithAsync().WithSkipStore().IsAsync);
- }
-
- [Test]
- public void TestCacheMetrics()
- {
- var cache = Cache();
-
- cache.Put(1, 1);
-
- var m = cache.GetMetrics();
-
- Assert.AreEqual(cache.Name, m.CacheName);
-
- Assert.AreEqual(cache.GetSize(), m.Size);
- }
-
- [Test]
- public void TestRebalance()
- {
- var cache = Cache();
-
- var fut = cache.Rebalance();
-
- Assert.IsNull(fut.Get());
- }
-
- [Test]
- public void TestCreate()
- {
- // Create a cache with random name
- var randomName = "template" + Guid.New
<TRUNCATED>